From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10509 invoked by alias); 28 Aug 2017 14:27:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3274 invoked by uid 89); 28 Aug 2017 14:27:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=insane X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Aug 2017 14:27:37 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1482B81DF0; Mon, 28 Aug 2017 14:27:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1482B81DF0 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-117-47.phx2.redhat.com [10.3.117.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA6CA53C76; Mon, 28 Aug 2017 14:27:35 +0000 (UTC) Subject: Re: [PATCH] Fix pr80044, -static and -pie insanity, and pr81170 To: Alan Modra , gcc-patches@gcc.gnu.org References: <20170622152859.GG8406@bubble.grove.modra.org> From: Jeff Law Message-ID: <24af0ca6-1673-ba77-152d-b6452f8c8047@redhat.com> Date: Mon, 28 Aug 2017 15:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170622152859.GG8406@bubble.grove.modra.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg01583.txt.bz2 On 06/22/2017 09:28 AM, Alan Modra wrote: > PR80044 notes that -static and -pie together behave differently when > gcc is configured with --enable-default-pie as compared to configuring > without (or --disable-default-pie). This patch removes that > difference. In both cases you now will have -static completely > overriding -pie. > > Fixing this wasn't quite as simple as you'd expect, due to poor > separation of functionality. PIE_SPEC didn't just mean that -pie was > on explicitly or by default, but also -r and -shared were *not* on. > Fortunately the three files touched by this patch are the only places > PIE_SPEC and NO_PIE_SPEC are used, so it isn't too hard to see that > the reason PIE_SPEC and NO_PIE_SPEC are not inverses is the use of > PIE_SPEC in LINK_PIE_SPEC. So, move the inelegant symmetry breaking > addition, to LINK_PIE_SPEC where it belongs. Doing that showed > another problem in gnu-user.h, with PIE_SPEC and NO_PIE_SPEC selection > of crtbegin*.o not properly hooked into a chain of if .. elseif .. > conditions, which required both PIE_SPEC and NO_PIE_SPEC to exclude > -static and -shared. Fixing that particular problem finally allows > PIE_SPEC to serve just one purpose, and NO_PIE_SPEC to disappear. > > Bootstrapped and regression tested powerpc64le-linux c,c++. No > regressions and a bunch of --enable-default-pie failures squashed. > OK mainline and active branches? > > Incidentally, there is a fairly strong case to be made for adding > -static to the -shared, -pie, -no-pie chain of RejectNegative's in > common.opt. Since git 0d6378a9e (svn r48039) 2001-11-15, -static has > done more than just the traditional "prevent linking with dynamic > libraries", as -static selects crtbeginT.o rather than crtbegin.o > on GNU systems. Realizing this is what led me to close pr80044, which > I'd opened with the aim of making -pie -static work together (with the > traditional meaning of -static). I don't that is worth doing, but > mention pr80044 in the changelog due to fixing the insane output > produced by -pie -static with --disable-default-pie. > > PR driver/80044 > PR target/81170 > * gcc.c (NO_PIE_SPEC): Delete. > (PIE_SPEC): Define as !no-pie/pie. Move static|shared|r exclusion.. > (LINK_PIE_SPEC): ..to here. > * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Correct > chain of crtbegin*.o selection, update for PIE_SPEC changes and format. > (GNU_USER_TARGET_ENDFILE_SPEC): Similarly. > * config/sol2.h (STARTFILE_CRTBEGIN_SPEC): Similarly. > (ENDFILE_CRTEND_SPEC): Similarly. > * config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Upgrade to > match gnu-user.h startfile. > (ENDFILE_LINUX_SPEC): Similarly. So sorry for the horrible delay. What was the final resolution here? I saw a lot of back and forth with HJ and yourself. 80044 is CLOSED/WONTFIX and 81170 has a patch attached to it, but is still in the ASSIGNED state. jeff