From 662f7a412e0e8d9639adf154abbf094fd7473f6d Mon Sep 17 00:00:00 2001 From: tschwinge Date: Thu, 7 Nov 2013 16:48:00 +0000 Subject: [PATCH] Generally link to libgomp for -ftree-parallelize-loops=*. Backport from trunk, r204517: gcc/ * config/arc/arc.h (LINK_COMMAND_SPEC): For -ftree-parallelize-loops=*, link to libgomp and its dependencies. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * gcc.c (GOMP_SELF_SPECS): Update comment about libgomp's dependencies. libgomp/ * libgomp.spec.in: Update comment about libgomp's dependencies. * configure.ac: Likewise. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@204523 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 12 ++++++++++++ gcc/config/arc/arc.h | 3 ++- gcc/config/ia64/hpux.h | 2 +- gcc/config/pa/pa-hpux11.h | 3 ++- gcc/config/pa/pa64-hpux.h | 18 ++++++++++++------ gcc/gcc.c | 2 +- libgomp/ChangeLog.gomp | 8 ++++++++ libgomp/configure | 2 +- libgomp/configure.ac | 2 +- libgomp/libgomp.spec.in | 2 +- 10 files changed, 41 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog.gomp b/gcc/ChangeLog.gomp index a62f1599fb6..e3b834cdf2d 100644 --- a/gcc/ChangeLog.gomp +++ b/gcc/ChangeLog.gomp @@ -1,3 +1,15 @@ +2013-11-07 Thomas Schwinge + + Backport from trunk, r204517: + + * config/arc/arc.h (LINK_COMMAND_SPEC): For + -ftree-parallelize-loops=*, link to libgomp and its dependencies. + * config/ia64/hpux.h (LIB_SPEC): Likewise. + * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. + * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. + * gcc.c (GOMP_SELF_SPECS): Update comment about libgomp's + dependencies. + 2013-11-07 Aldy Hernandez * omp-low.c (ipa_simd_modify_function_body): Avoid diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 637f7b66acc..87908d41afc 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -174,7 +174,8 @@ along with GCC; see the file COPYING3. If not see %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ - %{fopenmp:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ + %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ + %(mflib)\ %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h index ca592e4bc26..517132c8e63 100644 --- a/gcc/config/ia64/hpux.h +++ b/gcc/config/ia64/hpux.h @@ -92,7 +92,7 @@ do { \ #undef LIB_SPEC #define LIB_SPEC \ "%{!shared: \ - %{mt|pthread:%{fopenmp:-lrt} -lpthread} \ + %{mt|pthread:%{fopenmp|ftree-parallelize-loops=*:-lrt} -lpthread} \ %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \ %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \ %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \ diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h index c217398729a..4da1b096a50 100644 --- a/gcc/config/pa/pa-hpux11.h +++ b/gcc/config/pa/pa-hpux11.h @@ -120,7 +120,8 @@ along with GCC; see the file COPYING3. If not see #undef LIB_SPEC #define LIB_SPEC \ "%{!shared:\ - %{fopenmp:%{static:-a archive_shared} -lrt %{static:-a archive}}\ + %{fopenmp|ftree-parallelize-loops=*:%{static:-a archive_shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}\ diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h index a3e21d3b6a0..9efc137c89e 100644 --- a/gcc/config/pa/pa64-hpux.h +++ b/gcc/config/pa/pa64-hpux.h @@ -58,19 +58,22 @@ along with GCC; see the file COPYING3. If not see #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD) #define LIB_SPEC \ "%{!shared:\ - %{!p:%{!pg:%{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{!p:%{!pg:%{fopenmp|ftree-parallelize-loops=*:%{static:-a shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\ -lprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenmp|ftree-parallelize-loops=*:%{static:-a shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\ -lgprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenmp|ftree-parallelize-loops=*:%{static:-a shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ @@ -78,19 +81,22 @@ along with GCC; see the file COPYING3. If not see #else #define LIB_SPEC \ "%{!shared:\ - %{!p:%{!pg:%{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{!p:%{!pg:%{fopenmp|ftree-parallelize-loops=*:%{static:-a shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\ -lprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenmp|ftree-parallelize-loops=*:%{static:-a shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\ -lgprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenmp|ftree-parallelize-loops=*:%{static:-a shared} -lrt\ + %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ diff --git a/gcc/gcc.c b/gcc/gcc.c index 22982497a3b..e3029b80838 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -921,7 +921,7 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS; #define DRIVER_SELF_SPECS "" #endif -/* Adding -fopenmp should imply pthreads. This is particularly important +/* Linking to libgomp implies pthreads. This is particularly important for targets that use different start files and suchlike. */ #ifndef GOMP_SELF_SPECS #define GOMP_SELF_SPECS "%{fopenmp|ftree-parallelize-loops=*: -pthread}" diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp index c6f5a362c7b..85c36bc25a9 100644 --- a/libgomp/ChangeLog.gomp +++ b/libgomp/ChangeLog.gomp @@ -1,3 +1,11 @@ +2013-11-07 Thomas Schwinge + + Backport from trunk, r204517: + + * libgomp.spec.in: Update comment about libgomp's dependencies. + * configure.ac: Likewise. + * configure: Regenerate. + 2013-10-10 Jakub Jelinek * testsuite/libgomp.c++/udr-6.C: Remove UDR + on type F. diff --git a/libgomp/configure b/libgomp/configure index e754effa2b7..704f22a841e 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -16217,7 +16217,7 @@ else fi # Set up the set of libraries that we need to link against for libgomp. -# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp, +# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread, # which will force linkage against -lpthread (or equivalent for the system). # That's not 100% ideal, but about the best we can do easily. if test $enable_shared = yes; then diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 67f28ed6de8..da064264ca7 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -283,7 +283,7 @@ else fi # Set up the set of libraries that we need to link against for libgomp. -# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp, +# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread, # which will force linkage against -lpthread (or equivalent for the system). # That's not 100% ideal, but about the best we can do easily. if test $enable_shared = yes; then diff --git a/libgomp/libgomp.spec.in b/libgomp/libgomp.spec.in index b7319f33a53..5651603f487 100644 --- a/libgomp/libgomp.spec.in +++ b/libgomp/libgomp.spec.in @@ -1,3 +1,3 @@ # This spec file is read by gcc when linking. It is used to specify the -# standard libraries we need in order to link with -fopenmp. +# standard libraries we need in order to link with libgomp. *link_gomp: @link_gomp@ -- 2.11.4.GIT