From: Ivan Maidanski Date: Thu, 8 Jun 2017 08:40:36 +0000 (+0300) Subject: Fix pthread_start compilation if single-obj-compilation (Linux) X-Git-Tag: v7.4.6~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e137e69401dfe460630c888214a0ecd810302a8a;p=gc Fix pthread_start compilation if single-obj-compilation (Linux) (Cherry-pick commit 3300086 from 'release-7_6' branch.) * Makefile.am [SINGLE_GC_OBJ && PTHREAD_START_STANDALONE] (AM_CPPFLAGS): Add -DGC_PTHREAD_START_STANDALONE. * Makefile.am [SINGLE_GC_OBJ && PTHREAD_START_STANDALONE] (libgc_la_SOURCES): Add pthread_start.c entry. * Makefile.am: Add bank lines (to improve readability). * configure.ac (pthread_start_standalone): New variable. * configure.ac [*-*-*linux* && THREADS=posix] (pthread_start_standalone): Set to yes (instead of AM_CONDITIONAL(PTHREAD_START_STANDALONE) directly). * configure.ac (PTHREAD_START_STANDALONE): AM_CONDITIONAL if pthread_start_standalone. --- diff --git a/Makefile.am b/Makefile.am index b5658a89..8b7e9bba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,9 +55,18 @@ pkgconfig_DATA = bdw-gc.pc # --------- lib_LTLIBRARIES += libgc.la + if SINGLE_GC_OBJ + libgc_la_SOURCES = extra/gc.c + +if PTHREAD_START_STANDALONE +AM_CPPFLAGS += -DGC_PTHREAD_START_STANDALONE +libgc_la_SOURCES += pthread_start.c +endif + else + EXTRA_DIST += extra/gc.c libgc_la_SOURCES = \ allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \ @@ -73,6 +82,7 @@ if WIN32_THREADS libgc_la_SOURCES += win32_threads.c else if PTHREADS +# Not Cygwin or MinGW. libgc_la_SOURCES += pthread_start.c pthread_support.c if DARWIN_THREADS libgc_la_SOURCES += darwin_stop_world.c @@ -90,6 +100,7 @@ if ENABLE_DISCLAIM libgc_la_SOURCES += fnlz_mlc.c endif +# End of !SINGLE_GC_OBJ endif if USE_INTERNAL_LIBATOMIC_OPS diff --git a/configure.ac b/configure.ac index 9f2ad184..5cb34fcf 100644 --- a/configure.ac +++ b/configure.ac @@ -384,24 +384,31 @@ AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue) AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue) compiler_suncc=no +pthread_start_standalone=no case "$host" in - powerpc-*-darwin*) + *-*-*linux*) + # Turn on the workaround described in pthread_start.c. + AS_IF([test "$THREADS" = posix], [pthread_start_standalone=yes]) + ;; + powerpc-*-darwin*) powerpc_darwin=true ;; - *-*-solaris*) + *-*-solaris*) if test "$GCC" != yes; then # Solaris SunCC compiler_suncc=yes CFLAGS="-O $CFLAGS" fi ;; - *-*-wince*) + *-*-wince*) if test "$enable_gc_debug" != "no"; then AC_DEFINE([GC_READ_ENV_FILE], 1, [Read environment variables from the GC 'env' file.]) fi ;; esac +AM_CONDITIONAL(PTHREAD_START_STANDALONE, + test x$pthread_start_standalone = xyes) if test "$GCC" = yes; then # Output all warnings.