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

Bug 115724

Summary: XDTV fails to compile with Hardened GCC 3.4.4
Product: Gentoo Linux Reporter: Christopher Hogan <chris.c.hogan>
Component: [OLD] GCC PortingAssignee: Diego Elio Pettenò (RETIRED) <flameeyes>
Status: RESOLVED TEST-REQUEST    
Severity: normal CC: hardened, s.geschwandtner, vapier
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard: Patch in tree
Package list:
Runtime testing required: ---

Description Christopher Hogan 2005-12-15 18:43:54 UTC
XDTV fails to compile with Hardened GCC 3.4.4. It compiled fine with Hardened
GCC 3.3.6. I used the slow (emerge -e) method to upgrade. It compiles fine using
the i686-pc-linux-gnu-3.4.4-hardenednopie profile, but not the
i686-pc-linux-gnu-3.4.4 profile.

Reproducible: Always
Steps to Reproduce:
1. emerge xdtv
2.
3.

Actual Results:  
if i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../alevt   -Wall
-D_REENTRANT -march=athlon-xp -pipe -fomit-frame-pointer -fforce-addr -O3 
-DPREFIX='"/usr"' -D_LARGEFILE64_SOURCE  -MT memcpy.o -MD -MP -MF
".deps/memcpy.Tpo" \
  -c -o memcpy.o `test -f 'memcpy.c' || echo './'`memcpy.c; \
then mv -f ".deps/memcpy.Tpo" ".deps/memcpy.Po"; \
else rm -f ".deps/memcpy.Tpo"; exit 1; \
fi
memcpy.c: In function `sse_copie':
memcpy.c:365: error: PIC register `ebx' clobbered in `asm'
memcpy.c: In function `mmx2_copie':
memcpy.c:503: error: PIC register `ebx' clobbered in `asm'
memcpy.c: In function `mmx_copie':
memcpy.c:641: error: PIC register `ebx' clobbered in `asm'
memcpy.c: In function `fpu_copie':
memcpy.c:773: error: PIC register `ebx' clobbered in `asm'
main.c: In function `set_float':
main.c:1439: warning: dereferencing type-punned pointer will break
strict-aliasing rules
make[2]: *** [memcpy.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/var/tmp/portage/xdtv-2.2.0-r1/work/xdtv-2.2.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/xdtv-2.2.0-r1/work/xdtv-2.2.0'
make: *** [all] Error 2


Expected Results:  
>>> media-tv/xdtv-2.2.0-r1 merged.

emerge --info
Portage 2.0.51.22-r3 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r2,
2.6.14-gentoo-r4 i686)
=================================================================
System uname: 2.6.14-gentoo-r4 i686 AMD Athlon(tm) XP 2600+
Gentoo Base System version 1.6.13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -pipe -fomit-frame-pointer -fforce-addr -O3"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env
/usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -pipe -fomit-frame-pointer -fforce-addr -O3"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo ftp://chod.cwru.edu/gentoo
ftp://gentoo.chem.wisc.edu/gentoo/ http://mirror.uni-c.dk/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/mnt/net/keeper/apps/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex 3dnowext X Xaw3d a52 aac accessibility acl acpi adns alsa
aotuv arts audiofile avi bash-completion berkdb bitmap-fonts browserplugin bzip2
caps cddb cdinstall cdparanoia cdr crypt css cups curl dbus divx4linux dlloader
doc dts dv dvb dvd dvdr dvdread edl eds emboss encode esd examples exif expat
fam fame ffmpeg flac font-server foomaticdb fortran gcj gd gdbm gif gimp
glibc-omitfp glitz glut gmp gnome gphoto2 gpm gstreamer gtk gtk2 hal hardened
howl hpn idn ieee1394 imagemagick imlib innodb ipv6 jabber jack java joystick
jpeg jpeg2k junit kde kerberos lcms ldap libclamav libg++ libwww lirc live
lm_sensors logitech-mouse lzo mad matroska mikmod mjpeg mmap mmx mmxext mng mono
motif mozdevelop mozilla mozsvg mozxmlterm mp3 mpeg mpi mplayer mysql mythtv nas
ncurses network nls nptl nptlonly nsplugin nvidia oav objc offensive ogg
oggvorbis on-the-fly-crypt openal opengl pam pccts pcre pda pdflib perl pic pie
png ppds python qt quicktime quotas readline real recode rtc samba sasl scanner
sdl slp sndfile speex spell sse ssl svg svga tcltk tcpd tga theora threads tiff
toolbar transcode truetype truetype-fonts type1-fonts udev unicode usb
userlocales v4l v4l2 vcd vidix vorbis win32codecs wmf xanim xine xinerama xml2
xmms xosd xprint xscreensaver xv xvid xvmc yv12 zlib zvbi userland_GNU
kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 Mark Loeser (RETIRED) gentoo-dev 2005-12-27 17:20:23 UTC
Hardened: some help on this one? :)
Comment 2 SpanKY gentoo-dev 2005-12-28 13:24:35 UTC
read the source code and the answer is pretty obvious ...

src/memcpy.c:sse_copie() {
 __asm__ ( ... : : :  ... "ebx" ... )
}

you cant clobber ebx when building as PIC

rewrite the code to not clobber ebx, or hide ebx somewhere (say on the stack) as this bit of code looks to utilize all 6 x86 registers

although the code could use some touchups in general ... the first three lines look pointless when you could declare the input list to take care of that ...
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-12-29 16:10:27 UTC
I'll contact upstream and ask them if they can fix it.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-12-30 02:59:30 UTC
I've informed upstream and they'll take care of that for 2.3.0 due to end of january.
In the mean time you probably need to disable mmx useflag for that package.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-01-08 04:25:34 UTC
Reopening, as I have put a patch in tree from upstream, can someone test it?
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-01-29 22:50:39 UTC
Both 2.2.0-r2 and 2.3.0 are in tree, please test and reopen if it's still an issue.
Comment 7 Sascha G. 2006-04-18 12:29:25 UTC
I just tried to emerge xdtv 2.3.2 and it failed this way (with and without mmx USE flag):

i686-pc-linux-gnu-gcc -O3 -Wall -Wno-switch -DHAVE_AV_CONFIG_H -I.. -I'../'/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE   -c -o msmpeg4.o msmpeg4.c
msmpeg4.c: In function `msmpeg4_encode_dc':
msmpeg4.c:729: error: can't find a register in class `BREG' while reloading `asm'
make[2]: *** [msmpeg4.o] Error 1
make[2]: *** Waiting for unfinished jobs....
h263.c: In function `h263_decode_block':
h263.c:4552: warning: 'level' might be used uninitialized in this function
make[2]: Leaving directory `/var/tmp/portage/xdtv-2.3.2/work/xdtv-2.3.2/libavcodec'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/xdtv-2.3.2/work/xdtv-2.3.2'
make: *** [all] Error 2

!!! ERROR: media-tv/xdtv-2.3.2 failed.
Call stack:
  ebuild.sh, line 1532:   Called dyn_compile
  ebuild.sh, line 929:   Called src_compile
  xdtv-2.3.2.ebuild, line 155:   Called die

Gentoo Base System version 1.6.14
Portage 2.1_pre7-r5 (selinux/2005.1/x86/hardened, gcc-3.4.6, glibc-2.3.6-r3, 2.6.16-hardened-r3 i686)
=================================================================
System uname: 2.6.16-hardened-r3 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=pentium4 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -march=pentium4 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical"
FEATURES="autoconfig distlocks loadpolicy metadata-transfer parallel-fetch sandbox selinux sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
LANG="en_US.UTF-8"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X a52 aac alsa bzip2 caps cjk crypt cups curl dts dvd dvdread ffmpeg flac gif glut gnutls gtk
 hardened ipv6 jpeg kdeenablefinal mad matroska mikmod mmap mmx mp3 ncurses nptl offensive ogg opengl 
pam pic png readline sdl selinux sndfile sse sse2 ssl theora threads tiff truetype unicode vorbis win32codecs xinerama xv xvid zlib elibc_glibc input_devices_keyboard input_devices_mouse kernel_linux linguas_en userland_GNU"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LC_ALL, LDFLAGS