summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2006-11-10 20:37:45 +0000
committerEric Andersen <andersen@codepoet.org>2006-11-10 20:37:45 +0000
commit90c3c3ed5eec1062168d1ac0beb41044a9de7c58 (patch)
tree1ae4dd623f6b09dadc59b318e7958d71c07a6446 /ldso
parentf7dfb7453d8c0a66ba0de0446d1dcfc5afc29118 (diff)
arm thumb:
Put the call_via_rx code into each executable - call_via_ip cannot possibly work if called through the PLT! ldso requires this code too as it is not linked with the crt stuff and thumb ldso does make calls via a register. The patch puts the code into crti.S so that it is linked into every normally built application (if thumb or interworking is selected). This is only 30 extra bytes and it works - the previous code did not because nothing both implemented and exported the APIs (they were in libgcc, but not in the version script). crti.S and crtn.S is also brought up to date with GCC 3.4.4 - this is essential for thumb support because the .init and .fini sections must use arm or thumb code to match the compilation of the libraries. Note that code which pushes stuff into .init or .fini must be compiled with or without -mthumb to match the uclibc compilation - and gcc itself (which does do this) must therefore be compiled to match.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/arm/dl-syscalls.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/ldso/ldso/arm/dl-syscalls.h b/ldso/ldso/arm/dl-syscalls.h
index 4b42a57e0..ecbe96a1c 100644
--- a/ldso/ldso/arm/dl-syscalls.h
+++ b/ldso/ldso/arm/dl-syscalls.h
@@ -4,4 +4,39 @@
extern int _dl_errno;
#undef __set_errno
#define __set_errno(X) {(_dl_errno) = (X);}
+/* _call_via_rX calls are used in thumb ldso because of calls via
+ * function pointers, but ldso is not linked with anything which
+ * provides them, so define them here (only required for thumb).
+ */
+#if defined(__thumb__)
+asm(
+ ".macro call_via register\n"
+ " .global _call_via_\\register\n"
+ " .hidden _call_via_\\register\n"
+ " .type _call_via_\\register, %function\n"
+ " .thumb_func\n"
+ "_call_via_\\register:\n"
+ " bx \\register\n"
+ " .size _call_via_\\register, . - _call_via_\\register\n"
+ ".endm\n"
+ ".text\n"
+ ".thumb\n"
+ ".align 1\n"
+ " call_via r0\n"
+ " call_via r1\n"
+ " call_via r2\n"
+ " call_via r3\n"
+ " call_via r4\n"
+ " call_via r5\n"
+ " call_via r6\n"
+ " call_via r7\n"
+ " call_via r8\n"
+ " call_via r9\n"
+ " call_via r10\n"
+ " call_via r11\n"
+ " call_via r12\n"
+ " call_via r13\n"
+ " call_via r14\n"
+);
+#endif