This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/67812] New: Default-PIE patch broke building compiler as PIE and on esp toolchains
- From: "bugdal at aerifal dot cx" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 02 Oct 2015 00:06:26 +0000
- Subject: [Bug other/67812] New: Default-PIE patch broke building compiler as PIE and on esp toolchains
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67812
Bug ID: 67812
Summary: Default-PIE patch broke building compiler as PIE and
on esp toolchains
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: bugdal at aerifal dot cx
Target Milestone: ---
The default-pie patch added the following to gcc/Makefile.in:
+# We don't want to compile the compilers with -fPIE, it make PCH fail.
+COMPILER += @NO_PIE_CFLAGS@
+
+# Link with -no-pie since we compile the compiler with -fno-PIE.
+LINKER += @NO_PIE_FLAG@
This precludes building the compiler as PIE, which leads to multiple problems:
1. On existing PIE-by-default toolchains (ESP patches), -fno-PIE gets added to
NO_PIE_CFLAGS, but NO_PIE_FLAG remains blank, because the negative option was
called -nopie rather than -no-pie. Using -fno-PIE without -no-pie/-nopie
results in link errors on some host archs.
2. Refusal to build as PIE may violate distro policy of shipping only PIE
binaries.
3. For nommu systems, building as PIE is mandatory; non-PIE binaries simply
cannot run.
If there's an issue where PCH does not work with PIE then PCH should just be
disabled when the compiler is built as PIE. This worked fine before, and is
completely orthogonal to whether the compiler produces PIE by default; one is a
host issue and the other is a target issue.