Page MenuHomeFreeBSD

libllvmminimal: Add missing Support/ABIBreak.cpp
ClosedPublic

Authored by jrtc27 on Jan 26 2021, 11:19 PM.
Tags
None
Referenced Files
F80117460: D28367.id83001.diff
Thu, Mar 28, 4:55 AM
Unknown Object (File)
Fri, Mar 22, 6:05 PM
Unknown Object (File)
Dec 20 2023, 5:09 PM
Unknown Object (File)
Dec 20 2023, 4:48 AM
Unknown Object (File)
Nov 10 2023, 5:09 AM
Unknown Object (File)
Oct 15 2023, 1:25 AM
Unknown Object (File)
Oct 13 2023, 4:04 PM
Unknown Object (File)
Aug 16 2023, 8:50 AM

Details

Summary

When building natively on RISC-V, linking the bootstrap clang-tblgen
fails with:

ld: error: undefined symbol: llvm::EnableABIBreakingChecks
>>> referenced by PrettyStackTrace.cpp
>>>               PrettyStackTrace.o:(.sdata+0x0) in archive
/usr/obj/usr/src/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvmminimal/libllvmminimal.a
>>> referenced by Signals.cpp
>>>               Signals.o:(.sdata+0x8) in archive
/usr/obj/usr/src/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvmminimal/libllvmminimal.a
>>> referenced by Timer.cpp
>>>               Timer.o:(.sdata+0x28) in archive
/usr/obj/usr/src/freebsd-src/riscv.riscv64/tmp/obj-tools/lib/clang/libllvmminimal/libllvmminimal.a

This is likely due to Error.h's inclusion of abi-breaking.h. It's
unclear why this only affects RISC-V, but perhaps relates to its more
eager use of .sdata due to the ABI's support for linker relaxations.
Regardless, this is theoretically an issue for all architectures.

Reported by: Dennis Clarke <dclarke@blastwave.org>

Test Plan

Have pinged Dennis to see if he can verify that buildworld now succeeds (or at
least gets further).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Sure, this is fine. Please mark it for MFC too.

This revision is now accepted and ready to land.Jan 27 2021, 10:02 AM

This change does allow me to get paste this little hiccup and then we run into a problem with -Wl,--gc-sections in lib/clang/llvm.build.mk so the trivial hack is to comment out that line and continue. Which seems to work thus far however I suspect this buildworld will run for days.

ijiraq# 
ijiraq# uname -apKU
FreeBSD ijiraq 13.0-ALPHA1 FreeBSD 13.0-ALPHA1 #0 main-c256037-gf3ea417f96b0: Sun Jan 17 21:27:09 GMT 2021     root@ijiraq:/usr/obj/usr/src/freebsd-src/riscv.riscv64/sys/GENERIC  riscv riscv64 1300136 1300133
ijiraq# diff -u llvm.build.mk.orig /usr/src/freebsd-src/lib/clang/llvm.build.mk
--- llvm.build.mk.orig  2021-01-27 22:39:50.714882000 +0000
+++ /usr/src/freebsd-src/lib/clang/llvm.build.mk        2021-01-29 21:50:32.329284000 +0000
@@ -100,7 +100,7 @@
 
 CFLAGS+=       -ffunction-sections
 CFLAGS+=       -fdata-sections
-LDFLAGS+=      -Wl,--gc-sections
+# LDFLAGS+=    -Wl,--gc-sections
 
 CXXSTD?=       c++14
 CXXFLAGS+=     -fno-exceptions
ijiraq#

Happy to report that native buildworld did eventually complete just fine.

ijiraq# uname -apKU 
FreeBSD ijiraq 13.0-ALPHA1 FreeBSD 13.0-ALPHA1 #0 main-c256037-gf3ea417f96b0: Sun Jan 17 21:27:09 GMT 2021     root@ijiraq:/usr/obj/usr/src/freebsd-src/riscv.riscv64/sys/GENERIC  riscv riscv64 1300136 1400002
ijiraq#

Currently re-running buildworld to confirm.