summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2002-12-04 01:19:37 +0000
committerthorpej <thorpej@NetBSD.org>2002-12-04 01:19:37 +0000
commit044aeabaad9ef5efda3160bb2655c043b98663fa (patch)
tree7eed4d56e4b420522d1c6d2b323688e737801871 /libexec
parent805040f592b516dff0f75bfd2b2b56391a4db9d1 (diff)
Bintuils-current initializes the GOT entries to 0 (instead of the
base-relative offsets that were placed there previously), so we must use a different mechanism to compute our reloc base. Patch from Charles Hannum.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.elf_so/arch/powerpc/rtld_start.S22
1 files changed, 13 insertions, 9 deletions
diff --git a/libexec/ld.elf_so/arch/powerpc/rtld_start.S b/libexec/ld.elf_so/arch/powerpc/rtld_start.S
index 379f897b49a..b1dd76ca169 100644
--- a/libexec/ld.elf_so/arch/powerpc/rtld_start.S
+++ b/libexec/ld.elf_so/arch/powerpc/rtld_start.S
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld_start.S,v 1.12 2002/10/31 20:23:25 matt Exp $ */
+/* $NetBSD: rtld_start.S,v 1.13 2002/12/04 01:19:37 thorpej Exp $ */
/*-
* Copyright (C) 1998 Tsubai Masanari
@@ -44,19 +44,23 @@ _rtld_start:
/* stw %r7,28(%r1) # cleanup (always 0) */
stw %r8,32(%r1) # ps_strings
- bl _GLOBAL_OFFSET_TABLE_@local-4
+ bl _GLOBAL_OFFSET_TABLE_-4@local
mflr %r31 # r31 = (real) GOT
- lwz %r30,_GLOBAL_OFFSET_TABLE_@got(31)
- # the linker thought GOT were ...
- lwz %r3,_DYNAMIC@got(%r31)
-
- subf %r4,%r30,%r31 # r4 = relocbase
- add %r3,%r3,%r4 # r3 = &_DYNAMIC
+ lwz %r28,0(%r31) # base-relative &_DYNAMIC
+
+ bl 0f # lr = next instruction
+ b _DYNAMIC@local
+0: mflr %r30
+ lwz %r29,0(%r30) # load instruction contents
+ rlwinm %r29,%r29,0,6,29 # extract PC offset
+ add %r3,%r29,%r30 # r3 = &_DYNAMIC
+ sub %r28,%r3,%r28
+ mr %r4,%r28 # r4 = relocbase
bl _rtld_relocate_nonplt_self@plt
- subf 4,30,31 # r4 = relocbase
lwz %r3,16(%r1)
addi %r3,%r3,-12 # sp = &argv[-3] /* XXX */
+ mr %r4,%r28 # r4 = relocbase
bl _rtld@plt # _start = _rtld(sp, relocbase)
mtlr %r3