From patchwork Wed Jun 19 19:26:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1118960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-503302-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DmbhwUJh"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45TZhF0YxTz9s4Y for ; Thu, 20 Jun 2019 05:26:52 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; q=dns; s=default; b=Dm5Dr6Uf8BawJiHRBTDP Q3rBORNqQN8K9LUJ7+5lr/Cdl6ze5Ypx8KcFh+BFzFb7aVuhU37arw1MIKGj/enr 67m4gBvVRkAQSP73QZDi71fO4R5Eqh+j3tBmeMbDQQa3KE7AqASuWthl7ZEu8eWK Lq5gQ4ZFRSzT/nT2VWKTFBo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; s=default; bh=ibbr3Hz5srI6YYO2UuyK7XeRfq k=; b=DmbhwUJhYFjVwDcpKewyrWni4VtTT3hvoM3u0TnDpW94Uyc0dPZ/BtEZGn TnsdW4VvW6g0mRLTq3bNAMdazf2PliiXHi2ICw68CHQe5QLXk18f6TvCxPnWzSl8 anFnDtHAAMFVyKSeqa3S2U0R+/zS5QjaawSQn00tzN0PSQeE4= Received: (qmail 62553 invoked by alias); 19 Jun 2019 19:26:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 62338 invoked by uid 89); 19 Jun 2019 19:26:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, KAM_SHORT autolearn=ham version=3.3.1 spammy=10.6, mm, MM X-HELO: smtp1.wavenetuk.net Received: from smtp.wavenetuk.net (HELO smtp1.wavenetuk.net) (195.26.36.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jun 2019 19:26:43 +0000 Received: from euterpe-sie.home (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp1.wavenetuk.net (Postfix) with ESMTPA id 96F6912008C1; Wed, 19 Jun 2019 20:26:39 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [Darwin, specs, committed] Tidy some more linker options. Message-Id: Date: Wed, 19 Jun 2019 20:26:36 +0100 Cc: Mike Stump To: GCC Patches pie, no-pie and rdynamic are driver options, we can process them in the relevant place and drop them once dealt with. Support for the -pie, -no_pie and -no_compact_unwind options should ideally be checked at configure time, however the status quo is to assert that linkers capable of targeting the relevant systems support these options (i.e. we trust that the user doesn't attempt to configure inappropriately). TODO: check the availability of the linker opts in configure rather than trusting to the user. We now have machinery in configure that can do this and I plan to add tests for these, and a bunch of newer ones we are not yet handling. This fixes the fail of gcc.dg/pie-7.c, which is a result of failing to handle the no-pie driver option. tested on darwin9,10,16,18, applied to mainline, thanks Iain 2019-06-19 Iain Sandoe * config/darwin.h (DRIVER_SELF_SPECS): Add RDYNAMIC, DARWIN_PIE_SPEC and DARWIN_NOPIE_SPEC. (RDYNAMIC): New, modified from DARWIN_EXPORT_DYNAMIC. (DARWIN_PIE_SPEC): Collate from darwin.h and darwin9.h. (DARWIN_NOPIE_SPEC): Collate from darwin10.h. (DARWIN_NOCOMPACT_UNWIND): New from darwin10.h (DARWIN_EXPORT_DYNAMIC): Delete. * config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Move no_compact_unwind and pie options processing to darwin.h. * config/darwin9.h (DARWIN_PIE_SPEC): Move pie processing to darwin.h diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index bf44b10..ae324f1 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -124,7 +124,30 @@ extern GTY(()) int darwin_ms_struct; "%{fapple-kext|mkernel:-static}", \ "%{shared:-Zdynamiclib} %= 10.5 mmacosx-version-min= -Xlinker) \ + %:version-compare(>= 10.5 mmacosx-version-min= -pie) }} %= 10.7 mmacosx-version-min= -Xlinker ) \ + %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } %= 10.6 mmacosx-version-min= -no_compact_unwind) " + /* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus precomp, libtool, and fat build additions. @@ -164,12 +197,6 @@ extern GTY(()) int darwin_ms_struct; specifying the handling of options understood by generic Unix linkers, and for positional arguments like libraries. */ -#if LD64_HAS_EXPORT_DYNAMIC -#define DARWIN_EXPORT_DYNAMIC " %{rdynamic:-export_dynamic}" -#else -#define DARWIN_EXPORT_DYNAMIC " %{rdynamic: %nrdynamic is not supported}" -#endif - #define LINK_COMMAND_SPEC_A \ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker)" \ @@ -190,10 +217,11 @@ extern GTY(()) int darwin_ms_struct; %{%:sanitize(address): -lasan } \ %{%:sanitize(undefined): -lubsan } \ %(link_ssp) \ - " DARWIN_EXPORT_DYNAMIC " %. */ -/* Fix PR41260 by passing -no_compact_unwind on darwin10 and later until - unwinder in libSystem is fixed to digest new epilog unwinding notes. +/* Fix PR47558 by linking against libSystem ahead of libgcc_ext. */ - Fix PR47558 by linking against libSystem ahead of libgcc_ext. */ #undef LINK_GCC_C_SEQUENCE_SPEC #define LINK_GCC_C_SEQUENCE_SPEC \ -"%:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) \ - %{!static:%{!static-libgcc: \ +"%{!static:%{!static-libgcc: \ %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } \ - %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|mkernel|static|mdynamic-no-pic: \ - %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } \ %{!nostdlib:%:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef.o)} \ %G %{!nolibc:%L}" diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h index ca5c517..1fd1604 100644 --- a/gcc/config/darwin9.h +++ b/gcc/config/darwin9.h @@ -35,12 +35,6 @@ along with GCC; see the file COPYING3. If not see /* Tell collect2 to run dsymutil for us as necessary. */ #define COLLECT_RUN_DSYMUTIL 1 -#undef DARWIN_PIE_SPEC -#define DARWIN_PIE_SPEC \ - "%{fpie|pie|fPIE: \ - %{mdynamic-no-pic: %n'-mdynamic-no-pic' overrides '-pie', '-fpie' or '-fPIE'; \ - :-pie}}" - /* Only ask as for debug data if the debug style is stabs (since as doesn't yet generate dwarf.) */