Bug 93371 - -ffile-prefix-map ignored with assembly files
Summary: -ffile-prefix-map ignored with assembly files
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-22 01:10 UTC by comexk
Modified: 2022-11-02 16:02 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description comexk 2020-01-22 01:10:41 UTC
When using the GCC frontend to invoke GNU as, GCC passes through -fdebug-prefix-map (as --debug-prefix-map), but ignores -ffile-prefix-map.  -ffile-prefix-map is supposed to be "equivalent to specifying all the individual -f*-prefix-map options."

Most likely, GCC should be changed to pass --debug-prefix-map to as when the driver is passed -ffile-prefix-map (specifically in the definition of ASM_MAP in gcc/gcc.c).  An alternative might be to add a --file-prefix-map option to GNU as and pass that instead; however, the only other type of prefix map is -fmacro-prefix-map, and that doesn't apply to raw as.
Comment 1 Caleb Zulawski 2022-06-22 12:42:00 UTC
I just found this report--seems to be still an issue in 12.1.
Comment 2 CVS Commits 2022-11-02 16:02:11 UTC
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

https://gcc.gnu.org/g:abaa32c7384edef065c79741764bc112dd18f32d

commit r13-3611-gabaa32c7384edef065c79741764bc112dd18f32d
Author: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Date:   Wed Nov 2 10:01:22 2022 -0600

    gcc: honour -ffile-prefix-map in ASM_MAP [PR93371]
    
    -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.