Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RISC-V: Dynamic tracing support #1862

Open
namhyung opened this issue Dec 18, 2023 · 1 comment
Open

RISC-V: Dynamic tracing support #1862

namhyung opened this issue Dec 18, 2023 · 1 comment

Comments

@namhyung
Copy link
Owner

To implement entrire uftrace features, it should support (full) dynamic tracing either with compiler support or not. Specifically it'd support the following but we need to check the compiler implementations first:

  • -mfentry which generates calls to __fentry__
  • -mfentry with -mnop-mcount which would generate NOPs
  • -fpatchable-function-entry which adds NOPs
  • full dynamic tracing of normal binary
@honggyukim
Copy link
Collaborator

I can confirm that -fpatchable-function-entry is available in RISC-V.

$ gcc -fpatchable-function-entry=2 s-abc.c 
$ objdump -d a.out | grep -A 5 "<main>:$"
000000000000076e <main>:
 76e:   0001                    nop
 770:   0001                    nop
 772:   7179                    addi    sp,sp,-48
 774:   f406                    sd      ra,40(sp)
 776:   f022                    sd      s0,32(sp)

But -mfentry and -mnop-mcount are not available just like ARM/AArch64. I think that's only available in i386 and x86_64.

$ gcc -mfenty -mnop-mcount s-abc.c 
gcc: error: unrecognized command-line option '-mfenty'
gcc: error: unrecognized command-line option '-mnop-mcount'

Here is gcc version info.

$ gcc -v 2>&1 | grep Target
Target: riscv64-linux-gnu

$ gcc --version
gcc (Debian 11.3.0-3) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants