Patchwork [Revised] Pass -no_pie on SYSTEMSPEC for darwin11

login
register
mail settings
Submitter Jack Howarth
Date June 18, 2011, 2:49 a.m.
Message ID <20110618024913.GA29537@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/100889/
State New
Headers show

Comments

Jack Howarth - June 18, 2011, 2:49 a.m.
The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the new -pie
default of the linker. The attached patch accomplishes this by passing -no_pie on SYSTEMSPEC
for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I included it in the
triplet match to simplify the syntax. Bootstrap and tested on x86_64-apple-darwin11.
Okay for gcc trunk with PR added to comment as requested?
               Jack
ps This change also works for gcc-4_6-branch in concert with a backport of
r175089 and r175108.

2011-06-17  Jack Howarth <howarth@bromo.med.uc.edu>

	PR target/49461
	* libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11.
	* libjava/configure: Regenerate.
Mike Stump - June 18, 2011, 2:48 p.m.
On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote:
>  The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the new -pie
> default of the linker. The attached patch accomplishes this by passing -no_pie on SYSTEMSPEC
> for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I included it in the
> triplet match to simplify the syntax. Bootstrap and tested on x86_64-apple-darwin11.
> Okay for gcc trunk with PR added to comment as requested?

> ps This change also works for gcc-4_6-branch in concert with a backport of
> r175089 and r175108.

I've backported these two to the gcc-4_6-branch.  I tried 4.5, but, they'd need to have mh-darwin backported, so I didn't bother.
Mike Stump - June 18, 2011, 2:52 p.m.
On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote:
>  The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the new -pie
> default of the linker. The attached patch accomplishes this by passing -no_pie on SYSTEMSPEC
> for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I included it in the
> triplet match to simplify the syntax. Bootstrap and tested on x86_64-apple-darwin11.
> Okay for gcc trunk with PR added to comment as requested?

I've had a chance to review this more in-depth...

Ok.
Jack Howarth - June 18, 2011, 3:31 p.m.
On Sat, Jun 18, 2011 at 07:48:51AM -0700, Mike Stump wrote:
> On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote:
> >  The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the new -pie
> > default of the linker. The attached patch accomplishes this by passing -no_pie on SYSTEMSPEC
> > for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I included it in the
> > triplet match to simplify the syntax. Bootstrap and tested on x86_64-apple-darwin11.
> > Okay for gcc trunk with PR added to comment as requested?
> 
> > ps This change also works for gcc-4_6-branch in concert with a backport of
> > r175089 and r175108.
> 
> I've backported these two to the gcc-4_6-branch.  I tried 4.5, but, they'd need to have mh-darwin backported, so I didn't bother.

Mike,
   We might just create a mh-x86-darwin for gcc 4.5. Currently dragonegg only supports that FSF gcc release
so it would be nice to have a clean bootstrap on darwin11 to support that option.
       Jack
ps FYI, I am only suggesting we populate mh-x86-darwin with...

# Ensure we don't try and use -pie, as it is incompatible with pch.
BOOT_LDFLAGS += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`

and skip the...

BOOT_CFLAGS += -mdynamic-no-pic

bit.

Patch

Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 175131)
+++ libjava/configure.ac	(working copy)
@@ -898,9 +898,12 @@  case "${host}" in
         SYSTEMSPEC="-lunicows $SYSTEMSPEC"
       fi
     ;;
-    *-*-darwin[[912]]*)
+    *-*-darwin9*)
       SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}"
     ;;
+    *-*-darwin[[12]]*)
+      SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}"
+    ;;
     *)
       SYSTEMSPEC=
     ;;