git: platform: Remove .ldata/.lrodata/.lbss sections from ldscript
Aaron LI
aly at crater.dragonflybsd.org
Sun Jun 21 03:01:57 PDT 2026
commit aec7479b49850248990d7e77af4d5367deab924d
Author: Aaron LI <aly at aaronly.me>
Date: Sat Jun 20 21:08:06 2026 +0800
platform: Remove .ldata/.lrodata/.lbss sections from ldscript
The kernel is compiled with '-mcmodel=kernel', so the compiler never
emits the large model sections (e.g., .ldata/.lrodata/.lbss). Therefore,
remove such sections from the kernel linker scripts.
This change has another major benefit: the '.bss' section now correctly
lies at the end, so the linker does not need to allocate real file space
to store the BSS section. As a result, the kernel file size is reduced
by 14MB (e.g., stripped kernel reduces from 29MB to 15MB)! Meanwhile,
the following gold linker warning is also fixed:
```
/usr/libexec/binutils234/elf/ld.gold: warning: script places BSS section in the middle of a LOAD segment; space will be allocated in the file
```
See also: FreeBSD (https://reviews.freebsd.org/D21859)
Summary of changes:
sys/platform/pc64/conf/ldscript.x86_64 | 20 --------------------
sys/platform/vkernel64/conf/ldscript.x86_64 | 20 --------------------
2 files changed, 40 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/aec7479b49850248990d7e77af4d5367deab924d
--
DragonFly BSD source repository
More information about the Commits
mailing list