path: root/src/thread/sem_trywait.c
diff options
authorRich Felker <>2019-09-11 15:40:26 -0400
committerRich Felker <>2019-09-11 15:53:42 -0400
commit1ef37aa00ea830dfda76e04e3d941cafa74d8b76 (patch)
tree8b35688b0b1ad70fe7b8e343170df0ee40469eb3 /src/thread/sem_trywait.c
parentb0301f47f3cf510b0237a024a3a073d55799101f (diff)
fix arm __tlsdesc_dynamic when built as thumb code without __ARM_ARCH>=5
we don't actually support building asm source files as thumb1, but it's possible that the condition __ARM_ARCH>=5 would be false on old compilers that did not define __ARM_ARCH at all. avoiding that would require enumerating all of the possible __ARM_ARCH_*__ macros for testing. as noted in commit 05870abeaac0588fb9115cfd11f96880a0af2108, mov lr,pc is not valid for saving a return address when in thumb mode. since this code is a hot path (dynamic TLS access), don't do the out-of-line bl->bx chaining to save the return value; instead, use the fact that this file is preprocessed asm to add the missing thumb bit with an add in place of the mov. the change here does not affect builds for ISA levels new enough to have a thread pointer read instruction, or for armv5 and later as long as the compiler properly defines __ARM_ARCH, or for any build as arm (not thumb) code. it's likely that it makes no difference whatsoever to any present-day practical build environments, but nonetheless now it's safe. as an alternative, we could just assume __thumb__ implies availability of blx since we don't support building asm source files as thumb1. I didn't do that in order to avoid having a wrong assumption here if that ever changes.
Diffstat (limited to 'src/thread/sem_trywait.c')
0 files changed, 0 insertions, 0 deletions