https://sourceware.org/bugzilla/show_bug.cgi?id=24276
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-cfl-1 pr24276]$ cat x.c
int __attribute__((section("my_section"))) a[2] = {0x1234, 0x5678};
extern int __start_my_section;
int
foo ()
{
int* ap = &__start_my_section;
return ap[0];
}
[hjl@gnu-cfl-1 pr24276]$ cat z.c
int __attribute__((section("my_section"))) a[2] = {0x1234, 0x5678};
extern int __start_my_section;
int
_start ()
{
int* ap = &__start_my_section;
return ap[0];
}
[hjl@gnu-cfl-1 pr24276]$ make
gcc -fPIC -O2 -c -o z.o z.c
gcc -fPIC -O2 -c -o x.o x.c
ld -shared -o x.so.1 x.o
echo "INPUT(x.so.1)" > x.so
echo "SECTIONS {" >> x.so
echo " my_section : {" >> x.so
echo " __start_my_section = .;" >> x.so
echo " *(my_section);" >> x.so
echo " __stop_my_section = .;" >> x.so
echo "" >> x.so
echo " }" >> x.so
echo "}" >> x.so
ld -shared -o z.so z.o x.so
ld: warning: x.so contains output sections; did you forget -T?
make: *** [Makefile:14: z.so] Segmentation fault
make: *** Deleting file 'z.so'
[hjl@gnu-cfl-1 pr24276]$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils