Reputation: 738
I am pretty sure that ELF64 is larger than ELF32 but I am having an argument with someone on a forum and he is claiming that after switching his output to ELF64 that his programs are 1/3 smaller. Which one is larger? Oh and his program is in NASM so there is not like any optimization or anything,
Upvotes: 0
Views: 1416
Reputation:
I don't know if you've read this, but it appears that ELF64 uses 64 bit addressing whereas ELF32 uses 32 bit addressing...
To quote the site, just in case the details vanish...
Chapter 10. elf64: Executable and Linkable Format 64-bit Object Files
The elf64 object format is the 64-bit version of the Executable and Linkable Object Format. As it shares many similarities with elf32, only differences between elf32 and elf64 will be described in this chapter. For details on elf32, see Chapter 9.
Yasm defaults to BITS 64 mode when outputting to the elf64 object format.
elf64 supports the same debug formats as elf32, however, the stabs debug format is limited to 32-bit addresses, so dwarf2 (see Chapter 19) is the recommended debugging format.
elf64 also supports the exact same sections, section attributes, and directives as elf32. See Section 9.2 for more details on section attributes, and Section 9.3 for details on the additional directives ELF provides.
10.1. elf64 Special Symbols and WRT
The primary difference between elf32 and elf64 (other than 64-bit support in general) is the differences in shared library handling and position-independent code. As BITS 64 enables the use of RIP-relative addressing, most variable accesses can be relative to RIP, allowing easy relocation of the shared library to a different memory address.
Upvotes: 2