Bug 19477 - sparc64 build fails for default v9 targets: sparc64/soft-fp/qp_itoq.c requires v9a+
Summary: sparc64 build fails for default v9 targets: sparc64/soft-fp/qp_itoq.c require...
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: 2.23
: P2 normal
Target Milestone: ---
Assignee: David S. Miller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-16 07:25 UTC by Mike Frysinger
Modified: 2016-05-23 18:42 UTC (History)
3 users (show)

See Also:
Host: sparc64-linux-gnu
Target:
Build: x86_64-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments
config.log (8.27 KB, text/plain)
2016-01-16 07:25 UTC, Mike Frysinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2016-01-16 07:25:26 UTC
Created attachment 8903 [details]
config.log

using current git (019bf21ca710faaf3fd365c8bb61e1607610057d) here:
$ ../configure --host=sparc64-unknown-linux-gnu --prefix=/usr
$ make
...
sparc64-unknown-linux-gnu-gcc ../sysdeps/sparc/sparc64/soft-fp/qp_itoq.c -c -std=gnu11 -fgnu89-inline  -O2 -Wall -Werror -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes -Wold-style-definition -fcall-used-g6    -ftls-model=initial-exec   -U_FORTIFY_SOURCE   -I../include -I/usr/local/src/gnu/glibc/build/sparc/soft-fp  -I/usr/local/src/gnu/glibc/build/sparc  -I../sysdeps/unix/sysv/linux/sparc/sparc64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/sparc  -I../sysdeps/sparc/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/sparc/sparc64/fpu/multiarch  -I../sysdeps/sparc/sparc64/fpu  -I../sysdeps/sparc/sparc64/multiarch  -I../sysdeps/sparc/sparc64  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64/wordsize-64  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/sparc/sparc64/soft-fp  -I../sysdeps/sparc/fpu  -I../sysdeps/sparc  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /usr/local/src/gnu/glibc/build/sparc/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h       -o /usr/local/src/gnu/glibc/build/sparc/soft-fp/qp_itoq.o -MD -MP -MF /usr/local/src/gnu/glibc/build/sparc/soft-fp/qp_itoq.o.dt -MT /usr/local/src/gnu/glibc/build/sparc/soft-fp/qp_itoq.o
/tmp/ccuBwHjn.s: Assembler messages:
/tmp/ccuBwHjn.s:104: Error: Architecture mismatch on "fzero".
/tmp/ccuBwHjn.s:104:  (Requires v9a|v9b; requested architecture is v9.)

sparc64-unknown-linux-gnu-gcc (Gentoo 4.8.5 p1.3, pie-0.6.2) 4.8.5
GNU assembler (Gentoo 2.25.1 p1.1) 2.25.1
Comment 1 Anatoly Pugachev 2016-03-23 14:17:47 UTC
still valid for as per git (3c9a4cd16cbc7b79094fec68add2df66061ab5d7):

glibc git sources in ~/glibc
glibc build directory is ~/build/glibc:

mator@deb4g:~/build/glibc$ ~/glibc/configure --prefix=/opt/glibc && make -j16

make[2]: Entering directory '/home/mator/glibc/soft-fp'
gcc ../sysdeps/sparc/sparc64/soft-fp/qp_itoq.c -c -std=gnu11 -fgnu89-inline  -O2 -Wall -Werror -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes -Wold-style-definition -fcall-used-g6    -ftls-model=initial-exec      -I../include -I/home/mator/build/glibc/soft-fp  -I/home/mator/build/glibc  -I../sysdeps/unix/sysv/linux/sparc/sparc64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/sparc  -I../sysdeps/sparc/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/sparc/sparc64/fpu/multiarch  -I../sysdeps/sparc/sparc64/fpu  -I../sysdeps/sparc/sparc64/multiarch  -I../sysdeps/sparc/sparc64  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64/wordsize-64  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/sparc/sparc64/soft-fp  -I../sysdeps/sparc/fpu  -I../sysdeps/sparc  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /home/mator/build/glibc/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h       -o /home/mator/build/glibc/soft-fp/qp_itoq.o -MD -MP -MF /home/mator/build/glibc/soft-fp/qp_itoq.o.dt -MT /home/mator/build/glibc/soft-fp/qp_itoq.o
/tmp/ccQaqMLY.s: Assembler messages:
/tmp/ccQaqMLY.s:91: Error: Architecture mismatch on "fzero".
/tmp/ccQaqMLY.s:91:  (Requires v9a|v9b; requested architecture is v9.)
/home/mator/build/glibc/sysd-rules:2163: recipe for target '/home/mator/build/glibc/soft-fp/qp_itoq.o' failed
make[2]: *** [/home/mator/build/glibc/soft-fp/qp_itoq.o] Error 1
make[2]: Leaving directory '/home/mator/glibc/soft-fp'
Makefile:214: recipe for target 'soft-fp/subdir_lib' failed
make[1]: *** [soft-fp/subdir_lib] Error 2
make[1]: Leaving directory '/home/mator/glibc'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2
mator@deb4g:~/build/glibc$ 

I wonder why https://sourceware.org/ml/binutils/2014-09/msg00018.html does not fixed this issue.

My system is (debian sparc64 unstable/sid):

mator@deb4g:~/build/glibc$ uname -a
Linux deb4g 4.5.0-trunk-sparc64-smp #1 SMP Debian 4.5-1~exp1 (2016-03-20) sparc64 GNU/Linux

mator@deb4g:~/build/glibc$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/sparc64-linux-gnu/6/lto-wrapper
Target: sparc64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6-20160122-1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-sparc64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-sparc64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-sparc64 --with-arch-directory=sparc64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --enable-targets=all --with-long-double-128 --enable-multilib --enable-checking=release --build=sparc64-linux-gnu --host=sparc64-linux-gnu --target=sparc64-linux-gnu
Thread model: posix
gcc version 6.0.0 20160122 (experimental) [trunk revision 232729] (Debian 6-20160122-1) 

mator@deb4g:~/build/glibc$ as --version
GNU assembler (GNU Binutils for Debian) 2.26
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `sparc64-linux-gnu'.

mator@deb4g:~/build/glibc$ dpkg -s gcc binutils | grep Version
Version: 4:6-20160101-2
Version: 2.26-8

Thanks.

PS: this bug report is set as "build: x86_64-linux-gnu" in header, but I doing a native (sparc64) build.
Comment 2 John Paul Adrian Glaubitz 2016-04-22 12:56:59 UTC
Hi!

Quick heads-up: Setting -mcpu=ultrasparc fixes the issue for me, e.g.:

$ export CFLAGS='-mcpu=ultrasparc'
$ make

Cheers,
Adrian
Comment 3 Anatoly Pugachev 2016-05-02 15:52:09 UTC
Thanks.

I've successfully compiled glibc using CFLAGS='-mcpu=ultrasparc' or later CPUs (niagara2/3/4). And I don't (bash) export it for a later make, just set it as environment variable to configure. Besides, glibc is refusing to compile with only CPU spec in CFLAGS, giving me error, described in FAQ (and I don't understand answer there , https://sourceware.org/glibc/wiki/FAQ ):

/home/mator/build/glibc/config.h:4:3: error: #error "glibc cannot be compiled without optimization"
 # error "glibc cannot be compiled without optimization"

so full command line to compile glibc on my host was:

mator@deb4g:~/build/glibc$ CFLAGS="-mcpu=niagara4 -g -O3" ../../glibc/configure --prefix=/opt/glibc && make -j8

So, described solution is just a workaround for a problem with glibc compilation.