send2vinnie / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

sections should be aligned properly when symbols are moved from common to bss #149

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Run the following script.

cat > x.c << \!
int a = 10;
!

cat > t.c << \!

#define STACK_SIZE 0x8000
int count;
char __attribute__ ((aligned(16))) stack1[STACK_SIZE];
!

gcc -c -fPIC x.c t.c -m32
ld.mcld -march x86 x.o t.o -shared -o bss.mcld
/usr/bin/ld -m elf_i386 x.o t.o -shared -o bss.ld
readelf -S bss.mcld | grep '.bss'
readelf -S bss.ld | grep '.bss'

What is the expected output? What do you see instead?

Expect alignment of bss to be 16.

What version of the product are you using? On what operating system?

Trunk.

Please provide any additional information below.

Whenever a symbol is moved from common to bss, the alignment from the common 
symbol should be updated so that the bss section is aligned appropriately.

This is what has been done in Hexagon to fix the problem in 
allocateCommonSymbols.

      if ((*com_sym)->value() > bss_sect_data->getSection().align()) {
        bss_sect_data->getSection().setAlign((*com_sym)->value());
      }

Original issue reported on code.google.com by shanka...@gmail.com on 1 Jun 2013 at 12:10

GoogleCodeExporter commented 9 years ago

Original comment by pete.c...@gmail.com on 5 Sep 2013 at 3:41

GoogleCodeExporter commented 9 years ago
Fixed in c84c2bc2303f.

Original comment by pete.c...@gmail.com on 2 Apr 2014 at 3:50