fix -fdebug-prefix-map without gas .file support
authorRichard Biener <rguenther@suse.de>
Thu, 27 Feb 2020 10:42:50 +0000 (11:42 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 27 Feb 2020 10:43:52 +0000 (11:43 +0100)
This applies file mapping when emitting the directory table
directly instead of using the assemblers .file directive where
we already correctly apply the map.  Notably the non-assembler
path is used for the early debug emission for LTO.

2020-02-27  Mark Williams  <mwilliams@fb.com>

* dwarf2out.c (file_name_acquire): Call remap_debug_filename.
* lto-opts.c (lto_write_options): Drop -fdebug-prefix-map,
-ffile-prefix-map and -fmacro-prefix-map.
* lto-streamer-out.c: Include file-prefix-map.h.
(lto_output_location): Remap the file part of locations.

gcc/ChangeLog
gcc/dwarf2out.c
gcc/lto-opts.c
gcc/lto-streamer-out.c

index d8cfd09daa8b27a4c71c106dc983f7e240885896..beb56bc0130d3aa17d6c5704d055695e03b78aea 100644 (file)
@@ -1,3 +1,11 @@
+2020-02-27  Mark Williams  <mwilliams@fb.com>
+
+       * dwarf2out.c (file_name_acquire): Call remap_debug_filename.
+       * lto-opts.c (lto_write_options): Drop -fdebug-prefix-map,
+       -ffile-prefix-map and -fmacro-prefix-map.
+       * lto-streamer-out.c: Include file-prefix-map.h.
+       (lto_output_location): Remap the file part of locations.
+
 2020-02-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/93949
index 1fcb19a0489c1a09684e665d1663d8312fd75857..bb45279ea56d36621f14b0a68f4f0f0be3bf4e97 100644 (file)
@@ -12101,8 +12101,9 @@ file_name_acquire (dwarf_file_data **slot, file_name_acquire_data *fnad)
 
   fi = fnad->files + fnad->used_files++;
 
+  f = remap_debug_filename (d->filename);
+
   /* Skip all leading "./".  */
-  f = d->filename;
   while (f[0] == '.' && IS_DIR_SEPARATOR (f[1]))
     f += 2;
 
index 87e916a274174abc3c00ae7eaa9e7548a1b15e9a..2512560cc6dec3b19f788292acfd1a47d4c73c38 100644 (file)
@@ -131,6 +131,9 @@ lto_write_options (void)
        case OPT_SPECIAL_input_file:
        case OPT_dumpdir:
        case OPT_fresolution_:
+       case OPT_fdebug_prefix_map_:
+       case OPT_ffile_prefix_map_:
+       case OPT_fmacro_prefix_map_:
          continue;
 
        default:
index 1faf31c05512ffc5e38a02f5b0ca899242439de7..cea5e71cffbcfc068af6bb240a5bf2c8d561fa88 100644 (file)
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "omp-offload.h"
 #include "print-tree.h"
 #include "tree-dfa.h"
+#include "file-prefix-map.h" /* remap_debug_filename()  */
 
 
 static void lto_write_tree (struct output_block*, tree, bool);
@@ -200,7 +201,7 @@ lto_output_location (struct output_block *ob, struct bitpack_d *bp,
 
   if (ob->current_file != xloc.file)
     {
-      bp_pack_string (ob, bp, xloc.file, true);
+      bp_pack_string (ob, bp, remap_debug_filename (xloc.file), true);
       bp_pack_value (bp, xloc.sysp, 1);
     }
   ob->current_file = xloc.file;