[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#777753: Aw: [Reproducible-builds] Bug#777753: gcc: LTO produces unreproducible debug information



The patches are now upstream [1, 2].

> The last test [2] showed that these really seemed to be the culprit of
> the problem. In the meantime, Richard Biener proposed patches which can
> solve this problem. I've compiled my own version of gcc-4.9 using the
> attached patch and can confirm that the LTO builds are now working
> perfectly fine and no changes to the affected packages are necessary
> anymore.

I have to correct my last statement. It is still necessary to add
-flto-partition=none when using -flto in a package. My earlier statement
came from the wrong understanding of buildid as explained in the gcc bug [3].

I've used the updated patches in my tests (see attachment)

[1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=220678
[2] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=220613
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65015#c9
diff -u gcc-4.9-4.9.2/debian/rules.patch gcc-4.9-4.9.2/debian/rules.patch
--- gcc-4.9-4.9.2/debian/rules.patch
+++ gcc-4.9-4.9.2/debian/rules.patch
@@ -232,6 +232,7 @@
 	sys-auxv-header \
 	libcilkrts-targets \
 	go-use-gold \
+	drop_opt \
 
 ifeq ($(with_softfloat),yes)
   debian_patches += arm-multilib-soft-float
only in patch2:
unchanged:
--- gcc-4.9-4.9.2.orig/debian/patches/drop_opt.diff
+++ gcc-4.9-4.9.2/debian/patches/drop_opt.diff
@@ -0,0 +1,30 @@
+Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65015
+
+--- a/src/gcc/dwarf2out.c
++++ b/src/gcc/dwarf2out.c
+@@ -19196,6 +19196,9 @@ gen_producer_string (void)
+       case OPT__sysroot_:
+       case OPT_nostdinc:
+       case OPT_nostdinc__:
++      case OPT_fpreprocessed:
++      case OPT_fltrans_output_list_:
++      case OPT_fresolution_:
+ 	/* Ignore these.  */
+ 	continue;
+       default:
+@@ -23984,8 +23987,13 @@ dwarf2out_finish (const char *filename)
+   gen_remaining_tmpl_value_param_die_attribute ();
+ 
+   /* Add the name for the main input file now.  We delayed this from
+-     dwarf2out_init to avoid complications with PCH.  */
+-  add_name_attribute (comp_unit_die (), remap_debug_filename (filename));
++     dwarf2out_init to avoid complications with PCH.
++     For LTO produced units use a fixed artificial name to avoid
++     leaking tempfile names into the dwarf.  */
++  if (!in_lto_p)
++    add_name_attribute (comp_unit_die (), remap_debug_filename (filename));
++  else
++    add_name_attribute (comp_unit_die (), "<artificial>");
+   if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir)
+     add_comp_dir_attribute (comp_unit_die ());
+   else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL)

Reply to: