Page MenuHomeFreeBSD

Add an implementation of .mcount on arm64.
ClosedPublic

Authored by andrew on Mar 22 2022, 4:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 3, 9:20 AM
Unknown Object (File)
Mon, Aug 26, 11:04 PM
Unknown Object (File)
Jul 14 2024, 6:22 AM
Unknown Object (File)
Jul 14 2024, 6:22 AM
Unknown Object (File)
Jul 10 2024, 4:35 AM
Unknown Object (File)
Jul 4 2024, 3:51 PM
Unknown Object (File)
Jul 4 2024, 12:28 PM
Unknown Object (File)
Jul 4 2024, 3:22 AM
Subscribers

Details

Summary

To support cc -pg on arm64 we need to implement .mcount. As clang and
gcc think it is function like it just needs to load the arguments
to _mcount and call it.

On gcc the first argument is passed in x0, however this is missing on
clang so we need to load it from the stack. As it's the caller return
address this will be at a known location.

PR: 262709

Diff Detail

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

Event Timeline

Add a comment on where frompc comes from

lib/libc/aarch64/Symbol.map
14

I guess adding this to FBSD_1.0 (rather than FBSD_1.7) is appropriate given that this is existing functionality that was just missing from arm64's entry.

Looks OK to me. I think it's worth a comment or commit message note with what we discussed on IRC with respect to caller-saved registers.

This revision is now accepted and ready to land.Mar 22 2022, 6:48 PM
This revision was automatically updated to reflect the committed changes.