From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AA6agR7EMACF8ZxeTM9kFwlYLZvQywb/infKp/V4XhUbzrurYsSg4di4utozFbbPrvacGqZ+cwnd1g== 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 Cc: Vagrant Cascadian , Rasmus Villemoes 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 Content-Transfer-Encoding: 8bit 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 List-Id: -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 -- 2.37.2