Is assembler portable between Linux distros?

前端 未结 3 852
一个人的身影
一个人的身影 2021-01-14 18:26

Is a program shipped in assembler format portable between Linux distributions (modulo CPU architecture differences)?

Here\'s the background to my question: I\'m work

相关标签:
3条回答
  • 2021-01-14 18:49

    At a very high level, the ABI consists of { instruction set, system calls, binary format, libraries }.

    Distribution as .s may free you from the binary format. This is still rather pointless, because you are fixed to a particular ISA and still need to use libraries and/or make system calls. Libraries vary from distribution to distribution (although this isn't really that bad, especially if you just use libc) and syscalls vary from OS to OS.

    0 讨论(0)
  • 2021-01-14 18:50

    It's basically 20 years since I last bootstrapped a C compiler. At the level of compilers, the differences between Linux distributions are minimal.

    The much more important reason for going LLVM is cross-platform; if you're not writing some intermediate language, your compiler will be extremely difficult to retarget for different processors. And seeing as, on my laptop, I have compilers for x86, x86_64, two kinds of MIPS, PowerPC, ARM and AVR... you see where I'm going? I can compile multiple languages for most of those targets too (only C for AVR).

    0 讨论(0)
  • 2021-01-14 19:08

    You might want to check out LLVM before going down this particular path. It might make your life a lot easier, as it provides a low level virtual machine that makes a lot of hard stuff just work and has been very popular.

    0 讨论(0)
提交回复
热议问题