-
Notifications
You must be signed in to change notification settings - Fork 479
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
arch/riscv64: Update argument handling feature to support riscv64 #1824
Conversation
dba41c0
to
56fb6e4
Compare
We have not yet resolved the issues identified in the previous PR. And I got the same error message as below.
|
56fb6e4
to
4a38fcf
Compare
The following error when building with
However, one more error remains, and it occurs at runtime
|
4a38fcf
to
71533d6
Compare
I solved the error below, please see the link below for details.
And Finally, we can finally check string arguments in a RISC-V environment!
|
I see it's fixed. $ ./uftrace -a ./t-arg
# DURATION TID FUNCTION
[364301] | main(1, 0x3fcd72d448) {
[364301] | foo(3) {
264.254 us [364301] | bar(2, "c") = 0;
1.250 us [364301] | bar(1, "b") = 0;
0.750 us [364301] | bar(0, "a") = 0;
273.254 us [364301] | } = 0; /* foo */
1.250 us [364301] | many(12) = 0;
[364301] | pass(3) {
1.501 us [364301] | check(big{...}, 0x3fcd72d200) = 0;
4.501 us [364301] | } = 0; /* pass */
286.255 us [364301] | } = 0; /* main */ |
@@ -281,6 +281,9 @@ static int read_cpuinfo(void *arg) | |||
else if (!strncmp(info->cpudesc, "ARM64", 5)) { | |||
handle->arch = UFT_CPU_AARCH64; | |||
} | |||
else if (!strncmp(info->cpudesc, "RISCV64", 7)) { | |||
handle->arch = UFT_CPU_RISCV64; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this part should be in #1815 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's related to the cpuinfo.c
code I added in #1815, so I'll move it as per your feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a commit to ensure a successful build in a RISC-V 64bit environment, no functional behavior is implemented. Tested-by: Seonghee Jin <[email protected]> Co-authored-by: Honggyu Kim <[email protected]> Signed-off-by: Gichoel Choi <[email protected]>
In order to figure out the address of parent_loc, we need the frame pointer, but compiler optimization such as `-O2` in gcc removes the `fp` so we won't be able know where to change to hijack the return address to `mcount_return`. This problem only happens in gcc, but not in clang. To avoid the problem, `-fno-omit-frame-pointer` must be used when gcc optimization option is used in riscv64. Tested-by: Seonghee Jin <[email protected]> Tested-by: Paran Lee <[email protected]> Co-authored-by: Honggyu Kim <[email protected]> Signed-off-by: Gichoel Choi <[email protected]>
This is work to support argument handling on the RISC-V 64-bit architecture. If you are curious about how RISC-V 64bit register numbers map to DWARF register numbers, please refer to the 'RISC-V Run-time ABI Specification' in 'RISC-V ELF psABI'. Tested-by: Seonghee Jin <[email protected]> Tested-by: Jungmin Kim <[email protected]> Tested-by: SeokMin Kwon <[email protected]> Reviewed-by: Honggyu Kim <[email protected]> Signed-off-by: Gichoel Choi <[email protected]>
71533d6
to
aad0773
Compare
Hello, @gichoel, Thank you for your amazing contribution :D Could you update the commit messages like, Thank you! |
Note that 50/72 rule is not hard for us, but please consider it as a general advice. |
Hello, @MichelleJin12, I only remembered the part about the body having to be within 72 characters, but forgot the part about the title having to be within 50 characters. Thanks for checking! |
I will close this PR in the next few days based on the discussion in the link below and then move the commit to "arch/riscv64: Add basic mcount tracing support for RISC-V 64bit PR". If you're interested in argument handling on the RISC-V architecture and want to see what happens next, see #1815. |
This pull request is a porting effort to support Argument Handling in the RISC-V 64-bit architecture environment.
This feature has been tested on the VisionFive2 RISC-V board.
The following features are not yet supported
A list of PRs related to porting to the RISC-V 64-bit architecture is provided below.
This PR was born out of this issue.