0

I am trying to build my system from scratch, since I really like the idea of atomicity of each program in unix-like approach, I would like to preserve it as much as possible in my build.

Since GNU binutils, in a way, violates this principle, I would like to know if there is just GNU assembler, which wouldn't be dependant on binutils?

If not, are there any minimal and performant alternatives to GNU assembler? I know of yasm, but in case there is a better one, I would like to know of it.

Thank you in advance.

2
  • Check with linuxfromscratch.org. "Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code." Commented Jan 20 at 13:48
  • @waltinator , thank you for the answer, unfortunately I am not interesting in building system based on linux kernel, you may call it a fetish, lmao Commented Feb 2 at 1:00

1 Answer 1

1

ince I really like the idea of atomicity of each program in unix-like approach

I'm not one to tell you how to interpret some philosophy, but I think your assumption that an assembler without a linker would be useful for building software is wrong. Same for a compiler; these three need to work tightly together, and them belonging to one and the same software project makes a lot of sense.

Generally, the "UNIX philosophy", however you define that, definitely does not say "all programs are completely freestanding without shared code with each other". Completely the contrary must be the case – one of the cool thing about "original" UNIX was that it quickly supported virtual memory and linking against libraries. So, by no means are UNIX programs "atomic"! That's literally the opposite of what being able to use POSIX system calls like dlopen, or the idea of POSIX shared memory suggests (and that's been around since at least since SysV, around 1983, as far as a cursory search tells me.
So, maybe reduce your "desire for purity" there; UNIX itself isn't meant to give you atomic programs, but to allow you to compose programs out of pieces in function libraries, and make them work together on files exchanged through a stable file system.
That's why C exists – because Kernighan and Ritchie needed a language that allowed them to do exactly that, build programs that interact with components, and assembler did not provide a defined calling convention.
People confuse "no piece of code can have more than one purpose" with "compose complex scripts by piping output to standard input of the next process", but that concept is actually far less central than the idea that you can call functions from libraries that you could share with others¹.


That being said:

You can of course build and install the GNU assembler alone, but it won't be very useful. So, there's no problem here to solve; just ignore the things you don't want.

If you want to build a kernel, you will need to go with the GNU assembler or maybe the llvm-as competition (which is even more modular and pretty much useless without the clang C frontend).


¹ And frankly, I'm kind of annoyed by the claim that "every program has only a very singular purpose and that's a good system design for everything". I'm sure you prefer editing your text files in ed rather than vim or emacs, and I'm sure as a UNIX purist you hate awk with a passion, as it does allow you write complex text processing programs instead of composing them via endless concatenations of programs through file descriptors, and the idea that your shell can both be used to launch programs and count to 1000 is a travesty to you – but for me, programs having useful feature sets rather than minimal ones seems to make my day more productive. I'm not sure how one would reconcile "single-purpose tools are the optimum" with using a web browser, which explicitly is all – a news reader, a question&answer platform client, a mail client, a video player, a practically endless collection of games, a client to text chat networks, …

3
  • I can see from the answer and volume of it, that you are annoyed. I did not misinterpreted atomicity - I want to build this system from scientific interest, and the atomicity was just a bias for the idea of building such system, not for practical use, I should have been more clear on that, so there is no reason to be annoyed here, relax Commented Feb 2 at 0:57
  • I do not know, who you have payed to get information on my text editor preferences, but you really should arrange a refund. I have never used ed. one thing you got right, though - I do not use emacs nor vim - i use micro =) Commented Feb 2 at 3:21
  • I have read it through finally, why you so salty about ones fetish? I do not force you to use my system Commented Feb 2 at 3:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.