aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-03-17 15:39:02 -0700
committerAndrew Waterman <andrew@sifive.com>2017-03-29 19:47:17 -0700
commitd5f7bd296f72c1a75a910aff6dd9c43f4365a188 (patch)
treeb9def235c120b51596f921ef7b91a1b5b8a13db6
parent610e0cb499a807287320fb13701cdee373a0a091 (diff)
downloadriscv-tests-d5f7bd296f72c1a75a910aff6dd9c43f4365a188.zip
riscv-tests-d5f7bd296f72c1a75a910aff6dd9c43f4365a188.tar.gz
riscv-tests-d5f7bd296f72c1a75a910aff6dd9c43f4365a188.tar.bz2
Prohibit relaxing the initial gp generation
I've added an additional linker relaxation that relaxes two instruction pc-relative sequences to one instruction gp relative sequences when possible. This sequence now optimizes the initial gp generation to mv gp, gp which is obviously bogus. The fix is to disable relaxations when setting up gp, preventing the linker from relaxing away this setup code.
-rw-r--r--benchmarks/common/crt.S3
-rwxr-xr-xdebug/programs/entry.S3
2 files changed, 6 insertions, 0 deletions
diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S
index 3e6cee4..d75e81e 100644
--- a/benchmarks/common/crt.S
+++ b/benchmarks/common/crt.S
@@ -111,7 +111,10 @@ _start:
csrw mtvec, t0
# initialize global pointer
+.option push
+.option norelax
la gp, __global_pointer$
+.option pop
la tp, _end + 63
and tp, tp, -64
diff --git a/debug/programs/entry.S b/debug/programs/entry.S
index b507a93..e021860 100755
--- a/debug/programs/entry.S
+++ b/debug/programs/entry.S
@@ -35,7 +35,10 @@ handle_reset:
csrwi mie, 0
# initialize global pointer
+.option push
+.option norelax
la gp, __global_pointer$
+.option pop
# initialize stack pointer
la sp, stack_top