summaryrefslogtreecommitdiff
path: root/ldso/ldso/sh/resolve.S
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-08 14:35:49 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-08 14:35:49 +0000
commit9cba52f0aedbb95671e8a14e3fd5ff98381ff2b0 (patch)
treedd82b29998103d7d8ba34351e6fc3a12dc0ed7ac /ldso/ldso/sh/resolve.S
parent4c69b9f793fc1eae9190d8ba26dba25db616272f (diff)
Patch from Stefan Allius and Edie C. Dost to add SuperH
shared library support. This also adds some cleaner error handling, which I (Erik) then ported over to x86 and arm. In addition Stefan added the following fixes: - in hash.c was the lvalue handling of global library functions wrong. To fix this I had to change the prototype of _dl_find_hash. (==> TIS and ELF spec. Vers. 1.2) - in ldso.c was the order of the .init sections calls wrong. Before we call the initialization code of a library we have to check that all dependend libraries are already initialized. This can easily made by calling it in the revers loading order. For this I added a previous pointer chain. - in ldso.c the ELF magics wasn't checked fo PPC, MIPS and SH architecture
Diffstat (limited to 'ldso/ldso/sh/resolve.S')
-rw-r--r--ldso/ldso/sh/resolve.S69
1 files changed, 69 insertions, 0 deletions
diff --git a/ldso/ldso/sh/resolve.S b/ldso/ldso/sh/resolve.S
new file mode 100644
index 000000000..4d8eee6c2
--- /dev/null
+++ b/ldso/ldso/sh/resolve.S
@@ -0,0 +1,69 @@
+/*
+ * Stolen from glibc-2.2.2 by Eddie C. Dost <ecd@atecom.com>
+ */
+
+ .text
+ .globl _dl_linux_resolve
+ .type _dl_linux_resolve, @function
+ .balign 16
+_dl_linux_resolve:
+ mov.l r3, @-r15
+ mov.l r4, @-r15
+ mov.l r5, @-r15
+ mov.l r6, @-r15
+ mov.l r7, @-r15
+ mov.l r12, @-r15
+ movt r3 ! Save T flag
+ mov.l r3, @-r15
+
+#ifdef HAVE_FPU
+ sts.l fpscr, @-r15
+ mov #8,r3
+ swap.w r3, r3
+ lds r3, fpscr
+ fmov.s fr11, @-r15
+ fmov.s fr10, @-r15
+ fmov.s fr9, @-r15
+ fmov.s fr8, @-r15
+ fmov.s fr7, @-r15
+ fmov.s fr6, @-r15
+ fmov.s fr5, @-r15
+ fmov.s fr4, @-r15
+#endif
+ sts.l pr, @-r15
+
+ mov r2, r4 ! link map address
+
+ mov.l 3f, r0
+ jsr @r0 ! Call resolver
+ mov r1, r5 ! Reloc offset
+
+ lds.l @r15+, pr ! Get register content back
+
+#ifdef HAVE_FPU
+ fmov.s @r15+, fr4
+ fmov.s @r15+, fr5
+ fmov.s @r15+, fr6
+ fmov.s @r15+, fr7
+ fmov.s @r15+, fr8
+ fmov.s @r15+, fr9
+ fmov.s @r15+, fr10
+ fmov.s @r15+, fr11
+ lds.l @r15+, fpscr
+#endif
+
+ mov.l @r15+, r3
+ shal r3 ! Load T flag
+ mov.l @r15+, r12
+ mov.l @r15+, r7
+ mov.l @r15+, r6
+ mov.l @r15+, r5
+ mov.l @r15+, r4
+ jmp @r0 ! Jump to function address
+ mov.l @r15+, r3
+
+ .balign 4
+3:
+ .long _dl_linux_resolver
+ .size _dl_linux_resolve, . - _dl_linux_resolve
+