Page MenuHomeFreeBSD

stand: Add eh symbols to linker scripts
AcceptedPublic

Authored by imp on Dec 23 2022, 6:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 28, 8:56 PM
Unknown Object (File)
Fri, Apr 26, 8:03 AM
Unknown Object (File)
Jan 10 2024, 3:36 AM
Unknown Object (File)
Dec 16 2023, 5:08 PM
Unknown Object (File)
Jun 22 2023, 6:38 PM
Unknown Object (File)
May 20 2023, 10:37 AM
Unknown Object (File)
May 3 2023, 10:06 PM
Unknown Object (File)
Apr 25 2023, 11:50 AM

Details

Reviewers
manu
jrtc27
dim
Summary

Add eh_* symbols to the arm, arm64, i386, amd64 and riscv linker
scripts. They are needed to create tracebacks with libunwind. Without
addition arguments, these use no additional space in the binaries (flags
that I have no plans to add to even the debug versions since we do
exceptions in the boot loaders). Generally placed in the same location
as other places in the tree, except for where we have a pehdr section
(in which case I place them abitrarily last in the text section). These
are needed by libunwind, but defining this way will effectively disable
them. Libunwind has no easy way to disable them via a #define like so
many other aspects of its behavior.

Didn't do powerpc, nor uboot since those loaders are legacy, seen to
have unclear layout requirements and I have no way to test the results.

Sponsored by: Netflix

Test Plan

build before / after notice the 'size' size is the same.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 48875
Build 45764: arc lint + arc unit

Event Timeline

imp requested review of this revision.Dec 23 2022, 6:28 PM
imp added reviewers: jrtc27, dim.

You might want to clarify that this is specifically about boot loader linker scripts?

For the rest I'm fine with it.

This revision is now accepted and ready to land.Dec 23 2022, 10:57 PM

Do we need to add .eh_frame_hdr to the objcopy command in stand/efi/loader/Makefile?

I'm surprised these are needed, ld.lld should automatically add the symbols. Also can the _hdr symbols be placed inside the section? It should be fine for them to be be non-zero if non-existent since end will be equal to start.

I'm surprised these are needed, ld.lld should automatically add the symbols. Also can the _hdr symbols be placed inside the section? It should be fine for them to be be non-zero if non-existent since end will be equal to start.

I've not tried it without the eh_frame_hdr* symbols, to be honest. I hit the eh_frame_start/end being missing, found a comment and added what the comment said :)