This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] i386: Assembly Implementation cleanup


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]