mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s
@ 2019-09-18  6:04 Andre McCurdy
  2019-09-18 14:28 ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Andre McCurdy @ 2019-09-18  6:04 UTC (permalink / raw)
  To: musl; +Cc: Andre McCurdy

The R_ARM_THM_JUMP19 relocation type generated for the original code
when targeting Thumb 2 is not supported by the gold linker:

 | .../arm-oe-linux-musleabi/9.2.0/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
 | src/signal/arm/sigsetjmp.s:9: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19
---
 src/signal/arm/sigsetjmp.s | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/signal/arm/sigsetjmp.s b/src/signal/arm/sigsetjmp.s
index 318addba..69ebbf49 100644
--- a/src/signal/arm/sigsetjmp.s
+++ b/src/signal/arm/sigsetjmp.s
@@ -6,9 +6,10 @@
 sigsetjmp:
 __sigsetjmp:
 	tst r1,r1
-	beq setjmp
+	bne 1f
+	b setjmp
 
-	str lr,[r0,#256]
+1:	str lr,[r0,#256]
 	str r4,[r0,#260+8]
 	mov r4,r0
 
-- 
2.23.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s
  2019-09-18  6:04 [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s Andre McCurdy
@ 2019-09-18 14:28 ` Khem Raj
  2019-09-18 17:52   ` Andre McCurdy
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2019-09-18 14:28 UTC (permalink / raw)
  To: musl; +Cc: Andre McCurdy

On Tue, Sep 17, 2019 at 11:04 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>
> The R_ARM_THM_JUMP19 relocation type generated for the original code
> when targeting Thumb 2 is not supported by the gold linker:
>
>  | .../arm-oe-linux-musleabi/9.2.0/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
>  | src/signal/arm/sigsetjmp.s:9: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19

if it is thumb2 specific another option could be to use `it eq` before
beq which should turn branch into an unconditional branch, which then
uses R_ARM_THM_JUMP24 relocation that has a range of 16MB.

> ---
>  src/signal/arm/sigsetjmp.s | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/signal/arm/sigsetjmp.s b/src/signal/arm/sigsetjmp.s
> index 318addba..69ebbf49 100644
> --- a/src/signal/arm/sigsetjmp.s
> +++ b/src/signal/arm/sigsetjmp.s
> @@ -6,9 +6,10 @@
>  sigsetjmp:
>  __sigsetjmp:
>         tst r1,r1
> -       beq setjmp
> +       bne 1f
> +       b setjmp
>
> -       str lr,[r0,#256]
> +1:     str lr,[r0,#256]
>         str r4,[r0,#260+8]
>         mov r4,r0
>
> --
> 2.23.0
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s
  2019-09-18 14:28 ` Khem Raj
@ 2019-09-18 17:52   ` Andre McCurdy
  2019-09-18 19:54     ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Andre McCurdy @ 2019-09-18 17:52 UTC (permalink / raw)
  To: Khem Raj; +Cc: musl

On Wed, Sep 18, 2019 at 7:29 AM Khem Raj <raj.khem@gmail.com> wrote:
> On Tue, Sep 17, 2019 at 11:04 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> >
> > The R_ARM_THM_JUMP19 relocation type generated for the original code
> > when targeting Thumb 2 is not supported by the gold linker:
> >
> >  | .../arm-oe-linux-musleabi/9.2.0/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
> >  | src/signal/arm/sigsetjmp.s:9: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19
>
> if it is thumb2 specific another option could be to use `it eq` before
> beq which should turn branch into an unconditional branch, which then
> uses R_ARM_THM_JUMP24 relocation that has a range of 16MB.

That would work too. Thumb 2 specific code would need to be guarded by
#ifdef __thumb2__ though (which I think implies also renaming the file
from .s to .S ?) and I'm not sure if the extra complexity justifies
saving one instruction in the ARM case.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s
  2019-09-18 17:52   ` Andre McCurdy
@ 2019-09-18 19:54     ` Rich Felker
  2019-11-21 20:54       ` Andre McCurdy
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2019-09-18 19:54 UTC (permalink / raw)
  To: musl

On Wed, Sep 18, 2019 at 10:52:13AM -0700, Andre McCurdy wrote:
> On Wed, Sep 18, 2019 at 7:29 AM Khem Raj <raj.khem@gmail.com> wrote:
> > On Tue, Sep 17, 2019 at 11:04 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> > >
> > > The R_ARM_THM_JUMP19 relocation type generated for the original code
> > > when targeting Thumb 2 is not supported by the gold linker:
> > >
> > >  | .../arm-oe-linux-musleabi/9.2.0/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
> > >  | src/signal/arm/sigsetjmp.s:9: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19
> >
> > if it is thumb2 specific another option could be to use `it eq` before
> > beq which should turn branch into an unconditional branch, which then
> > uses R_ARM_THM_JUMP24 relocation that has a range of 16MB.
> 
> That would work too. Thumb 2 specific code would need to be guarded by
> #ifdef __thumb2__ though (which I think implies also renaming the file
> from .s to .S ?) and I'm not sure if the extra complexity justifies
> saving one instruction in the ARM case.

I don't think it does. Also, current style is not to use "it" at all,
but rather -Wa,-mimplicit-it=always. I'm not sure if unified syntax
accepts "it" in arm mode when the following insn has a matching
condition suffix, but here it wouldn't I think...

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s
  2019-09-18 19:54     ` Rich Felker
@ 2019-11-21 20:54       ` Andre McCurdy
  2019-12-07 18:03         ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Andre McCurdy @ 2019-11-21 20:54 UTC (permalink / raw)
  To: musl

On Wed, Sep 18, 2019 at 12:54 PM Rich Felker <dalias@libc.org> wrote:
> On Wed, Sep 18, 2019 at 10:52:13AM -0700, Andre McCurdy wrote:
> > On Wed, Sep 18, 2019 at 7:29 AM Khem Raj <raj.khem@gmail.com> wrote:
> > > On Tue, Sep 17, 2019 at 11:04 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> > > >
> > > > The R_ARM_THM_JUMP19 relocation type generated for the original code
> > > > when targeting Thumb 2 is not supported by the gold linker:
> > > >
> > > >  | .../arm-oe-linux-musleabi/9.2.0/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
> > > >  | src/signal/arm/sigsetjmp.s:9: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19
> > >
> > > if it is thumb2 specific another option could be to use `it eq` before
> > > beq which should turn branch into an unconditional branch, which then
> > > uses R_ARM_THM_JUMP24 relocation that has a range of 16MB.
> >
> > That would work too. Thumb 2 specific code would need to be guarded by
> > #ifdef __thumb2__ though (which I think implies also renaming the file
> > from .s to .S ?) and I'm not sure if the extra complexity justifies
> > saving one instruction in the ARM case.
>
> I don't think it does. Also, current style is not to use "it" at all,
> but rather -Wa,-mimplicit-it=always. I'm not sure if unified syntax
> accepts "it" in arm mode when the following insn has a matching
> condition suffix, but here it wouldn't I think...

Any issues with merging this now?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s
  2019-11-21 20:54       ` Andre McCurdy
@ 2019-12-07 18:03         ` Rich Felker
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2019-12-07 18:03 UTC (permalink / raw)
  To: musl

On Thu, Nov 21, 2019 at 12:54:41PM -0800, Andre McCurdy wrote:
> On Wed, Sep 18, 2019 at 12:54 PM Rich Felker <dalias@libc.org> wrote:
> > On Wed, Sep 18, 2019 at 10:52:13AM -0700, Andre McCurdy wrote:
> > > On Wed, Sep 18, 2019 at 7:29 AM Khem Raj <raj.khem@gmail.com> wrote:
> > > > On Tue, Sep 17, 2019 at 11:04 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> > > > >
> > > > > The R_ARM_THM_JUMP19 relocation type generated for the original code
> > > > > when targeting Thumb 2 is not supported by the gold linker:
> > > > >
> > > > >  | .../arm-oe-linux-musleabi/9.2.0/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
> > > > >  | src/signal/arm/sigsetjmp.s:9: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19
> > > >
> > > > if it is thumb2 specific another option could be to use `it eq` before
> > > > beq which should turn branch into an unconditional branch, which then
> > > > uses R_ARM_THM_JUMP24 relocation that has a range of 16MB.
> > >
> > > That would work too. Thumb 2 specific code would need to be guarded by
> > > #ifdef __thumb2__ though (which I think implies also renaming the file
> > > from .s to .S ?) and I'm not sure if the extra complexity justifies
> > > saving one instruction in the ARM case.
> >
> > I don't think it does. Also, current style is not to use "it" at all,
> > but rather -Wa,-mimplicit-it=always. I'm not sure if unified syntax
> > accepts "it" in arm mode when the following insn has a matching
> > condition suffix, but here it wouldn't I think...
> 
> Any issues with merging this now?

Looks fine. Applying. Sorry I overlooked this.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-07 18:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18  6:04 [PATCH] arm: avoid conditional branch to PLT in sigsetjmp.s Andre McCurdy
2019-09-18 14:28 ` Khem Raj
2019-09-18 17:52   ` Andre McCurdy
2019-09-18 19:54     ` Rich Felker
2019-11-21 20:54       ` Andre McCurdy
2019-12-07 18:03         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).