pawel k. via llvm-dev
2021-May-01 02:06 UTC
[llvm-dev] libunwind, -static and -lpthread on ARM
Hello, I may be wrong here but i was getting something like this in old vers of clang. Id assume, pthread.a namely unwind.c is using api for unwinding thats incompatible with one provided by clang libs. Prolly assumed gcc model or windows api. Id check source of unwind.c and lookup+use or if absent implement exception api version thats compatible with clang. We will need to ask somebody else which clang lib provides this api. Documentation to clang might have some hints too. Best regards, Pawel sob., 1.05.2021, 03:47 użytkownik Andrei Datcu via llvm-dev < llvm-dev at lists.llvm.org> napisał:> 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 > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210501/234913d9/attachment.html>
Fangrui Song via llvm-dev
2021-May-01 02:23 UTC
[llvm-dev] libunwind, -static and -lpthread on ARM
On 2021-05-01, pawel k. via llvm-dev wrote:>Hello, >I may be wrong here but i was getting something like this in old vers of >clang. > >Id assume, pthread.a namely unwind.c is using api for unwinding thats >incompatible with one provided by clang libs. Prolly assumed gcc model or >windows api. Id check source of unwind.c and lookup+use or if absent >implement exception api version thats compatible with clang. We will need >to ask somebody else which clang lib provides this api. Documentation to >clang might have some hints too. > >Best regards, >Pawel > >sob., 1.05.2021, 03:47 użytkownik Andrei Datcu via llvm-dev < >llvm-dev at lists.llvm.org> napisał: > >> 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.cppYou can use --unwindlib=libunwind. -lc++abi -lunwind are technically not in the right place. It is ok for ld.lld, though.>> 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?Pending patch adding _Unwind_ForcedUnwind for ARM EHABI https://reviews.llvm.org/D89570>> 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 >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>_______________________________________________ >LLVM Developers mailing list >llvm-dev at lists.llvm.org >https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Andrei Datcu via llvm-dev
2021-May-01 11:55 UTC
[llvm-dev] libunwind, -static and -lpthread on ARM
> > > Pending patch adding _Unwind_ForcedUnwind for ARM EHABI > https://reviews.llvm.org/D89570So until this gets merged, the only remaining option is to use libgcc, correct? Thanks, Andrei -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210501/49352599/attachment.html>