Reputation: 9811
I need to identify the ABI used to generate some binaries, programs, dynamic and static libraries .
I would like to ask if there is a property or a tag or a string I can check with some external tool to see which ABI was used to create that binary object . My objects are mostly ELF for x86 and ARM, and I'm including ABIs for debugging purposes too like DWARF ones .
EDIT: something like the magic bytes at the start of a file that are generally used to detect the fileformat of a file .
Upvotes: 3
Views: 2122
Reputation: 25318
There are a several indicators which may be present in the ELF files.
EI_OSABI
field of the ELF header ident.note.ABI-tag
used to mark e.g. Linux vs. FreeBSD binaries.FreeBSD
uses "branding" signature in the reserved part of the e_indent
field (starting from the 8th byte).EABI
version/variant info in the e_flags
field, and the object files may also have the .ARM.attributes
section.comment
section may contain compiler name/version, but it's informational only - it is not used by the OS to identify the ABI, and usually does not mention specific ABI information..note
section may contain additional info which could point to the ABI being used.In most cases, readelf
will display the necessary info, though you may need to add some switches (e.g. -A
to display the .ARM.attributes
section). I don't think there's anything to parse the .note.ABI-tag
section so you may have to do it manually.
For more info, see the SysV ABI and ARM EABI docs.
Upvotes: 7