Bug 718215

Summary: glibc-2.14.90-1 fails to build on s390(x)
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fweimer, jakub, krebbel1, schwab
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.14.90-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-21 14:51:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
preprocessed getsysstats.c none

Description Dan Horák 2011-07-01 12:49:21 UTC
Build of glibc-2.14.90-1 with gcc-4.6.1-1.fc16 on s390 and s390x in Rawhide fails with an error about using a register

make -s subdir=misc -C misc ..=../ subdir_lib
make[2]: Entering directory `/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/misc'
mkdir /builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl/misc
make[2]: Leaving directory `/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/misc'
make[2]: Entering directory `/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/misc'
../sysdeps/unix/sysv/linux/getsysstats.c: In function '__get_nprocs':
../sysdeps/unix/sysv/linux/getsysstats.c:249:1: error: %r11 cannot be used in asm here
make[2]: *** [/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl/misc/getsysstats.os] Error 1
make[2]: *** Waiting for unfinished jobs....

and

make -s subdir=misc -C misc ..=../ subdir_lib
make[2]: Entering directory `/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/misc'
mkdir /builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390-linuxnptl/misc
make[2]: Leaving directory `/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/misc'
make[2]: Entering directory `/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/misc'
../sysdeps/unix/sysv/linux/getsysstats.c: In function '__get_nprocs':
../sysdeps/unix/sysv/linux/getsysstats.c:249:1: error: %r11 cannot be used in asm here
make[2]: *** [/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390-linuxnptl/misc/getsysstats.os] Error 1
make[2]: *** Waiting for unfinished jobs....


For complete build logs please see http://s390.koji.fedoraproject.org/koji/taskinfo?taskID=421233

Comment 1 Jakub Jelinek 2011-07-01 13:33:25 UTC
Andreas, why do you think this is a gcc bug?  From what I can see, getsysstats.c has been largely rewritten and uses INTERNAL_VSYSCALL macro in a way that perhaps hasn't been used as on s390{,x} before.
Dan, could you please provide preprocessed source for it?
If you have access to the mock buildroot where it failed, cd into
/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390-linuxnptl
type make subdirs=misc
then cut'n'paste the getsysstats.c compilation line and rerun it with -save-temps in addition to other options, then attach here getsysstats.i and the command line options used to compile it.

Comment 2 Dan Horák 2011-07-01 14:13:18 UTC
Created attachment 510869 [details]
preprocessed getsysstats.c

the command line is:

gcc -save-temps ../sysdeps/unix/sysv/linux/getsysstats.c -c -std=gnu99 -fgnu89-inline -O3 -Wall -Winline -Wwrite-strings -fasynchronous-unwind-tables -fmerge-all-constants -fno-asynchronous-unwind-tables -g -Wstrict-prototypes -mlong-double-128  -fpic -fexceptions   -I../include -I/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl/misc -I/builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl -I../sysdeps/s390/s390-64/elf -I../nptl/sysdeps/unix/sysv/linux/s390/s390-64 -I../rtkaio/sysdeps/unix/sysv/linux/s390/s390-64 -I../sysdeps/unix/sysv/linux/s390/s390-64 -I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/unix/sysv/linux/s390/fpu -I../sysdeps/s390/fpu -I../nptl/sysdeps/unix/sysv/linux/s390 -I../rtkaio/sysdeps/unix/sysv/linux/s390 -I../sysdeps/unix/sysv/linux/s390 -I../sysdeps/ieee754/ldbl-64-128 -I../sysdeps/ieee754/ldbl-opt -I../../glibc-ports-2.14-2-ga437c07/sysdeps/unix/sysv/linux -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../rtkaio/sysdeps/pthread -I../sysdeps/pthread -I../rtkaio/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../../glibc-ports-2.14-2-ga437c07/sysdeps/unix/sysv -I../nptl/sysdeps/unix/sysv -I../rtkaio/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../../glibc-ports-2.14-2-ga437c07/sysdeps/unix -I../nptl/sysdeps/unix -I../rtkaio/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/s390/s390-64 -I../sysdeps/wordsize-64 -I../nptl/sysdeps/s390 -I../sysdeps/s390 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../../glibc-ports-2.14-2-ga437c07 -I../nptl -I../rtkaio  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/s390x-redhat-linux/4.6.1/include -isystem /usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED     -o /builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl/misc/getsysstats.os -MD -MP -MF /builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl/misc/getsysstats.os.dt -MT /builddir/build/BUILD/glibc-2.14-58-g2c0e54f/build-s390x-linuxnptl/misc/getsysstats.os

Let me know if you anything else.

Comment 3 Jakub Jelinek 2011-07-01 23:49:33 UTC
It is a glibc bug.  r11 is frame pointer register, and __get_nprocs uses alloca, therefore the asm can't clobber the frame pointer.  INTERNAL_VSYSCALL_NCS needs to use some other register instead of 11 for saving/restoring r14, or, alternatively, if there is no such register usable for it, it needs to save it to stack and restore it from there.