From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86677 invoked by alias); 2 Oct 2015 03:18:12 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 86654 invoked by uid 48); 2 Oct 2015 03:18:07 -0000 From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/67812] Default-PIE patch broke building compiler as PIE and on esp toolchains Date: Fri, 02 Oct 2015 03:18:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg00131.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67812 --- Comment #3 from Rich Felker --- Further research into the PCH issue shows that it will be seriously broken when GCC is built as PIE; this looks hard to fix, but worthwhile to fix if it can be. There's almost certainly no way it can work on FDPIC hosts, even when run with MMU where the default load address gets used, since function descriptors may be dynamically allocated and their addresses could vary according to ASLR. In the mean time, would it be acceptable to just make PCH support depend on #ifndef __PIC__? Even if the build system turns off (or attempts to turn off) PIE like it's doing now, having #ifndef __PIC__ around the PCH code would be a good fail-safe against random code execution if GCC somehow gets built as PIE anyway. And users who really want/need PIE could just drop the Makefile.in lines above and have everything work.