Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/27212 )
Change subject: util: Implement PIC assembly for the aarch64.
......................................................................
util: Implement PIC assembly for the aarch64.
When accessing m5_mem and building PIC code, we need to get the address
of m5_mem out of the global offset table, and then load the value from
there. If we try to load from m5_mem directly, the assembled code has a
relocation type the linker can't handle when building a shared object.
Change-Id: Ieb19c3d17c37ef810559ee24b68886b18ddcc869
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27212
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M util/m5/src/m5op_arm_A64.S
1 file changed, 11 insertions(+), 1 deletion(-)
Approvals:
Bobby R. Bruce: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/util/m5/src/m5op_arm_A64.S b/util/m5/src/m5op_arm_A64.S
index c0224e2..6f9f038 100644
--- a/util/m5/src/m5op_arm_A64.S
+++ b/util/m5/src/m5op_arm_A64.S
@@ -44,7 +44,17 @@
.macro m5op_func, name, func
.globl \name
\name:
- ldr x9, m5_mem
+ // Load the value of m5_mem into x9...
+#if defined(M5OP_PIC)
+ // using the global offset table.
+ adrp x9, :got:m5_mem
+ ldr x9, [ x9, #:got_lo12:m5_mem ]
+ ldr x9, [ x9 ]
+#else
+ // normally.
+ adrp x9, m5_mem
+ ldr x9, [ x9, #:lo12:m5_mem ]
+#endif
movz x10, #(\func << 8)
ldr x0, [ x9, x10 ]
ret
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27212
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ieb19c3d17c37ef810559ee24b68886b18ddcc869
Gerrit-Change-Number: 27212
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Ciro Santilli <ciro.santi...@arm.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev