This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] darwin-segaddr.c: pass -Wl,-no_pie for darwin11
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mikestump at comcast dot net, iains at gcc dot gnu dot org
- Date: Fri, 8 Jul 2011 09:13:32 -0400
- Subject: [PATCH] darwin-segaddr.c: pass -Wl,-no_pie for darwin11
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 <howarth@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 ();