musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2018年08月24日 23:11:59 +0000
committerRich Felker <dalias@aerifal.cx>2018年08月28日 17:08:14 -0400
commit056f9d818eaf1dbe9e9d63b64b109fd9b608fa36 (patch)
treec6b94b438e17f8618275279f62fc56c30052408a /src
parentcdbbcfb8f5d748f17694a5cc404af4b9381ff95f (diff)
downloadmusl-056f9d818eaf1dbe9e9d63b64b109fd9b608fa36.tar.gz
rewrite __aeabi_read_tp in asm
__aeabi_read_tp used to call c code, but that was incorrect as the arm runtime abi specifies special pcs for this function: it is only allowed to clobber r0, ip, lr and cpsr. maintainer's note: the old code explicitly saved and restored all general-purpose registers which are call-clobbered in the normal calling convention, so it's unlikely that any real-world compilers produced code that could break. however theoretically they could have chosen to use floating point registers, in which case the caller's values of those registers would be clobbered.
Diffstat (limited to 'src')
-rw-r--r--src/thread/arm/__aeabi_read_tp.s 10
-rw-r--r--src/thread/arm/__aeabi_read_tp_c.c 8
2 files changed, 6 insertions, 12 deletions
diff --git a/src/thread/arm/__aeabi_read_tp.s b/src/thread/arm/__aeabi_read_tp.s
index 9d0cd311..2585620c 100644
--- a/src/thread/arm/__aeabi_read_tp.s
+++ b/src/thread/arm/__aeabi_read_tp.s
@@ -2,7 +2,9 @@
.global __aeabi_read_tp
.type __aeabi_read_tp,%function
__aeabi_read_tp:
- push {r1,r2,r3,lr}
- bl __aeabi_read_tp_c
- pop {r1,r2,r3,lr}
- bx lr
+ ldr r0,1f
+ add r0,r0,pc
+ ldr r0,[r0]
+2: bx r0
+ .align 2
+1: .word __a_gettp_ptr - 2b
diff --git a/src/thread/arm/__aeabi_read_tp_c.c b/src/thread/arm/__aeabi_read_tp_c.c
deleted file mode 100644
index 0c56d613..00000000
--- a/src/thread/arm/__aeabi_read_tp_c.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "pthread_impl.h"
-#include <stdint.h>
-
-__attribute__((__visibility__("hidden")))
-void *__aeabi_read_tp_c(void)
-{
- return TP_ADJ(__pthread_self());
-}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月30日 14:48:55 +0000

AltStyle によって変換されたページ (->オリジナル) /