Instead of implicit global 'LIBS="-ldl $LIBS"' via 'AC_CHECK_LIB', make
'-ldl' explicit for libgomp proper, and clean up 'PLUGIN_GCN_LIBS',
'PLUGIN_NVPTX_LIBS' accordingly.
libgomp/
* Makefile.am (libgomp_la_LIBADD): Initialize.
* plugin/configfrag.ac (DL_LIBS): New.
(PLUGIN_GCN_LIBS): Remove.
(PLUGIN_NVPTX_LIBS): Don't set in the 'PLUGIN_NVPTX_DYNAMIC' case.
* plugin/Makefrag.am (libgomp_la_LIBADD)
(libgomp_plugin_gcn_la_LIBADD): Consider '$(DL_LIBS)'.
(libgomp_plugin_nvptx_la_LIBADD) <PLUGIN_NVPTX_DYNAMIC>: Likewise.
* Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.
(cherry picked from commit
dcc266796a6afa18eeba1edde81f9eb78e6c83ce)
+2022-05-05 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from mainline:
+ 2022-05-05 Thomas Schwinge <thomas@codesourcery.com>
+
+ * Makefile.am (libgomp_la_LIBADD): Initialize.
+ * plugin/configfrag.ac (DL_LIBS): New.
+ (PLUGIN_GCN_LIBS): Remove.
+ (PLUGIN_NVPTX_LIBS): Don't set in the 'PLUGIN_NVPTX_DYNAMIC' case.
+ * plugin/Makefrag.am (libgomp_la_LIBADD)
+ (libgomp_plugin_gcn_la_LIBADD): Consider '$(DL_LIBS)'.
+ (libgomp_plugin_nvptx_la_LIBADD) <PLUGIN_NVPTX_DYNAMIC>: Likewise.
+ * Makefile.in: Regenerate.
+ * config.h.in: Likewise.
+ * configure: Likewise.
+ * testsuite/Makefile.in: Likewise.
+
2022-04-07 Thomas Schwinge <thomas@codesourcery.com>
Backport from mainline:
libgomp_version_info = -version-info $(libtool_VERSION)
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
$(lt_host_flags)
+libgomp_la_LIBADD =
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@ -DPLUGIN_NVPTX_LINK_LIBCUDA
# 'dlopen'ing the CUDA Driver library vs. linking it.
-@PLUGIN_NVPTX_DYNAMIC_TRUE@@PLUGIN_NVPTX_TRUE@am__append_3 = $(PLUGIN_NVPTX_LIBS)
+@PLUGIN_NVPTX_DYNAMIC_TRUE@@PLUGIN_NVPTX_TRUE@am__append_3 = $(DL_LIBS)
@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_4 = $(PLUGIN_NVPTX_LIBS)
@PLUGIN_GCN_TRUE@am__append_5 = libgomp-plugin-gcn.la
@USE_FORTRAN_TRUE@am__append_6 = openacc.f90
$(libgomp_plugin_nvptx_la_LDFLAGS) $(LDFLAGS) -o $@
@PLUGIN_NVPTX_TRUE@am_libgomp_plugin_nvptx_la_rpath = -rpath \
@PLUGIN_NVPTX_TRUE@ $(toolexeclibdir)
-libgomp_la_LIBADD =
@USE_FORTRAN_TRUE@am__objects_1 = openacc.lo
am_libgomp_la_OBJECTS = alloc.lo atomic.lo barrier.lo critical.lo \
env.lo error.lo icv.lo icv-device.lo iter.lo iter_ull.lo \
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
-PLUGIN_GCN_LIBS = @PLUGIN_GCN_LIBS@
PLUGIN_NVPTX_CPPFLAGS = @PLUGIN_NVPTX_CPPFLAGS@
PLUGIN_NVPTX_LDFLAGS = @PLUGIN_NVPTX_LDFLAGS@
PLUGIN_NVPTX_LIBS = @PLUGIN_NVPTX_LIBS@
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
$(lt_host_flags)
+libgomp_la_LIBADD = $(DL_LIBS)
libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c env.c \
@PLUGIN_GCN_TRUE@libgomp_plugin_gcn_la_LDFLAGS = $(libgomp_plugin_gcn_version_info) \
@PLUGIN_GCN_TRUE@ $(lt_host_flags)
-@PLUGIN_GCN_TRUE@libgomp_plugin_gcn_la_LIBADD = libgomp.la $(PLUGIN_GCN_LIBS)
+@PLUGIN_GCN_TRUE@libgomp_plugin_gcn_la_LIBADD = libgomp.la $(DL_LIBS)
@PLUGIN_GCN_TRUE@libgomp_plugin_gcn_la_LIBTOOLFLAGS = --tag=disable-static
nodist_noinst_HEADERS = libgomp_f.h
nodist_libsubinclude_HEADERS = omp.h openacc.h acc_prof.h
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `dl' library (-ldl). */
-#undef HAVE_LIBDL
-
/* Define to 1 if you have the `memalign' function. */
#undef HAVE_MEMALIGN
offload_additional_options
offload_targets
offload_plugins
-PLUGIN_GCN_LIBS
PLUGIN_NVPTX_LIBS
PLUGIN_NVPTX_LDFLAGS
PLUGIN_NVPTX_CPPFLAGS
CUDA_DRIVER_LIB
CUDA_DRIVER_INCLUDE
+DL_LIBS
libtool_VERSION
ac_ct_FC
FCFLAGS
# <http://www.gnu.org/licenses/>.
plugin_support=yes
+DL_LIBS=
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
$as_echo_n "checking for dlsym in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlsym+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5
$as_echo "$ac_cv_lib_dl_dlsym" >&6; }
if test "x$ac_cv_lib_dl_dlsym" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDL 1
-_ACEOF
-
- LIBS="-ldl $LIBS"
-
+ DL_LIBS=-ldl
else
plugin_support=no
fi
PLUGIN_GCN=0
-PLUGIN_GCN_LIBS=
-
# Parse '--enable-offload-targets', figure out the corresponding libgomp
# plugins, and configure to find the corresponding offload compilers.
&& (test "x$CUDA_DRIVER_LIB" = x \
|| test "x$CUDA_DRIVER_LIB" = xno); then
PLUGIN_NVPTX=1
- PLUGIN_NVPTX_LIBS='-ldl'
PLUGIN_NVPTX_DYNAMIC=1
else
PLUGIN_NVPTX=0
;;
*)
tgt_plugin=gcn
- PLUGIN_GCN=$tgt
- PLUGIN_GCN_LIBS="-ldl"
PLUGIN_GCN=1
;;
esac
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# <http://www.gnu.org/licenses/>.
+libgomp_la_LIBADD += $(DL_LIBS)
+
if PLUGIN_NVPTX
# Nvidia PTX OpenACC plugin.
libgomp_plugin_nvptx_version_info = -version-info $(libtool_VERSION)
# 'dlopen'ing the CUDA Driver library vs. linking it.
if PLUGIN_NVPTX_DYNAMIC
-libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS)
+libgomp_plugin_nvptx_la_LIBADD += $(DL_LIBS)
else
libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA
libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS)
-D_GNU_SOURCE
libgomp_plugin_gcn_la_LDFLAGS = $(libgomp_plugin_gcn_version_info) \
$(lt_host_flags)
-libgomp_plugin_gcn_la_LIBADD = libgomp.la $(PLUGIN_GCN_LIBS)
+libgomp_plugin_gcn_la_LIBADD = libgomp.la
libgomp_plugin_gcn_la_LIBTOOLFLAGS = --tag=disable-static
+
+libgomp_plugin_gcn_la_LIBADD += $(DL_LIBS)
endif
# <http://www.gnu.org/licenses/>.
plugin_support=yes
-AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
+DL_LIBS=
+AC_SUBST(DL_LIBS)
+AC_CHECK_LIB(dl, dlsym, [DL_LIBS=-ldl], [plugin_support=no])
if test x"$plugin_support" = xyes; then
AC_DEFINE(PLUGIN_SUPPORT, 1,
[Define if all infrastructure, needed for plugins, is supported.])
AC_SUBST(PLUGIN_NVPTX_LIBS)
PLUGIN_GCN=0
-PLUGIN_GCN_LIBS=
-AC_SUBST(PLUGIN_GCN_LIBS)
# Parse '--enable-offload-targets', figure out the corresponding libgomp
# plugins, and configure to find the corresponding offload compilers.
&& (test "x$CUDA_DRIVER_LIB" = x \
|| test "x$CUDA_DRIVER_LIB" = xno); then
PLUGIN_NVPTX=1
- PLUGIN_NVPTX_LIBS='-ldl'
PLUGIN_NVPTX_DYNAMIC=1
else
PLUGIN_NVPTX=0
;;
*)
tgt_plugin=gcn
- PLUGIN_GCN=$tgt
- PLUGIN_GCN_LIBS="-ldl"
PLUGIN_GCN=1
;;
esac
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
-PLUGIN_GCN_LIBS = @PLUGIN_GCN_LIBS@
PLUGIN_NVPTX_CPPFLAGS = @PLUGIN_NVPTX_CPPFLAGS@
PLUGIN_NVPTX_LDFLAGS = @PLUGIN_NVPTX_LDFLAGS@
PLUGIN_NVPTX_LIBS = @PLUGIN_NVPTX_LIBS@