From patchwork Mon Aug 29 09:29:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp1331985wro; Mon, 29 Aug 2022 02:30:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR4gtOZT6SZQVaZfgHyqZ9vlIeWJvXtX9TZBy4Ewntfp4lTKg3HsMtKuUnWbSS5eAF9dW1Gi X-Received: by 2002:aa7:dc10:0:b0:440:b446:c0cc with SMTP id b16-20020aa7dc10000000b00440b446c0ccmr15879437edu.34.1661765419483; Mon, 29 Aug 2022 02:30:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661765419; cv=none; d=google.com; s=arc-20160816; b=J/lBYIGAMRGfoewu9N89UmZUw4++q6/92i282azV3dwBZtfnFoAp4zFscLkKnUVUGG 2PKadwAyEqep5sGiiz+xOACqM/e1Zk3BeOgr+ZTtM6Neb6RHcLA+dnwKcUmDqPz5jjg3 90kg3XZekoApmZH3J7tWKWCzomZAVyvXwcJ5oPvXuaBDPILBTJEtTVm/a8lCUmXi5VzM Lu9vifKBPZWXCysQNqzrrUBYulY11qkQd8mfIc/lD+7ARZea5JzVHiUjWjyg5W84XIGy vnuGaYizMQs0JzlOcadhf5DQYyNyO8ameBIpeN0skS9nxdzJbhY8ppw/twgsxFFnDg33 QWWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :dmarc-filter:delivered-to; bh=9V4ExW8j5ojkOHfPFYxcO0CBWQCFLV/om95aqolYuCc=; b=ip2hJx9CLMl5myrlddjn225Q1kLS97KF4uzh+0L5gQF3zlkffnK8U6F7VPJRba6WM1 6/MDLqO+cymr143wu0lfVS1+1cBiBO/raIDz+Qa0u3tPKDNUs4vCGQG1/DdZOKc/L7V5 AzL3qbG4vLxeTlCeskh1wG93650QtTXlYalbVA+1tubLuVZXyyhVwNSzU9C5485WbZb+ yzuzqdlF+xsrbGuN+FYX2oXGwEGPvCbjVWyI2AsbKbTOwEhgGgINuX89teO5N5enDnVi j/eqW4fHGIQXH3glBUaoOPhR5B8aSIXGGs1M4IoE0zz8hzQDoPVK5zYsQF6+Tvl0s1Ps t9rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Z9uEF7So; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f2-20020a50a6c2000000b0043ddc200046si6126711edc.454.2022.08.29.02.30.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 02:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Z9uEF7So; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A998E3857BB8 for ; Mon, 29 Aug 2022 09:29:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 036493858D32 for ; Mon, 29 Aug 2022 09:29:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 036493858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lf1-x12a.google.com with SMTP id p5so7172117lfc.6 for ; Mon, 29 Aug 2022 02:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=9V4ExW8j5ojkOHfPFYxcO0CBWQCFLV/om95aqolYuCc=; b=Z9uEF7SosepF8F9FgFS7P4LhAf8JKcY1DcHAPiLhzQ/xocmzz2yvSL5MzLLT12JXRn aZjV0d3Y1uITuHv9tgqMbCmpQLl2mXwMAUC9vlYfVbgzxoSJLX9MeP/41TWc8082VdXD ewxIRI9PK5YZ6lJCYVD/+8aC8n9ak71F5T98Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=9V4ExW8j5ojkOHfPFYxcO0CBWQCFLV/om95aqolYuCc=; b=qJ+W0RA7YVElz5Kd7O1rRzjwG3N+2eFUEgFzAekKhcsy1OsX6pFjAJXNZvqiNXOk4G Zd4sTa7D3FdDpNnoIdW4JKwIqOzt8ggIK9douXbPAZ/EvOSzLdiI95neko727CIA10Hi DphX3ItJWHVwezd87IK15wKK1WhNRp+X46VyM41M+qq/ZRvCamBCkIrI8wofR2z6+p1P WOV/IfneEl3z6nKVSwf0pe0TlsftcobElUcGOxm2NYo+U49XyH+YmuGoDDEecToj71Gw bjh+UKZNbTeNrtsZ3HchwGR/qsmKhDzdyuHrpZK5ZFuX/fcYNhHA2Gh12DTAGHGjWqw6 /rMA== X-Gm-Message-State: ACgBeo3UwqgN8LDluUOEgCS9HEvzYAsJ4SGIcpvxbfo/rWwjiIjEHsYg 9TJoSiFk6hmBWtnDWxyU51vqnHhgFU640teN X-Received: by 2002:a05:6512:2608:b0:494:7168:888a with SMTP id bt8-20020a056512260800b004947168888amr496780lfb.440.1661765365572; Mon, 29 Aug 2022 02:29:25 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id f13-20020a056512092d00b00492ed031aacsm1208533lft.173.2022.08.29.02.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 02:29:24 -0700 (PDT) From: Rasmus Villemoes To: gcc-patches@gcc.gnu.org Subject: [PATCH] gcc: honour -ffile-prefix-map in ASM_MAP [PR93371] Date: Mon, 29 Aug 2022 11:29:17 +0200 Message-Id: <20220829092917.477788-1-rv@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Cc: Vagrant Cascadian , Rasmus Villemoes Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742487336242298094?= X-GMAIL-MSGID: =?utf-8?q?1742487336242298094?= -ffile-prefix-map is supposed to be a superset of -fmacro-prefix-map and -fdebug-prefix-map. However, when building .S or .s files, gas is not called with the appropriate --debug-prefix-map option when -ffile-prefix-map is used. While the user can specify -fdebug-prefix-map when building assembly files via gcc, it's more ergonomic to also support -ffile-prefix-map; especially since for .S files that could contain the __FILE__ macro, one would then also have to specify -fmacro-prefix-map. gcc: PR driver/93371 * gcc.cc (ASM_MAP): Honour -ffile-prefix-map. --- I've tested that this works as expected, both by looking at how gas is now invoked, and by running 'strings' on the generated .o file. But I don't know how to add something to the testsuite for this. I stumbled on this since it came up on the U-Boot mailing list: https://lore.kernel.org/u-boot/4ed9f811-5244-54ef-b58e-83dba51510e4@prevas.dk/ . gcc/gcc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/gcc.cc b/gcc/gcc.cc index b6d562a92f0..44eafc60187 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -878,7 +878,7 @@ proper position among the other output files. */ #endif #ifdef HAVE_AS_DEBUG_PREFIX_MAP -#define ASM_MAP " %{fdebug-prefix-map=*:--debug-prefix-map %*}" +#define ASM_MAP " %{ffile-prefix-map=*:--debug-prefix-map %*} %{fdebug-prefix-map=*:--debug-prefix-map %*}" #else #define ASM_MAP "" #endif