|
|
Message-ID: <20180824215621.GE4418@port70.net>
Date: Fri, 24 Aug 2018 23:56:21 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH v2] fix tls access on arm targets before armv6k
* Rich Felker <dalias@...c.org> [2018-08-24 16:17:36 -0400]:
> On Fri, Aug 24, 2018 at 09:27:50PM +0200, Szabolcs Nagy wrote:
> > rewrote it in asm to fix a runtime-abi issue.
>
> I've already queued the previous fix. I could replace it since it's
> not pushed, but I'd kinda prefer to make this change independent from
> the bugfix since it's already been done in 2 steps anyway; normally I
> don't like to mix bugfixes with refactoring except when it would be
> hard to do the bugfix independently first.
>
ok.
> > __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
>
> Isn't there an idiomatic "adr" pseudo-mnemonic preferable to use
> instead of the explicit pc arithmetic here? Or is that necessarily
> less efficient?
>
adr r,label sets r to the address of label within a small offset. i don't
think that helps, you can avoid using pc, but it will be more instructions:
ldr r0,1f
adr ip,1f // == add ip,pc,1f-2f
add r0,ip
2: ldr r0,[r0]
bx r0
.align 2
1: .word __a_gettp_ptr - 1b
the main ugliness of the pc arithmetics is that pc evaluates to pc+8 in arm
mode but pc+4 in thumb, that's why i needed label 2, but i think it's fine.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.