public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
       [not found] <20110617022132.GA18745@bromo.med.uc.edu>
@ 2011-06-17 17:43 ` Mike Stump
  2011-06-17 19:24   ` Jack Howarth
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Stump @ 2011-06-17 17:43 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gcc-patches List, Iain Sandoe, Java Patches

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
  2011-06-17 17:43 ` [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11 Mike Stump
@ 2011-06-17 19:24   ` Jack Howarth
  2011-06-18  7:51     ` IainS
  0 siblings, 1 reply; 5+ messages in thread
From: Jack Howarth @ 2011-06-17 19:24 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc-patches List, Iain Sandoe, Java Patches

On Fri, Jun 17, 2011 at 10:43:07AM -0700, Mike Stump wrote:
> 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?

Mike,
   Since SYSTEMSPEC in configure.ac is setting system specific options for libgcj.spec.in, it seemed
the most rational place to append -no_pie to (and we already had a darwin entry in the case statement).
FYI, I also tried a different approach of not appending -no_pie SYSTEMSPEC on darwin but instead using...

Index: config/mh-darwin
===================================================================
--- config/mh-darwin	(revision 175150)
+++ config/mh-darwin	(working copy)
@@ -5,3 +5,4 @@ BOOT_CFLAGS += -mdynamic-no-pic
 
 # 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;`
+LDFLAGS_FOR_TARGET += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`

while this produced an apparently functional gcj (ecj1), the libjava testsuite showed two additional
regressions compared to my original SYSTEMSPEC approach to the problem...

cat <<'EOF' |
Native configuration is x86_64-apple-darwin11.0.0

		=== libjava tests ===


Running target unix/-m32
FAIL: TestClosureGC run               <================= new failure
FAIL: PR16923.c compilation
FAIL: TestLeak output - source compiled test  <================= new failure

		=== libjava Summary for unix/-m32 ===

# of expected passes		2570
# of unexpected failures	3
# of untested testcases		1

Running target unix/-m64
FAIL: TestClosureGC run     <==================== new failure
FAIL: PR16923 run
FAIL: Throw_2 execution - source compiled test
FAIL: Throw_2 -findirect-dispatch execution - source compiled test
FAIL: Throw_2 -O3 execution - source compiled test
FAIL: Throw_2 -O3 -findirect-dispatch execution - source compiled test
FAIL: TestLeak output - source compiled test   <======================= new failure

		=== libjava Summary for unix/-m64 ===

# of expected passes		2563
# of unexpected failures	7
# of untested testcases		6

		=== libjava Summary ===

# of expected passes		5133
# of unexpected failures	10
# of untested testcases		7

Compiler version: gcc libjava 
Platform: x86_64-apple-darwin11.0.0
configure flags: --prefix=/sw --prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.7/info --enable-languages=c,c++,fortran,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.7 --enable-checking=yes --enable-cloog-backend=isl

compared to the results for only passing -no_pie on libgcj.spec...

http://gcc.gnu.org/ml/gcc-testresults/2011-06/msg01853.html


> 
> 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.

I plan on opening a PR shortly, but I was hoping to be able to reproduce the same failures under linux
using a bootstrap with the compiler defaulted to -fPIC code generation and the inverse change applied
to linux of...

BOOT_LDFLAGS += -pie

to see how its boehm-gc and libjava testsuite results were impacted.
                        Jack

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
  2011-06-17 19:24   ` Jack Howarth
@ 2011-06-18  7:51     ` IainS
  0 siblings, 0 replies; 5+ messages in thread
From: IainS @ 2011-06-18  7:51 UTC (permalink / raw)
  To: Mike Stump; +Cc: Jack Howarth, gcc-patches List, Java Patches

Hi Mike, Jack,

On 17 Jun 2011, at 20:24, Jack Howarth wrote:

> On Fri, Jun 17, 2011 at 10:43:07AM -0700, Mike Stump wrote:
>> 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?
>
>   Since SYSTEMSPEC in configure.ac is setting system specific  
> options for libgcj.spec.in, it seemed
> the most rational place to append -no_pie to (and we already had a  
> darwin entry in the case statement).
> FYI, I also tried a different approach of not appending -no_pie  
> SYSTEMSPEC on darwin but instead using...

maybe I need more coffee .. and the gcc gathering was very sociable...  
but...

... It seems to me that switching pie off in libjava spec == switching  
pie off for every java program.

(i.e. it doesn't seem equivalent to BOOT_CFLAGS, but maybe I'm still  
missing something).

>> 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.
>
> I plan on opening a PR shortly, but I was hoping to be able to  
> reproduce the same failures under linux
> using a bootstrap with the compiler defaulted to -fPIC code  
> generation and the inverse change applied
> to linux of...

The thing that is not clear is this.

libjava (and boehm-gc) with pie passes on d9 and d10 (modulo a test- 
suite related kludge); so it doesn't seem that there's a fundamental  
problem.
(c.f. PCH, which won't work with pie, by definition from its design).

AFAIR ecj1 is not involved in the libjava tests - because they don't  
actually compile from .java.

(I'm not debating that there is a problem with ecj1 - but maybe that  
needs to be solved in the explicit build instructions for that  
executable).

----

So is this 'fix' a work-around for a tool bug... or is there really a  
lurking problem in boehm-gc/libjava that is uncovered by darwin11?

we seem to be switching off pie without actually pointing at the  
reason for doing so...

Iain

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
  2011-06-17  2:23 Jack Howarth
@ 2011-06-17  8:29 ` Andrew Haley
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2011-06-17  8:29 UTC (permalink / raw)
  To: java-patches

On 17/06/11 03:23, Jack Howarth wrote:
>   The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the new -pie
> default of the linker.

Why?

Andrew.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
@ 2011-06-17  2:23 Jack Howarth
  2011-06-17  8:29 ` Andrew Haley
  0 siblings, 1 reply; 5+ messages in thread
From: Jack Howarth @ 2011-06-17  2:23 UTC (permalink / raw)
  To: java-patches

  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.


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-18  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20110617022132.GA18745@bromo.med.uc.edu>
2011-06-17 17:43 ` [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11 Mike Stump
2011-06-17 19:24   ` Jack Howarth
2011-06-18  7:51     ` IainS
2011-06-17  2:23 Jack Howarth
2011-06-17  8:29 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).