about summary refs log tree commit diff
path: root/sysdeps/arc/dl-trampoline.S
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2018-10-23 11:38:32 -0700
committerVineet Gupta <vgupta@synopsys.com>2020-07-10 16:08:44 -0700
commit0e7d930c4c11de896fe807f67fa1eb756c9c1e05 (patch)
treea2ac4ff092909d6071a8ddb6e37c9c6c0ad31d38 /sysdeps/arc/dl-trampoline.S
parent04deeaa9ea74b0679dfc9d9155a37b6425f19a9f (diff)
downloadglibc-0e7d930c4c11de896fe807f67fa1eb756c9c1e05.tar.gz
glibc-0e7d930c4c11de896fe807f67fa1eb756c9c1e05.tar.xz
glibc-0e7d930c4c11de896fe807f67fa1eb756c9c1e05.zip
ARC: ABI Implementation
This code deals with the ARC ABI.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/arc/dl-trampoline.S')
-rw-r--r--sysdeps/arc/dl-trampoline.S72
1 files changed, 72 insertions, 0 deletions
diff --git a/sysdeps/arc/dl-trampoline.S b/sysdeps/arc/dl-trampoline.S
new file mode 100644
index 0000000000..eb2a030046
--- /dev/null
+++ b/sysdeps/arc/dl-trampoline.S
@@ -0,0 +1,72 @@
+/* PLT trampolines.  ARC version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include <libc-symbols.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* resolver has atypical calling ABI (r11 and r12)
+        PLTn which lands us here, sets up
+	r11 = Module info (tpnt pointer as expected by resolver)
+	r12 = PC of the PLTn itself - needed by resolver to find
+	      corresponding .rela.plt entry.  */
+
+ENTRY (_dl_runtime_resolve)
+
+	/* save args to func being resolved before entering resolver.  */
+	push_s	r0
+	push_s	r1
+	push_s	r2
+	push_s	r3
+	st.a	r4, [sp, -4]
+	st.a	r5, [sp, -4]
+	st.a	r6, [sp, -4]
+	st.a	r7, [sp, -4]
+	st.a	r8, [sp, -4]
+	st.a	r9, [sp, -4]
+	cfi_adjust_cfa_offset (40)
+	push_s	blink
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (blink, 0)
+
+	mov_s 	r1, r12
+	bl.d  	_dl_fixup
+	mov   	r0, r11
+
+	/* restore regs back.  */
+	ld.ab	blink,[sp, 4]
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (blink)
+	ld.ab	r9, [sp, 4]
+	ld.ab	r8, [sp, 4]
+	ld.ab	r7, [sp, 4]
+	ld.ab	r6, [sp, 4]
+	ld.ab	r5, [sp, 4]
+	ld.ab	r4, [sp, 4]
+	pop_s   r3
+	pop_s   r2
+	pop_s   r1
+	cfi_adjust_cfa_offset (-36)
+
+	j_s.d   [r0]    /* r0 has resolved function addr.  */
+	pop_s   r0      /* restore first arg to resolved call.  */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (r0)
+END (_dl_runtime_resolve)