On 29/08/2022 11.29, Rasmus Villemoes wrote:
> -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.

Is this ok for trunk? If so, how about older maintained branches?

And does anyone have ideas for how I could add a test case?


> 
> I stumbled on this since it came up on the U-Boot mailing list:
> https://lore.kernel.org/u-boot/4ed9f811-5244-54ef-b58e-83dba5151...@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

Reply via email to