From 1062db30700230a26fdc90088a4e2bdb6b6e4d6d Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 17 May 2024 21:22:22 +0100 Subject: [PATCH] libcxxrt: allow build with gcc13 and --no-undefined-version GCC 13 supports _Float16 and __int128 on fewer architectures than clang and thus libcxxrt compiled with gcc13 is sometimes missing related symbols. Hack around this by explicitly appending --undefined-version to LDFLAGS in problematic cases. Reviewed by: theraven, dim Differential Revision: https://reviews.freebsd.org/D45233 --- lib/libcxxrt/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/libcxxrt/Makefile b/lib/libcxxrt/Makefile index 6ad89e9da10..7a683ba779f 100644 --- a/lib/libcxxrt/Makefile +++ b/lib/libcxxrt/Makefile @@ -42,3 +42,13 @@ Version-64.map: Version.map .endif .include + +# gcc13 doesn't support _Float16 on riscv, powerpc64, and x86 or __int128 +# on i386. Disable checks for missing symbols to allow this to link. +# +# XXX: This is a hack that hides an ABI divergence between clang and gcc. +.if ${COMPILER_TYPE} == "gcc" && \ + (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \ + ${MACHINE_ARCH:Mpowerpc64*} || ${MACHINE_ARCH} == "riscv64") +LDFLAGS+= -Wl,--undefined-version +.endif