http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53708



Peter Bergner <bergner at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|RESOLVED                    |REOPENED

                 CC|                            |bergner at gcc dot gnu.org

         Resolution|FIXED                       |



--- Comment #9 from Peter Bergner <bergner at gcc dot gnu.org> 2012-10-30 
15:47:57 UTC ---

Richard, I'm seeing this same bug in GCC 4.7 on powerpc64-linux when compiling

GLIBC.  Is there a chance we can get your patch backported to 4.7?  I

bootstrapped and regtested the backport with no regressions and can confirm it

fixes the bug I'm running into, which can be seen with the reduced test case

from glibc:



bergner@bns:~/gcc/BUGS> cat foo.i 

static void (*const init_array []) (void)

  __attribute__ ((section (".init_array"), aligned (sizeof (void *)), used))

= { 0 };



bergner@bns:~/gcc/BUGS> /home/bergner/gcc/build/gcc-fsf-4_7-base/gcc/xgcc

-B/home/bergner/gcc/build/gcc-fsf-4_7-base/gcc -S -m64 -O3 -maltivec foo.i -o

bad.s



bergner@bns:~/gcc/BUGS> /home/bergner/gcc/build/gcc-fsf-4_7-pr53708/gcc/xgcc

-B/home/bergner/gcc/build/gcc-fsf-4_7-pr53708/gcc -S -m64 -O3 -maltivec foo.i

-o good.s



bergner@bns:~/gcc/BUGS> diff -u bad.s good.s 

--- bad.s    2012-10-30 10:41:15.000000000 -0500

+++ good.s    2012-10-30 10:41:23.000000000 -0500

@@ -2,7 +2,7 @@

     .section    ".toc","aw"

     .section    ".text"

     .section    .init_array,"a"

-    .align 4

+    .align 3

     .type    init_array, @object

     .size    init_array, 8

 init_array:



The above is bad, because the extra alignment causes the linker to add some

null padding to the init_array and the loader isn't expecting that and ends up

segv'ing.

Reply via email to