Page MenuHomeFreeBSD

arm64: Add unwind information to _start
ClosedPublic

Authored by dchagin on May 26 2023, 8:40 AM.
Tags
Referenced Files
Unknown Object (File)
Fri, Oct 4, 9:36 AM
Unknown Object (File)
Fri, Sep 27, 10:13 AM
Unknown Object (File)
Tue, Sep 17, 3:37 PM
Unknown Object (File)
Aug 31 2024, 12:16 AM
Unknown Object (File)
Aug 21 2024, 11:16 AM
Unknown Object (File)
Aug 18 2024, 1:10 PM
Unknown Object (File)
Jul 6 2024, 8:51 PM
Unknown Object (File)
May 25 2024, 1:54 PM

Details

Reviewers
andrew
emaste
Group Reviewers
arm64
Summary

The right unwinding stop indicator should be CFI-undefined PC.
http://dwarf.freestandards.org/Dwarf3.pdf - page 118:

  • If a Return Address register is defined in the virtual unwind table,

and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

Create an initial frame with 0 lr and fp.
Procedure Call Standard for the ARM 64-bit Architecture (AArch64)
specifies that the end of the frame record chain is indicated by
the address zero in the address for the previous frame.

This is necessary to complete fixing the libunwind for Aarch64.

MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51699
Build 48590: arc lint + arc unit

Event Timeline

I plan to commit this soon, any objections?

I thought the kernel zeroed these... but I have no objections since my aarch64 fu is weak

In D40277#924038, @imp wrote:

I thought the kernel zeroed these... but I have no objections since my aarch64 fu is weak

For the dynamically linked binaries there is no other proper way to tell the end frame to the unwinder, other than bad heuristic guessing games.
_start is the entry point for binary, which is called by rtld in that case.

This revision is now accepted and ready to land.Jun 20 2023, 12:36 PM
lib/csu/aarch64/crt1_s.S
37–38

whitespace doesn't match it seems -- tabs vs spaces?

lib/csu/aarch64/crt1_s.S
37–38

Hmm, looks like a phabricator rendering problems, the patch contains tabs.
Second argument is just arranged to the second arguments