git: 222210c6a822 - main - libgcc_s: add libgcc_s_asneeded.so wrapper for gcc 16
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Sep 2026 15:10:35 UTC
The branch main has been updated by siva:
URL: https://cgit.FreeBSD.org/src/commit/?id=222210c6a82282de78aa863c550da21471630316
commit 222210c6a82282de78aa863c550da21471630316
Author: Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-09-28 15:07:56 +0000
Commit: Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-09-28 15:08:05 +0000
libgcc_s: add libgcc_s_asneeded.so wrapper for gcc 16
GCC 16[0][1] now requires a wrapper lib to handle
`--push-state --as-needed -lgcc_s --pop-state` logic[1]
for `gcc` invocations. `g++` will still unconditionally
use `-lgcc_s`.
This fixes buildworld with gcc16.
[0] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8a99fdb70493df1294b53406913e5ea1fc971c13
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123396
Reviewed by: jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59511
---
Makefile.inc1 | 7 ++++---
lib/Makefile | 1 +
lib/libgcc_s_asneeded/Makefile | 11 +++++++++++
lib/libgcc_s_asneeded/libgcc_s_asneeded.ldscript | 1 +
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/Makefile.inc1 b/Makefile.inc1
index b683e007f0dc..b457a46febfe 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -3322,13 +3322,14 @@ _startup_libs+= lib/libc_nonshared
_startup_libs+= lib/libcxxrt
_startup_libs+= lib/libsys
-_prereq_libs+= lib/libgcc_eh lib/libgcc_s
-_startup_libs+= lib/libgcc_eh lib/libgcc_s
+_prereq_libs+= lib/libgcc_eh lib/libgcc_s lib/libgcc_s_asneeded
+_startup_libs+= lib/libgcc_eh lib/libgcc_s lib/libgcc_s_asneeded
lib/libc__L: lib/libsys__L
lib/libgcc_s__L: lib/libc__L
lib/libgcc_s__L: lib/libc_nonshared__L
-lib/libcxxrt__L: lib/libgcc_s__L
+lib/libgcc_s_asneeded__L: lib/libgcc_s__L
+lib/libcxxrt__L: lib/libgcc_s_asneeded__L
lib/libcrypt__L: lib/libmd__L
_prebuild_libs= ${_kerberos5_lib_libasn1} \
diff --git a/lib/Makefile b/lib/Makefile
index 78b48382e12e..27f757eb085c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -61,6 +61,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \
libfetch \
libgcc_eh \
libgcc_s \
+ libgcc_s_asneeded \
libgeom \
libifconfig \
libipsec \
diff --git a/lib/libgcc_s_asneeded/Makefile b/lib/libgcc_s_asneeded/Makefile
new file mode 100644
index 000000000000..eb59daac50f8
--- /dev/null
+++ b/lib/libgcc_s_asneeded/Makefile
@@ -0,0 +1,11 @@
+PACKAGE= clibs
+SHLIB_NAME= libgcc_s_asneeded.so.1
+SHLIBDIR?= /lib
+
+SHLIB_LDSCRIPT= libgcc_s_asneeded.ldscript
+
+.include <bsd.opts.mk>
+
+LDFLAGS+= -nodefaultlibs
+
+.include <bsd.lib.mk>
diff --git a/lib/libgcc_s_asneeded/libgcc_s_asneeded.ldscript b/lib/libgcc_s_asneeded/libgcc_s_asneeded.ldscript
new file mode 100644
index 000000000000..3461e92fa7ca
--- /dev/null
+++ b/lib/libgcc_s_asneeded/libgcc_s_asneeded.ldscript
@@ -0,0 +1 @@
+INPUT (AS_NEEDED(-lgcc_s))