gcc: drop explicit -fno-PIE, let gcc figure this out.

Explicit -fno-PIE results in parts of libstdc++.a being built non-PIC,
which breaks -static-libstdc++ for PIE binaries.
Also requires lots of fiddling in the build system which we try to
avoid.

See #8842.
This commit is contained in:
Leah Neukirchen 2017-11-06 15:02:05 +01:00
parent 5650abfedf
commit ec067ff736
1 changed files with 5 additions and 16 deletions

View File

@ -3,7 +3,7 @@ _majorver=7.2
pkgname=gcc
version=${_majorver}.0
revision=3
revision=4
short_desc="The GNU C Compiler"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://gcc.gnu.org"
@ -80,21 +80,6 @@ replaces="gcc-c++>=0"
pre_configure() {
# _FORTIFY_SOURCE needs an optimization level.
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {gcc,libiberty}/configure
if [ -n "$nopie" ]; then
# Fix configure failures by adding -no-pie when linking conftest.c/.cpp files
find -name configure -exec sed -i {} \
-e 's;$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS;& -no-pie;' \
-e 's;$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS;& -no-pie;' \
\;
# Fix linking error for fixincl by adding -no-pie
sed -i fixincludes/Makefile.in \
-e 's;-o $(FI);-no-pie &;' \
-e 's;-o $@;-no-pie &;'
# Fix linking error for gotools by adding -no-pie
sed -i gotools/Makefile.in \
-e 's;LINK = .*;& -no-pie;'
fi
}
do_configure() {
local _langs _args _hash
@ -167,6 +152,10 @@ do_configure() {
export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
# Disable explicit -fno-PIE, gcc will figure this out itself.
export CFLAGS="${CFLAGS//-fno-PIE/}"
export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
_args+=" --prefix=/usr"
_args+=" --mandir=/usr/share/man"
_args+=" --infodir=/usr/share/info"