What is the difference between the 386 and 32 bit options in
And, where can I find the documentation on these "emulation modes"
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
The “emulation” selects different linker scripts; you’ll find the scripts themselves in
/usr/lib/ldscripts on your system. The emulations you’ve listed correspond to
elf32_x86_64: ELF for x64-32, aka x32 — 32-bit x86-64 binaries
elf_i386: ELF for i386 — 32-bit i386 binaries
i386linux: a.out for i386
i386pep: PE+ for x86-64 — Windows-format 64-bit binaries
i386pe: PE for i386 — Windows-format 32-bit binaries
The linker scripts define the output format and architecture, the search directories (where
ld looks for libraries), the sections in the binary, among other things.
The linker script format is well documented (see above), but the available scripts aren’t; in most cases GCC will specify the right one, so you don’t need to worry about it, and in other cases you effectively end up needing to read the linker scripts themselves to figure out what they do.