Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 55906 - libnids fails while compiling (gcc 3.5) with -fPIC due to clobbered register
Summary: libnids fails while compiling (gcc 3.5) with -fPIC due to clobbered register
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-02 12:30 UTC by Jon Oberheide
Modified: 2004-12-17 04:22 UTC (History)
2 users (show)

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


Attachments
patch (libnids-asm-clobber-bx.patch,374 bytes, patch)
2004-07-02 12:31 UTC, Jon Oberheide
Details | Diff
src/checksum.c, save/restore ebx (libnids-1.18-chksum.c.diff,615 bytes, patch)
2004-11-02 11:45 UTC, Thomas
Details | Diff
An ebuild which uses Thomas's libnids-1.18-chksum.c.diff (libnids-1.18-r1.ebuild,1.07 KB, text/plain)
2004-11-04 08:59 UTC, Josh Nichols (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Oberheide 2004-07-02 12:30:00 UTC
when emerging libnids-1.18 with gcc 3.5:

cd src ; make  shared
make[1]: Entering directory `/var/tmp/portage/libnids-1.18/work/libnids-1.18/src'
gcc -fPIC -march=athlon-xp -O3 -pipe -D_BSD_SOURCE -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/include -I/usr/include -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -c checksum.c -o checksum_pic.o
checksum.c: In function `csum_partial':
checksum.c:25: error: PIC register `bx' clobbered in `asm'
make[1]: *** [checksum_pic.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/libnids-1.18/work/libnids-1.18/src'
make: *** [shared] Error 2

bx is already in the clobbered register list.  I'm no expert on how GCC handles the clobbered registers but removing bx from the clobber list allows it to compile successfully.  Can anyone verify that this is the correct way to handle this?

Regards,
Jon Oberheide
jon@focalhost.com

Reproducible: Always
Steps to Reproduce:
Comment 1 Jon Oberheide 2004-07-02 12:31:51 UTC
Created attachment 34667 [details, diff]
patch
Comment 2 Itay Greenspon 2004-10-12 06:00:31 UTC
Same thing happens here, using:
gcc (GCC) 3.4.2  (Gentoo Linux 3.4.2-r2, ssp-3.4.1-1, pie-8.7.6.5)

Error message is:
----------------------------------------------------START-------------------
gcc -fPIC -march=pentium4 -O3 -mtune=pentium4 -fomit-frame-pointer -pipe -D_BSD_SOURCE -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/include -I/usr/include -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -c checksum.c -o checksum_pic.o
checksum.c: In function `csum_partial':
checksum.c:25: error: PIC register `bx' clobbered in `asm'
make[1]: *** [checksum_pic.o] Error 1
------------------------------------------------------END-------------------
Comment 3 Thomas 2004-11-02 11:45:30 UTC
Created attachment 43179 [details, diff]
src/checksum.c, save/restore ebx

IMO one should be more careful about EBX. I would prefer saving/restoring it
instead of removing the register from the clobber list. See the attached patch.

(can confirm the same problem with gcc-3.4.2)
Comment 4 Josh Nichols (RETIRED) gentoo-dev 2004-11-04 08:59:39 UTC
Created attachment 43291 [details]
An ebuild which uses Thomas's libnids-1.18-chksum.c.diff

I can confirm that Thomas's libnids-1.18-chksum.c.diff fixes the problem. I've
attached an ebuild that makes uses of it.
Comment 5 Dion Sole 2004-11-08 18:00:09 UTC
I had this bug with gcc 3.4.2. 
The ebuild and patch compiled cleanly for me and fixed the issue
Comment 6 Eldad Zack (RETIRED) gentoo-dev 2004-12-17 04:22:26 UTC
Thomas, thanks for the patch.
in portage.