Shash316
Shash316

Reputation: 2218

Why does the executable built in 64 bit mode on linux show machine type as AMD x86 64?

I encountered this while trying to understand ELF (Executable and Linking Format).

Steps I followed

  1. Wrote a simple application. main.c containing int main(int argc, char **argv){ return 0;}
  2. Compiled in linux environment using gcc. (Done on intel laptop) Simplest command possible gcc main.c
  3. Now when I run a.out, it runs without any issue. So build is fine.
  4. I used readelf tool to retrieve the ELF information, where in machine field is put as Advanced 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?

Upvotes: 3

Views: 2390

Answers (3)

osgx
osgx

Reputation: 94165

why does the executable ... show machine type as AMD x86 64?

Because the ELF machine code, used by file, was registered by AMD. There is the official list of registered codes: http://www.sco.com/developers/gabi/latest/ch4.eheader.html (the table at second page):

e_machine
This member's value specifies the required architecture for an individual file. 

Name    Value   Meaning
EM_NONE 0   No machine
...
EM_X86_64   62  AMD x86-64 architecture

Upvotes: 0

Jonathan Leffler
Jonathan Leffler

Reputation: 753455

For a while, the IA-64 (Intel Architecture 64-bit) or Itanium chips were Intel's 64-bit offering, and the Pentium-class chips were the IA-32 chips. The IA-64 chip instruction set was sufficiently different from the Pentium code set that people did not pick it up in large numbers. Meanwhile, AMD came out with a 64-bit extension to the Pentium code set - and that got a lot of support. After a while, Intel bowed to the inevitable and made its own chips that were compatible with the AMD x86/64 chips. But it was AMD that specified the architecture, so it gets the credit in the name.

Upvotes: 4

David Schwartz
David Schwartz

Reputation: 182743

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 tagged i686 which refers to the Pentium Pro, circa 1995.)

Upvotes: 9

Related Questions