[llvm-dev] libunwind, -static and -lpthread on ARM

Andrei Datcu via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 30 18:38:32 PDT 2021


Hello,

I'm trying to cross compile an executable that's using pthread. Target is
armv7-linux-gnueabihf. I'm using the latest raspberry pi os as sysroot.
I've managed to successfully build llvm, clang + all the runtimes and I'm
trying to build a statically linked executable that's using as less GNU
stuff as possible.

clang++ -sysroot=...  -stdlib=libc++ --rtlib=compiler-rt -static
-resource-dir ... -fuse-ld=lld -lc++abi -lunwind test.cpp

The linker error I'm getting is:

ld.lld: error: undefined symbol: _Unwind_ForcedUnwind
>>> referenced by unwind.c:121
>>>               unwind.o:(__pthread_unwind) in archive
path-to-sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a

Peeking at libunwind's internals, it seems clear there's no
_Unwind_ForcedUnwind built for ARM (at least not with default options).
What options do I have?

1) Should I add some options when building libunwind so I get
_Unwind_ForcedUnwind? I'm not sure this is even possible
2) Use libgcc?

Thanks,
Andrei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210501/e343375b/attachment.html>


More information about the llvm-dev mailing list