Questions on .dynbss and empty input sections

H. J. Lu hjl@lucon.org
Thu Feb 24 13:33:00 GMT 2005
Why does _bfd_elf_create_dynamic_sections create .dynbss section for
all outputs, but only .rel.bss/.rela.bss for executables? I thought
.dynbss was for copy relocations. If they aren't needed for DSO, why
.dynbss is created for DSO and relocatable?

Also, linker creates empty .text, .data and .bss output sections:

# echo > x.c
# gcc -c x.c
# ld -shared x.o
# readelf -S a.out
  [ 4] .text  PROGBITS  0000018c 00018c 000000 00  AX 0   0  4
  [ 7] .data  PROGBITS  000011f0 0001f0 000000 00  WA 0   0  4
  [ 8] .bss   NOBITS    000011f0 0001f0 000000 00  WA 0   0  4

Can we not generate an output section if its input sections are
all empty?


H.J.



More information about the Binutils mailing list