[Bug 292567] lang/gcc13: (and later) trivial C program fails to link using "-static-libgcc" but only on freeBSD 15 and later
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 18 Jan 2026 16:11:53 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292567
Bug ID: 292567
Summary: lang/gcc13: (and later) trivial C program fails to
link using "-static-libgcc" but only on freeBSD 15 and
later
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Individual Port(s)
Assignee: salvadore@freebsd.org
Reporter: marklmi26-fbsd@yahoo.com
Flags: maintainer-feedback?(salvadore@freebsd.org)
Assignee: salvadore@freebsd.org
This submittal is essentially a copy of information
related to:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278649#c5
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278649#c8
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278649#c11
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278649#c13
because building gcc13 or later no longer seems to involve
an example of such a link (at least for poudriere(-devel)
based builds) --but the same error message reproduces
independently.
The issue is tied to the likes of:
# gcc15 -static-libgcc main.c
producing messages like:
/usr/local/bin/ld: a.out: hidden symbol `__aeabi_unwind_cpp_pr0' in
/usr/local/lib/gcc15/gcc/armv7-portbld-freebsd16.0/15.2.0/libgcc_eh.a(unwind-arm.o)
Of note is the _cpp_ in the name being involved for
what is a C compile/link, no explicit C++ context
involved.
This did not happen on FreeBSD 14 and before when tested,
only on FreeBSD 15 and later.
Note: I'm not trying to assign blame or indicate if
lang/gcc* vs. FreeBSD 15+ vs. both need changes for
things to work right. I've no specific evidence about
why a _cpp_ symbol ends up referenced for a C
compile/link: too little context is known to me.
Quoting:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278649#c5
A trivial armv7 example based on pkgbase:
# ls -lodTt /var/cache/pkg/*.snap*.pkg | grep -v "^l" | sed -E
's@^[^/]*(/.*/pkg/([^-]*-)(.*)(\.snap[^~]*)~[^.]*\.pkg)$@\2\4@' |
sort -r | uniq | head -1
FreeBSD-.snap20240626211138
# uname -apKU
FreeBSD OPiP2E-RPi2v1p1 15.0-CURRENT FreeBSD 15.0-CURRENT
main-n270963-609cdb12b962 GENERIC arm armv7 1500019 1500019
and packages from pkg update.
# more main.c
int main() {}
# gcc13 -static-libgcc main.c
/usr/local/bin/ld: warning: libunwind.o: missing .note.GNU-stack section
implies executable stack
/usr/local/bin/ld: NOTE: This behaviour is deprecated and will be removed in a
future version of the linker
/usr/local/bin/ld: a.out: hidden symbol `__aeabi_unwind_cpp_pr0' in
/usr/local/lib/gcc13/gcc/armv7-portbld-freebsd15.0/13.2.0/libgcc_eh.a(unwind-arm.o)
is referenced by DSO
/usr/local/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
# gcc13 -v
Using built-in specs.
COLLECT_GCC=gcc13
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc13/gcc/armv7-portbld-freebsd15.0/13.2.0/lto-wrapper
Target: armv7-portbld-freebsd15.0
Configured with: /wrkdirs/usr/ports/lang/gcc13/work/gcc-13.2.0/configure
--disable-multilib --disable-bootstrap --disable-nls
--enable-gnu-indirect-function --enable-host-shared --enable-plugin
--libdir=/usr/local/lib/gcc13 --libexecdir=/usr/local/libexec/gcc13
--program-suffix=13 --with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc13/include/c++/
--with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-ld=/usr/local/bin/ld
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --without-zstd
--enable-languages=c,c++,objc,fortran,jit --prefix=/usr/local
--localstatedir=/var --mandir=/usr/local/share/man
--infodir=/usr/local/share/info/gcc13 --build=armv7-portbld-freebsd15.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (FreeBSD Ports Collection)
--
You are receiving this mail because:
You are the assignee for the bug.