[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#368039: marked as done (linux-kernel-headers: can't use _syscallx (x>=2) with -fPIC on x86)



Your message dated Wed, 1 Nov 2006 23:25:50 +0100
with message-id <20061101222550.GD4807@bouh.residence.ens-lyon.fr>
and subject line linux-kernel-headers: can't use _syscallx (x>=2) with -fPIC on x86
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: linux-kernel-headers
Version: 2.6.13+0rc3-2.1
Severity: normal

Hi,

When using _syscallx (with x>=2) in an x86 shared library, gcc complains
that it can't find a BREG register, for instance:

#include <sys/types.h>
#include <linux/unistd.h>

_syscall2(int, tkill, pid_t, tid, int, sig)

int main(void) { tkill(0,0); }

gcc -c test.c -o test.o -fPIC

test.c: In function 'tkill':
test.c:4: error: can't find a register in class 'BREG' while reloading 'asm'

This is because with -fPIC, gcc keeps the GOT address in %ebx, and
refuses it be clobbered. In latest kernel sources (2.6.17-rc1 for
instance), the problem got fixed by saving %ebx in the assembly string:

#define _syscall2(type,name,type1,arg1,type2,arg2) \
type name(type1 arg1,type2 arg2) \
{ \
long __res; \
__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
	: "=a" (__res) \
	: "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \
	: "memory"); \
__syscall_return(type,__res); \
}

Please either upgrade to more recent kernel headers, or at least
backport these #defines.

Thanks,
Samuel

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-rc1
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

-- no debconf information

-- 
Samuel Thibault <samuel.thibault@ens-lyon.org>
<D> m'enfin, le 5 juillet, le mec vient visiter le labo...
* D a marque d'une croix rouge le 5 juillet sur son agenda
<y> niarc niarc niarc
<D> cet homme va souffrir
<B> c'est donc le 5 juillet qu'il meurt d'un accident de la route écrasé par un truck muni d'un pare buffle
 -+- #ens-mim - repaire de terroristes -+-


--- End Message ---
--- Begin Message ---
Version: 2.6.17.1-1

The package was upgraded to 2.6.17 which holds a fix, so closing.

Samuel

--- End Message ---

Reply to: