Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 75563 - (toolchain) xine-lib-1_rc8-r1 compile fails with error: can't find a register in class `BREG' while reloading `asm'
Summary: (toolchain) xine-lib-1_rc8-r1 compile fails with error: can't find a register...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
: 81088 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-24 10:12 UTC by Gerhard Holzmeister
Modified: 2005-06-23 18:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Holzmeister 2004-12-24 10:12:18 UTC
no -fPIC in CFLAGS

gcc -DHAVE_CONFIG_H -I. -I. -I../../../.. -I../../../.. -I../../../../include -I../../../../include -I../../../../src -I../../../../src/xine-engine -I../../../../src/xine-engine -I../../../../src/xine-utils -I../../../../src/input -I../../../../src/input -I../../../../lib -DSIMPLE_IDCT -DHAVE_AV_CONFIG_H -DRUNTIME_CPUDETECT -DUSE_FASTMEMCPY -DCONFIG_RISKY -DCONFIG_DECODERS -DXINE_MPEG_ENCODER -DCONFIG_ZLIB -mcpu=pentiumpro -O3 -pipe -fomit-frame-pointer -falign-functions=4 -falign-loops=4 -falign-jumps=4 -mpreferred-stack-boundary=2 -fexpensive-optimizations -fschedule-insns2 -fno-strict-aliasing -ffast-math -finline-functions -Wall -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DXINE_COMPILE -Wnested-externs -Wcast-align -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -O2 -march=pentium3 -fomit-frame-pointer -mno-sse2 -mno-sse3 -ffunction-sections -MT dsputil_mmx.lo -MD -MP -MF .deps/dsputil_mmx.Tpo -c dsputil_mmx.c -o .libs/dsputil_mmx.o
dsputil_mmx.c: In function `put_qpel8_mc10_3dnow':
dsputil_mmx_rnd.h:61: error: can't find a register in class `BREG' while reloading `asm'
make[5]: *** [dsputil_mmx.lo] Error 1
make[5]: Leaving directory `/var/tmp/portage/xine-lib-1_rc8-r1/work/xine-lib-1-rc8/src/libffmpeg/libavcodec/i386'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/var/tmp/portage/xine-lib-1_rc8-r1/work/xine-lib-1-rc8/src/libffmpeg/libavcodec'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/var/tmp/portage/xine-lib-1_rc8-r1/work/xine-lib-1-rc8/src/libffmpeg'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/xine-lib-1_rc8-r1/work/xine-lib-1-rc8/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/xine-lib-1_rc8-r1/work/xine-lib-1-rc8'
make: *** [all] Error 2

!!! ERROR: media-libs/xine-lib-1_rc8-r1 failed.
!!! Function src_compile, Line 159, Exitcode 2
!!! Parallel make failed
!!! If you need support, post the topmost build error, NOT this status message.




Reproducible: Always
Steps to Reproduce:
emerge xine-lib
Actual Results:  
compile error

Expected Results:  
compile succesfull

hardened toolchain!


hnb3gentoo root # emerge info
Portage 2.0.51-r3 (default-linux/x86/2004.2, gcc-3.3.4, glibc-2.3.4.20040808-r1,
2.6.9 i686)
=================================================================
System uname: 2.6.9 i686 Intel(R) Pentium(R) M processor 1.50GHz
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.15.90.0.1.1-r3
Headers:  sys-kernel/linux-headers-2.4.21-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
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/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium3 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
ftp://ftp.easynet.nl/mirror/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X acl acpi alsa apm arts avi berkdb bitmap-fonts cdr crypt cups dvdr
encode esd fam flac foomaticdb fortran gcj gdbm gif gnome gpm gtk gtk2 hardened
imagemagick imlibjava jpeg junit kde libwww mad mikmod motif mpeg ncurses nls
oggvorbis opengl oss pam pdflib perl png python qt quicktime readline sdl slang
spell ssl svga tcpd tiff truetype xml2 xmms xv zlib linguas_de"
Comment 1 darkstalker 2004-12-24 10:15:37 UTC
Perhaps this can help, taken from http://my.execpc.com/~geezer/osd/gotchas/

'can't find a register in class `[AREG|BREG|CREG|DREG]' while reloading `asm'

 New versions of the GNU assembler are pickier about the clobber lists used in inline asm. Though it worked fine with older versions of the GNU assembler, the following code is now considered incorrect: 
static inline void
memset(void *__dest, unsigned int __fill, unsigned int __size) {
    __asm__ __volatile__ ("cld
                           rep
                           stosb"               :
                           /* no outputs */     :
                           "c" (__size),
                           "a" (__fill),
                           "D" (__dest)         :
                           "ecx","eax","edi","memory");
}
 because registers ECX, EAX, and EDI are present in both the clobber list and the input constraints. Remove these registers from the clobber list: 
                           ...
                           "a" (__fill),
                           "D" (__dest)         :
                                             "memory");
}
 and the code should assemble without error.

Hopefully someone that knows how to do the above can fix things. Several other packages are having the same problem, including callgrind.
Comment 2 Keith Landry 2004-12-24 21:53:10 UTC
Same errors here with hardened toolchain. 

Switching from gcc profile i686-pc-linux-gnu-3.4.3 to i686-pc-linux-gnu-3.4.3-vanilla allows sucessful compile.

# emerge info
Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20040808-r1, 2.6.9-gentoo-r1 i686)
=================================================================
System uname: 2.6.9-gentoo-r1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
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.15.90.0.1.1-r3
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium4 -fstack-protector -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.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -fstack-protector -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache distlocks prelink sandbox sfperms"
GENTOO_MIRRORS="ftp://gentoo.ccccom.com http://gentoo.ccccom.com http://mymirror.asiaosc.org/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X acl alsa apm arts artswrappersuid audiofile avi berkdb bitmap-fonts cdparanoia cdr crypt cups dhcp divx4linux doc dvd dvdr emacs encode fam ffmpeg flac foomatic foomaticdb fortran gdbm gif gpm hardened i8x0 ipv6 ithreads java jpeg kde kerberos ladccakde ladspa libwww mad matroska mikmod mmx motif mpeg ncurses network nls nptl odbc oggvorbis opengl oss pam pdflib perl png python qt quicktime readline real samba sdl spell sse sse2 ssl svga tcltk tcpd theora threads tiff transcode truetype unicode usb videos xine xml2 xmms xosd xprint xv xvid zlib"
Comment 3 Eric Grüttefien 2004-12-28 05:16:55 UTC
in the 2 "static void DEF" functions in 'src/libffmpeg/libavcodec/i386/dsputil_mmx_rnd.h'

change the input regs from:

'"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)'
(ebx,eax,ecx,dcx)
to:

'"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)'
(memory effective address,eax,ecx,dcx)

on hardended Gentoo this should fix it..

BTW,

How can i supply patches the right way for gentoo.

Thanks in advance.


Comment 4 Eric Grüttefien 2004-12-28 07:33:59 UTC
Some addons...

File src/libffmpeg/libavcodec/msmpeg4.c:

function 'static inline int msmpeg4_pred_dc'
input regs from

: "+b" (a), "+c" (b), "+D" (c)

to

: "+m" (a), "+c" (b), "+D" (c)


File src/post/goom/mmx.h:

remove ebx from clobber in function 'static int mm_support(void)':

from 

: "eax", "ebx", "ecx", "edx"

to
: "eax", "ecx", "edx"

Don't why ebx isn't used es input nor output REG but moded, gcc does not like it... so remove it.


in File: src/post/goom/xmmx.c

Function "zoom_filter_xmmx":

from: 

               /*
                 * pre : mm0 : clipped position on screen
                 *
                 * post : mm3 & mm4 : coefs for this position
                 *              mm1 : X vector [0|X]
                 *
                 * modif : eax,ebx
                 */
                __asm__ __volatile__ (
                        "movd %%mm0,%%ebx\n"
                        "movq %%mm0,%%mm1\n"

                        "andl $15,%%ebx\n"
                        "psrlq $32,%%mm1\n"

                        "shll $6,%%ebx\n"
                        "movd %%mm1,%%eax\n"

                        "addl %0,%%ebx\n"
                        "andl $15,%%eax\n"

                        "movd (%%ebx,%%eax,4),%%mm3\n"
                        ::"g"(precalCoef):"eax","ebx")

to:

               /*
                 * pre : mm0 : clipped position on screen
                 *
                 * post : mm3 & mm4 : coefs for this position
                 *              mm1 : X vector [0|X]
                 *
                 * modif : eax,ecx
                 */
                __asm__ __volatile__ (
                        "movd %%mm0,%%ecx\n"
                        "movq %%mm0,%%mm1\n"

                        "andl $15,%%ecx\n"
                        "psrlq $32,%%mm1\n"

                        "shll $6,%%ecx\n"
                        "movd %%mm1,%%eax\n"

                        "addl %0,%%ecx\n"
                        "andl $15,%%eax\n"

                        "movd (%%ebx,%%eax,4),%%mm3\n"
                        ::"g"(precalCoef):"eax","ecx");

and from:
               /*
                 * pre : mm0 : Y pos [*|Y]
                 *       mm1 : X pos [*|X]
                 *
                 * post : mm0 : expix1[position]
                 *        mm2 : expix1[position+largeur]
                 *
                 * modif : eax,ebx
                 */
                psrld_i2r (PERTEDEC,mm0);
                psrld_i2r (PERTEDEC,mm1);
                __asm__ __volatile__ (
                        "movd %%mm1,%%eax\n"
                        /*^*/ "movq %%mm3,%%mm5\n"       /*^*/

                        "mull %1\n"
                        "movd %%mm0,%%ebx\n"
                        /*^*/ "punpcklbw %%mm5, %%mm3\n" /*^*/

                        "addl %%ebx,%%eax\n"
                        /*^*/ "movq %%mm3,%%mm4\n"       /*^*/
                        /*^*/ "movq %%mm3,%%mm5\n"       /*^*/

                        "movl %0,%%ebx\n"
                        /*^*/ "punpcklbw %%mm5,%%mm3\n"  /*^*/

                        "movq (%%ebx,%%eax,4),%%mm0\n"
                        /*^*/ "punpckhbw %%mm5,%%mm4\n"  /*^*/

                        "addl %1,%%eax\n"
                        "movq (%%ebx,%%eax,4),%%mm2\n"

                        : : "X"(expix1), "X"(prevX):"eax","ebx"
                );


to:
               /*
                 * pre : mm0 : Y pos [*|Y]
                 *       mm1 : X pos [*|X]
                 *
                 * post : mm0 : expix1[position]
                 *        mm2 : expix1[position+largeur]
                 *
                 * modif : eax,ecx
                 */
                psrld_i2r (PERTEDEC,mm0);
                psrld_i2r (PERTEDEC,mm1);
                __asm__ __volatile__ (
                        "movd %%mm1,%%eax\n"
                        /*^*/ "movq %%mm3,%%mm5\n"       /*^*/

                        "mull %1\n"
                        "movd %%mm0,%%ecx\n"
                        /*^*/ "punpcklbw %%mm5, %%mm3\n" /*^*/

                        "addl %%ecx,%%eax\n"
                        /*^*/ "movq %%mm3,%%mm4\n"       /*^*/
                        /*^*/ "movq %%mm3,%%mm5\n"       /*^*/

                        "movl %0,%%ecx\n"
                        /*^*/ "punpcklbw %%mm5,%%mm3\n"  /*^*/

                        "movq (%%ecx,%%eax,4),%%mm0\n"
c                       /*^*/ "punpckhbw %%mm5,%%mm4\n"  /*^*/

                        "addl %1,%%eax\n"
                        "movq (%%ecx,%%eax,4),%%mm2\n"

                        : : "X"(expix1), "X"(prevX):"eax","ecx"
                );


so.. now it compile cleanly ..

hth,
  Eric
Comment 5 solar (RETIRED) gentoo-dev 2005-01-22 12:46:05 UTC
I'm not sure hardened can really support these multi-media apps. If somebody has a patch for xine-lib then please attach it hee for testing. And then it's best to push it upstream wrappered in #ifdef __PIC__.
Comment 6 Kevin F. Quinn (RETIRED) gentoo-dev 2005-02-07 05:19:28 UTC
This is all fixed in 1.0 (apart from textrels, but that doesn't stop it building).  Try xine-lib-1.0; builds fine for me with "everything on" (currently marked ~x86 - add the line:

=media-libs/xine-lib-1.0 ~x86

to /etc/portage/package.keywords if you're otherwise stable).
Comment 7 Adam Mondl (RETIRED) gentoo-dev 2005-04-21 18:41:51 UTC
*** Bug 81088 has been marked as a duplicate of this bug. ***
Comment 8 Robert Paskowitz (RETIRED) gentoo-dev 2005-06-23 18:02:59 UTC
xine-lib-1.0-r2 is stable, and should work, according to comment 6.

Reopen if bug is not actually resolved.