I encountered this while trying to understand ELF (Executable and Linking Format).
Steps I followed
- Wrote a simple application.
main.ccontaining
int main(int argc, char **argv){ return 0;} - Compiled in linux environment using gcc. (Done on intel laptop)
Simplest command possible
gcc main.c - Now when I run
a.out, it runs without any issue. So build is fine. - I used
readelftool to retrieve the ELF information, where in machine field is put asAdvanced Micro Devices X86-64.
This part puzzled me.
So I checked the file header of a.out, it was as per ELF-64 specification (Value 64 - EM_X86_64).
Would anyone care to explain, why does the executable, built in 64 bit mode on linux, show machine type as AMD x86 64?
The x86_64 platform was called the AMD64 platform back when AMD introduced it. Initially, it was far from clear that Intel would ever support it.
You notice how long after i386’s ceases to exist, a lot of software had the architecture tag
i386? It was because i386 CPUs introduced the instruction set that software uses. Similarly, AMD introduced the instruction set your program uses, so it has an architecture tag that reflects the first CPUs that supported its instruction set. (Modern 32-bit code is still often taggedi686which refers to the Pentium Pro, circa 1995.)