mirror of git://gcc.gnu.org/git/gcc.git
PR81358: Enable automatic linking of libatomic.
ChangeLog: PR driver/81358 * Makefile.def: Add no_atomic=true for libraries that don't depend on libatomic. * Makefile.tpl: Export TARGET_CONFIGDIRS and create rule to add dependencies for libatomic. * configure.ac: Add libatomic to bootstrap_target_libs. * Makefile.in: Regenerate. * configure: Regenerate. gcc/ChangeLog: PR driver/81358 * common.opt: New option -flink-libatomic. * gcc.cc (LINK_LIBATOMIC_SPEC): New macro. * config/alpha/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Use LINK_LIBATOMIC_SPEC. * config/arm/uclinux-elf.h: Likewise. * config/arm/unknown-elf.h: Likewise. * config/avr/avrlibc.h: Likewise. * config/bfin/linux.h: Likewise. * config/darwin.h: Likewise. * config/gnu-user.h: Likewise. * config/lm32/uclinux-elf.h: Likewise. * config/rs6000/linux64.h: Likewise. * config/rs6000/rtems.h: Likewise. * config/sparc/sparc.h: Likewise. * doc/invoke.texi: Document -flink-libatomic. * configure.ac: Define TARGET_PROVIDES_LIBATOMIC. * configure: Regenerate. * config.in: Regenerate. * common.opt.urls: Regenerate. libatomic/ChangeLog: PR driver/81358 * Makefile.am: Pass -fno-link-libatomic. New rule all-local. * configure.ac: Assert that CFLAGS is set and pass -fno-link-libatomic. Use __libatomic_save_CFLAGS__ instead of save_CFLAGS. * Makefile.in: Regenerate. * configure: Regenerate. Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com> Co-authored-by: Matthew Malcolmson <mmalcolmson@nvidia.com>
This commit is contained in:
parent
5e9eecc668
commit
e63cf4b130
11
Makefile.def
11
Makefile.def
|
|
@ -650,14 +650,15 @@ dependencies = { module=all-m4; on=all-build-texinfo; };
|
|||
// on libgcc and newlib/libgloss.
|
||||
lang_env_dependencies = { module=libitm; cxx=true; };
|
||||
lang_env_dependencies = { module=libffi; cxx=true; };
|
||||
lang_env_dependencies = { module=newlib; no_c=true; };
|
||||
lang_env_dependencies = { module=libgloss; no_c=true; };
|
||||
lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; };
|
||||
lang_env_dependencies = { module=newlib; no_c=true; no_atomic=true; };
|
||||
lang_env_dependencies = { module=libgloss; no_c=true; no_atomic=true; };
|
||||
lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; no_atomic=true; };
|
||||
// libiberty does not depend on newlib or libgloss because it must be
|
||||
// built newlib on some targets (e.g. Cygwin). It still needs
|
||||
// a dependency on libgcc for native targets to configure.
|
||||
lang_env_dependencies = { module=libiberty; no_c=true; };
|
||||
lang_env_dependencies = { module=libgcobol; cxx=true; };
|
||||
lang_env_dependencies = { module=libiberty; no_c=true; no_atomic=true; };
|
||||
lang_env_dependencies = { module=libgcobol; cxx=true; no_atomic=true; };
|
||||
lang_env_dependencies = { module=libatomic; no_atomic=true; };
|
||||
|
||||
dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
|
||||
dependencies = { module=all-target-fastjar; on=all-target-zlib; };
|
||||
|
|
|
|||
3279
Makefile.in
3279
Makefile.in
File diff suppressed because it is too large
Load Diff
17
Makefile.tpl
17
Makefile.tpl
|
|
@ -246,6 +246,7 @@ HOST_EXPORTS = \
|
|||
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
|
||||
ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
|
||||
ISLINC="$(HOST_ISLINC)"; export ISLINC; \
|
||||
TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS; \
|
||||
XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
|
||||
@if gcc-bootstrap
|
||||
$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
|
||||
|
|
@ -2098,6 +2099,11 @@ ENDFOR dependencies +]@endif gcc-bootstrap
|
|||
(if (exist? "no_gcc")
|
||||
(hash-create-handle! lang-env-deps
|
||||
(string-append (get "module") "-" "no_gcc") #t))
|
||||
|
||||
(if (exist? "no_atomic")
|
||||
(hash-create-handle! lang-env-deps
|
||||
(string-append (get "module") "-" "no_atomic") #t))
|
||||
|
||||
"" +][+ ENDFOR lang_env_dependencies +]
|
||||
|
||||
@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
|
||||
|
|
@ -2116,6 +2122,17 @@ configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
|
|||
ENDIF +][+ IF (lang-dep "cxx") +]
|
||||
configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
|
||||
ENDIF +]
|
||||
|
||||
@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_atomic"))
|
||||
+][+ IF bootstrap +][+ FOR bootstrap_stage +]
|
||||
configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libatomic[+
|
||||
ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
|
||||
@endif gcc-bootstrap
|
||||
|
||||
@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_atomic")) +]
|
||||
configure-target-[+module+]: maybe-all-target-libatomic[+
|
||||
ENDIF +][+ ENDFOR target_modules +]
|
||||
@endif gcc-no-bootstrap
|
||||
[+ ENDFOR target_modules +]
|
||||
|
||||
CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
|
||||
|
|
|
|||
|
|
@ -11075,6 +11075,11 @@ if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
|
|||
bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
|
||||
fi
|
||||
|
||||
# If we are building libatomic, bootstrap it.
|
||||
if echo " ${target_configdirs} " | grep " libatomic " > /dev/null 2>&1 ; then
|
||||
bootstrap_target_libs=${bootstrap_target_libs}target-libatomic,
|
||||
fi
|
||||
|
||||
# If we are building libsanitizer and $BUILD_CONFIG contains bootstrap-asan
|
||||
# or bootstrap-ubsan, bootstrap it.
|
||||
if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
|
||||
|
|
|
|||
|
|
@ -3251,6 +3251,11 @@ if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
|
|||
bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
|
||||
fi
|
||||
|
||||
# If we are building libatomic, bootstrap it.
|
||||
if echo " ${target_configdirs} " | grep " libatomic " > /dev/null 2>&1 ; then
|
||||
bootstrap_target_libs=${bootstrap_target_libs}target-libatomic,
|
||||
fi
|
||||
|
||||
# If we are building libsanitizer and $BUILD_CONFIG contains bootstrap-asan
|
||||
# or bootstrap-ubsan, bootstrap it.
|
||||
if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
|
||||
|
|
|
|||
|
|
@ -3439,6 +3439,10 @@ Use the Modern linker (MOLD) linker instead of the default linker.
|
|||
fuse-linker-plugin
|
||||
Common Undocumented Var(flag_use_linker_plugin)
|
||||
|
||||
flink-libatomic
|
||||
Common Driver Var(flag_link_libatomic) Init(1)
|
||||
Enable linking of libatomic.
|
||||
|
||||
; Positive if we should track variables, negative if we should run
|
||||
; the var-tracking pass only to discard debug annotations, zero if
|
||||
; we're not to run it.
|
||||
|
|
|
|||
|
|
@ -1634,6 +1634,9 @@ UrlSuffix(gcc/Link-Options.html#index-fuse-ld_003dmold)
|
|||
fuse-linker-plugin
|
||||
UrlSuffix(gcc/Optimize-Options.html#index-fuse-linker-plugin)
|
||||
|
||||
flink-libatomic
|
||||
UrlSuffix(gcc/Link-Options.html#index-flink-libatomic)
|
||||
|
||||
fvar-tracking
|
||||
UrlSuffix(gcc/Debugging-Options.html#index-fvar-tracking)
|
||||
|
||||
|
|
|
|||
|
|
@ -2626,6 +2626,12 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Define if libatomic is built for the target. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef TARGET_PROVIDES_LIBATOMIC
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
|
||||
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:%L} \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} \
|
||||
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
|
||||
|
||||
/* Use --as-needed -lgcc_s for eh support. */
|
||||
|
|
|
|||
|
|
@ -67,8 +67,9 @@
|
|||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:%L} \
|
||||
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G %{!nolibc:%L}}}"
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} \
|
||||
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G %{!nolibc:" \
|
||||
LINK_LIBATOMIC_SPEC "%L}}}"
|
||||
|
||||
/* Use --as-needed -lgcc_s for eh support. */
|
||||
#ifdef HAVE_LD_AS_NEEDED
|
||||
|
|
|
|||
|
|
@ -93,4 +93,4 @@
|
|||
udivmoddi4, which will depend on the exception unwind routines,
|
||||
which will depend on abort, which is defined in libc. */
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %{!nolibc:%L} --end-group"
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} --end-group"
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ along with GCC; see the file COPYING3. If not see
|
|||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"--start-group %G %{!nolibc:%L} --end-group"
|
||||
"--start-group %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} --end-group"
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{static|static-pie:--start-group} %{mfast-fp:-lbffastfp} %G %{!nolibc:%L} \
|
||||
"%{static|static-pie:--start-group} %{mfast-fp:-lbffastfp} %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} \
|
||||
%{static|static-pie:--end-group} \
|
||||
%{!static:%{!static-pie:%{mfast-fp:-lbffastfp} %G}}"
|
||||
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ extern GTY(()) int darwin_ms_struct;
|
|||
depend on libgcc. */
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%G %{!nolibc:%L} "
|
||||
"%G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} "
|
||||
|
||||
/* ld64 supports a sysroot, it just has a different name and there's no easy
|
||||
way to check for it at config time. */
|
||||
|
|
|
|||
|
|
@ -109,8 +109,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|||
#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
|
||||
#endif
|
||||
|
||||
|
||||
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:%L} \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} \
|
||||
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
|
||||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:%L} \
|
||||
"%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} \
|
||||
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
|
||||
|
||||
#undef CC1_SPEC
|
||||
|
|
|
|||
|
|
@ -393,9 +393,9 @@ extern int dot_symbols;
|
|||
/* Use gnu-user.h LINK_GCC_SEQUENCE_SPEC for linux. */
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{mads|myellowknife|mmvme|msim:%G %L %G;" \
|
||||
"%{mads|myellowknife|mmvme|msim:%G" LINK_LIBATOMIC_SPEC "%L %G;" \
|
||||
"!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \
|
||||
":%G %L %G}"
|
||||
":%G" LINK_LIBATOMIC_SPEC "%L %G}"
|
||||
|
||||
#undef TOC_SECTION_ASM_OP
|
||||
#define TOC_SECTION_ASM_OP \
|
||||
|
|
|
|||
|
|
@ -297,9 +297,9 @@
|
|||
/* Use gnu-user.h LINK_GCC_SEQUENCE_SPEC for rtems. */
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%{mads|myellowknife|mmvme|msim:%G %L %G;" \
|
||||
"%{mads|myellowknife|mmvme|msim:%G" LINK_LIBATOMIC_SPEC "%L %G;" \
|
||||
"!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \
|
||||
":%G %L %G}"
|
||||
":%G" LINK_LIBATOMIC_SPEC "%L %G}"
|
||||
|
||||
#define RTEMS_STARTFILE_SPEC "ecrti%O%s rtems_crti%O%s crtbegin%O%s"
|
||||
#define RTEMS_ENDFILE_SPEC "crtend%O%s rtems_crtn%O%s ecrtn%O%s"
|
||||
|
|
|
|||
|
|
@ -409,7 +409,9 @@ along with GCC; see the file COPYING3. If not see
|
|||
|
||||
/* Because libgcc can generate references back to libc (via .umul etc.) we have
|
||||
to list libc again after the second libgcc. */
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L} %G %{!nolibc:%L}"
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
"%G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L} \
|
||||
%G %{!nolibc:" LINK_LIBATOMIC_SPEC "%L}"
|
||||
|
||||
|
||||
#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
|
||||
|
|
|
|||
|
|
@ -33934,6 +33934,12 @@ $as_echo "#define ENABLE_DEFAULT_SSP 1" >>confdefs.h
|
|||
fi
|
||||
|
||||
|
||||
if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then
|
||||
|
||||
$as_echo "#define TARGET_PROVIDES_LIBATOMIC 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Test for <sys/sdt.h> on the target.
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
|
||||
|
|
|
|||
|
|
@ -7060,6 +7060,11 @@ if test x$enable_default_ssp = xyes ; then
|
|||
fi
|
||||
AC_SUBST([enable_default_ssp])
|
||||
|
||||
if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then
|
||||
AC_DEFINE(TARGET_PROVIDES_LIBATOMIC, 1,
|
||||
[Define if libatomic is built for the target.])
|
||||
fi
|
||||
|
||||
# Test for <sys/sdt.h> on the target.
|
||||
GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
|
||||
AC_CACHE_CHECK([sys/sdt.h in the target C library], [gcc_cv_sys_sdt_h], [
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ Objective-C and Objective-C++ Dialects}.
|
|||
|
||||
@item Linker Options
|
||||
@xref{Link Options,,Options for Linking}.
|
||||
@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library}
|
||||
@gccoptlist{@var{object-file-name} -flink-libatomic -fuse-ld=@var{linker} -l@var{library}
|
||||
-nostartfiles -nodefaultlibs -nolibc -nostdlib -nostdlib++
|
||||
-e @var{entry} --entry=@var{entry}
|
||||
-pie -pthread -r -rdynamic
|
||||
|
|
@ -19470,6 +19470,12 @@ If any of these options is used, then the linker is not run, and
|
|||
object file names should not be used as arguments. @xref{Overall
|
||||
Options}.
|
||||
|
||||
@opindex flink-libatomic
|
||||
@item -flink-libatomic
|
||||
Enable linking of libatomic if it's supported by target, and is enabled by
|
||||
default. The negative form @option{-fno-link-libatomic} can be used to
|
||||
explicitly disable linking of libatomic.
|
||||
|
||||
@opindex flinker-output
|
||||
@item -flinker-output=@var{type}
|
||||
This option controls code generation of the link-time optimizer. By
|
||||
|
|
|
|||
|
|
@ -984,6 +984,13 @@ proper position among the other output files. */
|
|||
|
||||
/* Here is the spec for running the linker, after compiling all files. */
|
||||
|
||||
#if defined(TARGET_PROVIDES_LIBATOMIC) && defined(USE_LD_AS_NEEDED)
|
||||
#define LINK_LIBATOMIC_SPEC "%{!fno-link-libatomic:" LD_AS_NEEDED_OPTION \
|
||||
" -latomic " LD_NO_AS_NEEDED_OPTION "} "
|
||||
#else
|
||||
#define LINK_LIBATOMIC_SPEC ""
|
||||
#endif
|
||||
|
||||
/* This is overridable by the target in case they need to specify the
|
||||
-lgcc and -lc order specially, yet not require them to override all
|
||||
of LINK_COMMAND_SPEC. */
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ libatomic_darwin_rpath += -Wl,-rpath,@loader_path
|
|||
endif
|
||||
|
||||
libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
|
||||
$(lt_host_flags) $(libatomic_darwin_rpath)
|
||||
-Wc,-fno-link-libatomic $(lt_host_flags) $(libatomic_darwin_rpath)
|
||||
|
||||
SIZES = @SIZES@
|
||||
|
||||
|
|
@ -168,6 +168,19 @@ libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
|
|||
# when it is reloaded during the build of all-multi.
|
||||
all-multi: $(libatomic_la_LIBADD)
|
||||
|
||||
# Copy built libatomic library to $build/gcc so it's easier to locate,
|
||||
# similar to libgcc.
|
||||
#
|
||||
# FIXME: libtool --mode=install also ends up copying libatomic.la in $gcc_objdir,
|
||||
# which (somehow) ends up adding $gcc_objdir to RPATH for libraries that get
|
||||
# built after libatomic, which makes RPATH insecure. Removing libatomic.la
|
||||
# from $gcc_objdir seems to fix the issue.
|
||||
|
||||
gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/
|
||||
all-local: libatomic.la
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la $(gcc_objdir)$(MULTISUBDIR)/
|
||||
rm $(gcc_objdir)$(MULTISUBDIR)/libatomic.la
|
||||
|
||||
# target overrides
|
||||
-include $(tmake_file)
|
||||
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ libatomic_version_info = -version-info $(libtool_VERSION)
|
|||
@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \
|
||||
@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path
|
||||
libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
|
||||
$(lt_host_flags) $(libatomic_darwin_rpath)
|
||||
-Wc,-fno-link-libatomic $(lt_host_flags) $(libatomic_darwin_rpath)
|
||||
|
||||
@PARTIAL_VXWORKS_FALSE@libatomic_la_SOURCES = gload.c gstore.c gcas.c \
|
||||
@PARTIAL_VXWORKS_FALSE@ gexch.c glfree.c lock.c init.c fenv.c \
|
||||
|
|
@ -474,6 +474,15 @@ libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \
|
|||
@ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@@PARTIAL_VXWORKS_FALSE@IFUNC_OPTIONS = -mcx16 -mcx16
|
||||
libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES)
|
||||
libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
|
||||
|
||||
# Copy built libatomic library to $build/gcc so it's easier to locate,
|
||||
# similar to libgcc.
|
||||
#
|
||||
# FIXME: libtool --mode=install also ends up copying libatomic.la in $gcc_objdir,
|
||||
# which (somehow) ends up adding $gcc_objdir to RPATH for libraries that get
|
||||
# built after libatomic, which makes RPATH insecure. Removing libatomic.la
|
||||
# from $gcc_objdir seems to fix the issue.
|
||||
gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
MULTIDIRS =
|
||||
|
|
@ -917,6 +926,9 @@ vpath % $(strip $(search_path))
|
|||
# makefile fragments to avoid broken *.Ppo getting included into the Makefile
|
||||
# when it is reloaded during the build of all-multi.
|
||||
all-multi: $(libatomic_la_LIBADD)
|
||||
all-local: libatomic.la
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la $(gcc_objdir)$(MULTISUBDIR)/
|
||||
rm $(gcc_objdir)$(MULTISUBDIR)/libatomic.la
|
||||
|
||||
# target overrides
|
||||
-include $(tmake_file)
|
||||
|
|
|
|||
|
|
@ -3418,6 +3418,26 @@ esac
|
|||
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
||||
# As a side effect, we have to subst CFLAGS ourselves.
|
||||
|
||||
# AC_PROG_CC sets CFLAGS to "-g -O2" by default (if unset), and
|
||||
# then compile conftests with default CFLAGS, leaving no place to temporarily
|
||||
# modify CFLAGS and restore them later. However we need to pass
|
||||
# -fno-link-libatomic in CFLAGS so conftests compiled in AC_PROG_CC don't fail.
|
||||
# Assert that CFLAGS is always set by user so the default setting of CFLAGS by
|
||||
# AC_PROG_CC won't be applicable anyway.
|
||||
if test -z "${CFLAGS}"; then
|
||||
as_fn_error $? "CFLAGS must be set." "$LINENO" 5
|
||||
fi
|
||||
|
||||
# In order to override CFLAGS_FOR_TARGET, all of our special flags go
|
||||
# in XCFLAGS. But we need them in CFLAGS during configury. So put them
|
||||
# in both places for now and restore CFLAGS at the end of config.
|
||||
__libatomic_save_CFLAGS__="$CFLAGS"
|
||||
|
||||
# Append -fno-link-libatomic to avoid automatically linking libatomic,
|
||||
# while building libatomic itself.
|
||||
XCFLAGS="$XCFLAGS -fno-link-libatomic"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ $XCFLAGS"
|
||||
|
||||
|
||||
|
||||
ac_ext=c
|
||||
|
|
@ -4596,11 +4616,6 @@ fi
|
|||
|
||||
|
||||
|
||||
# In order to override CFLAGS_FOR_TARGET, all of our special flags go
|
||||
# in XCFLAGS. But we need them in CFLAGS during configury. So put them
|
||||
# in both places for now and restore CFLAGS at the end of config.
|
||||
save_CFLAGS="$CFLAGS"
|
||||
|
||||
# Find other programs we need.
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
|
||||
|
|
@ -11833,7 +11848,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11836 "configure"
|
||||
#line 11851 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
|
@ -11939,7 +11954,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11942 "configure"
|
||||
#line 11957 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
|
@ -12333,7 +12348,7 @@ _ACEOF
|
|||
|
||||
# Disable fallbacks to __sync routines from libgcc. Otherwise we'll
|
||||
# make silly decisions about what the cpu can do.
|
||||
CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ -fno-sync-libcalls $XCFLAGS"
|
||||
|
||||
# Check header files.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
|
||||
|
|
@ -15354,7 +15369,7 @@ _ACEOF
|
|||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
XPCFLAGS=" -pthread"
|
||||
else
|
||||
CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ $XCFLAGS" LIBS="-lpthread $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <pthread.h>
|
||||
|
|
@ -15377,7 +15392,7 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$save_CFLAGS $XPCFLAGS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ $XPCFLAGS $XCFLAGS"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -15952,7 +15967,7 @@ $as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
|
|||
|
||||
|
||||
# Cleanup and exit.
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__"
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
|
|
|
|||
|
|
@ -129,6 +129,26 @@ AC_SUBST(toolexeclibdir)
|
|||
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
||||
# As a side effect, we have to subst CFLAGS ourselves.
|
||||
|
||||
# AC_PROG_CC sets CFLAGS to "-g -O2" by default (if unset), and
|
||||
# then compile conftests with default CFLAGS, leaving no place to temporarily
|
||||
# modify CFLAGS and restore them later. However we need to pass
|
||||
# -fno-link-libatomic in CFLAGS so conftests compiled in AC_PROG_CC don't fail.
|
||||
# Assert that CFLAGS is always set by user so the default setting of CFLAGS by
|
||||
# AC_PROG_CC won't be applicable anyway.
|
||||
if test -z "${CFLAGS}"; then
|
||||
AC_MSG_ERROR([CFLAGS must be set.])
|
||||
fi
|
||||
|
||||
# In order to override CFLAGS_FOR_TARGET, all of our special flags go
|
||||
# in XCFLAGS. But we need them in CFLAGS during configury. So put them
|
||||
# in both places for now and restore CFLAGS at the end of config.
|
||||
__libatomic_save_CFLAGS__="$CFLAGS"
|
||||
|
||||
# Append -fno-link-libatomic to avoid automatically linking libatomic,
|
||||
# while building libatomic itself.
|
||||
XCFLAGS="$XCFLAGS -fno-link-libatomic"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ $XCFLAGS"
|
||||
|
||||
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
|
||||
m4_define([_AC_ARG_VAR_PRECIOUS],[])
|
||||
AC_PROG_CC
|
||||
|
|
@ -137,11 +157,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
|||
|
||||
AC_SUBST(CFLAGS)
|
||||
|
||||
# In order to override CFLAGS_FOR_TARGET, all of our special flags go
|
||||
# in XCFLAGS. But we need them in CFLAGS during configury. So put them
|
||||
# in both places for now and restore CFLAGS at the end of config.
|
||||
save_CFLAGS="$CFLAGS"
|
||||
|
||||
# Find other programs we need.
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_TOOL(NM, nm)
|
||||
|
|
@ -189,7 +204,7 @@ AC_DEFINE_UNQUOTED(IFUNC_RESOLVER_ARGS, $IFUNC_RESOLVER_ARGS,
|
|||
|
||||
# Disable fallbacks to __sync routines from libgcc. Otherwise we'll
|
||||
# make silly decisions about what the cpu can do.
|
||||
CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ -fno-sync-libcalls $XCFLAGS"
|
||||
|
||||
# Check header files.
|
||||
AC_STDC_HEADERS
|
||||
|
|
@ -230,7 +245,7 @@ case " $config_path " in
|
|||
void *g(void *d) { return NULL; }],
|
||||
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
|
||||
[XPCFLAGS=" -pthread"],
|
||||
[CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS"
|
||||
[CFLAGS="$__libatomic_save_CFLAGS__ $XCFLAGS" LIBS="-lpthread $LIBS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <pthread.h>
|
||||
|
|
@ -238,7 +253,7 @@ case " $config_path " in
|
|||
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
|
||||
[],
|
||||
[AC_MSG_ERROR([Pthreads are required to build libatomic])])])
|
||||
CFLAGS="$save_CFLAGS $XPCFLAGS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__ $XPCFLAGS $XCFLAGS"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -254,7 +269,7 @@ fi
|
|||
LIBAT_ENABLE_SYMVERS
|
||||
|
||||
# Cleanup and exit.
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CFLAGS="$__libatomic_save_CFLAGS__"
|
||||
AC_CACHE_SAVE
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
|
|
|
|||
Loading…
Reference in New Issue