crtbegin / crtend

Dear libcxx community,

On Ubuntu 16.04 is it possible to compile and use libcxx (and clang)
without any dependence on gcc?
Part of this effort would be to use alternate crtbegin.o / crtend.o
With google i found both .s (assembler) and .c (C) versions of these
artifacts, are there any which can be ued and what needs to be done for
them to get picked up in the clang / lld link?

Best regards

Franz

I’ve implemented crtbegin.o/crtend.o as part of compiler-rt in https://reviews.llvm.org/D28791, but there has been pushback on that change and it never got merged. Ultimately, I ended up implementing support for emitting __dso_handle symbol in lld which is the only part of crtbegin.o we need on our platform (Fuchsia) and that way we avoided the need for crtbegin.o/crtend.o altogether. On other platforms such as yours, you might still need these. You can either reuse the ones from https://reviews.llvm.org/D28791 or find a different ones which will satisfy your requirements for licensing, etc.

To get them picked up by the linker, you’ll need to either place these into one of the default locations e.g. /usr/local/lib or explicitly specify the location using the -L flag.