rss feed
< more posts

Application Binary Interface (ABI)


When I started to develop embedded systems based on ARM-based chips I used the arm-none-eabi-gcc compiler. I always wondered what was the meaning of eabi.
EABI stands for Embedded Application Binary Interface, but what is an application binary interface or ABI?
I will try to explain what I understood the best I can.

The ABI is related to ELF-based files. I wrote a post about elf basics some time ago. In one hand ELF files contain a header that give us information that will help the linker to parse and interpret the object file. On the other hand, ABI specifies the content and format of ELF-files, such as the calling conventions. We could say that a ELF-based file for an specific architecture have some structure and rules defined by the ABI.

An ELF header for ARM architecture generated by arm-eabi-gnat

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                     ELF32
  Data:                      2 s complement, little endian
  Version:                   1 (current)
  OS/ABI:                    UNIX - System V
  ABI Version:               0
  Type:                      EXEC (Executable file)
  Machine:                   ARM
  Version:                   0x1
  Entry point address:       0x801e799
  Start of program headers:  52 (bytes into file)
  Start of section headers:  965452 (bytes into file)
  Flags:                     0x5000400, Version5 EABI, hard-float ABI
  Size of this header:       52 (bytes)
  Size of program headers:   32 (bytes)
  Number of program headers: 4
  Size of section headers:   40 (bytes)
  Number of section headers: 20

An here is a ELF-header for x86_64 architecture generated by gcc

ELF Header:
  Class:                    ELF64
  Data:                     2 s complement, little endian
  Version                   1 (current)
  OS/ABI:                   UNIX - System V
  Type:                     EXEC (Executable file)
  Machine                   Advanced Micro Devices X86-64
  Entry point address:      0x4003b0
  Start of program headers: 64 (bytes into file)
  Start of section headers: 6568 (bytes into file)
  Size of this header:      64 (bytes)
  Size of program headers:  56 (bytes)
  Number of program headers:9
  Size of section headers:  64 (bytes)
  Number of section headers:28

Two systems can be considered binary compatible if they can run the same software without requiring that the application be recompiled. For example, the system that can run the ELF file generated by gcc is not binary compatible with the one that can run the ELF file generated by arm-eabi-gnat, they are from different classes, have different header size and machine type.

More info:

  • ARM Cortex-A Series Programmer’s Guide for ARMv8-A link
  • System V ABI link
  • Application Binary Interface (ABI) for the ARM Architecture link

Wanna talk?. Send me a mail.
Did you enjoy it?.
Similar Posts