Skip to content

Commit

Permalink
aarch64: Fix floating point retval recording
Browse files Browse the repository at this point in the history
It seems that the address of 'float_retval' is loaded instead of its
return value, so it has to be dereferenced when it's passed to inline
assembly code.

Before:
  $ gcc -pg -g float.c
  $ uftrace -R float_add@retval/f32 -F float_add a.out
  0.100000
  # DURATION     TID     FUNCTION
     8.959 us [  4424] | float_add() = -593125376.000000;

After:
  $ gcc -pg -g float.c
  $ uftrace -R float_add@retval/f32 -F float_add a.out
  0.100000
  # DURATION     TID     FUNCTION
     1.303 us [  4653] | float_add() = 0.100000;

Signed-off-by: Honggyu Kim <[email protected]>
  • Loading branch information
honggyukim committed Feb 12, 2020
1 parent a0fbee4 commit 251ba74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/aarch64/mcount-support.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ void mcount_arch_get_retval(struct mcount_arg_context *ctx,
if (spec->size <= 4) {
asm volatile ("ldr s0, %1\n"
"str s0, %0\n" :
"=m" (ctx->val.v) : "m" (float_retval));
"=m" (ctx->val.v) : "m" (*float_retval));
}
else {
asm volatile ("ldr d0, %1\n"
"str d0, %0\n" :
"=m" (ctx->val.v) : "m" (float_retval));
"=m" (ctx->val.v) : "m" (*float_retval));
}
}
else
Expand Down

0 comments on commit 251ba74

Please sign in to comment.