Gabe Black has uploaded this change for review. ( 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
---
M util/m5/src/m5op_arm_A64.S
1 file changed, 7 insertions(+), 0 deletions(-)



diff --git a/util/m5/src/m5op_arm_A64.S b/util/m5/src/m5op_arm_A64.S
index c0224e2..3e1d52a 100644
--- a/util/m5/src/m5op_arm_A64.S
+++ b/util/m5/src/m5op_arm_A64.S
@@ -44,7 +44,14 @@
 .macro m5op_func, name, func
         .globl \name
         \name:
+#if defined(M5OP_PIC)
+        /* Load the address of m5_mem from the global offset table. */
+        ldr x9, :got:m5_mem
+        /* Load the value of m5_mem into x9. */
+        ldr x9, [ x9 ]
+#else
         ldr x9, 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: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to