]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2017-08-24 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Aug 2017 13:41:51 +0000 (13:41 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Aug 2017 13:41:51 +0000 (13:41 +0000)
PR debug/81936
* dwarf2out.c (output_die): Handle flag_generate_offload like
flag_generate_lto.
(output_comp_unit): Likewise.
(gen_array_type_die): Likewise.
(dwarf2out_early_finish): Likewise.
(note_variable_value_in_expr): Likewise.
(dwarf2out_finish): Likewise.  Adjust assert.
* cgraphunit.c (symbol_table::compile): Move setting of
flag_generate_offload earlier ...
(symbol_table::finalize_compilation_unit): ... here, before
early debug finalization.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251332 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraphunit.c
gcc/dwarf2out.c

index 25149f3e5a4d483821012a8eb7d7664c974e9d74..67261275be0bcf0be8ff33a95c133372f3c2154d 100644 (file)
@@ -1,3 +1,18 @@
+2017-08-24  Richard Biener  <rguenther@suse.de>
+
+       PR debug/81936
+       * dwarf2out.c (output_die): Handle flag_generate_offload like
+       flag_generate_lto.
+       (output_comp_unit): Likewise.
+       (gen_array_type_die): Likewise.
+       (dwarf2out_early_finish): Likewise.
+       (note_variable_value_in_expr): Likewise.
+       (dwarf2out_finish): Likewise.  Adjust assert.
+       * cgraphunit.c (symbol_table::compile): Move setting of
+       flag_generate_offload earlier ...
+       (symbol_table::finalize_compilation_unit): ... here, before
+       early debug finalization.
+
 2017-08-24  Richard Biener  <rguenther@suse.de>
 
        * config/i386/i386.c: Include symbol-summary.h, ipa-prop.h
index e8cc765095d44f22366e11f1c21c084ce70a85df..a287f0dfd44357e3e55a4f226fa131c1324cbf56 100644 (file)
@@ -2464,10 +2464,6 @@ symbol_table::compile (void)
     fprintf (stderr, "Performing interprocedural optimizations\n");
   state = IPA;
 
-  /* Offloading requires LTO infrastructure.  */
-  if (!in_lto_p && g->have_offload)
-    flag_generate_offload = 1;
-
   /* If LTO is enabled, initialize the streamer hooks needed by GIMPLE.  */
   if (flag_generate_lto || flag_generate_offload)
     lto_streamer_hooks_init ();
@@ -2614,6 +2610,10 @@ symbol_table::finalize_compilation_unit (void)
   /* Gimplify and lower thunks.  */
   analyze_functions (/*first_time=*/false);
 
+  /* Offloading requires LTO infrastructure.  */
+  if (!in_lto_p && g->have_offload)
+    flag_generate_offload = 1;
+
   if (!seen_error ())
     {
       /* Emit early debug for reachable functions, and by consequence,
index ba8d24bd5907274aa097f812fa53fad97805489a..a4887b572f2a803bbba6e1de5addf4052d95d3e0 100644 (file)
@@ -9999,7 +9999,7 @@ output_die (dw_die_ref die)
   if (! die->comdat_type_p && die->die_id.die_symbol
       /* Don't output the symbol twice.  For LTO we want the label
          on the section beginning, not on the actual DIE.  */
-      && (!flag_generate_lto
+      && ((!flag_generate_lto && !flag_generate_offload)
          || die->die_tag != DW_TAG_compile_unit))
     output_die_symbol (die);
 
@@ -10450,7 +10450,7 @@ output_comp_unit (dw_die_ref die, int output_if_empty,
 
   /* For LTO cross unit DIE refs we want a symbol on the start of the
      debuginfo section, not on the CU DIE.  */
-  if (flag_generate_lto && oldsym)
+  if ((flag_generate_lto || flag_generate_offload) && oldsym)
     {
       /* ???  No way to get visibility assembled without a decl.  */
       tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
@@ -20843,7 +20843,7 @@ gen_array_type_die (tree type, dw_die_ref context_die)
        add_AT_unsigned (array_die, DW_AT_byte_size, size);
       /* ???  We can't annotate types late, but for LTO we may not
         generate a location early either (gfortran.dg/save_6.f90).  */
-      else if (! (early_dwarf && flag_generate_lto)
+      else if (! (early_dwarf && (flag_generate_lto || flag_generate_offload))
               && TYPE_DOMAIN (type) != NULL_TREE
               && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != NULL_TREE)
        {
@@ -29740,9 +29740,9 @@ dwarf2out_finish (const char *)
 
   gen_remaining_tmpl_value_param_die_attribute ();
 
-  if (flag_generate_lto)
+  if (flag_generate_lto || flag_generate_offload)
     {
-      gcc_assert (flag_fat_lto_objects);
+      gcc_assert (flag_fat_lto_objects || flag_generate_offload);
 
       /* Prune stuff so that dwarf2out_finish runs successfully
         for the fat part of the object.  */
@@ -30318,7 +30318,7 @@ note_variable_value_in_expr (dw_die_ref die, dw_loc_descr_ref loc)
       {
        tree decl = loc->dw_loc_oprnd1.v.val_decl_ref;
        dw_die_ref ref = lookup_decl_die (decl);
-       if (! ref && flag_generate_lto)
+       if (! ref && (flag_generate_lto || flag_generate_offload))
          {
            /* ???  This is somewhat a hack because we do not create DIEs
               for variables not in BLOCK trees early but when generating
@@ -30529,7 +30529,7 @@ dwarf2out_early_finish (const char *filename)
   early_dwarf_finished = true;
 
   /* Do not generate DWARF assembler now when not producing LTO bytecode.  */
-  if (!flag_generate_lto)
+  if (!flag_generate_lto && !flag_generate_offload)
     return;
 
   /* Now as we are going to output for LTO initialize sections and labels