* [PATCH roland/arm-sfi-tlsdesc] ARM: Make dl-tlsdesc.S use sfi_breg, respect ARM_ALWAYS_BX and ARM_NO_INDEX_REGISTER.
@ 2013-03-15 21:10 Roland McGrath
2013-03-15 23:38 ` Joseph S. Myers
0 siblings, 1 reply; 2+ messages in thread
From: Roland McGrath @ 2013-03-15 21:10 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: libc-ports
Verified on armv7l-linux-gnueabihf that no object code changes.
There is lots more nontrivial work involved in making dynamic linking work
for arm-nacl and I'm not tackling that yet. But it was easy enough to hack
up dl-tlsdesc.S in isolation, so I did it early.
Thanks,
Roland
ports/ChangeLog.arm
2013-03-15 Roland McGrath <roland@hack.frob.com>
* sysdeps/arm/dl-tlsdesc.S: Include <arm-features.h>.
Use sfi_breg macro throughout.
(_dl_tlsdesc_dynamic) [!ARM_NO_INDEX_REGISTER]: Avoid two-register
addressing mode.
(_dl_tlsdesc_dynamic) [ARM_ALWAYS_BX]: Don't pop into pc.
* sysdeps/arm/arm-features.h: Add comment for ARM_NO_INDEX_REGISTER.
--- a/ports/sysdeps/arm/arm-features.h
+++ b/ports/sysdeps/arm/arm-features.h
@@ -53,4 +53,7 @@
# define ARM_BX_ALIGN_LOG2 2
#endif
+/* An OS-specific arm-features.h file may define ARM_NO_INDEX_REGISTER to
+ indicate that the two-register addressing modes must never be used. */
+
#endif /* arm-features.h */
--- a/ports/sysdeps/arm/dl-tlsdesc.S
+++ b/ports/sysdeps/arm/dl-tlsdesc.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <arm-features.h>
#include <tls.h>
#include "tlsdesc.h"
@@ -31,7 +32,8 @@
.fnstart
.align 2
_dl_tlsdesc_return:
- ldr r0, [r0]
+ sfi_breg r0, \
+ ldr r0, [\B]
BX (lr)
.fnend
cfi_endproc
@@ -90,16 +92,27 @@ _dl_tlsdesc_dynamic:
cfi_rel_offset (r3,4)
cfi_rel_offset (r4,8)
cfi_rel_offset (lr,12)
- ldr r1, [r0] /* td */
+ sfi_breg r0, \
+ ldr r1, [\B] /* td */
GET_TLS (lr)
mov r4, r0 /* r4 = tp */
- ldr r0, [r0]
- ldr r2, [r1, #8] /* gen_count */
- ldr r3, [r0]
+ sfi_breg r0, \
+ ldr r0, [\B]
+ sfi_breg r1, \
+ ldr r2, [\B, #8] /* gen_count */
+ sfi_breg r0, \
+ ldr r3, [\B]
cmp r2, r3
bhi 1f
- ldr r3, [r1]
+ sfi_breg r1, \
+ ldr r3, [\B]
+#ifndef ARM_NO_INDEX_REGISTER
ldr r2, [r0, r3, lsl #3]
+#else
+ add lr, r0, r3, lsl #3
+ sfi_breg lr, \
+ ldr r2, [\B]
+#endif
cmn r2, #1
ittt ne
ldrne r3, [r1, #4]
@@ -110,7 +123,8 @@ _dl_tlsdesc_dynamic:
bl __tls_get_addr
rsb r0, r4, r0
2:
-#if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__)
+#if ((defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__)) \
+ || defined (ARM_ALWAYS_BX))
pop {r2,r3,r4, lr}
cfi_adjust_cfa_offset (-16)
cfi_restore (lr)
@@ -163,7 +177,8 @@ _dl_tlsdesc_lazy_resolver:
pop {r2}
cfi_adjust_cfa_offset (-4)
cfi_restore (r2)
- ldr r1, [r0, #4]
+ sfi_breg r0, \
+ ldr r1, [\B, #4]
BX (r1)
.fnend
cfi_endproc
@@ -202,7 +217,8 @@ _dl_tlsdesc_resolve_hold:
pop {r2}
cfi_adjust_cfa_offset (-4)
cfi_restore (r2)
- ldr r1, [r0, #4]
+ sfi_breg r0, \
+ ldr r1, [\B, #4]
BX (r1)
.fnend
cfi_endproc
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH roland/arm-sfi-tlsdesc] ARM: Make dl-tlsdesc.S use sfi_breg, respect ARM_ALWAYS_BX and ARM_NO_INDEX_REGISTER.
2013-03-15 21:10 [PATCH roland/arm-sfi-tlsdesc] ARM: Make dl-tlsdesc.S use sfi_breg, respect ARM_ALWAYS_BX and ARM_NO_INDEX_REGISTER Roland McGrath
@ 2013-03-15 23:38 ` Joseph S. Myers
0 siblings, 0 replies; 2+ messages in thread
From: Joseph S. Myers @ 2013-03-15 23:38 UTC (permalink / raw)
To: Roland McGrath; +Cc: libc-ports
On Fri, 15 Mar 2013, Roland McGrath wrote:
> 2013-03-15 Roland McGrath <roland@hack.frob.com>
>
> * sysdeps/arm/dl-tlsdesc.S: Include <arm-features.h>.
> Use sfi_breg macro throughout.
> (_dl_tlsdesc_dynamic) [!ARM_NO_INDEX_REGISTER]: Avoid two-register
> addressing mode.
> (_dl_tlsdesc_dynamic) [ARM_ALWAYS_BX]: Don't pop into pc.
>
> * sysdeps/arm/arm-features.h: Add comment for ARM_NO_INDEX_REGISTER.
OK.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-15 23:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 21:10 [PATCH roland/arm-sfi-tlsdesc] ARM: Make dl-tlsdesc.S use sfi_breg, respect ARM_ALWAYS_BX and ARM_NO_INDEX_REGISTER Roland McGrath
2013-03-15 23:38 ` Joseph S. Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).