* [gentoo-musl] Self-hosting Clang-based (libc++, musl libc) stage4
@ 2017-05-07 6:05 Jens Staal
[not found] ` <1494142061.1410.3.camel@gentoo.org>
0 siblings, 1 reply; 5+ messages in thread
From: Jens Staal @ 2017-05-07 6:05 UTC (permalink / raw
To: gentoo-musl, llvm
Dear all,
I have made a self-hosting clang-based stage4 that some might want to
play with. LLVM/clang (4) are bootstrapped against libc++ and gcc is
uninstalled (custom crt{begin,end} from ELLCC, see /usr/local/hack/crt)
An update from the last version announced on the gentoo-musl list 1st of
May is that I now have LLVM-patched linux (4.11) sources in there (already
installed and symlinked to /usr/src/linux, default config binaries
installed to /boot)
The stage4 can be downloaded here:
https://mega.nz/#!VrQASApL!F4v7SmS5wkJKBzBigsqptipJYuT94yT3-ObjOWEEG3Y
sha256sum:
6d7d68478ead5c80fa34553cf3fbff2af2916364d1aef0cbdae7147c8761aa81
stuff that might interest the LLVM project:
- the whole system is based on libedit
- some LLVMlinux patch sources:
full patch set from llvmlinux project + extras
https://github.com/staalmannen/linux/tree/llvmlinux
minimal patch set
https://github.com/ramosian-glider/clang-kernel-build
the minimal patch set + some fixes against noisy build
https://github.com/staalmannen/linux/tree/llvmlinux-fresh
The linux 4.11 in /usr/local/portage-clang/sys-kernel/llvm-sources
is patched against the minimal patch set. For later kernel versions I
would most likely go for the llvmlinux-fresh set (alternatively, fixes
are upstream in the kernel or in clang-kernel-build).
Important note: I did not write any of those patches, just applied them.
Some thoughts:
- it would be really cool if an "official" custom crt package for
llvm/clang could be in portage
- it would be really cool if llvm-sources could be officially supported
since this would mean that clang actually can be (optionally) used as
a system compiler with no reliance on gcc (a few years later than freebsd).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-musl] Re: Self-hosting Clang-based (libc++, musl libc) stage4
[not found] ` <1494142061.1410.3.camel@gentoo.org>
@ 2017-05-07 9:19 ` Jens Staal
[not found] ` <67270d8b-0bda-d6b0-a97f-722ae449e424@gentoo.org>
[not found] ` <1494669664.8406.1.camel@gentoo.org>
0 siblings, 2 replies; 5+ messages in thread
From: Jens Staal @ 2017-05-07 9:19 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-musl, llvm
On Sun, May 07, 2017 at 09:27:41AM +0200, Michał Górny wrote:
> On nie, 2017-05-07 at 08:05 +0200, Jens Staal wrote:
> > - it would be really cool if an "official" custom crt package for
> > llvm/clang could be in portage
> >
>
> This is something I really look forward to adding. Any suggestion on
> which crt implementation to use?
>
> I know that glibc provides crt1/i/n. Does musl provide them too, or does
> it need a more complete crt* set?
>
> --
> Best regards,
> Michał Górny
musl itself does not provide crt* as far as I know, but I downloaded the
relevant files from ELLCC, which is a musl/libc++ LLVM/clang toolchain
http://ellcc.org/viewvc/svn/ellcc/trunk/libecc/src/musl/crt/
Those crt files originate from NetBSD and googling for crt
implementations often point to the NetBSD variants as drop-in
replacements of libgcc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-musl] Re: Self-hosting Clang-based (libc++, musl libc) stage4
[not found] ` <67270d8b-0bda-d6b0-a97f-722ae449e424@gentoo.org>
@ 2017-05-07 18:29 ` Jens Staal
2017-05-08 11:00 ` Jens Staal
1 sibling, 0 replies; 5+ messages in thread
From: Jens Staal @ 2017-05-07 18:29 UTC (permalink / raw
To: Luca Barbato; +Cc: Michał Górny, gentoo-musl, llvm
On Sun, May 07, 2017 at 02:08:03PM +0200, Luca Barbato wrote:
> On 5/7/17 11:19 AM, Jens Staal wrote:
> > On Sun, May 07, 2017 at 09:27:41AM +0200, Michał Górny wrote:
> >> On nie, 2017-05-07 at 08:05 +0200, Jens Staal wrote:
> >>> - it would be really cool if an "official" custom crt package for
> >>> llvm/clang could be in portage
> >>>
> >>
> >> This is something I really look forward to adding. Any suggestion on
> >> which crt implementation to use?
> >>
> >> I know that glibc provides crt1/i/n. Does musl provide them too, or does
> >> it need a more complete crt* set?
> >>
> >> --
> >> Best regards,
> >> Michał Górny
> >
> > musl itself does not provide crt* as far as I know, but I downloaded the
> > relevant files from ELLCC, which is a musl/libc++ LLVM/clang toolchain
> >
> > http://ellcc.org/viewvc/svn/ellcc/trunk/libecc/src/musl/crt/
> >
> > Those crt files originate from NetBSD and googling for crt
> > implementations often point to the NetBSD variants as drop-in
> > replacements of libgcc.
> >
> >
>
> IIRC during the GSoC the netbsd crt is the one that was used. I'd check
> how hard is to package it properly.
>
> lu
In principle not very hard at all, I just installed the .o files in
/usr/lib and it worked.
It might be interesting to put the crt* source files in a separate source
repository for making a new package.
For building and which files that are needed, see
/usr/local/hack/crt/build.sh in my stage4
In my case, I only used the files needed for amd64, but ELLCC supports
several architectures so a more properly layed out source with
architecture-dependent build system would definitely be possible.
An important difference with the ELLCC crt-files: I had to move
__dso_handle from crt1 to crtbegin in order to replace libgcc (no idea
why!).
PS.
If a self-hosting clang would evolve into a true alternative system
compiler for Gentoo, it would definitely be interesting to evolve
"gcc-config" to a more generic "compiler-config" that also would point
to LLVM/Clang installations
DS.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-musl] Re: Self-hosting Clang-based (libc++, musl libc) stage4
[not found] ` <67270d8b-0bda-d6b0-a97f-722ae449e424@gentoo.org>
2017-05-07 18:29 ` Jens Staal
@ 2017-05-08 11:00 ` Jens Staal
1 sibling, 0 replies; 5+ messages in thread
From: Jens Staal @ 2017-05-08 11:00 UTC (permalink / raw
To: Luca Barbato; +Cc: Michał Górny, gentoo-musl, llvm
On Sun, May 07, 2017 at 02:08:03PM +0200, Luca Barbato wrote:
> On 5/7/17 11:19 AM, Jens Staal wrote:
> > On Sun, May 07, 2017 at 09:27:41AM +0200, Michał Górny wrote:
> >> On nie, 2017-05-07 at 08:05 +0200, Jens Staal wrote:
> >>> - it would be really cool if an "official" custom crt package for
> >>> llvm/clang could be in portage
> >>>
> >>
> >> This is something I really look forward to adding. Any suggestion on
> >> which crt implementation to use?
> >>
> >> I know that glibc provides crt1/i/n. Does musl provide them too, or does
> >> it need a more complete crt* set?
> >>
> >> --
> >> Best regards,
> >> Michał Górny
> >
> > musl itself does not provide crt* as far as I know, but I downloaded the
> > relevant files from ELLCC, which is a musl/libc++ LLVM/clang toolchain
> >
> > http://ellcc.org/viewvc/svn/ellcc/trunk/libecc/src/musl/crt/
> >
> > Those crt files originate from NetBSD and googling for crt
> > implementations often point to the NetBSD variants as drop-in
> > replacements of libgcc.
> >
> >
>
> IIRC during the GSoC the netbsd crt is the one that was used. I'd check
> how hard is to package it properly.
>
> lu
I uploaded a slightly modified version of the files I have in
/usr/local/hack/crt on github
https://github.com/staalmannen/llvm-crt-replacement
is this sufficient for packaging?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-musl] Re: Self-hosting Clang-based (libc++, musl libc) stage4
[not found] ` <1494669664.8406.1.camel@gentoo.org>
@ 2017-05-13 11:24 ` Jens Staal
0 siblings, 0 replies; 5+ messages in thread
From: Jens Staal @ 2017-05-13 11:24 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-musl, llvm
On Sat, May 13, 2017 at 12:01:04PM +0200, Michał Górny wrote:
> On nie, 2017-05-07 at 11:19 +0200, Jens Staal wrote:
> > On Sun, May 07, 2017 at 09:27:41AM +0200, Michał Górny wrote:
> > > On nie, 2017-05-07 at 08:05 +0200, Jens Staal wrote:
> > > > - it would be really cool if an "official" custom crt package for
> > > > llvm/clang could be in portage
> > > >
> > >
> > > This is something I really look forward to adding. Any suggestion on
> > > which crt implementation to use?
> > >
> > > I know that glibc provides crt1/i/n. Does musl provide them too, or does
> > > it need a more complete crt* set?
> > >
> > > --
> > > Best regards,
> > > Michał Górny
> >
> > musl itself does not provide crt* as far as I know, but I downloaded the
> > relevant files from ELLCC, which is a musl/libc++ LLVM/clang toolchain
> >
> > http://ellcc.org/viewvc/svn/ellcc/trunk/libecc/src/musl/crt/
> >
> > Those crt files originate from NetBSD and googling for crt
> > implementations often point to the NetBSD variants as drop-in
> > replacements of libgcc.
> >
>
> To be honest, I'm not sure if this is complete enough as useful
> replacement. For reference, the implementation submitted for compiler-rt
> was a little larger, and still wasn't considered good enough [1].
>
> [1]:https://reviews.llvm.org/D28791
>
> --
> Best regards,
> Michał Górny
I just know that it works on my experimental system. Perhaps there are
additional stuff needed for corner cases that I have not yet
encountered...
(hobbyist learning-by-doing so might be obvious things that I have
missed)
I have rebuilt @world several times (and llvm/clang), built llvm-patched linux on this gcc-free system.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-13 11:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-07 6:05 [gentoo-musl] Self-hosting Clang-based (libc++, musl libc) stage4 Jens Staal
[not found] ` <1494142061.1410.3.camel@gentoo.org>
2017-05-07 9:19 ` [gentoo-musl] " Jens Staal
[not found] ` <67270d8b-0bda-d6b0-a97f-722ae449e424@gentoo.org>
2017-05-07 18:29 ` Jens Staal
2017-05-08 11:00 ` Jens Staal
[not found] ` <1494669664.8406.1.camel@gentoo.org>
2017-05-13 11:24 ` Jens Staal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox