summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-08-06 12:44:50 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-08-06 12:44:50 +0000
commit24f68bac59f686a2de21003524d5085406e1d0c6 (patch)
tree4d3228722ff74455e4d8157e1697fbc8319380f4
parent9d4bdfed62eea2827929b7460479ee70cdf31aed (diff)
downloadeglibc2-24f68bac59f686a2de21003524d5085406e1d0c6.tar.gz
2007-08-06 Paul Brook <paul@codesourcery.com>
* sysdeps/arm/dl-machine.h (elf_machine_dynamic): Add missing indirection in Thumb assembly code. (elf_machine_load_address): Clear T bit of PLT entry contents. (RTLD_START): Mark function symbols as such. Tweak pc-relative addressing to avoid depending on pc read pipeline offset. git-svn-id: svn://svn.eglibc.org/branches/eglibc-2_5@3062 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--ports/ChangeLog.eglibc8
-rw-r--r--ports/sysdeps/arm/dl-machine.h14
2 files changed, 18 insertions, 4 deletions
diff --git a/ports/ChangeLog.eglibc b/ports/ChangeLog.eglibc
index 868aad532..30db4b082 100644
--- a/ports/ChangeLog.eglibc
+++ b/ports/ChangeLog.eglibc
@@ -1,3 +1,11 @@
+2007-08-06 Paul Brook <paul@codesourcery.com>
+
+ * sysdeps/arm/dl-machine.h (elf_machine_dynamic): Add missing
+ indirection in Thumb assembly code.
+ (elf_machine_load_address): Clear T bit of PLT entry contents.
+ (RTLD_START): Mark function symbols as such. Tweak pc-relative
+ addressing to avoid depending on pc read pipeline offset.
+
2007-06-12 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/nptl/bits/local_lim.h: Copy from
diff --git a/ports/sysdeps/arm/dl-machine.h b/ports/sysdeps/arm/dl-machine.h
index 0a27edf54..f839d97b1 100644
--- a/ports/sysdeps/arm/dl-machine.h
+++ b/ports/sysdeps/arm/dl-machine.h
@@ -57,7 +57,7 @@ elf_machine_dynamic (void)
long tmp;
asm ("ldr\t%0, 1f\n\t"
"adr\t%1, 1f\n\t"
- "add\t%0, %1\n\t"
+ "ldr\t%0, [%0, %1]\n\t"
"b 2f\n"
".align 2\n"
"1: .word _GLOBAL_OFFSET_TABLE_ - 1b\n"
@@ -80,6 +80,10 @@ elf_machine_load_address (void)
extern void __dl_start asm ("_dl_start");
Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
Elf32_Addr pcrel_addr;
+#ifdef __thumb__
+ /* Clear the low bit of the funciton address. */
+ got_addr &= ~(Elf32_Addr) 1;
+#endif
asm ("adr %0, _dl_start" : "=r" (pcrel_addr));
return pcrel_addr - got_addr;
}
@@ -151,7 +155,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
#define RTLD_START asm ("\
.text\n\
.globl _start\n\
+.type _start, %function\n\
.globl _dl_start_user\n\
+.type _dl_start_user, %function\n\
_start:\n\
@ we are PIC code, so get global offset table\n\
ldr sl, .L_GET_GOT\n\
@@ -163,8 +169,8 @@ _start:\n\
bl _dl_start\n\
@ returns user entry point in r0\n\
_dl_start_user:\n\
- add sl, pc, sl\n\
-.L_GOT_GOT:\n\
+ adr r6, .L_GET_GOT\n\
+ add sl, sl, r6\n\
ldr r4, [sl, r4]\n\
@ save the entry point in another register\n\
mov r6, r0\n\
@@ -221,7 +227,7 @@ _dl_start_user:\n\
b .L_done_fixup\n\
\n\
.L_GET_GOT:\n\
- .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
+ .word _GLOBAL_OFFSET_TABLE_ - .L_GET_GOT\n\
.L_SKIP_ARGS:\n\
.word _dl_skip_args(GOTOFF)\n\
.L_FINI_PROC:\n\