GNU free compilation toolchain - Programming On Unix

Users browsing this thread: 1 Guest(s)
Grey Hair Nixers
Hello everyone!

As the title say, I'm currently trying to setup a compilation toolchain (for C programs) that would not depend on any GNU software (because freedom shouldn't mean "use GNU software").

Do any of you would like to help me on this? I know of clang, which works great. But I'd like to explore more options, using alternative compilers/assembler/linkers. To former being the hardest to find it seems.

For now, here is what I'm using:
  • libc - musl
  • preprocessor - pcc
  • compiler - pcc
  • assembler - nasm?
  • linker - ???

If you have better options, please share!
Long time nixers
I found some good linkers that might be worth a shot.

The Byte Optimized Linker - a x86_64 ELF linker (has some limitations compared to other linkers)
The Rape 'n Load Linker (yes i know the name is fucking stupid) - a x86 ELF linker

Some limitations to 'rld':
  • Command line is limited to 255 arguments.
  • Each command line argument is limited to 255 characters.
  • Input/Output elf cannot exceed 2GiB.
  • Currently supporting only x86 architecture.

I know that having separate linkers for separate architecture is annoying, but finding an alternative linker is not easy.
Version: 3.1
G d s+:++ a--- C++ UB P+ L+ !E !W+++ !N !o K--? w++ !O M++ !V PS+++ PE-- Y++ PGP+ !t !5 !X !R tv b+ DI D++ G e- h r y--

buddhist ~ esperantisto ~ communist
Grey Hair Nixers
Thanks for thosd links, I'll check them out. I found neatld (, but I couldn't make it link a simple brllo world, no matter how hard I tried...
Sweet, looking forward to this.

p.s. you are right, "freedom shouldn't mean "use GNU software"."

(14-05-2015, 04:16 AM)vypr Wrote: The Rape 'n Load Linker (yes i know the name is fucking stupid) - a x86 ELF linker
Grey Hair Nixers
Waking up this thread, as I made some progress.

I finally build a PCC toolchain using musl as its libc. It's not entirely GNU Free though, as it still need GNU binutils to work. But it's a huge step forward!
I've been looking into elftoolchain (from the fedora project) and elfutils (freebsd iirc) but none of them include an assembler, and only elftoolchain provides a linker (not sure if it's working though).

Regarding the PCC+musl toolchain, I blogged about it, you can find everything about it here:
If you have any questions about it, or think some infos are missing or not crystal clear, tell me and I'll rework this article.
LLVM + lld is also a strong candidate to have a system GNU free. I'm seriously thinking of it.
But I guess we will still need to use a few other GPL softwares, especially for the networking part (final system).
And if I'm not wrong, elftoolchain is a project from FreeBSD.
Grey Hair Nixers
I never looked much into LLVM and Clang. Even if it's more 'hype' than GNU, I still find them to be too huge for my "minimal" needs. I know it's a dumb statement, But I Like small projects :)
Though after a quick look, lld seems to be a totally standalone project, so it might be worth taking a look. Keep us updated if you give it a go!

(17-08-2015, 08:02 AM)Ypnose Wrote: if I'm not wrong, elftoolchain is a project from FreeBSD.

You were right, I swapped them. elfutils is the fedora project, while elftoolchain is the freebsd one.
I just recently switched from GCC to Clang on OpenBSD, so far so good.
Long time nixers
In my opinion, it is astonishing how much GNU has you locked in.
Using another standard library than glibc is surprisingly hard, and gdb does not work with output produced by tcc.
Grey Hair Nixers
tcc isn't working well as a standard compiler sadly. But works well as a tiny interpreter for small C programs! Anyway, GNU sucks for locking everything like this. I hate them for that
Long time nixers
I might also be wrong about tcc, because it is discontinued. It might not yet have implemented symbols for gdb.
Long time nixers
So z3bra, what's your toolchain these days?
Grey Hair Nixers
I finally managed to get a static musl-based toolchain! To do so, I used an alpinelinux container and compiled gcc multiple times.

I now have gcc, binutils, patch, make, m4, and so on, statically compiled.
If anyone wants to try the same, I'd suggest starting there:
It will let you build a musl-based cross-compiler that's portable.

I'm now able to build packs for my distro ON my distro (currently within an LXC container). I'm facing a few errors, but they are mostly related to the tools I use, and that don't behave like GNU's. For reference, here are the "tool swap" I made to avoid GNU:

There are still some quacks, but this toolset is rather usable for now. As a matter of fact, here are the GNU/tools I'm still relying on, and the replacement I'm considering (if any):