Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 484798 - sys-devel/gcc > 4.7.0 wont compile, cc1: internal compiler error: Illegal instruction (libgcc)
Summary: sys-devel/gcc > 4.7.0 wont compile, cc1: internal compiler error: Illegal ins...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-13 17:28 UTC by User3569
Modified: 2013-09-13 19:09 UTC (History)
1 user (show)

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


Attachments
gcc-build-logs.tar.bz2 (gcc-build-logs.tar.bz2,95.49 KB, application/octet-stream)
2013-09-13 17:28 UTC, User3569
Details

Note You need to log in before you can comment on or make changes to this bug.
Description User3569 2013-09-13 17:28:43 UTC
Created attachment 358596 [details]
gcc-build-logs.tar.bz2

sys-devel/gcc > 4.7.0 wont compile, cc1: internal compiler error: Illegal instruction (libgcc)

Hello, I am unable to compile gcc > 4.7.0 on a fresh install. I am running a gentoo linux vm in Xenserver 6.2. The error happens when I add -march=native to the cflags. CPU is Xeon E3-1270 v2.

Pasted below are some of the different options I tried and emerge info. The complete gcc-build-logs.tar.bz2 is attached.


Below are some of the options I tried:
4.6.3 -> 4.7.3
 NO: -march=native
 NO: -march=corei7 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mno-avx -msse4.2 -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=generic -fno-strict-overflow -fPIE -fstack-protector-all
 YES: -march=corei7 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mno-avx -msse4.2 -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=generic -fno-strict-overflow -fPIE (remove -fstack-protector-all)

YES: 4.6.3 -> 4.7.0 (with -march=native)
NO: 4.6.3 -> 4.7.1  (with -march=native)
NO: 4.6.3 -> 4.7.2-r1 (with -march=native)
NO: 4.6.3 -> 4.7.3 (with -march=native)
NO: 4.6.3 -> 4.8.1 (with -march=native)


4.7.3 (without -fstack-protector-all) -> 4.7.3
 YES: -march=i686
 NO: -O1 (changed from -O2)
 NO: -march=core-avx-i
 NO: -march=native
 NO: -march=corei7 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mrdrnd -mf16c -mfsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=generic -fno-strict-overflow -fPIE -fstack-protector-all (this is what march=native expands to)
 NO: -march=corei7 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mrdrnd -mf16c -mfsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=generic -fno-strict-overflow -fPIE (remove -fstack-protector-all)

YES: 4.7.0 -> 4.7.0 (with -march=native)
NO: 4.7.0 -> 4.7.3 (with -march=native)


localhost ~ # emerge -pqv '=sys-devel/gcc-4.7.3::gentoo'
[ebuild   R   ] sys-devel/gcc-4.7.3  USE="cxx hardened mudflap nls nptl openmp (-altivec) -doc (-fixed-point) -fortran -gcj -go -graphite -gtk (-libssp) -lto (-multilib) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla"



localhost ~ # emerge --info '=sys-devel/gcc-4.7.3::gentoo'
Portage 2.2.1 (hardened/linux/amd64/no-multilib/selinux, gcc-4.7.3, glibc-2.15-r3, 3.10.1-hardened-r1 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.10.1-hardened-r1-x86_64-Intel-R-_Xeon-R-_CPU_E3-1270_V2_@_3.50GHz-with-gentoo-2.2
KiB Mem:    16033796 total,  11884316 free
KiB Swap:     916476 total,    916476 free
Timestamp of tree: Wed, 11 Sep 2013 22:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p45
dev-lang/python:          2.7.5, 3.2.5-r1
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.69
sys-devel/automake:       1.12.6
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.6.3, 4.7.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=native"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/ http://gentoo.mirrors.hoobly.com/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="amd64 bash-completion berkdb bzip2 cli cracklib crypt cxx dri gdbm hardened iconv ipv6 justify mmx modules mudflap ncurses nls nptl offensive open_perms openmp pam pax_kernel pcre perl python readline selinux session sse sse2 ssl tcpd threads unicode urandom vim-syntax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 cgi cgid 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" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="UTF-8" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

sys-devel/gcc-4.7.3 was built with the following:
USE="cxx hardened mudflap nls nptl openmp (selinux) (-altivec) -doc (-fixed-point) -fortran -gcj -go -graphite -gtk (-libssp) -lto (-multilib) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla"
CFLAGS="-O2 -pipe -march=corei7 -mno-movbe -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-lzcnt -mtune=generic -fno-strict-overflow"
CXXFLAGS="-O2 -pipe -march=corei7 -mno-movbe -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-lzcnt -mtune=generic -fno-strict-overflow"
Comment 1 User3569 2013-09-13 17:31:59 UTC
cpuinfo from the Guest
processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Xeon(R) CPU E3-1270 V2 @ 3.50GHz
stepping        : 9
microcode       : 0x12
cpu MHz         : 3500.101
cache size      : 8192 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes f16c rdrand hypervisor lahf_lm fsgsbase smep erms
bogomips        : 7093.66
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:


cpuinfo from the Host
processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Xeon(R) CPU E3-1270 V2 @ 3.50GHz
stepping        : 9
cpu MHz         : 3500.098
cache size      : 8192 KB
physical id     : 3
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 3
initial apicid  : 3
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc nonstop_tsc aperfmperf pni pclmulqdq vmx est ssse3 sse4_1 sse4_2 x2apic popcnt aes hypervisor ida arat tpr_shadow vnmi flexpriority ept vpid
bogomips        : 7036.86
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:
Comment 2 Michael Palimaka (kensington) gentoo-dev 2013-09-13 18:06:12 UTC
There is an issue with Xen and -march=native.

-march=native naturally implies all flags supported by the CPU, but Xen does not necessarily expose them all to the DomU.

In my case, these flags worked for me: CFLAGS="-march=native -mno-avx -O2 -pipe"
Comment 3 User3569 2013-09-13 19:07:42 UTC
(In reply to Michael Palimaka (kensington) from comment #2)
> There is an issue with Xen and -march=native.
> 
> -march=native naturally implies all flags supported by the CPU, but Xen does
> not necessarily expose them all to the DomU.
> 
> In my case, these flags worked for me: CFLAGS="-march=native -mno-avx -O2
> -pipe"

This worked for me. Thanks!