aboutsummaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac426
1 files changed, 242 insertions, 184 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 8ef11e3..c652257 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -358,7 +358,7 @@ if test x"${DEFAULT_LINKER+set}" = x"set"; then
AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
gnu_ld_flag=yes
- elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep ld64- > /dev/null; then
+ elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep 'PROJECT:ld\(64\)*-' > /dev/null; then
ld64_flag=yes
fi
AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
@@ -563,35 +563,6 @@ if test $ac_cv_std_swap_in_utility = yes; then
[Define if <utility> defines std::swap.])
fi
-# Check whether compiler is affected by placement new aliasing bug (PR 29286).
-# If the host compiler is affected by the bug, and we build with optimization
-# enabled (which happens e.g. when cross-compiling), the pool allocator may
-# get miscompiled. Use -fno-strict-aliasing to work around this problem.
-# Since there is no reliable feature check for the presence of this bug,
-# we simply use a GCC version number check. (This should never trigger for
-# stages 2 or 3 of a native bootstrap.)
-aliasing_flags=
-if test "$GCC" = yes; then
- saved_CXXFLAGS="$CXXFLAGS"
-
- # The following test compilation will succeed if and only if $CXX accepts
- # -fno-strict-aliasing *and* is older than GCC 4.3.
- CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
- AC_MSG_CHECKING([whether $CXX is affected by placement new aliasing bug])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#error compiler not affected by placement new aliasing bug
-#endif
-])],
- [AC_MSG_RESULT([yes]); aliasing_flags='-fno-strict-aliasing'],
- [AC_MSG_RESULT([no])])
-
- CXXFLAGS="$saved_CXXFLAGS"
-fi
-AC_SUBST(aliasing_flags)
-
-
-
# ---------------------
# Warnings and checking
# ---------------------
@@ -1366,7 +1337,7 @@ AC_HEADER_TIOCGWINSZ
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
fcntl.h ftw.h unistd.h sys/auxv.h sys/file.h sys/time.h sys/mman.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \
- direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
+ direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libgen.h)
# Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@@ -1397,7 +1368,7 @@ AC_CHECK_HEADERS(ext/hash_map)
ZW_CREATE_DEPDIR
AC_CONFIG_COMMANDS([gccdepdir],[
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
- for lang in $subdirs c-family common analyzer text-art rtl-ssa sym-exec
+ for lang in $subdirs c-family common analyzer custom-sarif-properties diagnostics text-art rtl-ssa sym-exec
do
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
@@ -1531,6 +1502,8 @@ if test "x$ZSTD_LIB" != x \
ZSTD_LDFLAGS=-L$ZSTD_LIB
fi
+saved_CXXFLAGS="$CXXFLAGS"
+saved_LDFLAGS="$LDFLAGS"
CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
@@ -1562,6 +1535,9 @@ elif test "x$with_zstd" != x; then
fi
fi
+CXXFLAGS="$saved_CXXFLAGS"
+LDFLAGS="$saved_LDFLAGS"
+
dnl Disabled until we have a complete test for buggy enum bitfields.
dnl gcc_AC_C_ENUM_BF_UNSIGNED
@@ -1574,7 +1550,7 @@ AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat getauxval \
- clock_gettime munmap msync get_current_dir_name)
+ clock_gettime munmap msync get_current_dir_name memrchr)
# At least for glibc, clock_gettime is in librt. But don't pull that
# in if it still doesn't give us the function we want.
@@ -1645,9 +1621,17 @@ CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
# normal autoconf function for these. But force definition of
# HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre
# basename handling in libiberty.h.
-AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[
+# Match the configure test in libiberty so that we have a consistent result.
+AC_CHECK_DECLS([basename(char*)], , ,[
#undef HAVE_DECL_BASENAME
#define HAVE_DECL_BASENAME 1
+#if HAVE_LIBGEN_H
+# include <libgen.h>
+#endif
+#include "ansidecl.h"
+#include "system.h"])
+
+AC_CHECK_DECLS([strstr(const char*,const char*)], , ,[
#include "ansidecl.h"
#include "system.h"])
@@ -1773,6 +1757,21 @@ if test $ac_cv_have_decl_O_NONBLOCK = yes; then
[Define if O_NONBLOCK supported by fcntl.])
fi
+# Check if personality and ADDR_NO_RANDOMIZE are declared
+# in sys/personality.h
+AC_CACHE_CHECK(for personality ADDR_NO_RANDOMIZE,
+ ac_cv_personality_addr_no_randomize, [
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/personality.h>]], [[
+personality (personality (0xffffffffU) | ADDR_NO_RANDOMIZE);]])],
+[ac_cv_personality_addr_no_randomize=yes],
+[ac_cv_personality_addr_no_randomize=no])])
+if test $ac_cv_personality_addr_no_randomize = yes; then
+ AC_DEFINE(HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE, 1,
+ [Define if personality and ADDR_NO_RANDOMIZE are declared in
+sys/personality.h.])
+fi
+
# C++ Modules would like some networking features to provide the mapping
# server. You can still use modules without them though.
@@ -2449,6 +2448,17 @@ for f in $tm_rust_file; do
esac
done
+tm_jit_file_list=
+tm_jit_include_list=
+for f in $tm_jit_file; do
+ case $f in
+ * )
+ tm_jit_file_list="${tm_jit_file_list} \$(srcdir)/config/$f"
+ tm_jit_include_list="${tm_jit_include_list} config/$f"
+ ;;
+ esac
+done
+
xm_file_list=
xm_include_list=
for f in $xm_file; do
@@ -2792,6 +2802,16 @@ if test x$gcc_cv_ld != x; then
fi
AC_MSG_RESULT($ld_is_mold)
+# Check to see if we are using Wild instead of ld
+AC_MSG_CHECKING(whether we are using wild)
+ld_is_wild=no
+if test x$gcc_cv_ld != x; then
+ if $gcc_cv_ld --version 2>/dev/null | sed 1q \
+ | grep "Wild" > /dev/null; then
+ ld_is_wild=yes
+ fi
+fi
+AC_MSG_RESULT($ld_is_wild)
AC_MSG_CHECKING(gold linker with split stack support as non default)
# Check to see if default ld is not gold, but gold is
@@ -3026,7 +3046,7 @@ gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,,
.subsection -1
conftest_label2: .word 0
.previous],
- [if test x$gcc_cv_nm != x; then
+ [if test x"$gcc_cv_nm" != x; then
$gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
$gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
@@ -3118,9 +3138,9 @@ bar:
ret
.size bar, .-bar
EOF
- if test x$gcc_cv_as != x \
- && test x$gcc_cv_ld != x \
- && test x$gcc_cv_readelf != x \
+ if test x"$gcc_cv_as" != x \
+ && test x"$gcc_cv_ld" != x \
+ && test x"$gcc_cv_readelf" != x \
&& $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
&& $gcc_cv_readelf --relocs --wide conftest \
@@ -3161,6 +3181,19 @@ if test $in_tree_ld != yes ; then
ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+ case "${target}" in
+ *-*-solaris2*)
+ if test "$ld_vers_major" -gt 2; then
+ :
+ elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 30; then
+ :
+ else
+changequote([,])dnl
+ AC_MSG_ERROR([GNU ld 2.30 or later is required on Solaris (found GNU ld $ld_ver)])
+changequote(,)dnl
+ fi
+ ;;
+ esac
else
case "${target}" in
*-*-solaris2*)
@@ -3201,6 +3234,8 @@ else
:
elif test x"$ld_is_mold" = xyes; then
:
+ elif test x"$ld_is_wild" = xyes; then
+ :
elif echo "$ld_ver" | grep GNU > /dev/null; then
if test 0"$ld_date" -lt 20020404; then
if test -n "$ld_date"; then
@@ -3259,7 +3294,7 @@ if test $in_tree_ld = yes ; then
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_ro_rw_mix=read-write
fi
-elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
+elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x -a x"$gcc_cv_objdump" != x ; then
echo '.section myfoosect, "a"' > conftest1.s
echo '.section myfoosect, "aw"' > conftest2.s
echo '.byte 1' >> conftest2.s
@@ -3268,8 +3303,11 @@ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
&& $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
&& $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1; then
+ # Note the Wild linker has --gc-sections on by default.
if $gcc_cv_ld -shared -o conftest1.so conftest1.o \
- conftest2.o conftest3.o > /dev/null 2>&1 \
+ conftest2.o conftest3.o --no-gc-sections > /dev/null 2>&1 \
+ || $gcc_cv_ld -shared -o conftest1.so conftest1.o \
+ conftest2.o conftest3.o > /dev/null 2>&1 \
|| $gcc_cv_ld -r -o conftest1.so conftest1.o \
conftest2.o conftest3.o > /dev/null 2>&1; then
gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
@@ -3313,8 +3351,8 @@ case $target in
esac
# Check if we have .[us]leb128, and support symbol arithmetic with it.
-# Older versions of GAS and some non-GNU assemblers, have a bugs handling
-# these directives, even when they appear to accept them.
+# Older versions of GAS and some non-GNU assemblers have bugs in handling
+# of these directives, even when they appear to accept them.
gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
[$check_leb128_asflags],
[ .data
@@ -3336,6 +3374,11 @@ elif test "x$gcc_cv_otool" != x; then
| grep '04 80 0a 8e 78 80 80 80 80 80 80 80 80 80 01' >/dev/null; then
gcc_cv_as_leb128=yes
fi
+elif test "x$gcc_cv_readelf" != x; then
+ if $gcc_cv_readelf -x .data conftest.o 2>/dev/null \
+ | grep '04800a8e 78808080 80808080 808001' >/dev/null; then
+ gcc_cv_as_leb128=yes
+ fi
else
# play safe, assume the assembler is broken.
:
@@ -3404,6 +3447,12 @@ gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,,
esac
fi
;;
+ x86_64-*-darwin* | i?86-*-darwin* | powerpc*-darwin-*)
+ # Darwin has assemblers that support .cfi_ instructions, but that then
+ # triggers emission of compact unwind which has incompatibilities with
+ # current GCC output.
+ gcc_cv_as_cfi_directive=no
+ ;;
*-*-*)
gcc_cv_as_cfi_directive=yes
;;
@@ -3571,9 +3620,9 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
# Test if the assembler supports the section flag 'R' for specifying
# section with SHF_GNU_RETAIN.
case "${target}" in
- # Solaris may use GNU assembler with Solairs ld. Even if GNU
+ # Solaris may use GNU assembler with Solaris ld. Even if GNU
# assembler supports the section flag 'R', it doesn't mean that
- # Solairs ld supports it.
+ # Solaris ld supports it.
*-*-solaris2*)
gcc_cv_as_shf_gnu_retain=no
;;
@@ -3591,9 +3640,9 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_GNU_RETAIN,
# Test if the assembler supports the section flag 'o' for specifying
# section with link-order.
case "${target}" in
- # Solaris may use GNU assembler with Solairs ld. Even if GNU
+ # Solaris may use GNU assembler with Solaris ld. Even if GNU
# assembler supports the section flag 'o', it doesn't mean that
- # Solairs ld supports it.
+ # Solaris ld supports it.
*-*-solaris2*)
gcc_cv_as_section_link_order=no
;;
@@ -3674,6 +3723,8 @@ if test x"$ld_is_gold" = xyes; then
comdat_group=yes
elif test x"$ld_is_mold" = xyes; then
comdat_group=yes
+elif test x"$ld_is_wild" = xyes; then
+ comdat_group=yes
elif test $in_tree_ld = yes ; then
comdat_group=no
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
@@ -3695,21 +3746,8 @@ elif echo "$ld_ver" | grep GNU > /dev/null; then
else
changequote(,)dnl
case "${target}" in
- *-*-solaris2.1[1-9]*)
- comdat_group=no
- # Sun ld has COMDAT group support since Solaris 9, but it doesn't
- # interoperate with GNU as until Solaris 11 build 130, i.e. ld
- # version 1.688.
- #
- # If using Sun as for COMDAT group as emitted by GCC, one needs at
- # least ld version 1.2267.
- if test "$ld_vers_major" -gt 1; then
- comdat_group=yes
- elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
- comdat_group=yes
- elif test "$ld_vers_minor" -ge 2267; then
- comdat_group=yes
- fi
+ *-*-solaris2*)
+ comdat_group=yes
;;
*)
# Assume linkers other than GNU ld don't support COMDAT group.
@@ -4184,6 +4222,35 @@ else
[$tls_as_opt], [$conftest_s],,
[set_have_as_tls=yes])
fi
+case $target_os in
+ win32 | pe | cygwin* | mingw32*)
+ if test $set_have_as_tls = yes; then
+ # Hack to check whether ld breaks on @secrel32 for Windows
+ if test $in_tree_ld = yes; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 44 -o "$gcc_cv_gld_major_version" -gt 2; then
+ : # ld support for @secrel32 was fixed in this version
+ else
+ AC_MSG_ERROR([ld version is known to have broken secrel32 relocations, configure without --enable-tls or with --disable-tls to remove this error. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881 for more information.])
+ fi
+ elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x -a x"$gcc_cv_objdump" != x; then
+ echo '.text' > conftest.s
+ echo 'foo: nop' >> conftest.s
+ echo '.data' >> conftest.s
+ echo '.secrel32 foo' >> conftest.s
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 && $gcc_cv_ld -o conftest.exe conftest.o > /dev/null; then
+ if $gcc_cv_objdump -h conftest.exe | grep '\.reloc\>' > /dev/null; then
+ AC_MSG_ERROR([ld has broken secrel32 relocations, configure without --enable-tls or with --disable-tls to remove this error. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881 for more information.])
+ fi
+ else
+ AC_MSG_ERROR([Error occurred while checking for broken secrel32 relocations. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881 for more information.])
+ fi
+ rm -f conftest.s conftest.o conftest.exe
+ else
+ AC_MSG_ERROR([Cannot check for broken secrel32 relocations to determine --enable-tls support. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881 for more information.])
+ fi
+ fi
+ ;;
+esac
if test $set_have_as_tls = yes ; then
AC_DEFINE(HAVE_AS_TLS, 1,
[Define if your assembler and linker support thread-local storage.])
@@ -4415,6 +4482,15 @@ case "$target" in
ldr x0, [[x2, #:gotpage_lo15:globalsym]]
],,[AC_DEFINE(HAVE_AS_SMALL_PIC_RELOCS, 1,
[Define if your assembler supports relocs needed by -fpic.])])
+ # Check if we have binutils support for AEABI build attributes.
+ gcc_GAS_CHECK_FEATURE([support of AEABI build attributes], gcc_cv_as_aarch64_aeabi_build_attributes,,
+ [
+ .aeabi_subsection aeabi_feature_and_bits, optional, ULEB128
+ .aeabi_attribute Tag_Feature_BTI, 1
+ .aeabi_attribute Tag_Feature_PAC, 1
+ .aeabi_attribute Tag_Feature_GCS, 1
+ ],,[AC_DEFINE(HAVE_AS_AEABI_BUILD_ATTRIBUTES, 1,
+ [Define if your assembler supports AEABI build attributes.])])
# Enable Branch Target Identification Mechanism and Return Address
# Signing by default.
AC_ARG_ENABLE(standard-branch-protection,
@@ -4948,12 +5024,11 @@ foo: nop
if test x$gas = xyes; then
as_ix86_gas_32_opt="--32"
fi
- if echo "$ld_ver" | grep GNU > /dev/null; then
- if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
- ld_ix86_gld_32_opt="-melf_i386_sol2"
- else
- ld_ix86_gld_32_opt="-melf_i386"
- fi
+ if test x$gnu_ld = xyes; then
+ case $target in
+ *-*-solaris2*) ld_ix86_gld_32_opt="-melf_i386_sol2" ;;
+ *) ld_ix86_gld_32_opt="-melf_i386" ;;
+ esac
fi
gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
@@ -5046,12 +5121,11 @@ _start:
# Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15"
# with R_X86_64_CODE_6_GOTTPOFF relocation.
- if echo "$ld_ver" | grep GNU > /dev/null; then
- if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then
- ld_ix86_gld_64_opt="-melf_x86_64_sol2"
- else
- ld_ix86_gld_64_opt="-melf_x86_64"
- fi
+ if test x$gnu_ld = xyes; then
+ case $target in
+ *-*-solaris2*) ld_ix86_gld_64_opt="-melf_x86_64_sol2" ;;
+ *) ld_ix86_gld_64_opt="-melf_x86_64" ;;
+ esac
fi
# Enforce 64-bit output with gas and gld.
if test x$gas = xyes; then
@@ -5354,7 +5428,7 @@ x:
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_as_ld_jalr_reloc=yes
fi
- elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then
+ elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x -a x"$gcc_cv_objdump" != x; then
echo ' .ent x' > conftest.s
echo 'x: lw $2,%got_disp(y)($3)' >> conftest.s
echo ' lw $25,%call16(y)($28)' >> conftest.s
@@ -5391,9 +5465,9 @@ x:
-o "$gcc_cv_gld_major_version" -gt 2; then
gcc_cv_ld_mips_personality_relaxation=yes
fi
- elif test x$gcc_cv_as != x \
- -a x$gcc_cv_ld != x \
- -a x$gcc_cv_readelf != x ; then
+ elif test x"$gcc_cv_as" != x \
+ -a x"$gcc_cv_ld" != x \
+ -a x"$gcc_cv_readelf" != x ; then
cat > conftest.s <<EOF
.cfi_startproc
.cfi_personality 0x80,indirect_ptr
@@ -5531,6 +5605,12 @@ x:
[lu12i.w $t0,%le_hi20_r(a)],,
[AC_DEFINE(HAVE_AS_TLS_LE_RELAXATION, 1,
[Define if your assembler supports tls le relocation.])])
+ gcc_GAS_CHECK_FEATURE([16-byte atomic support],
+ gcc_cv_as_loongarch_16_byte_atomic_support,,
+ [vori.b $vr0, $vr1, 0
+ sc.q $a0, $a1, $a2, 0],,
+ [AC_DEFINE(HAVE_AS_16B_ATOMIC, 1,
+ [Define if your assembler supports LSX and SCQ for 16B atomic.])])
;;
s390*-*-*)
gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
@@ -5588,7 +5668,7 @@ case "$target" in
amdgcn-* | gcn-*)
AC_MSG_CHECKING(llvm assembler version)
gcc_cv_as_version="unknown"
- if test x$gcc_cv_as != x; then
+ if test x"$gcc_cv_as" != x; then
gcc_cv_as_version=`$gcc_cv_as --version 2>&1 | sed -ne '/version/s/.* \([[0-9]]\)/\1/p' || echo error`
case "$gcc_cv_as_version" in
13.0.[[1-9]]*) ;; # 13.0.1+
@@ -6088,10 +6168,7 @@ elif test x$gcc_cv_ld != x; then
else
case "$target" in
*-*-solaris2*)
- # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
- if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
- gcc_cv_ld_eh_frame_hdr=yes
- fi
+ gcc_cv_ld_eh_frame_hdr=yes
;;
esac
fi
@@ -6106,11 +6183,7 @@ AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
AC_MSG_CHECKING(linker position independent executable support)
gcc_cv_ld_pie=no
if test $in_tree_ld = yes ; then
- case "$target" in
- # Full PIE support on Solaris was only introduced in gld 2.26.
- *-*-solaris2*) gcc_gld_pie_min_version=26 ;;
- *) gcc_gld_pie_min_version=15 ;;
- esac
+ gcc_gld_pie_min_version=15
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge "$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_pie=yes
@@ -6119,21 +6192,11 @@ elif test x$gcc_cv_ld != x; then
# Check if linker supports -pie option
if $gcc_cv_ld --help 2>&1 | grep -- -pie > /dev/null; then
gcc_cv_ld_pie=yes
- case "$target" in
- *-*-solaris2*)
- if echo "$ld_ver" | grep GNU > /dev/null \
- && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then
- gcc_cv_ld_pie=no
- fi
- ;;
- esac
else
case "$target" in
- *-*-solaris2.1[[1-9]]*)
+ *-*-solaris2*)
# Solaris 11.3 added PIE support.
- if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
- gcc_cv_ld_pie=yes
- fi
+ gcc_cv_ld_pie=yes
;;
esac
fi
@@ -6151,7 +6214,7 @@ if test $gcc_cv_ld_pie = yes ; then
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
gcc_cv_ld_pie_copyreloc=yes
fi
- elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
+ elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x ; then
# Check if linker supports -pie option with copy reloc
case "$target" in
i?86-*-linux* | x86_64-*-linux*)
@@ -6199,7 +6262,7 @@ if test $in_tree_ld = yes ; then
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_eh_gc_sections=yes
fi
-elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
+elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x -a x"$gcc_cv_objdump" != x ; then
cat > conftest.s <<EOF
.section .text
.globl _start
@@ -6280,7 +6343,7 @@ if test $in_tree_ld = yes ; then
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_eh_gc_sections_bug=yes
fi
-elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x -a x$gcc_cv_as_comdat_group = xyes; then
+elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x -a x"$gcc_cv_objdump" != x -a x$gcc_cv_as_comdat_group = xyes; then
gcc_cv_ld_eh_gc_sections_bug=yes
cat > conftest.s <<EOF
.section .text
@@ -6332,11 +6395,12 @@ changequote(,)dnl
case "${target}" in
*-*-solaris2*)
# Introduced in Solaris 11.2.
- if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then
- gcc_cv_ld_compress_debug=1
- gcc_cv_ld_compress_debug_option="-z compress-sections"
- else
- gcc_cv_ld_compress_debug=0
+ gcc_cv_ld_compress_debug=1
+ gcc_cv_ld_compress_debug_option="-z compress-sections"
+ # Detect zstd debug section compression support. Introduced in
+ # Solaris 11.4 SRU 90.
+ if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections.*\<zstd\>' > /dev/null; then
+ gcc_cv_ld_compress_debug=2
fi
;;
*)
@@ -6360,6 +6424,7 @@ if test x"$ld64_flag" = x"yes"; then
gcc_cv_ld64_platform_version=0
gcc_cv_ld64_macos_version_min=0
gcc_cv_ld64_demangle=0
+ gcc_cv_ld64_no_deduplicate=0
if test "$build" = "$host"; then
darwin_try_test=1
@@ -6387,6 +6452,9 @@ if test x"$ld64_flag" = x"yes"; then
if test "$gcc_cv_ld64_major" -ge 236; then
gcc_cv_ld64_export_dynamic=1
fi
+ if test "$gcc_cv_ld64_major" -ge 262; then
+ gcc_cv_ld64_no_deduplicate=1
+ fi
if test "$gcc_cv_ld64_major" -ge 512; then
gcc_cv_ld64_platform_version=1
gcc_cv_ld64_macos_version_min=1
@@ -6395,8 +6463,9 @@ if test x"$ld64_flag" = x"yes"; then
# If the version was not specified, try to find it.
AC_MSG_CHECKING(linker version)
if test x"${gcc_cv_ld64_version}" = x; then
- gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld' \
- | sed -e 's/.*ld64-//' -e 's/.*dyld-//'| awk '{print $1}'`
+ gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld|PROJECT:ld' \
+ | sed -e 's/.*ld64-//' -e 's/.*dyld-//' -e 's/.*PROJECT:ld-//' \
+ | awk '{print $1}'`
fi
AC_MSG_RESULT($gcc_cv_ld64_version)
@@ -6414,6 +6483,13 @@ if test x"$ld64_flag" = x"yes"; then
fi
AC_MSG_RESULT($gcc_cv_ld64_export_dynamic)
+ AC_MSG_CHECKING(linker for -no_deduplicate support)
+ gcc_cv_ld64_no_deduplicate=1
+ if $gcc_cv_ld -no_deduplicate < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
+ gcc_cv_ld64_no_deduplicate=0
+ fi
+ AC_MSG_RESULT($gcc_cv_ld64_no_deduplicate)
+
AC_MSG_CHECKING(linker for -platform_version support)
gcc_cv_ld64_platform_version=1
if $gcc_cv_ld -platform_version macos 10.5 0.0 < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
@@ -6440,6 +6516,9 @@ if test x"$ld64_flag" = x"yes"; then
AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic,
[Define to 1 if ld64 supports '-export_dynamic'.])
+ AC_DEFINE_UNQUOTED(LD64_HAS_NO_DEDUPLICATE, $gcc_cv_ld64_no_deduplicate,
+ [Define to 1 if ld64 supports '-no_deduplicate'.])
+
AC_DEFINE_UNQUOTED(LD64_HAS_PLATFORM_VERSION, $gcc_cv_ld64_platform_version,
[Define to 1 if ld64 supports '-platform_version'.])
@@ -6572,21 +6651,12 @@ elif test x$gcc_cv_ld != x; then
;;
esac
fi
-# --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
-# dl_iterate_phdr, i.e. since Solaris 11.
case "$target" in
- *-*-solaris2.1[[1-9]]*)
- case "$target" in
- i?86-*-* | x86_64-*-*)
- if echo "$ld_ver" | grep GNU > /dev/null; then
- # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
- gcc_cv_ld_as_needed=no
- fi
- ;;
- esac
- ;;
- *-*-solaris2*)
- gcc_cv_ld_as_needed=no
+ i?86-*-solaris2* | x86_64-*-solaris2*)
+ if echo "$ld_ver" | grep GNU > /dev/null; then
+ # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
+ gcc_cv_ld_as_needed=no
+ fi
;;
esac
])
@@ -6635,7 +6705,7 @@ case "$target" in
-o "$gcc_cv_gld_major_version" -gt 2; then
gcc_cv_ld_ppc_attr=yes
fi
- elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
+ elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x ; then
# check that merging the long double .gnu_attribute doesn't warn
cat > conftest1.s <<EOF
.gnu_attribute 4,1
@@ -6684,7 +6754,7 @@ case "$target:$tm_file" in
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
gcc_cv_ld_no_dot_syms=yes
fi
- elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
+ elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x ; then
cat > conftest1.s <<EOF
.text
bl .foo
@@ -6723,7 +6793,7 @@ EOF
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then
gcc_cv_ld_large_toc=yes
fi
- elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
+ elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x ; then
cat > conftest.s <<EOF
.section ".tbss","awT",@nobits
.align 3
@@ -6731,7 +6801,7 @@ ie0: .space 8
.global _start
.text
_start:
- addis 9,13,ie0@got@tprel@ha
+ addis 9,2,ie0@got@tprel@ha
ld 9,ie0@got@tprel@l(9)
EOF
if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
@@ -6748,7 +6818,7 @@ EOF
AC_CACHE_CHECK(linker toc pointer alignment,
gcc_cv_ld_toc_align,
- [if test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_nm != x; then
+ [if test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x -a x"$gcc_cv_nm" != x; then
cat > conftest.s <<EOF
.global _start
.text
@@ -6778,7 +6848,7 @@ case "$target" in
AC_CACHE_CHECK(linker large toc support,
gcc_cv_ld_large_toc,
[gcc_cv_ld_large_toc=no
- if test x$gcc_cv_as != x ; then
+ if test x"$gcc_cv_as" != x ; then
cat > conftest.s <<EOF
.toc
LC..1:
@@ -6837,29 +6907,6 @@ if test x"$enable_linker_build_id" = xyes; then
fi
fi
-# In binutils 2.21, GNU ld gained support for new emulations fully
-# supporting the Solaris 2 ABI. Detect their presence in the linker used.
-AC_CACHE_CHECK(linker *_sol2 emulation support,
- gcc_cv_ld_sol2_emulation,
- [gcc_cv_ld_sol2_emulation=no
- if test $in_tree_ld = yes ; then
- if test "$gcc_cv_gld_major_version" -eq 2 -a \
- "$gcc_cv_gld_minor_version" -ge 21 -o \
- "$gcc_cv_gld_major_version" -gt 2 \
- && test $in_tree_ld_is_elf = yes; then
- gcc_cv_ld_sol2_emulation=yes
- fi
- elif test x$gcc_cv_ld != x; then
- if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \
- grep _sol2 > /dev/null; then
- gcc_cv_ld_sol2_emulation=yes
- fi
- fi])
-if test x"$gcc_cv_ld_sol2_emulation" = xyes; then
- AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1,
- [Define if your linker supports the *_sol2 emulations.])
-fi
-
AC_CACHE_CHECK(linker --sysroot support,
gcc_cv_ld_sysroot,
[gcc_cv_ld_sysroot=no
@@ -6877,37 +6924,6 @@ if test x"$gcc_cv_ld_sysroot" = xyes; then
[Define if your linker supports --sysroot.])
fi
-case $target in
-*-*-solaris2*)
- # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
- AC_CACHE_CHECK([system-provided CRTs on Solaris],
- gcc_cv_solaris_crts,
- [gcc_cv_solaris_crts=no
- if test x$host != x$target; then
- if test "x$with_sysroot" = xyes; then
- target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
- else
- target_sysroot="${with_sysroot}"
- fi
- fi
- target_libdir="$target_sysroot/usr/lib"
- # At the time they were added, gcrt1.o became a symlink for backwards
- # compatibility on x86, while crt1.o was added on sparc, so check for that.
- case $target in
- i?86-*-solaris2* | x86_64-*-solaris2*)
- if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
- ;;
- sparc*-*-solaris2*)
- if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
- ;;
- esac])
- ;;
-esac
-if test x$gcc_cv_solaris_crts = xyes; then
- AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
- [Define if the system-provided CRTs are present on Solaris.])
-fi
-
AC_ARG_ENABLE(libssp,
[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
[case "${enableval}" in
@@ -6991,6 +7007,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], [
@@ -7538,6 +7559,8 @@ AC_SUBST(tm_d_file_list)
AC_SUBST(tm_d_include_list)
AC_SUBST(tm_rust_file_list)
AC_SUBST(tm_rust_include_list)
+AC_SUBST(tm_jit_file_list)
+AC_SUBST(tm_jit_include_list)
AC_SUBST(xm_file_list)
AC_SUBST(xm_include_list)
AC_SUBST(xm_defines)
@@ -7547,6 +7570,7 @@ AC_SUBST(cxx_target_objs)
AC_SUBST(fortran_target_objs)
AC_SUBST(d_target_objs)
AC_SUBST(rust_target_objs)
+AC_SUBST(jit_target_objs)
AC_SUBST(target_cpu_default)
AC_SUBST_FILE(language_hooks)
@@ -7741,7 +7765,6 @@ if test x$enable_default_pie = xyes ; then
AC_DEFINE(ENABLE_DEFAULT_PIE, 1,
[Define if your target supports default PIE and it is enabled.])
fi
-AC_SUBST([enable_default_pie])
# Check if -fno-PIE works.
AC_CACHE_CHECK([for -fno-PIE option],
@@ -7910,6 +7933,41 @@ standards-compatible mode on s390 targets.])
;;
esac
+# On x86-64, when profiling is enabled with shrink wrapping, the mcount
+# call may not be placed at the function entry after
+# pushq %rbp
+# movq %rsp,%rbp
+# As the result, the profile data may be skewed which makes PGO less
+# effective:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120881
+# Enable -mfentry by default on x86-64 to put the profiling counter call
+# before the prologue.
+AC_ARG_ENABLE(x86-64-mfentry,
+ [AS_HELP_STRING([--enable-x86-64-mfentry],
+ [enable -mfentry by default on x86-64 targets])],
+ [case "${enableval}" in
+ yes | no | auto)
+ enable_x86_64_mfentry=$enableval
+ ;;
+ *)
+ AC_MSG_ERROR(['$enable_x86_64_mfentry' is an invalid value for --enable-x86-64-mfentry. Valid choices are 'yes', 'no' and 'auto'.])
+ ;;
+ esac],
+ [enable_x86_64_mfentry=auto])
+
+if test x"$enable_x86_64_mfentry" = xauto; then
+ case "${target}" in
+ i?86-*-*gnu* | x86_64-*-*gnu*)
+ # Enable -mfentry by default with glibc on x86.
+ enable_x86_64_mfentry=yes
+ ;;
+ esac
+fi
+
+gif=`if test x$enable_x86_64_mfentry = xyes; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(ENABLE_X86_64_MFENTRY, $gif,
+[Define to enable -mfentry by default on x86-64.])
+
# Check if the linker supports '-z now'
ld_now_support=no
AC_MSG_CHECKING(linker -z now option)