Patchwork : Pass -no_pie on SYSTEMSPEC for darwin11

login
register
mail settings
Submitter Jack Howarth
Date June 17, 2011, 2:21 a.m.
Message ID <20110617022132.GA18745@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/100754/
State New
Headers show

Comments

Jack Howarth - June 17, 2011, 2:21 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?
               Jack

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

	* libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11.
	* libjava/configure: Regenerate.
Mike Stump - June 17, 2011, 5:43 p.m.
On Jun 16, 2011, at 7:21 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?

The darwin aspects of this seem right to me.  I'm less familiar with the SYSTEMSPEC bit in libjava, someone want to give a quick comment on if this is the right knob to twist?

Roughly, there are unresolved issues with position independent code with the garbage collector (or was it a problem with some unknown bit in the compiler), and this just turns off a new OS default for java to work around the issue.  I hope that's an at least half way accurate description.  We're aiming to have the default for C be -fpie, but for java, no pie.  For the C compiler, we must build the compiler without -pie in order for PCH to work.  It is reasonable to turn off pie in the java compiler as well.

Jack, do we have a PR number for this?  If so, please include in the changelog in the usual spot.

> 2011-06-16  Jack Howarth <howarth@bromo.med.uc.edu>
> 
> 	* libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11.
> 	* libjava/configure: Regenerate.
> 
> 
> 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=
>     ;;

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=
     ;;