From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Cc: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Subject: Re: Some questions
Date: Wed, 2 May 2018 09:42:24 -0400 [thread overview]
Message-ID: <20180502134224.GW1392@brightrain.aerifal.cx> (raw)
In-Reply-To: <20180501221441.GX4418@port70.net>
On Wed, May 02, 2018 at 12:14:41AM +0200, Szabolcs Nagy wrote:
> * Andre McCurdy <armccurdy@gmail.com> [2018-05-01 14:49:00 -0700]:
> > On Tue, May 1, 2018 at 10:35 AM, Rich Felker <dalias@libc.org> wrote:
> > > I'm considering applying the attached patch, which would make it so
> > > VLAs don't break thumb syscalls and eliminate the need to force frame
> > > pointer off when building as thumb. This is all a workaround for gcc
> > > being wrong about not letting you use r7, but it seems reasonable and
> > > non-invasive. It just omits r7 from the constraints and uses a temp
> > > register to save/restore it.
> >
> > This seems to fail when compiling src/thread/arm/__set_thread_area.c:
> >
> > {standard input}: Assembler messages:
> > {standard input}:45: Error: invalid constant (f0005) after fixup
> > make: *** [obj/src/thread/arm/__set_thread_area.o] Error 1
> >
> > Without the patch, __set_thread_area() effectively compiles to:
> >
> > __set_thread_area:
> > push {r7, lr}
> > ldr r7, .L2
> > pop {r7, pc}
> > .L2:
> > .word 983045
> >
> > With the patch:
> >
> > __set_thread_area:
> > push {r7, lr}
> > add r7, sp, #0
> > mov r3,r7 ; mov r7,#983045 ; svc 0 ; mov r7,r3
> > pop {r7, pc}
> >
> > ie the immediate value 0xf0005 can't be loaded directly into r7 with a
> > single Thumb2 mov instruction.
> >
> > I tried a quick test to replace the single mov instruction in
> > __asm_syscall() with a movw + movt pair:
> >
>
> i think the syscall can be just inline asm here,
> since __set_thread_area is arm specific code.
>
> in generic code the mov r7,.. hack should work
> and fixes the vla issue.
>
> (alternatively using just "r" operand instead
> of "rI" does not generate immediate, but will
> use more registers/instructions)
The above posted patch used "ri" not "rI". The "I" constraint, which I
switched to after posting the patch, only allows immediates that work
with mov, so the issue does not arise.
Rich
next prev parent reply other threads:[~2018-05-02 13:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 2:52 Patrick Oppenlander
2018-04-30 3:16 ` Rich Felker
2018-04-30 3:55 ` Patrick Oppenlander
2018-04-30 15:35 ` Rich Felker
2018-05-01 2:35 ` Patrick Oppenlander
2018-05-01 21:03 ` Rich Felker
2018-05-01 22:14 ` Patrick Oppenlander
2018-04-30 5:17 ` Patrick Oppenlander
2018-04-30 15:29 ` Rich Felker
2018-05-01 2:32 ` Patrick Oppenlander
2018-04-30 5:29 ` Patrick Oppenlander
2018-04-30 15:31 ` Rich Felker
2018-05-01 2:34 ` Patrick Oppenlander
2018-05-01 15:52 ` Rich Felker
2018-05-01 17:35 ` Rich Felker
2018-05-01 21:49 ` Andre McCurdy
2018-05-01 22:14 ` Szabolcs Nagy
2018-05-02 13:42 ` Rich Felker [this message]
2018-05-01 0:10 ` Patrick Oppenlander
2018-05-01 14:19 ` Szabolcs Nagy
2018-05-01 21:05 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180502134224.GW1392@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
--cc=patrick.oppenlander@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).