RFC: Remove empty output sections

H. J. Lu hjl@lucon.org
Fri Mar 18 03:29:00 GMT 2005


On Fri, Mar 18, 2005 at 12:06:51PM +1030, Alan Modra wrote:
> Hi HJ,
>   It seems your change to remove zero-size output sections is
> responsible for segfaults when generating map files.  For example,
> taking something from the ld testsuite with -Map added:
> 
> $ gcc -L/home/alan/build/ppc/bin/./ld -B/home/alan/build/ppc/bin/ld/tmpdir/ld/ -L/usr/local/powerpc-linux/lib -L/usr/local/lib -L/lib -L/usr/lib  -o tmpdir/libsize_bar.so --shared  tmpdir/size_bar.o -Wl,-Map,xxx.map
> collect2: ld terminated with signal 11 [Segmentation fault]
> 
> On powerpc-linux this particular .so has an empty .bss, and the linker
> script has an ALIGN inside the .bss output section.  Processing ALIGN_K
> in ldexp.c refeferences the bfd_section, which is now NULL.  I expect
> other linker expressions will similarly segfault if their associated
> output section is removed before the linker map is printed.  Would you
> take a look, please?
> 
> A solution that might work is to simply not clear os->bfd_section in
> gld${EMULATION_NAME}_finish.

Can you send me a testcase?


H.J.



More information about the Binutils mailing list