From patchwork Sun Sep 19 18:37:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 45163 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C0D8F3857400 for ; Sun, 19 Sep 2021 18:37:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp001-out.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) by sourceware.org (Postfix) with ESMTPS id D7E503858409 for ; Sun, 19 Sep 2021 18:37:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D7E503858409 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=sandoe.co.uk Received: (qmail 96959 invoked from network); 19 Sep 2021 18:37:33 -0000 X-APM-Out-ID: 16320766539695 X-APM-Authkey: 257869/1(257869/1) 3 Received: from unknown (HELO ?192.168.1.214?) (81.138.1.83) by smtp001.apm-internet.net with SMTP; 19 Sep 2021 18:37:33 -0000 From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: [pushed] Darwin, crts: Build Darwin10 unwinder shim as a library. Message-Id: <650CB810-C7A1-47A5-A9F4-2372CC98CEB7@sandoe.co.uk> Date: Sun, 19 Sep 2021 19:37:32 +0100 To: GCC Patches X-Mailer: Apple Mail (2.3445.104.21) X-Spam-Status: No, score=-15.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, We have a small unwinder shim that is only used for Darwin10 (and only then in quite specific cases). To avoid linking this code for every executable or DSO, we can present the crt as a convenience library (rather than a .o file). tested on x86_64-darwin10,18, x86_64-linux-gnu pushed to master, thanks Iain Signed-off-by: Iain Sandoe gcc/ChangeLog: * config/darwin.h (LINK_COMMAND_SPEC_A): Use Darwin10 unwinder shim as a convenience library. libgcc/ChangeLog: * config.host: Use convenience library for Darwin10 unwinder shim. * config/t-darwin: Build Darwin10 unwinder shim as a convenience library. --- gcc/config/darwin.h | 2 +- libgcc/config.host | 2 +- libgcc/config/t-darwin | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) -- diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 6396586c138..50524a51511 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -231,7 +231,7 @@ extern GTY(()) int darwin_ms_struct; %{%:sanitize(address): -lasan } \ %{%:sanitize(undefined): -lubsan } \ %(link_ssp) \ - %:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef.o) \ + %:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef) \ %(link_gcc_c_sequence) \ }}}\ %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} %{F*} "\ diff --git a/libgcc/config.host b/libgcc/config.host index 432a3e1e38e..6c34b13d611 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -215,7 +215,7 @@ case ${host} in *-*-darwin*) asm_hidden_op=.private_extern tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin" - extra_parts="crt3.o d10-uwfef.o crttms.o crttme.o" + extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o" ;; *-*-dragonfly*) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin index 3b5e3428958..4b6317b5d85 100644 --- a/libgcc/config/t-darwin +++ b/libgcc/config/t-darwin @@ -18,3 +18,9 @@ LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \ # Patch to __Unwind_Find_Enclosing_Function for Darwin10. d10-uwfef.o: $(srcdir)/config/darwin10-unwind-find-enc-func.c $(crt_compile) -mmacosx-version-min=10.6 -c $< + +# Using this crt as a library means that it will not be added to an exe +# (or module) unless needed. +libd10-uwfef.a: d10-uwfef.o + $(AR_CREATE_FOR_TARGET) $@ d10-uwfef.o + $(RANLIB_FOR_TARGET) $@