output section ALIGN and relocatable links

Sterling Augustine sterling@tensilica.com
Tue Nov 15 18:36:00 GMT 2005


I have found a bug in the new output section ALIGN feature that was 
added with this patch:

http://sourceware.org/ml/binutils-cvs/2005-09/msg00112.html

I tested this against the mainline this morning.

With the following linker script commands, one would expect the output 
section "foo" to be aligned to 16, but it won't be.

The output section's alignment is only copied to the output bfd's 
alignment in lang_add_section, which is only called when an input 
section goes into the output section.

However, in this case, no input section ever appears in the output 
section, although the output section does have contents. I am happy to 
provide a patch, but after reading the back and forth about zero-sized 
sections and alignment, it is unclear to me where the correct place to 
fix it is.

jaw > cat t.xr

SECTIONS {
    foo : ALIGN(16) {
      asymbol = .;
      WORD(0xFFFFFF);
   }
}


jaw > ld -r -T t.xr random_object_file.o
jaw > objdump -h a.out

...

  6 foo           00000010  00000000  00000000  00000034  0
                   CONTENTS, ALLOC, LOAD, DATA
...



More information about the Binutils mailing list