Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 331341

Summary: sys-devel/clang-2.7-r2 fails one test
Product: Gentoo Linux Reporter: Xake <kanelxake>
Component: New packagesAssignee: The Gentoo Linux Hardened Team <hardened>
Status: RESOLVED OBSOLETE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Xake 2010-08-05 16:34:12 UTC
Looks to me like it is a problem wrt hardened (pic/pie)


FAIL: Clang :: Driver/hello.c (889 of 2103)
******************** TEST 'Clang :: Driver/hello.c' FAILED ********************
Script:
--
/var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/Release-Asserts/bin/clang  -ccc-echo -o /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/hello.c 2> /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp.log
grep 'clang" -cc1 .*hello.c' /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp.log
/var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp > /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp.out
grep "I'm a little driver, short and stout." /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp.out
--
Exit Code: 1
Command Output (stdout):
--
--
Command Output (stderr):
--
--



# cat /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp.log 
 "/var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/Release-Asserts/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -S -disable-free -disable-llvm-verifier -main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu x86-64 -resource-dir /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/Release-Asserts/lib/clang/1.1 -fmessage-length 0 -fgnu-runtime -fdiagnostics-show-option -o /tmp/cc-lSbhtI.s -x c /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/hello.c
 "/usr/bin/gcc" -c -m64 -o /tmp/cc-OTGajy.o -x assembler /tmp/cc-lSbhtI.s
 "/usr/bin/gcc" -m64 -o /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/Output/hello.c.tmp /tmp/cc-OTGajy.o
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/cc-OTGajy.o: relocation R_X86_64_32 against `.rodata.str1.16' can not be used when making a shared object; recompile with -fPIC
/tmp/cc-OTGajy.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see invocation)



# emerge --info
Portage 2.2_rc67 (hardened/linux/amd64/10.0, gcc-4.4.4, glibc-2.11.2-r0, 2.6.34-hardened-r1 x86_64)
=================================================================
System uname: Linux-2.6.34-hardened-r1-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.0.1
Timestamp of tree: Thu, 05 Aug 2010 01:30:19 +0000
ccache version 2.4 [disabled]
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
virtual/os-headers:  2.6.34
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ggdb -mtune=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe -ggdb -mtune=native"
DISTDIR="/var/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.sunet.se/pub/os/Linux/distributions/gentoo"
INSTALL_MASK="*.la"
LANG="sv_SE.UTF-8"
LC_ALL="C"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu"
LINGUAS="sv en"
MAKEOPTS="-j10 -l10"
PKGDIR="/var/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/var/portage"
PORTDIR_OVERLAY="/var/overlays/layman/hardened-development /var/overlays/layman/gamerlay /var/overlays/layman/x11 /var/overlays/mine"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac accessibility acl acpi alsa amd64 amr amrnb amrwb applet archive asyncns avahi bash-completion bluetooth branding bzip2 cairo ccache cdaudio cdda cdr cleartype cli consolekit coverart cracklib crypt cups cxx dbus device-mapper devicekit devkit dhcpcd digitalradio dirac djvu dri dts dvd dvdr dvi eds encode eselect evo exif faac faad fat fbcondecor ffmpeg fftw flac fontconfig fuse gdbm gdm gdu gif gimp glib gmp gnome gnome-keyring gphoto2 gpm grammar graphite gsf gsm gstreamer gtk gudev hal hardened hpn ical iconv iconvacl icq icu id3tag idn ieee1394 iptc ithreads jabber jack java6 jingle jpeg jpeg2k justify kate kvm lcms libffi libnotify libsamplerate logrotate lvm lvm2 lzma mad maps math matroska md mdadm midi mms mmx mmxext mng moonlight mp2 mp3 mpeg mpi msn mtp mudflap multilib musepack musicbrainz nautilus ncurses network-cron networkmanager nfs nls nntp nptl nptlonly ntfs offensive ogg openal opencore-amr opengl openmp openntpd ots pam pango parted pcre pdf perl pic pidgin playlist png policykit pppd pulseaudio python quicktime raw readline reflection rrdcgi rtmp samba sensord session smp sms speex spell spl sse sse2 ssl ssse3 startup-notification subversion svg sysfs test tex theora thesaurus threads tiff totem truetype udev unicode upnp urandom usb userlocales v4l2 vaapi vdpau vhook videos vim-syntax vorbis vpx webkit wmf x264 xcb xcomposite xmp xmpp xorg xrandr xscreensaver xulrunner xv xvid xvmc zeroconf zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv en" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Michael Weber (RETIRED) gentoo-dev 2010-08-06 15:03:37 UTC
Hello,

please attach the full build.log and environment files mentioned at the end of
the emerge process.

Thanks, Michael
Comment 2 Xake 2010-08-06 19:36:08 UTC
The build.log is to big to attach, however the question is if it really is necessary.

I think the problem is that the test makes an asm file with the help of clang, then compiles it into an object with the help of gcc, and then in the third step tries to link it with the help of gcc. the last step fails and I think it is due to the first two steps not creating any PIC code, however if you are using hardened the last step currently requires it. 

This is confirmed by doing the following:

lillen ~ # "/var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/Release-Asserts/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -S -disable-free -disable-llvm-verifier -main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu x86-64 -resource-dir /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/Release-Asserts/lib/clang/1.1 -fmessage-length 0 -fgnu-runtime -fdiagnostics-show-option -o testing.s -x c /var/tmp/portage/sys-devel/clang-2.7-r2/work/llvm-2.7/tools/clang/test/Driver/hello.c
lillen ~ # gcc -c -m64 -o testing.o -x assembler testing.s 
lillen ~ # gcc -m64 -o testing testing.o 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/../../../../x86_64-pc-linux-gnu/bin/ld: bajs.o: relocation R_X86_64_32 against `.rodata.str1.16' can not be used when making a shared object; recompile with -fPIC
bajs.o: could not read symbols: Bad value
collect2: ld returnerade avslutningsstatus 1
lillen ~ # gcc -nopie -m64 -o testing testing.o 
lillen ~ # ./testing
I'm a little driver, short and stout.lillen ~ #
Comment 3 Xake 2010-08-06 19:37:45 UTC
hehe, I saw I did not sanitise all output, do a s/bajs/testing/ in the last comment and everything is set.;)
Comment 4 Bernard Cafarelli gentoo-dev 2014-01-30 19:46:21 UTC
Cleaning old bugs, clang (and its ebuild) has come a long way since 2.7 :)