Hi
I noted from a previous post (7 months ago) that support for linux pure-cap libc++ was not yet available - is this now available? If so please can you advise how to get it?
It appears that the morello aarch64 linux pure-cap toolchain only has the MUSL CRT libraries built for aarch64 purecap, the C++ libs are aarch64 only.
Note that I downloaded the build artefact https://git.morello-project.org/morello/musl-libc/-/jobs/artifacts/morello/master/download?job=build-musl-aarch64 ... perhaps some other artefact now has the needed support?
Thanks
Pete
Hi Yury, thanks for coming back. Re. compiling yes that is easier, thanks, I had just copied the morello example Makefile scripts.
Re. the warnings, I had assumed these were related to the fact exception handling is not working... seems you already know about those warnings, so I guess exception handling is a bug. I investigated this issue further, so here are some more details...
Exceptions Issue
Here is a simple bit of C++ code, I cross-compile it to a linux pure-cap program using the same clang++ command line as you used above then I transfer it to the morello board and execute it.
#include <iostream> struct CMyException {}; int main() { std::cout << "Start of exception test" << std::endl; try { throw CMyException(); std::cout << "Should not print this" << std::endl; } catch(CMyException) { std::cout << "Exception!" << std::endl; } std::cout << "End of exception test" << std::endl; return 0; }
We expect on stdout to see "Start of exception test", "Exception!", "End of exception test" and in fact this happens if you build with g++. But instead we get a segmentation fault at the throw() instruction.
The reason for this is there is a dereference of a capability memory address which has an invalid tag (i.e tag==0). And looking at the generated assembler code the reason for this would appear to be because an address has been dereferenced as an integer not a intptr_t i.e the compiler has used an x-register not the c-register.
This all occurs in dl_iterate_phdr()... I had a quick look at the source code but I cannot obviously figure out what has gone wrong. Anyway, I will hand it over to you as you should be able to recreate it (or alternatively tell me if I have done something silly!)
Explaining LLVM variable in build
Ok, to explain this...
So in summary I think probably you just need to update your document to add instructions to set LLVM variable and then run the script. Also BTW there look like a few copy/paste errors in the document as it refers to building libunwind in the instructions for building libc++ and libc++abi, and finally there are no instructions in the bash_morello.sh file itself although the other targets have instructions in that file.
Hope this makes sense.
That being said, these are small points and the process was quite ok and the instructions were very helpful. The only problem I found was this need to set LLVM variable to build the libcxx case, although as I say I did not rebuild clang itself from source so I cannot comment if that step works or not.
ThanksPete
Hi Pete, thanks for the detailed report! We've made some updates on the Musl side and if you rebuild it from the top of the "morello/master" branch, you should get two improvements:
Hope this helps!
Thanks Yury, I look forward to giving it another try sometime next week!Pete
Hi Yury, just reporting back, I updated from master and re-tested and indeed the two changes you described worked well - many thanks!I appreciate there is still a little bit more work to do (e.g all those build warnings are still there), but do you have an updated estimate for when there will be an official release of this MUSL libc++ support?Best RegardsPete