a clang-provided implementation of crtbegin/crtend

Greetings,

Given that clang has been self-hosting for quite some time now, I wonder whether there have been any plans to provide a clang-native source code for crtbegin/crtend? I haven’t seen any discussion of this on the mailing list, and so wanted to know whether that would be considered the territory of the libc implementaiton and/or the operating system distribution.

Kind regards,
writeonce at midipix dot org

If I'm not mistaken the NetBSD devs have "solved" this. Maybe one of them could reply, but possibly share more details of your exact goal. Without some objective - you may not get much interest or help

For my self hosting clang/LLVM/musl I used the NetBSD versions. -Rich

You can find an implementation for all architectures NetBSD supports in
src/lib/csu in the CVS tree. Some parts may depend on the machine/asm.h
code of the corresponding platform.

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/

Joerg

Given that clang has been self-hosting for quite some time now, I wonder
whether there have been any plans to provide a clang-native source code for
crtbegin/crtend? I haven't seen any discussion of this on the mailing list,
and so wanted to know whether that would be considered the territory of the
libc implementaiton and/or the operating system distribution.

You can find an implementation for all architectures NetBSD supports in
src/lib/csu in the CVS tree. Some parts may depend on the machine/asm.h
code of the corresponding platform.

Thank you, Joerg, that helps a lot!
zg

Thank you, Rich. If I understand correctly, the above is different from the NetBSD assembly sources (link sent by Joerg), and is also more compact and portable (written in C). Is that true, or am I missing something? zg

We have both a C version in the tree for strange architectures like MIPS
where you have to fight with many different ABIs and straight forward
assemblers versions for others. At least for classic .init/.fini
support, avoiding asm completely is difficult to impossible...

Joerg