3

For eg. arm-unknown-linux-gnueabi Now, once the OS i.e Linux is fixed, the C Library will be fixed (GLibc) and hence the calling convention and ABI being followed will be fixed. What is the requirement of 4th field i.e. ABI separately? Can a toolchain use a different ABI from the one used by underlying OS and LIBC. In that case how will libraries compiled by the said toolchain run on the OS?

1 Answers1

4

It's more or less a matter of historical reasons, a.k.a the holy wars about the sacred operating system's name. What you call the "toolchain name" is actually called the Target Triplet, and as it name imply, it has three fields, not either more or less. In your example case, the fields would be:

  • Machine/CPU: arm
  • Vendor: unknown
  • Operating System: linux-gnueabi

Take another reference example I've already faced: i686-elf-gcc, which is used for hobbyist operating system development:

  • Machine/CPU: i686-elf
  • Vendor: unknown (implicit)
  • Operating System: none (implicit; the compiler is actually a freestanding cross compiler, used for the development of operating system kernels, thus the code it outputs expects no underlying OS, as the output code is the OS itself!).

This is just a matter of confusion originating from the fact that the fields may (and do) use the - character, which is used to separate the fields, too. In your case, the OS is considered to be linux-gnueabi, otherwise known as the GNU operating system with the Linux kernel using the Embedded ARM ABI. The Linux Kernel has historically been one of the most portable pieces of software in the world, so it's expected to be portable to other ARM ABIs, although I'm only aware of the EABI...

3442
  • 8,248
  • 2
  • 19
  • 41
  • Thanks! so Linux using Embedded ABI it is. One more doubt is how ABI is tied to C std Library(GLibc for eg.) and the OS.. (In this particular case, I think LibC has been compiled using a compiler which uses EABI convention and the machine code generated by this compiler also uses EABI..? Is it? – Code_Complete Oct 04 '15 at 07:02
  • @BhavikAmeta: You're (apparently) using a cross-compiler (see link in my answer), so your compiler is probably *not* running on ARM EABI, but generating code for it. The target triplet has actually nothing to do with the C library. That wouldn't make too much sense, after all, because C has nothing to do with the ABI. For example, if you write a program in assembly, what would be the C library field set to? `unknown`? Then we would need (yet) another toolchain for the assembly! Anyway, there're [many other C libraries for GNU/Linux apart from Glibc](http://www.etalabs.net/compare_libcs.html). – 3442 Oct 04 '15 at 07:17