When I try to emerge callgrind with gentoo hardened profile I get an error: can't find a register in class `BREG' while reloading `asm' !!! ERROR: dev-util/callgrind-0.9.9 failed. !!! Function src_compile, Line 415, Exitcode 2 !!! emake failed Reproducible: Always Steps to Reproduce: 1.emerge callgring 2. 3. Actual Results: !!! ERROR: dev-util/callgrind-0.9.9 failed. !!! Function src_compile, Line 415, Exitcode 2 !!! emake failed Expected Results: callgrind emerged successfully I'm using HARDENED gentoo profile, and I suppose that the problem is in '-fPIC' flag, I think it should be filtered out in ebuild. Portage 2.0.50-r11 (x86, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.8-gentoo-r10) ================================================================= System uname: 2.6.8-gentoo-r10 i686 AMD Athlon(tm) XP 2500+ Gentoo Base System version 1.4.16 ccache version 2.3 [enabled] Autoconf: sys-devel/autoconf-2.59-r5 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-Os -march=athlon-xp -msse -mmmx -m3dnow -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/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-Os -march=athlon-xp -msse -mmmx -m3dnow -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox strict userpriv usersandbox" GENTOO_MIRRORS="http://src.gentoo.pl/ http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/portage/local" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="3dnow 3dnowex X acl acpi alsa apache2 arts audiofile avi berkdb bitmap-fonts bzlib cap caps cdparanoia cdr codecs crypt cscope ctype cups curl dedicated dga dio divx4linux dlloader doc dts dv encode erandom exif extensions faac fam ffmpeg flac flash foomaticdb freetype ftp gcj gd gdbm gif gimp gimpprint gphoto2 graphviz gs gstreamer gtk gtk2 hardened hardenedphp iconv imagemagick imap imlib innodb java javascript jbig jikes jp2 jpeg jpeg2k junit kadu-moduleskde kerberos lcms libg++ libwww linguas_pl lirc live lzo mad maildir matroska memlimit mhash mikmod mime ming mmap mmx mmx2 mng monkey motif mozilla moznocompose moznoirc moznomail mozsvg mp3 mpeg mpeg4 mpi myslqi mysql ncurses nls no-old-linux nocd nptl oav odbc oggvorbis openal opengl operanom2 pam pdflib perl php pic pie png portaudio posix postgres ppds private python qt quicktime radeon readline recode samba sasl sdl session shared sharedmem simplexml slang slp sndfile snmp sockets speedo speex spell spl sse sse2 ssl svg sysvipc szip tcltk tcpd theora tiff truetype type1 unicode usb v4l2 videos vim-with-x virus-scan wmf wxwindows x86 xface xine xml xml2 xmms xosd xpm xprint xsl xv xvid xvmc yv12 zlib zvbi"
can you try 0.9.10 and see if it persists?
*** Bug 62219 has been marked as a duplicate of this bug. ***
I had the same error. Then I recompiled the gcc switching the use flag "hardened" off. Now callgrind emerges without errors.
For me it persits with 0.9.10. I'm also using a hardenend gcc (3.4.3), but no not wish to recompile the compiler. Callgrind is called in by kdesdk, but doesn't seem to need it very much, it runs without it. The error in a bit more detail: [...] if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"callgrind\" -DVERSION=\"0.9.10\" -I. -I. -I../-I/usr/include/valgrind -DVG_LIBDIR="\"/usr/lib"\" -Winline -Wall -Wshadow -O2 -fomit-frame-pointer -mpreferred-stack-boundary=2 -g -mpreferred-stack-boundary=2 -MT sim.o -MD -MP -MF ".deps/sim.Tpo" -c -o sim.o sim.c; \ then mv -f ".deps/sim.Tpo" ".deps/sim.Po"; else rm -f ".deps/sim.Tpo"; exit 1; fi sim.c: In function `cachesim_post_clo_init': sim.c:696: error: can't find a register in class `BREG' while reloading `asm' sim.c:696: error: can't find a register in class `BREG' while reloading `asm' sim.c:696: error: can't find a register in class `BREG' while reloading `asm' sim.c:696: error: can't find a register in class `BREG' while reloading `asm' sim.c:696: error: can't find a register in class `BREG' while reloading `asm' sim.c:696: error: can't find a register in class `BREG' while reloading `asm' make[2]: *** [sim.o] Error 1 make[2]: Leaving directory `/var/tmp/portage/callgrind-0.9.10/work/callgrind-0.9.10/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/callgrind-0.9.10/work/callgrind-0.9.10/src' make: *** [all-recursive] Error 1 !!! ERROR: dev-util/callgrind-0.9.10 failed. !!! Function src_compile, Line 510, Exitcode 2 !!! emake failed
I've got a filter-flags in the src_compile, but perhaps I'm going about it the wrong way. maybe hardened can help?
I have the exact same error in 0.9.10, and I'm on a non-hardened system.
Weird, I tried recompiling and now it's fine...
The problem still persists for me. Running on Gentoo Hardened with hardened gcc 3.3.4-r1.
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.
I think if someone could file this with the callgrind maintainer, that would be very helpful.
It appears that someone has already taken this up with the maintainer - although no word as of yet. http://sourceforge.net/tracker/?atid=507103&group_id=64331&func=browse 1080329 callgrind-0.9.10 will not compile 2004-12-06 15:48 5 nobody amoeba2k I tried to implement the patch from here: http://bugs.kde.org/show_bug.cgi?id=79696 but didn't get very far - I expect that it would work if I fully understood what was happening. You usually don't have to recompile gcc to remove the hardened options... I have used the following work-around a few times: laptop portage # gcc-config -l [1] i386-pc-linux-gnu-3.3.4 [2] i686-pc-linux-gnu-3.4.3 * [3] i686-pc-linux-gnu-3.4.3-hardenednopie [4] i686-pc-linux-gnu-3.4.3-hardenednossp [5] i686-pc-linux-gnu-3.4.3-vanilla laptop portage # gcc-config i686-pc-linux-gnu-3.4.3-hardenednopie && source /etc/profile Note: i686-pc-linux-gnu-3.4.3-vanilla will also work. laptop portage # emerge --oneshot callgrind Then put the hardened tool chain back into use after: laptop portage # gcc-config i686-pc-linux-gnu-3.4.3 && source /etc/profile Then continue... laptop portage # emerge kdesdk kdevelop Its not perfect - but following this only callgrind is not "hardened".
Created attachment 49723 [details, diff] Fix cpuid assembler code to be PIC-compatible Fixes the compilation error. Problem, as always, is that EBX is used by the compiler for PIC code, so it often has to be preserved.
The patch works for me (with 0.9.10). It's over a month old now, could somebody add it to the portage tree, please.
It doesn't cleanly apply here.
Nevermind, fixed the patch. callgrind-0.9.10-r1 in portage.
Nice, thanks a lot.
Appears again in 0.9.11 :-(.
Reopening.
*** Bug 92213 has been marked as a duplicate of this bug. ***
Try the sim-pic patch that went into 0.9.10-r1. You'll need to fixup a couple of things to get the patch to apply. Create an overlay, then add: cd ${S} epatch ${FILESDIR}/callgrind-sim-pic.patch to the src_unpack() function after the 'unpack ${A}'; and edit the patch file callgrind-sim-pic.patch to remove "callgrind-0.9.10/' from the two lines at the top of the file so they read: --- src/sim.c.orig 2005-01-28 11:40:35.000000000 +0100 +++ src/sim.c 2005-01-28 11:50:00.000000000 +0100 (the hunk offset has changed, but that doesn't stop the patch from applying correctly).
Committed callgrind-0.9.11-r1 reintroducing the patch, please reopen if the problem persists.