Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 68140 - callgrind-0.9.9 compilation error - can't find a register in class `BREG' while reloading `asm'
Summary: callgrind-0.9.9 compilation error - can't find a register in class `BREG' whi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Caleb Tennis (RETIRED)
URL:
Whiteboard:
Keywords:
: 62219 92213 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-19 05:51 UTC by Pawel Pokladek
Modified: 2005-06-08 11:12 UTC (History)
6 users (show)

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


Attachments
Fix cpuid assembler code to be PIC-compatible (callgrind-sim-pic.patch,723 bytes, patch)
2005-01-28 03:42 UTC, Kevin F. Quinn (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Pokladek 2004-10-19 05:51:07 UTC
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"
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2004-12-02 03:28:31 UTC
can you try 0.9.10 and see if it persists?
Comment 2 Caleb Tennis (RETIRED) gentoo-dev 2004-12-02 03:30:11 UTC
*** Bug 62219 has been marked as a duplicate of this bug. ***
Comment 3 Fabio Rossi 2004-12-03 09:10:55 UTC
I had the same error. Then I recompiled the gcc switching the use flag "hardened" off. Now callgrind emerges without errors.
Comment 4 Benno Schulenberg 2004-12-04 07:57:14 UTC
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
Comment 5 Caleb Tennis (RETIRED) gentoo-dev 2004-12-06 16:53:04 UTC
I've got a filter-flags in the src_compile, but perhaps I'm going about it the wrong way.  maybe hardened can help?
Comment 6 Simon Roby 2004-12-12 12:14:23 UTC
I have the exact same error in 0.9.10, and I'm on a non-hardened system.
Comment 7 Simon Roby 2004-12-12 12:17:29 UTC
Weird, I tried recompiling and now it's fine...
Comment 8 darkstalker 2004-12-23 06:26:01 UTC
The problem still persists for me. Running on Gentoo Hardened with hardened gcc 3.3.4-r1.
Comment 9 darkstalker 2004-12-23 06:38:26 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.
Comment 10 Caleb Tennis (RETIRED) gentoo-dev 2004-12-23 10:00:07 UTC
I think if someone could file this with the callgrind maintainer, that would be very helpful.
Comment 11 Adrian Head 2005-01-03 11:39:55 UTC
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".
Comment 12 Kevin F. Quinn (RETIRED) gentoo-dev 2005-01-28 03:42:52 UTC
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.
Comment 13 Dirk Heinrichs 2005-03-09 04:53:59 UTC
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.
Comment 14 Caleb Tennis (RETIRED) gentoo-dev 2005-03-09 05:01:24 UTC
It doesn't cleanly apply here.
Comment 15 Caleb Tennis (RETIRED) gentoo-dev 2005-03-09 05:03:43 UTC
Nevermind, fixed the patch.  callgrind-0.9.10-r1 in portage.
Comment 16 Dirk Heinrichs 2005-03-09 05:16:45 UTC
Nice, thanks a lot.
Comment 17 Dirk Heinrichs 2005-04-04 23:08:37 UTC
Appears again in 0.9.11 :-(.
Comment 18 Gregorio Guidi (RETIRED) gentoo-dev 2005-05-11 02:59:01 UTC
Reopening.
Comment 19 Gregorio Guidi (RETIRED) gentoo-dev 2005-05-11 02:59:15 UTC
*** Bug 92213 has been marked as a duplicate of this bug. ***
Comment 20 Kevin F. Quinn (RETIRED) gentoo-dev 2005-05-11 08:27:07 UTC
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).
Comment 21 Gregorio Guidi (RETIRED) gentoo-dev 2005-06-08 11:12:09 UTC
Committed callgrind-0.9.11-r1 reintroducing the patch, please reopen if the 
problem persists.