Page MenuHomeFreeBSD

csu: Implement _start using as to satisfy unwinders on i386
ClosedPublic

Authored by dchagin on Jun 20 2023, 12:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 4:00 PM
Unknown Object (File)
Fri, Sep 27, 3:08 AM
Unknown Object (File)
Thu, Sep 26, 11:40 AM
Unknown Object (File)
Wed, Sep 25, 2:48 PM
Unknown Object (File)
Tue, Sep 24, 6:54 AM
Unknown Object (File)
Mon, Sep 23, 5:36 AM
Unknown Object (File)
Mon, Sep 23, 1:49 AM
Unknown Object (File)
Mon, Sep 23, 1:31 AM
Subscribers

Details

Summary

The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/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.

The hack localizing _start1 symbol removed.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dchagin added a reviewer: kib.

I suggest don't waste time with rewriting _start1 on i386

I suggest don't waste time with rewriting _start1 on i386

What do you mean? i386 userspace, unlike kernel, is there with us for long time.

In D40624#928940, @kib wrote:

I suggest don't waste time with rewriting _start1 on i386

What do you mean? i386 userspace, unlike kernel, is there with us for long time.

Sure, I want to finish our arm64 and libunwind before 14.0 is out to release a libunwind too, and after that I want to finish i386,
but I'm not sure I have enough time for i386 due to arm64 has much more unresolved issues

btw, with latest changes libunwind x86_64 make check is green, thank you

dchagin edited the summary of this revision. (Show Details)

Implement _start using as

cfi_offsett for %ebp set to -4, ie to 0

lib/csu/Makefile.inc
47

The main reason why I mostly agree with the change, is due to removal of the hack for _start1.

lib/csu/i386/crt1_s.S
81

This comment should go into the #else block.

csu: Implement _start using as to satisfy unwinders on i386

The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/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.

The hack localizing _start1 symbol removed.

I suppose the latest comment is really a commit message.

lib/csu/i386/crt1_s.S
57

why not use the local 1: label and then calll 1f?

This revision is now accepted and ready to land.Jul 10 2023, 10:15 AM

.L was used due to it not entered into the symbol table, replaced by numbered labels.

This revision now requires review to proceed.Jul 10 2023, 11:13 AM
dchagin retitled this revision from csu: Add stop indicator to _start to satisfy unwinders on i386 to csu: Implement _start using as to satisfy unwinders on i386.Jul 10 2023, 11:14 AM
dchagin edited the summary of this revision. (Show Details)
dchagin marked 2 inline comments as done.
This revision is now accepted and ready to land.Jul 10 2023, 11:42 AM