From patchwork Sat Sep 12 15:02:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 517099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 802E11402A6 for ; Sun, 13 Sep 2015 01:02:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=TnYv8UL4; dkim-atps=neutral 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:subject:date:message-id:cc:to:mime-version; q=dns; s=default; b=v6ldiFoTctuwkZhJn1BFptpRdIrS2+0CVBSCpwOuUypBj5HR0O Iic69ofrryxp51QialeJk9pUU1cmPlL74Jn0cWOoZsTbx09yOcys/3HZjA+uCBya Vls6wiEf2sbxfUwdinlDmDQpnqF1LvG0yKhL6vGcodgVMLJ4BQabP+28o= 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:subject:date:message-id:cc:to:mime-version; s= default; bh=HvoVwb8CgpMrOy6wwnZJ5S7Gla4=; b=TnYv8UL4ODkEW5ualRb6 voZAY6OCVrLxg2kAtO/mFYgunYrWYGdQgXDM917hI9LsGEp2xMTtSDernFRYMh9a jDh0bUr8ZW7fbakPKSoFOx09Ght/cqsIvAAJx3IXlTE4r0cPi71f98U/Xgqx6BQ3 ewQTtiMeRXWsSM7vSSUWTNA= Received: (qmail 95180 invoked by alias); 12 Sep 2015 15:02:47 -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 95166 invoked by uid 89); 12 Sep 2015 15:02:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Sep 2015 15:02:44 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZamK9-0002tY-9O from Iain_Sandoe@mentor.com ; Sat, 12 Sep 2015 08:02:41 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Sat, 12 Sep 2015 16:02:39 +0100 From: Iain Sandoe Subject: [Darwin, driver] Make our sysroot handling the same as clang's. Date: Sat, 12 Sep 2015 16:02:26 +0100 Message-ID: <825FAE2A-2E50-4EFC-9CE4-167A50F4830E@mentor.com> CC: Mike Stump To: gcc-patches List MIME-Version: 1.0 (Apple Message framework v1283) Hi, At present, we have somewhat strange sysroot in that --sysroot causes -isysroot to be passed to cc1* ... ... but no -syslibroot for collect2/ld. Conversely, -isysroot /XYZZY causes this to be passed as -isysroot to cc1* and -syslibroot to collect/ld. AFAIU the options, it ought to be the other way around. However (possibly to be 'compatible' with GCC) currently clang has the same behaviour for both -isysroot and --sysroot. In preparation for other improvements, I want to use the --sysroot properly, so the following patch makes GCC's behaviour match that of clang (for the Darwin platform only). TODO: is to start a joint conversation with the clang folks about retiring the -syslibroot from the "-isysroot" case ( but that ship might have sailed - this behaviour is already "in the wild" ). checked out with x86_64-darwin12 and an i686-darwin9 X x86_64-darwin12 cross, where the built-in configured --with-sysroot= is correctly overridden by --sysroot= on the c/l. Unfortunately, other than detecting the version of ld in use, there's no sensible configure mechanism to set HAVE_LD_SYSROOT, and it seems somewhat overkill to do that for something that's essentially a constant for the versions of ld that work with current GCC. OK for trunk? Iain gcc/ * config/darwin.h (TARGET_SYSTEM_ROOT): Remove this from here (use the mechanism ing gcc.c) driven by - (HAVE_LD_SYSROOT): New. (SYSROOT_SPEC): New. (LINK_SYSROOT_SPEC): Revise to remove the default for target sysroot. (STANDARD_STARTFILE_PREFIX_1): New. (STANDARD_STARTFILE_PREFIX_2): New. From 3d20de66ec2e7da5f371175253f01d0dd74dc8c0 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Fri, 11 Sep 2015 23:39:35 +0100 Subject: [PATCH] [darwin] Make sysroot stuff the same as clang --- gcc/config/darwin.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index bb4451a..7d093c9 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -207,12 +207,21 @@ extern GTY(()) int darwin_ms_struct; #undef LINK_GCC_C_SEQUENCE_SPEC #define LINK_GCC_C_SEQUENCE_SPEC "%G %L" -#ifdef TARGET_SYSTEM_ROOT -#define LINK_SYSROOT_SPEC \ - "%{isysroot*:-syslibroot %*;:-syslibroot " TARGET_SYSTEM_ROOT "}" -#else +/* ld64 supports a sysroot, it just has a different name and there's no easy + way to check for it at config time. */ +#undef HAVE_LD_SYSROOT +#define HAVE_LD_SYSROOT 1 +/* It seems the only (working) way to get a space after %R is to append a + dangling '/'. */ +#define SYSROOT_SPEC "%{!isysroot*:-syslibroot %R/ }" + +/* Do the same as clang, for now, and insert the sysroot for ld when an + isysroot is specified. */ #define LINK_SYSROOT_SPEC "%{isysroot*:-syslibroot %*}" -#endif + +/* Suppress the addition of extra prefix paths when a sysroot is in use. */ +#define STANDARD_STARTFILE_PREFIX_1 "" +#define STANDARD_STARTFILE_PREFIX_2 "" #define DARWIN_PIE_SPEC "%{fpie|pie|fPIE:}"