On Fri, Jun 17, 2011 at 12:04:34PM +0100, IainS wrote: > Hi Jack, > > On 17 Jun 2011, at 03:21, 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? >> Jack >> >> 2011-06-16 Jack Howarth <howa...@bromo.med.uc.edu> >> >> * libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11. >> * libjava/configure: Regenerate. > > > I would like to see some more analysis of what the underlying reasons > for failure are. > > -fpie works fine with darwin 9 and darwin 10 libjava [XCode 3.1.4 and > 3.2.5 respectively, bootstrap w/4.2.1] > (modulo suppressing it when building test-suite .dylibs *** - which is a > testsuite options handling issue - not a fundamental problem).
This is from a complete bootstrap with... BOOT_LDFLAGS += -Wl,-no_pie Otherwise you are not duplicating darwin11's -pie linker default. Again it is essential that you cause ecj1 to be linked with -pie to manifest this problem. Also note the comments in... http://gcc.gnu.org/ml/gcc/2011-06/msg00211.html which argue that there is little to be gained by building gcc as PIE. If that is valid, my patch achieves that. The problem is that the infrastructure for gcj and ecj1 currently doesn't allow BOOT_LDFLAGS to be used when ecj1 is built. Note that if I go back to the build directory (without my patch), relink ecjx with -Wl,-no_pie and copy that over the installed ecj1, the crash in gcj disappears. Jack > > so: > > make -k check-target-libjava "RUNTESTFLAGS=--target_board=unix/-fpie\{- > m32,-m64\} " > > passes without regression (re the no pie case) given that pie is > suppressed for dylibs. > > ----- > > So is your proposed patch a work-around for (as yet unreleased) darwin > 11 tool-chain bugs or ... ? > > Iain > > === > **** > kludge to suppress pie for for dylibs (use in place of the darwin9.h > hunk from the attachment on PR49371). > > Index: gcc/config/darwin9.h > =================================================================== > --- gcc/config/darwin9.h (revision 175110) > +++ gcc/config/darwin9.h (working copy) > @@ -35,6 +35,12 @@ along with GCC; see the file COPYING3. If not see > /* Tell collect2 to run dsymutil for us as necessary. */ > #define COLLECT_RUN_DSYMUTIL 1 > > +#undef PIE_SPEC > +#define PIE_SPEC \ > + "%{fpie|pie|fPIE: %{!Zdynamiclib: \ > + %{mdynamic-no-pic: %n'-mdynamic-no-pic' overrides '-pie', '-fpie' > or '-fPIE'; \ > + :-pie}}}" > + > #undef ASM_OUTPUT_ALIGNED_COMMON > #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ > do { \