aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog19
-rw-r--r--libgcc/Makefile.in2
-rw-r--r--libgcc/config/rs6000/t-slibgcc-aix8
-rwxr-xr-xlibgcc/configure65
-rw-r--r--libgcc/configure.ac18
5 files changed, 102 insertions, 10 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index a9f4a1f..75ba93e 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,22 @@
+2025-12-09 John Ericson <git@JohnEricson.me>
+
+ * config/rs6000/t-slibgcc-aix: Instead of using a
+ TARGET_SYSTEM_ROOT make variable, just define a shell variable
+ as part of the rule and use that.
+
+2025-12-09 John Ericson <git@JohnEricson.me>
+
+ * Makefile.in: Define NO_PIE_CFLAGS make variable via autoconf
+ substitution.
+ * configure: Regenerate.
+ * configure.ac: New configure check to define NO_PIE_CFLAGS
+ using the algorithm Andrew asked for in the linked mail.
+
+2025-12-09 John Ericson <git@johnericson.me>
+
+ * configure: Regenerate.
+ * configure.ac: Use GCC_AC_THREAD_MODEL instead of hand-rolled
+
2025-11-27 Lulu Cheng <chenglulu@loongson.cn>
* config/loongarch/cpuinfo.c (HWCAP_LOONGARCH_LSX): Define
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 32a5a15..f0cbcb8 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -298,6 +298,8 @@ override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
$(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
+NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
+
# Options to use when compiling crtbegin/end.
CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
$(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
diff --git a/libgcc/config/rs6000/t-slibgcc-aix b/libgcc/config/rs6000/t-slibgcc-aix
index 6333687..4a3d624 100644
--- a/libgcc/config/rs6000/t-slibgcc-aix
+++ b/libgcc/config/rs6000/t-slibgcc-aix
@@ -40,7 +40,9 @@ SHLIB_LINK = \
-Wl,-bE:@shlib_map_file@ -o shr.o \
@multilib_flags@ @shlib_objs@ -lc \
`case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
+ *pthread*) \
+ TARGET_SYSTEM_ROOT=\`$(CC) -print-sysroot\`; \
+ echo -L$$TARGET_SYSTEM_ROOT/usr/lib/threads -lpthreads -lc_r $$TARGET_SYSTEM_ROOT/usr/lib/libc.a ;; \
*) echo -lc ;; esac` ; \
rm -f tmp-@shlib_base_name@.a ; \
$(AR_CREATE_FOR_TARGET) tmp-@shlib_base_name@.a shr.o ; \
@@ -53,7 +55,9 @@ SHLIB_LINK = \
-Wl,-bE:@shlib_map_file@ -o $$shr.o \
@multilib_flags@ @shlib_objs@ -lc \
`case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
+ *pthread*) \
+ TARGET_SYSTEM_ROOT=\`$(CC) -print-sysroot\`; \
+ echo -L$$TARGET_SYSTEM_ROOT/usr/lib/threads -lpthreads -lc_r $$TARGET_SYSTEM_ROOT/usr/lib/libc.a ;; \
*) echo -lc ;; esac` ; \
$(STRIP_FOR_TARGET) -X32_64 -e $$shr.o ; \
{ echo "\#! $(SHLIB_SONAME)($$shr.o)" ; \
diff --git a/libgcc/configure b/libgcc/configure
index d5e80d2..fe7a21c2 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -610,6 +610,7 @@ accel_dir_suffix
use_tm_clone_registry
force_explicit_eh_registry
CET_FLAGS
+NO_PIE_CFLAGS
fixed_point
enable_decimal_float
decimal_float
@@ -4836,6 +4837,40 @@ $as_echo "$libgcc_cv_fixed_point" >&6; }
fixed_point=$libgcc_cv_fixed_point
+# Check whether the compiler defines __PIE__ by default, so -fno-PIE is needed.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler defines __PIE__" >&5
+$as_echo_n "checking whether the compiler defines __PIE__... " >&6; }
+if ${libgcc_cv_no_pie_cflags+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef __PIE__
+#error __PIE__ defined
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libgcc_cv_no_pie_cflags=''
+else
+ libgcc_cv_no_pie_cflags='-fno-PIE'
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_no_pie_cflags" >&5
+$as_echo "$libgcc_cv_no_pie_cflags" >&6; }
+
+NO_PIE_CFLAGS=$libgcc_cv_no_pie_cflags
+
+
# For platforms with the unwind ABI which includes an unwind library,
# libunwind, we can choose to use the system libunwind.
# config.gcc also contains tests of with_system_libunwind.
@@ -5046,11 +5081,28 @@ $as_echo "$acl_cv_prog_gnu_ld" >&6; }
with_gnu_ld=$acl_cv_prog_gnu_ld
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GCC" >&5
-$as_echo_n "checking for thread model used by GCC... " >&6; }
-target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5
-$as_echo "$target_thread_file" >&6; }
+
+# Specify the threading model for this GCC runtime library
+# Pass with no value to take from compiler's metadata
+# Pass with a value to specify a thread package
+# 'single' means single threaded -- without threads.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the threading model used by GCC" >&5
+$as_echo_n "checking for the threading model used by GCC... " >&6; }
+if ${gcc_cv_target_thread_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ # Set new cache variable
+ gcc_cv_target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_target_thread_file" >&5
+$as_echo "$gcc_cv_target_thread_file" >&6; }
+# Set variable name (not prefixed enough to be a good cache variable
+# name) traditionally used for this purpose, to avoid having to change
+# a bunch of configure scripts.
+target_thread_file="$gcc_cv_target_thread_file"
+
# Check for assembler CFI support.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler supports CFI directives" >&5
@@ -5737,6 +5789,9 @@ case $target_thread_file in
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
mcf) thread_header=config/i386/gthr-mcf.h ;;
+ *)
+ as_fn_error $? "No known header for threading model '$target_thread_file'." "$LINENO" 5
+ ;;
esac
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 65cd3c6..5945243 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -258,6 +258,20 @@ AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point],
fixed_point=$libgcc_cv_fixed_point
AC_SUBST(fixed_point)
+# Check whether the compiler defines __PIE__ by default, so -fno-PIE is needed.
+AC_CACHE_CHECK([whether the compiler defines __PIE__], [libgcc_cv_no_pie_cflags],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+#ifdef __PIE__
+#error __PIE__ defined
+#endif
+ ]], [[]])],
+ [libgcc_cv_no_pie_cflags=''],
+ [libgcc_cv_no_pie_cflags='-fno-PIE'])])
+
+NO_PIE_CFLAGS=$libgcc_cv_no_pie_cflags
+AC_SUBST([NO_PIE_CFLAGS])
+
# For platforms with the unwind ABI which includes an unwind library,
# libunwind, we can choose to use the system libunwind.
# config.gcc also contains tests of with_system_libunwind.
@@ -305,9 +319,7 @@ AC_SUBST([use_tm_clone_registry])
AC_LIB_PROG_LD_GNU
-AC_MSG_CHECKING([for thread model used by GCC])
-target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
-AC_MSG_RESULT([$target_thread_file])
+GCC_AC_THREAD_MODEL
# Check for assembler CFI support.
AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],