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:
Created attachment 34667 [details, diff] patch
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-------------------
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)
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.
I had this bug with gcc 3.4.2. The ebuild and patch compiled cleanly for me and fixed the issue
Thomas, thanks for the patch. in portage.