Patchwork darwin-segaddr.c: pass -Wl,-no_pie for darwin11

login
register
mail settings
Submitter Jack Howarth
Date July 8, 2011, 1:13 p.m.
Message ID <20110708131332.GA32029@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/103838/
State New
Headers show

Comments

Jack Howarth - July 8, 2011, 1:13 p.m.
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.

Patch

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 ();