summaryrefslogtreecommitdiffstats
path: root/arch/riscv/lib/runtime-offset.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv/lib/runtime-offset.S')
-rw-r--r--arch/riscv/lib/runtime-offset.S12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/riscv/lib/runtime-offset.S b/arch/riscv/lib/runtime-offset.S
new file mode 100644
index 0000000000..f6a0406289
--- /dev/null
+++ b/arch/riscv/lib/runtime-offset.S
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* SPDX-FileCopyrightText: Copyright (c) 2021 Ahmad Fatoum, Pengutronix */
+#include <linux/linkage.h>
+#include <asm/sections.h>
+
+.section ".text_bare_init","ax"
+ENTRY(get_runtime_offset)
+ lla a0, _text /* load addr */
+ la a1, _text /* link addr */
+ sub a0, a0, a1
+ ret
+ENDPROC(get_runtime_offset)