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)
Thu, Apr 25, 7:57 AM
Unknown Object (File)
Feb 18 2024, 8:30 AM
Unknown Object (File)
Dec 22 2023, 10:28 PM
Unknown Object (File)
Dec 12 2023, 12:58 AM
Unknown Object (File)
Sep 26 2023, 7:02 PM
Unknown Object (File)
Sep 14 2023, 4:15 AM
Unknown Object (File)
Aug 27 2023, 2:48 PM
Unknown Object (File)
Aug 14 2023, 4:16 AM

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