diff options
author | Cherry Zhang <cherryyz@google.com> | 2019-02-15 23:22:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-02-15 23:22:29 +0000 |
commit | fba70f605e759144eeebfaabcf12756906578d59 (patch) | |
tree | edf18f3e7cae2f28d16b5bc522be03d23f734de5 /libgo | |
parent | 9695618899f4f85d1e9fdbe7728d0e238b99511c (diff) | |
download | gcc-fba70f605e759144eeebfaabcf12756906578d59.zip gcc-fba70f605e759144eeebfaabcf12756906578d59.tar.gz gcc-fba70f605e759144eeebfaabcf12756906578d59.tar.bz2 |
compiler,runtime: use __builtin_dwarf_cfa for getcallersp
Currently, the compiler lowers runtime.getcallersp to
__builtin_frame_address(1). In the C side of the runtime,
getcallersp is defined as __builtin_frame_address(0). They don't
match. Further, neither of them actually returns the caller's SP.
On AMD64, __builtin_frame_address(0) just returns the frame
pointer. __builtin_frame_address(1) returns the memory content
where the frame pointer points to, which is typically the
caller's frame pointer but can also be garbage if the frame
pointer is not enabled.
This CL changes it to use __builtin_dwarf_cfa(), which returns
the caller's SP at the call site. This matches the SP we get
from unwinding the stack.
Currently getcallersp is not used for anything real. It will be
used for precise stack scan (a new version of CL 159098).
Reviewed-on: https://go-review.googlesource.com/c/162905
* go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_dwarf_cfa
instead of __builtin_frame_address.
From-SVN: r268952
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/runtime.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index a6135b0..97b1f11 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -268,7 +268,7 @@ void* runtime_sysAlloc(uintptr, uint64*) void runtime_sysFree(void*, uintptr, uint64*) __asm__ (GOSYM_PREFIX "runtime.sysFree"); void runtime_mprofinit(void); -#define runtime_getcallersp() __builtin_frame_address(0) +#define runtime_getcallersp() __builtin_dwarf_cfa() void runtime_mcall(FuncVal*) __asm__ (GOSYM_PREFIX "runtime.mcall"); int32 runtime_timediv(int64, int32, int32*) |