Page MenuHomeFreeBSD

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

Authored by ian on Dec 24 2019, 11:51 PM.


Group Reviewers

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

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

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...


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?


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?


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.


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


whitespace at EOL.



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