This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] i386: Assembly Implementation cleanup
- From: Florian Weimer <fweimer at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 12 Aug 2015 17:01:46 +0200
- Subject: Re: [PATCH] i386: Assembly Implementation cleanup
- Authentication-results: sourceware.org; auth=none
- References: <5596AD3B dot 1060903 at linaro dot org> <CAMe9rOof5LzNfW_Yd2qgtX2=UMdP-E-ewdneJ9GjiCF9SPyNqQ at mail dot gmail dot com> <55CB3E37 dot 8080006 at linaro dot org> <CAMe9rOr6a+iNtDjx6xT3KWYsyetpDswu8Zm8rQiJWS9CtP5f6w at mail dot gmail dot com>
On 08/12/2015 02:44 PM, H.J. Lu wrote:
> Is there a way to truly inline syscall with 6 arguments, not by calling
> __libc_do_syscall?
Yes, newer GCC versions are able to spill %ebx just by writing
appropriate constraints.
Test case:
int
doit(int v)
{
int r;
__asm__ ("MAGIC"
: "=r" (r)
: "b" (v));
return r;
}
Compile with â-m32 -fpic -O2â.
Older GCC (4.8.3 in this example):
reg.c: In function âdoitâ:
reg.c:5:3: error: inconsistent operand constraints in an âasmâ
__asm__ ("MAGIC"
^
Newer GCC:
doit:
.LFB0:
.cfi_startproc
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_offset 3, -8
movl 8(%esp), %ebx
#APP
# 5 "/tmp/t.c" 1
MAGIC
# 0 "" 2
#NO_APP
popl %ebx
.cfi_restore 3
.cfi_def_cfa_offset 4
ret
.cfi_endproc
--
Florian Weimer / Red Hat Product Security