Page MenuHomeFreeBSD

Eliminate generated ldscript for arm and arm64, and strip $a/$d marker symbols from linked kernel.
ClosedPublic

Authored by ian on Dec 24 2019, 11:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 26, 10:10 AM
Unknown Object (File)
Sun, Mar 3, 11:41 AM
Unknown Object (File)
Feb 17 2024, 8:48 AM
Unknown Object (File)
Feb 12 2024, 12:53 AM
Unknown Object (File)
Jan 12 2024, 2:55 AM
Unknown Object (File)
Dec 23 2023, 12:05 AM
Unknown Object (File)
Nov 30 2023, 10:13 AM
Unknown Object (File)
Nov 29 2023, 5:11 AM
Subscribers

Details

Reviewers
imp
mmel
Group Reviewers
ARM
arm64
Summary

The main thrust of this change is to generate a kernel that has the arm "marker" symbols stripped. Marker symbols start with $a, $d, or $t, and are emitted by the compiler to tell other toolchain components about the locations of data embedded in the instruction stream (literal-pool stuff). They are used for generating mixed-endian binaries (which we don't support). The linked kernel has approximately 21,000 such symbols in it, wasting space (500K in kernel.full, 190K in the final linked kernel), and sometimes obscuring function names in stack tracebacks.

This change also simplifies the way the kernel is linked. Instead of using sed to generate two different ldscript files to generate both an elf kernel and a binary (elf headers stripped) kernel, we now use a single ldscript that refers to a "text_start" symbol, and we provide the value for that symbol using --defsym on the linker command line.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 28311

Event Timeline

Since we don't generate ldscript files anymore, remove the generated files from the CLEAN+= list.

I like where this is going, and have a couple of questions...

sys/conf/Makefile.arm
68

SYSTEM_LD_TAIL will become unused with these changes.... Are you planning on followups? Or did mips become a consumer while I wasn't looking?

77

I'm torn on this... This isn't a no, but just a question...

Do we want additional targets here to do this work? Or all of it in the psuedo shell script here? Eg, would there be an advantage to that over this approach?

sys/conf/Makefile.arm
68

Unused only in the sense of not being overridden in Makefile.arm, but it's still used in all arches to (uselessly, I think) strip a gcc2_compiled symbol (probably long-obsolete and we should gc it), and to print the linked sizes.

77

I would like separate targets a bit better I think, but things overall don't seem to be structured that way.

ian retitled this revision from Eliminate generated ldscript.arm and strip arm $a/$d marker symbols from linked kernel. to Eliminate generated ldscript for arm and arm64, and strip $a/$d marker symbols from linked kernel..
ian edited the summary of this revision. (Show Details)
ian added a reviewer: arm64.

Add arm64; the changes needed are almost identical to armv6/7.

Also, switch to using a separate target for the kernel.bin, as suggested by imp@. It turns out it has a noticible advantage: kernel.full and kernel.bin will link in parallel, reducing the penalty for linking the file twice.

In D22922#502063, @imp wrote:

I like where this is going, and have a couple of questions...

Now with arm64 added the SYSTEM_LD_TAIL becomes unused, but I'd rather clean that up in a separate commit, mostly just to avoid cluttering the diffs in this one with stuff that isn't directly related to eliminating marker symbols and generated ldscript files.

mmel added a subscriber: mmel.

tested on arm64
lgtm

sys/conf/Makefile.arm
60

whitespace at EOL.

sys/conf/Makefile.arm64
32 ↗(On Diff #65992)

ditto.

This revision is now accepted and ready to land.Dec 28 2019, 4:46 PM
ian marked an inline comment as done.

Committed as r356180