Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 584014

Summary: sys-kernel/gentoo-sources-4.6.0: building w/gcc-6[pie]: kernel/bounds.c:1:0: error: code model kernel does not support PIC mode
Product: Gentoo Linux Reporter: Magnus Granberg <zorry>
Component: HardenedAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED FIXED    
Severity: normal CC: hardened, marci_r
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugzilla.kernel.org/show_bug.cgi?id=119381
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 582084, 582688    
Attachments: Add -fno-PIE and -no-pie
add only -fno-PIE
check if -fPIE and disable it
patch for 4.8
Upstream patch
Patch for 4.8

Description Magnus Granberg gentoo-dev 2016-05-24 19:50:46 UTC
Gcc 6.1 with use pie enable add -fPIE and -pie as default.
The kernel code don't compile well it.
virtual6 / # genkernel all
* Gentoo Linux Genkernel; Version 3.5.0.1
* Running with options: all

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

* Linux Kernel 4.6.0-gentoo for x86_64...
* .. with config file /etc/kernels/kernel-config-x86_64-4.6.0-gentoo
* kernel: Using config from /etc/kernels/kernel-config-x86_64-4.6.0-gentoo
* kernel: >> Running mrproper...
*         >> Running oldconfig...
* kernel: >> Cleaning...
* ERROR: Failed to compile the "prepare" target...
* 
* -- Grepping log... --
* 
*  HOSTCC  arch/x86/tools/relocs_common.o
*  HOSTLD  arch/x86/tools/relocs
*  CHK     include/generated/timeconst.h
*  CC      kernel/bounds.s
*  UPD     include/generated/timeconst.h
*kernel/bounds.c:1:0: error: code model kernel does not support PIC mode
* /*
* 
*Kbuild:44: recipe for target 'kernel/bounds.s' failed
*make[1]: *** [kernel/bounds.s] Error 1
*Makefile:1005: recipe for target 'prepare0' failed
*make: *** [prepare0] Error 2
*--
* Running with options: all
* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..
*
* ERROR: Failed to compile the "prepare" target...
* 
* -- End log... --
* 
* Please consult /var/log/genkernel.log for more information and any
* errors that were reported above.
* 
* Report any genkernel bugs to bugs.gentoo.org and
* assign your bug to genkernel@gentoo.org. Please include
* as much information as you can in your bug report; attaching
* /var/log/genkernel.log so that your issue can be dealt with effectively.
* 
* Please do *not* report compilation failures as genkernel bugs!

Reproducible: Always
Comment 1 Magnus Granberg gentoo-dev 2016-05-24 19:57:57 UTC
Portage 2.2.28 (python 3.4.3-final-0, default/linux/amd64/13.0, gcc-6.1.0, glibc-2.23-r2, 4.4.6-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.4.6-gentoo-x86_64-AMD_Opteron-TM-_Processor_6272-with-gentoo-2.2
KiB Mem:    32948116 total,  28190972 free
KiB Swap:    2000372 total,   2000372 free
Timestamp of repository gentoo: Mon, 09 May 2016 19:15:01 +0000
sh bash 4.3_p42-r2
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r2::gentoo
dev-lang/perl:            5.22.2::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo, 3.5.1-r2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.20.5::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.69-r2::gentoo
sys-devel/automake:       1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo, 6.1.0::x-portage
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.5::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Repositories:

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

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

ABI="amd64"
ABI_X86="32 64"
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
ALSA_CARDS="hda-intel intel8x0 intel8x0m"
ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol"
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"
ARCH="amd64"
AUTOCLEAN="yes"
BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_4 python_targets_python2_7 multilib"
CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"
CAMERAS="ptp2"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -fno-diagnostics-color"
CFLAGS_amd64="-m64"
CFLAGS_x32="-mx32"
CFLAGS_x86="-m32"
CHOST="x86_64-pc-linux-gnu"
CHOST_amd64="x86_64-pc-linux-gnu"
CHOST_x32="x86_64-pc-linux-gnux32"
CHOST_x86="i686-pc-linux-gnu"
CLEAN_DELAY="5"
COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
COLLISION_IGNORE="/lib/modules/* *.py[co] *$py.class */dropin.cache"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/portage/package.use/99_autounmask /etc/sandbox.d /etc/terminfo"
CPU_FLAGS_X86="mmx sse sse2"
CXXFLAGS="-O2 -pipe -march=native -fno-diagnostics-color"
DEFAULT_ABI="amd64"
DISTDIR="/usr/portage/distfiles"
EDITOR="/bin/nano"
ELIBC="glibc"
EMERGE_DEFAULT_OPTS="-v --binpkg-respect-use=y --rebuild-if-new-rev=y --rebuilt-binaries=y --binpkg-changed-deps=y --autounmask=y --autounmask-write=y --jobs=3 --load-average=5.0"
EMERGE_WARNING_DELAY="10"
EPREFIX=""
EROOT="/"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles merge-sync parallel-fetch preserve-libs protect-owned sandbox sfperms strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
FETCHCOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""
FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; eval \"declare -a ssh_opts=(\${3})\" ; exec sftp -P \${port} \"\${ssh_opts[@]}\" \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FFLAGS="-O2 -pipe"
GCC_COLORS=""
GCC_SPECS=""
GENTOO_MIRRORS="ftp://mirror.mdfnet.se/gentoo ftp://trumpetti.atm.tut.fi/gentoo/ http://distfiles.gentoo.org"
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 ublox ubx"
GRUB_PLATFORMS="pc"
GUILE_LOAD_PATH="/usr/share/guile/1.8"
HOME="/root"
INFOPATH="/usr/share/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/6.1.0/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.25.1/info"
INPUT_DEVICES="keyboard mouse synaptics evdev"
IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest"
KERNEL="linux"
LANG="en_US.utf8"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
LC_MESSAGES="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LDFLAGS_amd64="-m elf_x86_64"
LDFLAGS_x32="-m elf32_x86_64"
LDFLAGS_x86="-m elf_i386"
LESS="-R -M --shift 5"
LESSOPEN="|lesspipe %s"
LIBDIR_amd64="lib64"
LIBDIR_amd64_fbsd="lib64"
LIBDIR_arm="lib"
LIBDIR_arm64="lib64"
LIBDIR_n32="lib32"
LIBDIR_n64="lib64"
LIBDIR_o32="lib"
LIBDIR_ppc="lib32"
LIBDIR_ppc64="lib64"
LIBDIR_s390="lib32"
LIBDIR_s390x="lib64"
LIBDIR_sparc32="lib32"
LIBDIR_sparc64="lib64"
LIBDIR_x32="libx32"
LIBDIR_x86="lib32"
LIBDIR_x86_fbsd="lib32"
LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
LINGUAS="en"
LOGNAME="root"
MAIL="/var/mail/root"
MAKEOPTS="-j6"
MANPAGER="manpager"
MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/6.1.0/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.25.1/man"
MULTILIB_ABIS="amd64 x86"
MULTILIB_STRICT_DENY="64-bit.*shared object"
MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec)"
MULTIOSDIRS="../lib64:../lib32"
NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
NOCOLOR="true"
OFFICE_IMPLEMENTATION="libreoffice"
OLDPWD="/root"
PAGER="/usr/bin/less"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/6.1.0"
PHP_TARGETS="php5-5"
PKGDIR="/usr/portage/packages"
PORTAGE_ARCHLIST="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa hppa-hpux ia64 ia64-hpux ia64-linux m68k m68k-mint mips nios2 ppc ppc-aix ppc-macos ppc-openbsd ppc64 ppc64-linux riscv s390 sh sparc sparc-fbsd sparc-solaris sparc64-freebsd sparc64-solaris x64-cygwin x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
PORTAGE_BIN_PATH="/usr/lib/portage/python3.4"
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"
PORTAGE_CONFIGROOT="/"
PORTAGE_DEBUG="0"
PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"
PORTAGE_ELOG_CLASSES=""
PORTAGE_ELOG_MAILFROM="portage@localhost"
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"
PORTAGE_ELOG_MAILURI="root"
PORTAGE_ELOG_SYSTEM="save"
PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"
PORTAGE_FETCH_RESUME_MIN_SIZE="350K"
PORTAGE_GID="250"
PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA256 --clearsign --yes --default-key "${PORTAGE_GPG_KEY}" --homedir "${PORTAGE_GPG_DIR}" "${FILE}""
PORTAGE_INST_GID="0"
PORTAGE_INST_UID="0"
PORTAGE_INTERNAL_CALLER="1"
PORTAGE_OVERRIDE_EPREFIX=""
PORTAGE_PYM_PATH="/usr/lib64/python3.4/site-packages"
PORTAGE_PYTHONPATH="/usr/lib64/python3.4/site-packages"
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_RSYNC_RETRIES="-1"
PORTAGE_SYNC_STALE="30"
PORTAGE_TMPDIR="/var/tmp"
PORTAGE_TMPFS="/dev/shm"
PORTAGE_VERBOSE="1"
PORTAGE_WORKDIR_MODE="0700"
PORTAGE_XATTR_EXCLUDE="btrfs.* security.evm security.ima 	security.selinux system.nfs4_acl"
PORT_LOGDIR="/var/log/portage"
PORT_LOGDIR_CLEAN="find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete"
PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUES_USERLAND"
PWD="/root"
PYTHONDONTWRITEBYTECODE="1"
PYTHON_SINGLE_TARGET="python2_7"
PYTHON_TARGETS="python2_7 python3_4 python3_5"
RESUMECOMMAND="wget -c -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
RESUMECOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""
RESUMECOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
ROOT="/"
ROOTPATH="/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/6.1.0"
RPMDIR="/usr/portage/rpm"
RUBY_TARGETS="ruby20 ruby21 ruby22"
SHELL="/bin/bash"
SHLVL="1"
SSH_CLIENT="192.168.1.2 57043 22"
SSH_CONNECTION="192.168.1.2 57043 192.168.1.16 22"
SSH_TTY="/dev/pts/0"
SYMLINK_LIB="yes"
TERM="xterm"
UNINSTALL_IGNORE="/lib/modules/* /var/run /var/lock"
USE="X acl amd64 berkdb bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 mmx mmxext modules multilib ncurses nls nptl openmp pam pcre qt3support readline seccomp session sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="32 64" ALSA_CARDS="hda-intel intel8x0 intel8x0m" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2" 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 ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" RUBY_TARGETS="ruby20 ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="radeon" 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"
USER="root"
USERLAND="GNU"
USE_EXPAND="ABI_MIPS ABI_PPC ABI_S390 ABI_X86 ALSA_CARDS APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES CAMERAS COLLECTD_PLUGINS CPU_FLAGS_X86 CROSSCOMPILE_OPTS CURL_SSL DRACUT_MODULES DVB_CARDS ELIBC ENLIGHTENMENT_MODULES FCDSL_CARDS FFTOOLS FOO2ZJS_DEVICES FRITZCAPI_CARDS GPSD_PROTOCOLS GRUB_PLATFORMS INPUT_DEVICES KERNEL LCD_DEVICES LIBREOFFICE_EXTENSIONS LINGUAS LIRC_DEVICES MONKEYD_PLUGINS NETBEANS_MODULES NGINX_MODULES_HTTP NGINX_MODULES_MAIL NGINX_MODULES_STREAM OFED_DRIVERS OFFICE_IMPLEMENTATION OPENMPI_FABRICS OPENMPI_OFED_FEATURES OPENMPI_RM PHP_TARGETS PYTHON_SINGLE_TARGET PYTHON_TARGETS QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS ROS_MESSAGES RUBY_TARGETS SANE_BACKENDS USERLAND UWSGI_PLUGINS VIDEO_CARDS VOICEMAIL_STORAGE XFCE_PLUGINS XTABLES_ADDONS"
USE_EXPAND_HIDDEN="ABI_MIPS ABI_PPC ABI_S390 CROSSCOMPILE_OPTS ELIBC KERNEL USERLAND"
USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
USE_EXPAND_UNPREFIXED="ARCH"
USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa hppa-hpux ia64 ia64-hpux ia64-linux m68k m68k-mint mips nios2 ppc ppc64 ppc64-linux ppc-aix ppc-macos ppc-openbsd riscv s390 sh sparc sparc64-freebsd sparc64-solaris sparc-fbsd sparc-solaris x64-cygwin x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
USE_EXPAND_VALUES_ELIBC="AIX Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
USE_EXPAND_VALUES_USERLAND="BSD GNU"
USE_ORDER="env:pkg:conf:defaults:pkginternal:repo:env.d"
VIDEO_CARDS="radeon"
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"
Comment 2 Magnus Granberg gentoo-dev 2016-05-24 20:07:16 UTC
Created attachment 435292 [details, diff]
Add -fno-PIE and -no-pie
Comment 3 Emil Medve 2016-05-25 15:15:03 UTC
Everything else being the same, when compiling the kernel (v4.6.0) with gcc v6.1.0 instead of v5.3.0, the resulting kernel fails to boot. Any obvious mistake I'm making?
Comment 4 Emil Medve 2016-05-25 22:01:36 UTC
> LDFLAGS += $(call ld-option, -no-pie,)

With my 'GNU ld (Gentoo 2.25.1 p1.1) 2.25.1' -no-pie is not a command-line option, yet ld-option concludes it is because ld parses -no-pie as '-n' followed by '-o -pie' (output file name is '-pie'). At kernel link time '-n' causes just enough trouble to render the kernel unusable
Comment 5 Magnus Granberg gentoo-dev 2016-05-25 22:30:16 UTC
Created attachment 435394 [details, diff]
add only -fno-PIE
Comment 6 Magnus Granberg gentoo-dev 2016-10-04 21:13:09 UTC
Created attachment 449158 [details, diff]
check if -fPIE and disable it

Check if the compiler default to -fPIE and disable it with -fno-PIE
Comment 7 Anthony Basile gentoo-dev 2016-10-13 06:20:08 UTC
(In reply to Magnus Granberg from comment #6)
> Created attachment 449158 [details, diff] [details, diff]
> check if -fPIE and disable it
> 
> Check if the compiler default to -fPIE and disable it with -fno-PIE

That patch doesn't apply cleanly to git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git.  I'm not sure how to clean it up.  Can you take a look at it before I submit it upstream.
Comment 8 Magnus Granberg gentoo-dev 2016-10-13 18:49:54 UTC
Created attachment 450174 [details, diff]
patch for 4.8
Comment 9 Magnus Granberg gentoo-dev 2016-11-16 20:41:38 UTC
Created attachment 453568 [details, diff]
Upstream patch

The patches is from https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/?h=rc-fixes
Comment 10 Magnus Granberg gentoo-dev 2016-11-16 20:44:28 UTC
Kernel can this be added to the patchset?
Comment 11 Mike Pagano gentoo-dev 2016-11-16 20:57:53 UTC
(In reply to Magnus Granberg from comment #10)
> Kernel can this be added to the patchset?

Any specific kernel version in mind?
Comment 12 Magnus Granberg gentoo-dev 2016-11-16 21:06:45 UTC
(In reply to Mike Pagano from comment #11)
> (In reply to Magnus Granberg from comment #10)
> > Kernel can this be added to the patchset?
> 
> Any specific kernel version in mind?
4.8.x will do
Comment 14 Magnus Granberg gentoo-dev 2016-11-16 21:56:36 UTC
(In reply to Mike Pagano from comment #13)
> https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/patch/
> ?id=8ae94224c9d72fc4d9aaac93b2d7833cf46d7141
> 
> https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/patch/
> ?id=82031ea29e454b574bc6f49a33683a693ca5d907
> 
> 
> https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/patch/
> ?id=90944e40ba1838de4b2a9290cf273f9d76bd3bdd
> 
> https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/patch/
> ?id=c6a385539175ebc603da53aafb7753d39089f32e
> 
> The first and the forth fail, I'll take a closer look, but feel free to look
> yourself if you can beat me to it.

the attached patch applay cleany agenst 4.8.8
Comment 15 Magnus Granberg gentoo-dev 2016-11-22 22:44:50 UTC
Fixed in 4.9-rc6 upstream.
Any progress on 4.8?
Comment 16 Mike Pagano gentoo-dev 2016-11-23 11:41:03 UTC
The attachment fails to apply to gentoo-sources-4.8.10, I'm sure it's simple.  American Holiday starts tomorrow, so I should be able to look at it then.
Comment 17 Magnus Granberg gentoo-dev 2016-11-23 19:14:41 UTC
(In reply to Mike Pagano from comment #16)
> The attachment fails to apply to gentoo-sources-4.8.10, I'm sure it's
> simple.  American Holiday starts tomorrow, so I should be able to look at it
> then.
laptop1 linux-4.8.10-gentoo # patch -p1 < kernel-fno-pie.patch
patching file scripts/gcc-x86_64-has-stack-protector.sh
patching file arch/x86/purgatory/Makefile
patching file Makefile
laptop1 linux-4.8.10-gentoo #
Comment 18 Mike Pagano gentoo-dev 2016-11-23 19:28:11 UTC
patch -p1 < /tmp/kerbel-fno-pie.patch 
patching file scripts/gcc-x86_64-has-stack-protector.sh
Hunk #1 succeeded at 1 with fuzz 2.
patching file arch/x86/purgatory/Makefile
Hunk #1 succeeded at 16 with fuzz 1.
patching file Makefile
Hunk #1 FAILED at 399.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.rej


Again, I will look at this.
Comment 19 Mike Pagano gentoo-dev 2016-11-23 20:16:49 UTC
Created attachment 454150 [details, diff]
Patch for 4.8

Review this
Comment 20 Magnus Granberg gentoo-dev 2016-11-23 20:52:55 UTC
if you look in the patch on the Makefile parts
in one part
--- a/Makefile	2016-11-23 15:03:33.153194812 -0500
+++ b/Makefile	2016-11-23 15:04:11.433367357 -0500
@@ -621,6 +621,8 @@ include arch/$(SRCARCH)/Makefile
 
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 KBUILD_CFLAGS	+= $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS	+= $(call cc-option,-fno-PIE)
+KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os

then later

@@ -621,8 +621,6 @@ include arch/$(SRCARCH)/Makefile
 
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 KBUILD_CFLAGS	+= $(call cc-disable-warning,maybe-uninitialized,)
-KBUILD_CFLAGS	+= $(call cc-option,-fno-PIE)
-KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os

one add it and then it get remove
Comment 21 Mike Pagano gentoo-dev 2016-11-24 00:35:03 UTC
Isn't the result the same as the previous patch?

#+KBUILD_CFLAGS	+= $(call cc-option,-fno-PIE)
#+KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)
Comment 22 Mike Pagano gentoo-dev 2016-11-24 00:39:47 UTC
Looks like some of these are queued for the next upstream release

http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git/commit/?id=afad7e0e67ef545a4d92507a236f0666c33d3ad4
Comment 23 Magnus Granberg gentoo-dev 2016-11-24 15:35:39 UTC
(In reply to Mike Pagano from comment #22)
> Looks like some of these are queued for the next upstream release
> 
> http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git/commit/
> ?id=afad7e0e67ef545a4d92507a236f0666c33d3ad4
Just wait for that one.
Comment 24 Magnus Granberg gentoo-dev 2016-12-06 21:29:09 UTC
fixed in g-s 4.8.12