H.J., Did you attach the correct version of the patch? I don't see anything conditional on linux. Jack
On Tue, Mar 31, 2015 at 11:58 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Tue, Mar 31, 2015 at 7:25 AM, Jack Howarth <howarth.at....@gmail.com> > wrote: >> H.J., >> While the latest patch fails to bootstrap on x86_64-apple-darwin14... >> >> _restore_x86_fp_state in os-unix-sysdep.o >> _sysdep_save_fp_ctrl_state in os-unix-sysdep.o >> ld: symbol(s) not found for architecture x86_64 >> collect2: error: ld returned 1 exit status >> Makefile:540: recipe for target 'libcilkrts.la' failed >> make[2]: *** [libcilkrts.la] Error 1 >> make[2]: Leaving directory >> '/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libcilkrts' >> Makefile:13569: recipe for target 'all-target-libcilkrts' failed >> make[1]: *** [all-target-libcilkrts] Error 2 >> make[1]: Leaving directory '/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir' >> Makefile:21064: recipe for target 'bootstrap' failed >> make: *** [bootstrap] Error 2 >> >> as darwin will require the new usage of libgcc_nonshared.a to be added >> to the spec handling with... > > Here is the updated patch to make libgcc_nonshared.a optional > so that it is only needed on Linux. > >> Index: gcc/config/darwin.h >> =================================================================== >> --- gcc/config/darwin.h (revision 221794) >> +++ gcc/config/darwin.h (working copy) >> @@ -325,7 +325,7 @@ extern GTY(()) int darwin_ms_struct; >> need symbols from -lgcc. */ >> #undef REAL_LIBGCC_SPEC >> #define REAL_LIBGCC_SPEC \ >> - "%{static-libgcc|static: -lgcc_eh -lgcc; \ >> + "%{static-libgcc|static: -lgcc_eh -lgcc_nonshared -lgcc; \ >> shared-libgcc|fexceptions|fgnu-runtime: \ >> %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ >> %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ >> @@ -336,7 +336,7 @@ extern GTY(()) int darwin_ms_struct; >> %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ >> %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ >> %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ >> - -lgcc }" >> + -lgcc_nonshared -lgcc }" >> >> /* We specify crt0.o as -lcrt0.o so that ld will search the library path. >> >> Jack >> ps One minor nit... >> >> Index: gcc/gcc.c >> =================================================================== >> --- gcc/gcc.c (revision 221794) >> +++ gcc/gcc.c (working copy) >> @@ -1566,11 +1566,13 @@ init_spec (void) >> if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0) >> { >> init_gcc_specs (&obstack, >> + "-lgcc_nonshared " >> "-lgcc_s" >> #ifdef USE_LIBUNWIND_EXCEPTIONS >> " -lunwind" >> #endif >> , >> + "-lgcc_nonshared " >> "-lgcc", >> "-lgcc_eh" >> #ifdef USE_LIBUNWIND_EXCEPTIONS >> @@ -1591,7 +1593,9 @@ init_spec (void) >> /* Ug. We don't know shared library extensions. Hope that >> systems that use this form don't do shared libraries. */ >> init_gcc_specs (&obstack, >> + "libgcc_nonshared.a%s " >> "-lgcc_s", >> + "libgcc_nonshared.a%s " >> "libgcc.a%s", >> "libgcc_eh.a%s" >> >> You seem to have unnecessary trailing whitespace at the end of these flags. >> > > The white space is needed to avoid -lgcc_nonshared-lgcc_s. > > > -- > H.J. > --- > > We shouldn't call external function, __cpu_indicator_init, while an object > is being relocated since its .got.plt section hasn't been updated. It > works for non-PIE since no update on .got.plt section is required. This > patch hides __cpu_indicator_init/__cpu_model from linker to force linker > to resolve __cpu_indicator_init/__cpu_model to their hidden definitions > in libgcc_nonshared.a while providing backward binary compatibility. The > new libgcc_nonshared.a is always linked togther with -lgcc_s and -lgcc. > > gcc/ > > PR target/65612 > * gcc.c (init_spec): Add -lgcc_nonshared/libgcc_nonshared.a%s > to -lgcc_s. > > gcc/testsuite/ > > PR target/65612 > * g++.dg/ext/mv18.C: New test. > * g++.dg/ext/mv19.C: Likewise. > * g++.dg/ext/mv20.C: Likewise. > * g++.dg/ext/mv21.C: Likewise. > * g++.dg/ext/mv22.C: Likewise. > * g++.dg/ext/mv23.C: Likewise. > > libgcc/ > > PR target/65612 > * Makefile.in (LIB2ADDNONSHARED): New. > (libgcc-nonshared-objects): Likewise. > (libgcc_nonshared.a): Likewise. > Check unsupported files in LIB2ADDNONSHARED. > (iter-items): Add $(LIB2ADDNONSHARED). > (all): Depend on libgcc_nonshared.a. > ($(libgcc-nonshared-objects)): Depend on libgcc_tm.h. > (install-leaf): Install libgcc_nonshared.a. > * shared-object.mk: Check empty $o. > * config/i386/cpuinfo.c (__cpu_model): Initialize. > (__cpu_indicator_init@GCC_4.8.0): New. > (__cpu_model@GCC_4.8.0): Likewise. > * config/i386/t-cpuinfo (LIB2ADDNONSHARED): New. > * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Add > -DUSE_ELF_SYMVER. > ---