Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 618908 - sys-devel/gcc-5.4.0-r3 fails to build with sys-devel/gcc-6.3.0 (-pie)
Summary: sys-devel/gcc-5.4.0-r3 fails to build with sys-devel/gcc-6.3.0 (-pie)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
: 624492 (view as bug list)
Depends on:
Blocks: gcc-6-stable
  Show dependency tree
 
Reported: 2017-05-19 08:59 UTC by tka
Modified: 2017-11-18 19:19 UTC (History)
8 users (show)

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


Attachments
gcc-build-logs.tar.bz2 (gcc-build-logs.tar.bz2,71.33 KB, application/x-bzip2)
2017-05-19 08:59 UTC, tka
Details
applay -no-pie on stage1 build (gcc6_nopie_oldergcc2.patch,428 bytes, patch)
2017-10-02 11:14 UTC, Magnus Granberg
Details | Diff
Patch toolchain eclass with a sed to add -no-pie (toolchain_eclass-no-pie.patch,629 bytes, patch)
2017-11-17 02:24 UTC, Magnus Granberg
Details | Diff
Patch toolchain eclass with a sed to add -no-pie (toolchain_eclass-no-pie.patch,631 bytes, patch)
2017-11-18 16:27 UTC, Magnus Granberg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tka 2017-05-19 08:59:08 UTC
Created attachment 473200 [details]
gcc-build-logs.tar.bz2

After upgrading to gcc-6.3.0, I uninstalled gcc-5.4.0. Now I tried to reinstall it, but the build fails.

x86_64-pc-linux-gnu-g++ -DEFAULT_PIE_SSP   -fno-PIE    -DIN_GCC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -o build/genmddeps \
    build/genmddeps.o build/read-md.o build/errors.o ../build-x86_64-pc-linux-gnu/libiberty/libiberty.a
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: build/genmddeps.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: build/read-md.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: build/errors.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: build/read-md.o: warning: relocation against `__stack_chk_fail@@GLIBC_2.4' in readonly section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:2635: build/genmddeps] Error 1
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-5.4.0-r3/work/build/gcc'
make[2]: *** [Makefile:4367: all-stage1-gcc] Error 2
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-5.4.0-r3/work/build'
make[1]: *** [Makefile:18753: stage1-bubble] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-5.4.0-r3/work/build'
make: *** [Makefile:19085: bootstrap-lean] Error 2
 * ERROR: sys-devel/gcc-5.4.0-r3::gentoo failed (compile phase):
 *   emake failed
Comment 1 tka 2017-05-19 09:01:20 UTC
# emerge --info '=sys-devel/gcc-5.4.0-r3::gentoo'
Portage 2.3.5 (python 3.4.6-final-0, hardened/linux/amd64/no-multilib, gcc-6.3.0, glibc-2.23-r3, 4.11.1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.11.1-x86_64-Intel-R-_Core-TM-_i7-3720QM_CPU_@_2.60GHz-with-gentoo-2.3
KiB Mem:    16397612 total,  10251008 free
KiB Swap:   17825788 total,  17825788 free
Timestamp of repository gentoo: Fri, 19 May 2017 08:00:01 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.26.2::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            6.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

local
    location: /var/lib/portage-local/local
    masters: gentoo
    priority: 0

testing
    location: /var/lib/portage-local/testing
    masters: gentoo
    priority: 1

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
MAKEOPTS="-j8"
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 --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 acl acpi alsa amd64 avx berkdb bzip2 cairo caps cdda cddb cdparanoia cli cracklib crypt cups cxx dbus dri dts dvd fam ffmpeg fftw flac fontconfig gdbm gif gimp gmp gnutls gtk hardened iconv icu idn ipv6 jpeg justify lame lcms libnotify lzma mad matroska mmap mmx mmxext modules mp3 mpeg ncurses networkmanager nptl ogg opengl openmp pam pcre pie png policykit ppds readline sasl sdl seccomp session sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg tcpd theora threads tiff truetype udev udisks unicode upower vaapi vorbis wayland x264 xattr xcb xinerama xml xtpax xv xvid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="i965 intel nouveau" XFCE_PLUGINS="power" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON


# gcc-config -l
 [1] x86_64-pc-linux-gnu-6.3.0 *

# emerge -pqv '=sys-devel/gcc-5.4.0-r3::gentoo' '=sys-devel/gcc-6.3.0:6.3.0::gentoo'
[ebuild   R   ] sys-devel/gcc-6.3.0  USE="cxx hardened nptl openmp (pie) (ssp) vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) -fortran (-gcj) -go -graphite (-jit) (-libssp) -mpx (-multilib) -nls -objc -objc++ -objc-gc (-pch) -regression-test (-sanitize) -vanilla" 
[ebuild  NS   ] sys-devel/gcc-5.4.0-r3 [6.3.0] USE="cxx hardened nptl openmp vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) -fortran -gcj -go -graphite (-jit) (-libssp) -mpx (-multilib) -nls -nopie -nossp -objc -objc++ -objc-gc -regression-test (-sanitize) -vanilla"
Comment 2 Arfrever Frehtes Taifersar Arahesis 2017-07-13 12:23:03 UTC
*** Bug 624492 has been marked as a duplicate of this bug. ***
Comment 3 Kristian 2017-09-15 13:58:12 UTC
same problem here, also with 6.4.0 on hardened.
Comment 4 Attila Tóth 2017-09-26 16:56:50 UTC
(In reply to Kristian from comment #3)
> same problem here, also with 6.4.0 on hardened.

Just like in my case: also with 6.4.0 on hardened.
Comment 5 Andreas K. Hüttel archtester gentoo-dev 2017-09-30 18:12:01 UTC
@ hardened - any idea?
Comment 6 Magnus Granberg gentoo-dev 2017-10-02 11:14:12 UTC
Created attachment 497404 [details, diff]
applay -no-pie on stage1 build

This patch applay -no-pie to stage1 ldflag so we can build older gcc with pie enable gcc
Comment 7 tka 2017-10-02 23:34:48 UTC
(In reply to Magnus Granberg from comment #6)
> Created attachment 497404 [details, diff] [details, diff]
> applay -no-pie on stage1 build
> 
> This patch applay -no-pie to stage1 ldflag so we can build older gcc with
> pie enable gcc

Confirmed. This patch works for me.
Comment 8 Attila Tóth 2017-10-03 08:17:57 UTC
(In reply to tka from comment #7)
> (In reply to Magnus Granberg from comment #6)
> > Created attachment 497404 [details, diff] [details, diff] [details, diff]
> > applay -no-pie on stage1 build
> > 
> > This patch applay -no-pie to stage1 ldflag so we can build older gcc with
> > pie enable gcc
> 
> Confirmed. This patch works for me.

Is it ment to be applied on the affected gcc-5.4.0 or the active gcc-6.*?
Comment 9 tka 2017-10-03 09:42:44 UTC
(In reply to Attila Tóth from comment #8)
> Is it ment to be applied on the affected gcc-5.4.0 or the active gcc-6.*?

The patch has to be applied to gcc-5.4.0.
Comment 10 Attila Tóth 2017-10-03 15:09:48 UTC
(In reply to tka from comment #9)
> (In reply to Attila Tóth from comment #8)
> > Is it ment to be applied on the affected gcc-5.4.0 or the active gcc-6.*?
> 
> The patch has to be applied to gcc-5.4.0.

Patch seems to solve the issue for me.
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2017-10-28 13:39:02 UTC
> -STAGE1_LDFLAGS = @stage1_ldflags@
> +STAGE1_LDFLAGS = @stage1_ldflags@ -no-pie

That will work only for host gcc-6+, right?

My understanding is gcc-5.4.0 calls it -nopie and we can't apply the patch unconditionally.
Comment 12 Norman Shulman 2017-11-15 16:57:51 UTC
(In reply to Magnus Granberg from comment #6)
> Created attachment 497404 [details, diff] [details, diff]
> applay -no-pie on stage1 build
> 
> This patch applay -no-pie to stage1 ldflag so we can build older gcc with
> pie enable gcc

Builds for me using gcc-6.4.
Comment 13 Magnus Granberg gentoo-dev 2017-11-17 02:24:20 UTC
Created attachment 504542 [details, diff]
Patch toolchain eclass with a sed to add -no-pie

This patch the eclass so we don't need to update the patchset.
We use a sed to add the needed the -no-pie
Comment 14 Magnus Granberg gentoo-dev 2017-11-18 16:27:02 UTC
Created attachment 504632 [details, diff]
Patch toolchain eclass with a sed to add -no-pie

Use sed instead och patch to add -no-pie
Comment 15 Larry the Git Cow gentoo-dev 2017-11-18 19:19:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff4fba46149d5e5e2db6b923fa70881ff4ca58ff

commit ff4fba46149d5e5e2db6b923fa70881ff4ca58ff
Author:     Magnus Granberg <zorry@gentoo.org>
AuthorDate: 2017-11-18 17:16:48 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: 2017-11-18 19:19:08 +0000

    toolchain.eclass: Add -no-pie to stage1 LDFLAGS when building <gcc-6 with >=gcc6, bug 618908
    
    Closes: https://bugs.gentoo.org/618908

 eclass/toolchain.eclass | 8 ++++++++
 1 file changed, 8 insertions(+)