PHIPS BLOG

  •  Home
  •  Get To Know Me

Linker

Programming & DevOps

How Does the “File Size is Smaller Than Mem Size” Optimization Work in GNU ld for the .bss Section?

This article explains how the GNU linker (GNU ld) can save disk space for symbols in the .bss section. TL;DR: If a section is of type SHT_NOBITS and if it is the last section in a LOAD segment, GNU ld uses this optimization. When you build software with a compiled Read more

By Philipp Schuster, 3 years2022-12-07 ago
Symbolic Picture: .bss is part of .data section
Programming & DevOps

GNU ld: Linking .bss into .data to Ensure that Mem Size Equals File Size For Each LOAD Segment (.bss in a PROGBITS Section)

Update: I found another variant. I appended it to the end of the article. Original post: Some rudimentary ELF loaders require that p_memsz equals p_filesz for each LOAD segment in order to simplify the loading of the file. For example, the microkernels NOVA and Hedron have this restriction to bootstrap Read more

By Philipp Schuster, 3 years2022-12-07 ago
Assembly Code Snippet: Use section flags if you need custom section names
Programming & DevOps

GNU ld Discards Section Containing Code – Section Flags are Important for ELF Files

Update: Since I published this article, I gained more knowledge from own research and hints from others. I adjusted the blog post. Thanks for the help! When it comes to low-level systems engineering and producing binaries, such as firmware or kernels, dealing with linkers and especially linker scripts feels like Read more

By Philipp Schuster, 3 years2022-09-02 ago

Because this blog is a few years old and used to be a more or less personal german blog, old posts are in german. Newer posts are in english.

Suche
  • Impressum
  • Datenschutzerklärung
Hestia | Developed by ThemeIsle