diff options
author | Fangrui Song <i@maskray.me> | 2022-02-08 15:51:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 15:51:20 -0800 |
commit | bc6e624fe1167b088af5694bb74eb68d61dde8ba (patch) | |
tree | 1d4cd2f381151d063045f1f6dd1bc65827b0ae8d | |
parent | 90191ad93eac47d61ab9cc89084050ad1541d160 (diff) | |
download | riscv-pk-bc6e624fe1167b088af5694bb74eb68d61dde8ba.zip riscv-pk-bc6e624fe1167b088af5694bb74eb68d61dde8ba.tar.gz riscv-pk-bc6e624fe1167b088af5694bb74eb68d61dde8ba.tar.bz2 |
Fix local variable register usage for ra (#268)
See https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables
"Other than when invoking the Extended asm, the contents of the
specified register are not guaranteed."
Also revert 90191ad93eac47d61ab9cc89084050ad1541d160.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | pk/console.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 7df0b61..81492de 100644 --- a/configure.ac +++ b/configure.ac @@ -91,7 +91,7 @@ AS_IF([test "x$enable_print_device_tree" = "xyes"], [ AC_DEFINE([PK_PRINT_DEVICE_TREE],,[Define if the DTS is to be displayed]) ]) -CFLAGS="-Wall -Werror -D__NO_INLINE__ -mcmodel=medany -O2 -std=gnu99 -Wno-unused -Wno-attributes -Wno-uninitialized -fno-delete-null-pointer-checks -fno-PIE" +CFLAGS="-Wall -Werror -D__NO_INLINE__ -mcmodel=medany -O2 -std=gnu99 -Wno-unused -Wno-attributes -fno-delete-null-pointer-checks -fno-PIE" LDFLAGS="$LDFLAGS -Wl,--build-id=none" AC_SUBST(CFLAGS) diff --git a/pk/console.c b/pk/console.c index 475a93b..cf40a0a 100644 --- a/pk/console.c +++ b/pk/console.c @@ -64,6 +64,5 @@ void do_panic(const char* s, ...) void kassert_fail(const char* s) { - register uintptr_t ra asm ("ra"); - do_panic("assertion failed @ %p: %s\n", ra, s); + do_panic("assertion failed @ %p: %s\n", __builtin_return_address(0), s); } |