H.J., While the latest patch fails to bootstrap on x86_64-apple-darwin14...
make[2]: Entering directory '/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libcilkrts' /bin/sh ./libtool --tag=CXX --mode=link /sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/./gcc/xg++ -B/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/./gcc/ -nostdinc++ -nostdinc++ -I/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/include/x86_64-apple-darwin14.3.0 -I/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/include -I/sw/src/fink.build/gcc5-5.0.0-1/gcc-5-20150331/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc5-5.0.0-1/gcc-5-20150331/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc5-5.0.0-1/gcc-5-20150331/libstdc++-v3/testsuite/util -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/libsupc++/.libs -B/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src/.libs -B/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/libsupc++/.libs -B/sw/lib/gcc5/x86_64-apple-darwin14.3.0/bin/ -B/sw/lib/gcc5/x86_64-apple-darwin14.3.0/lib/ -isystem /sw/lib/gcc5/x86_64-apple-darwin14.3.0/include -isystem /sw/lib/gcc5/x86_64-apple-darwin14.3.0/sys-include -g -O2 -version-info 5:0:0 -ldl -lpthread -no-undefined -o libcilkrts.la -rpath /sw/lib/gcc5/lib cilk-abi-vla.lo os-unix-sysdep.lo bug.lo cilk-abi.lo cilk-abi-cilk-for.lo cilk-abi-vla-internal.lo cilk_api.lo cilk_fiber.lo cilk_fiber-unix.lo cilk_malloc.lo c_reducers.lo except-gcc.lo frame_malloc.lo full_frame.lo global_state.lo jmpbuf.lo local_state.lo metacall_impl.lo os_mutex-unix.lo os-unix.lo pedigrees.lo record-replay.lo reducer_impl.lo scheduler.lo signal_node.lo spin_mutex.lo stats.lo symbol_test.lo sysdep-unix.lo worker_mutex.lo libtool: link: /sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/./gcc/xg++ -B/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/./gcc/ -nostdinc++ -nostdinc++ -I/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/include/x86_64-apple-darwin14.3.0 -I/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/include -I/sw/src/fink.build/gcc5-5.0.0-1/gcc-5-20150331/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc5-5.0.0-1/gcc-5-20150331/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc5-5.0.0-1/gcc-5-20150331/libstdc++-v3/testsuite/util -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/libsupc++/.libs -B/sw/lib/gcc5/x86_64-apple-darwin14.3.0/bin/ -B/sw/lib/gcc5/x86_64-apple-darwin14.3.0/lib/ -isystem /sw/lib/gcc5/x86_64-apple-darwin14.3.0/include -isystem /sw/lib/gcc5/x86_64-apple-darwin14.3.0/sys-include -dynamiclib -o .libs/libcilkrts.5.dylib .libs/cilk-abi-vla.o .libs/os-unix-sysdep.o .libs/bug.o .libs/cilk-abi.o .libs/cilk-abi-cilk-for.o .libs/cilk-abi-vla-internal.o .libs/cilk_api.o .libs/cilk_fiber.o .libs/cilk_fiber-unix.o .libs/cilk_malloc.o .libs/c_reducers.o .libs/except-gcc.o .libs/frame_malloc.o .libs/full_frame.o .libs/global_state.o .libs/jmpbuf.o .libs/local_state.o .libs/metacall_impl.o .libs/os_mutex-unix.o .libs/os-unix.o .libs/pedigrees.o .libs/record-replay.o .libs/reducer_impl.o .libs/scheduler.o .libs/signal_node.o .libs/spin_mutex.o .libs/stats.o .libs/symbol_test.o .libs/sysdep-unix.o .libs/worker_mutex.o -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc5-5.0.0-1/darwin_objdir/x86_64-apple-darwin14.3.0/libstdc++-v3/libsupc++/.libs -ldl -lpthread -install_name /sw/lib/gcc5/lib/libcilkrts.5.dylib -compatibility_version 6 -current_version 6.0 -Wl,-single_module Undefined symbols for architecture x86_64: "___cpu_model", referenced from: _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... 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. On Tue, Mar 31, 2015 at 6:38 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Mon, Mar 30, 2015 at 10:38 PM, Jakub Jelinek <ja...@redhat.com> wrote: >> On Mon, Mar 30, 2015 at 07:08:00PM -0700, H.J. Lu wrote: >>> --- a/gcc/gcc.c >>> +++ b/gcc/gcc.c >>> @@ -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" >> >> Why do you need to link libgcc_nonshared.a twice here? -lgcc_s surely won't >> add any new __cpu* undefined references. > > The one added for -lgcc_s is for building shared C++ library since -lgcc isn't > used and only -lgcc_s is used. The one added for -lgcc is for static linking > since -lgcc_s isn't used. I updated the patch to add some testcases > for -static. > I couldn't find a way to add tests for: > > export/build/gnu/gcc/build-x86_64-linux/gcc/xg++ > -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -c -o main.o > main.cc > /export/build/gnu/gcc/build-x86_64-linux/gcc/xg++ > -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -shared -fPIC -O2 -o > libmv20.so mv20.cc > -L/export/build/gnu/gcc/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs > /export/build/gnu/gcc/build-x86_64-linux/gcc/xg++ > -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -o x main.o > libmv20.so -Wl,-R,. > -L/export/build/gnu/gcc/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs > /usr/local/bin/ld: x: hidden symbol `__cpu_model' in > /export/build/gnu/gcc/build-x86_64-linux/gcc/libgcc_nonshared.a(cpuinfo.o) > is referenced by DSO > /usr/local/bin/ld: final link failed: Bad value > collect2: error: ld returned 1 exit status > >>> @@ -424,3 +424,8 @@ __cpu_indicator_init (void) >>> >>> return 0; >>> } >>> + >>> +#if defined SHARED && !defined _WIN32 >>> +__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0"); >>> +__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0"); >>> +#endif >> >> Will this work on Solaris? >> I'd say you at least want to also guard with some configure check if >> .symver is supported by assembler. >> > > I updated my patch with: > > @@ -424,3 +424,8 @@ __cpu_indicator_init (void) > > return 0; > } > + > +#if defined SHARED && defined USE_ELF_SYMVER > +__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0"); > +__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0"); > +#endif > > diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux > index 4f47f7b..11bb46e 100644 > --- a/libgcc/config/i386/t-linux > +++ b/libgcc/config/i386/t-linux > @@ -3,4 +3,4 @@ > # t-slibgcc-elf-ver and t-linux > SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver > > -HOST_LIBGCC2_CFLAGS += -mlong-double-80 > +HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER > > OK for master? > > -- > H.J.