Currently, gcc.dg/darwin-segaddr.c fails its execution test at both -m32
and -m64 on darwin11. This is due to the default -pie linkage on darwin11 
allowing
ASLR to randomize the segaddr on each individual execution of the resulting 
binary. The
attached patch eliminates this failure by passing -Wl,-no_pie for darwin10 and 
later.
This form of the match was selected becaused darwin9 and earlier doesn't support
-no_pie in the linker. Tested on x86_64-apple-darwin10/11. Okay for gcc trunk
and gcc-4_6-branch/gcc-4_5-branch/gcc-4_4-branch?
                Jack

2011-07-08  Jack Howarth <howa...@bromo.med.uc.edu>

        * gcc.dg/darwin-segaddr.c: Pass -Wl,-no_pie for darwin10 and later.


Index: gcc.dg/darwin-segaddr.c
===================================================================
--- gcc.dg/darwin-segaddr.c     (revision 176025)
+++ gcc.dg/darwin-segaddr.c     (working copy)
@@ -2,6 +2,8 @@
 /* { dg-do run { target *-*-darwin* } } */
 /* { dg-options "-O0 -segaddr __TEST 0x200000" { target { *-*-darwin* && { ! 
lp64 } } } } */
 /* { dg-options "-O0 -segaddr __TEST 0x110000000" { target { *-*-darwin* && 
lp64 } } } */
+/* { dg-options "-O0 -segaddr __TEST 0x200000 -Wl,-no_pie" { target { 
*-*-darwin1* && { ! lp64 } } } } */
+/* { dg-options "-O0 -segaddr __TEST 0x110000000 -Wl,-no_pie" { target { 
*-*-darwin1* && lp64 } } } */
 
 extern void abort ();
 

Reply via email to