arch: discard runtime-unused metadata sections

The toolchain emits several sections that have no meaning for a flat
binary bootloader:

  .eh_frame             DWARF unwind tables (we never unwind)
  .note.gnu.property    BTI/PAC ELF markers (lost at objcopy)
  .note.gnu.build-id    debug identity (lost at objcopy)
  .comment              compiler version string
  .ARM.attributes       ABI metadata

Gcc emits roughly 7-8 KB of .eh_frame by default for a build of this
size; the others are smaller but equally pointless. Just drop all of
them in the linker scripts.

Net effect on dreamlte_defconfig w/ empty embedded blobs:
61960 -> ~54000 bytes. Stonks.
This commit is contained in:
Ivaylo Ivanov authored and Ивайло Иванов committed 2026-05-28 10:12:51 +03:00
1 parent dab24eacef
commit 3f4eb1b319
2 files changed
+20

No files matched your search

+10
View File
@@ -89,4 +89,14 @@ SECTIONS
#ifdef CONFIG_LINUX_KRNL_HEADER_IMG
_kernel_size = _stack_end - _start;
#endif
/* size optimization for flat binaries */
/DISCARD/ : {
*(.eh_frame)
*(.eh_frame.*)
*(.note.gnu.property)
*(.note.gnu.build-id)
*(.comment)
*(.ARM.attributes)
}
}
+10
View File
@@ -45,4 +45,14 @@ SECTIONS
}
_end = .;
/* size optimization for flat binaries. */
/DISCARD/ : {
*(.eh_frame)
*(.eh_frame.*)
*(.note.gnu.property)
*(.note.gnu.build-id)
*(.comment)
*(.ARM.attributes)
}
}