Compilation on hardened produces the following: cc -Wall -m32 -march=i486 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector -m32 -c -o patn.o patn.c test.c: In function `movinvr': test.c:302: error: can't find a register in class `BREG' while reloading `asm' Solution (???): inherit flag-o-matic and filter-flags "-fPIC" in source_compile.
emerge --info please.
[randyb@nsg-dev-01 ~] emerge --info Portage 2.1.3.19 (hardened/x86/2.6, gcc-3.4.6, glibc-2.6.1-r0, 2.6.23-hardened-r5 i686) ================================================================= System uname: 2.6.23-hardened-r5 i686 Intel(R) Xeon(TM) CPU 3.06GHz Timestamp of tree: Wed, 13 Feb 2008 01:47:01 +0000 app-shells/bash: 3.2_p17-r1 dev-lang/python: 2.4.4-r6, 2.5.1-r5 dev-python/pycrypto: 2.0.1-r6 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.61-r1 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.8.5-r3, 1.9.6-r2, 1.10.1 sys-devel/binutils: 2.18-r1 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.24 ACCEPT_KEYWORDS="x86 ~x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=pentium4 -O2 -fforce-addr -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /var/bind" CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-march=pentium4 -O2 -fforce-addr -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="buildpkg collision-protect distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LINGUAS="en" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_EXTRA_OPTS="-P" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X509 acl aio ares atm audit bash-completion bcmath berkdb big-tables bzip2 caps cdb cgi chroot cli cracklib crypt curl cvs dbase dbtool dbus dell dhcp dlz extensions extraengine fam fastcgi flatfile force-cgi-redirect ftp gd gd-external git gmp gpg gpgme gpm hal hardened hash hpn hybrid-auth icap-client iconv idea idn imap inifile iproute2 ipv6 isc ithreads jpeg keyscrub libedit lighttpd loop-aes lzo max-idx-128 mbox md5sum memcache mhash midi mmx multislot mutilib mysql ncurses nfs nls nntp nptl nptlonly openct openmp openntpd openssl pam pcapnav pcntl pcre pcsc-lite pdo perl pg-intdatetime php pic png pop posix postgres python readline rrdcgi rrdtool session sguil simplexml smartcard smime smtp sockets socks5 soundex spl sqlite sqlite3 sse2 ssl subversion suhosin tcpd tftp threads tidy tokenizer truetype unicode urandom usb vnc x86 xattr xml xmlreader xmlrpc xmlwriter xorg xsl zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Sorry for the spam, but 'filter-flags "-fPIC"' doesn't work - the Makefile sets it as well. Manual removal (sed in unpack) still doesn't fix the issue; same failure as before. cc -Wall -m32 -march=i486 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fno-stack-protector -m32 -c -o lib.o lib.c test.c: In function `movinvr': test.c:302: error: can't find a register in class `BREG' while reloading `asm' test.c:364: error: can't find a register in class `BREG' while reloading `asm' I'm out of ideas now - this might have to go upstream.
Just try. -fno-pie -nopie.
Neither of the following substitutions worked (sed shorthand): s/-fPIC/-nopie -no-pie/ s/-fPIC/-fPIC -nopie -no-pie/ They still failed at the same point. Setting GCC profile to -hardenednopiessp succeeds in compiling (no substitutions).
If it's still failing when using -fno-pie -nopie then clearly the cflags are not being propogated down into the source code where it needs to be.
For the permanent record, I'm adding these CFLAGS by hand and running 'make' by hand as well, after running an 'ebuild <ebuild> unpack' [bob@dev-01 memtest86+-2.00] make clean rm -f *.o memtest.bin memtest memtest_shared memtest_shared.bin [bob@dev-01 memtest86+-2.00] grep CFLAGS= Makefile CFLAGS=-Wall -m32 -march=i486 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fno-pie -nopie -fno-stack-protector [bob@dev-01 memtest86+-2.00] make as -32 -o head.o head.s cc -c -Wall -m32 -march=i486 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fno-pie -nopie -fno-stack-protector -fno-strict-aliasing -fno-stack-protector reloc.c reloc.c: In function `_dl_start': reloc.c:49: warning: 'got' might be used uninitialized in this function reloc.c:49: warning: 'got' might be used uninitialized in this function cc -Wall -m32 -march=i486 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fno-pie -nopie -fno-stack-protector -m32 -c -o main.o main.c cc -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding test.c test.c: In function `movinvr': test.c:302: error: can't find a register in class `BREG' while reloading `asm' test.c:364: error: can't find a register in class `BREG' while reloading `asm' make: *** [test.o] Error 1
The problem should be fixed in CVS now. Thanks everyone.