A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
1–7 of 7 posts
Re: A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
#2Also, this is "teensy" as in "very small" rather than the Teensy microcontroller.
Re: A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
#3Re: A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
#4Re: A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
#5Backing away from the assembler.
Re: A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
#6Being nerd sniped into thinking I could learn how to do the same thing for X64. Backing away from the assembler.
It's not so easy to find it by naively testing for ignored header fields, since it depends on the precise details of which sizes and addresses must have the same alignment within a page. I instead proceeded from first principles, by studying the ELF loader and determining which programs are definitely ruled out.
Re: A Whirlwind Tutorial on Creating Teensy ELF Executables for Linux (2001)
#71. Most systems today are 64-bit, where gcc needs "-m32" to build the 32-bit assembly code that this article uses.
2. Modern versions of GCC's ld enable "-z separate-code" by default, which adds several kilobytes of padding that completely dwarfs everything this article does until you start hand-crafting ELF files. Passing "-Wl,-z,noseparate-code" to gcc undoes this.
3. Most Linux distros now configure GCC with "--enable-default-pie", which similarly inflates all of the binaries by several kilobytes. Passing "-no-pie" to gcc undoes this.