I'm trying to emerge the adjtimex package, but the compilation fails at the line with the "_syscall1(int, adjtimex, struct timex *, txcp)" macro. Reproducible: Always Steps to Reproduce: 1.ACCEPT_KEYWORDS='~x86' emerge adjtimex 2. 3. Actual Results: gcc -Os -march=athlon-xp -fomit-frame-pointer -pipe -I. -DVERSION=\"1.16\" -o adjtimex adjtimex.c \ mat.o -lm adjtimex.c: In function `adjtimex': adjtimex.c:43: error: can't find a register in class `BREG' while reloading `asm' make: *** [adjtimex] Error 1 Performing Global Updates: /usr/portage/profiles/updates/4Q-2004 (Could take a couple of minutes if you have a lot of binary packages.) .='update pass' *='binary update' @='/var/db move' s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*' ............................ Portage 2.0.51-r2 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.9-gentoo-r1 i686) ================================================================= System uname: 2.6.9-gentoo-r1 i686 AMD Duron(tm) Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r5 Automake: sys-devel/automake-1.8.5-r1 Binutils: sys-devel/binutils-2.14.90.0.8-r1 Headers: sys-kernel/linux26-headers-2.6.8.1 Libtools: sys-devel/libtool-1.5.2-r5 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-Os -march=athlon-xp -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-Os -march=athlon-xp -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distlocks sandbox" GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/ http://ftp.linux.ee/pub/gentoo/distfiles/ http://ftp.du.se/pub/os/gentoo ftp://ibiblio.org/pub/Linux/distributions/gentoo/ ftp://gentoo.mirrors.pair.com/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="acpi berkdb bitmap-fonts crypt cups emacs encode f77 foomaticdb gdbm gif gpm hardened imlib jpeg libg++ libwww mad mikmod mmx mpeg ncurses nls nptl oggvorbis oss pam pdflib perl png python readline slang spell sse ssl svga tcpd truetype x86 xml2 xmms zlib"
could you please go into the adjtimex work directory, and run: cpp -E -I. adjtimex.c -o adjtimex.c.out then go and look for 'int F_print = 0;' and please tell me the contents of the source line above it (post the line here). I get: int adjtimex(struct timex * txcp) { long __res; __asm__ volatile ("int $0x80" : "=a" (__res) : "0" (124),"b" ((long)(txcp))); do { if ((unsigned long)(__res) >= (unsigned long)(-125)) { (*__errno_location ()) = -(__res); __res = -1; } return (int) (__res); } while (0); } Then put this line in 'foo.c': "extern int *__errno_location (void);" and put in the line you got above as well. run: "gcc -c foo.c -o tmp -save-temps" and post up any output that is generated, and the 'foo.c.s' file.
int adjtimex(struct timex * txcp) { long __res; __asm__ volatile ("int $0x80" : "=a" (__res) : "0" (124),"b" ((long)(txcp))); do { if ((unsigned long)(__res) >= (unsign ed long)(-125)) { (*__errno_location ()) = -(__res); __res = -1; } return (int) (__r es); } while (0); } # gcc -c foo.c -o tmp -save-temps foo.c:3: warning: `struct timex' declared inside parameter list foo.c:3: warning: its scope is only this definition or declaration, which is probably not what you want foo.c: In function `adjtimex': foo.c:3: error: can't find a register in class `BREG' while reloading `asm' # cat foo.s .file "foo.c" .globl __stack_smash_handler .section .note.GNU-stack,"",@progbits .ident "GCC: (GNU) 3.3.4 20040623 (Gentoo Hardened Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)"
I've narrowed this down to only happening when hardened GCC is being used. I'm passing the bug on to the hardened folk to deal with.
Created attachment 44057 [details, diff] adjtimex-1.16-pic.patch initial patch for hardened toolchain users that allows adjtimex-1.16 to compile.
markku: does solar's patch work for you?
Yes, adjtimex compiles and works after applying the patch.
fixed in cvs. solar: thanks for the patch.