RFC: Remove empty output sections

Alan Modra amodra@bigpond.net.au
Fri Mar 18 03:15:00 GMT 2005


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.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list