diff mbox

PR77985: DWARF: Emit DW_AT_comp_dir in all cases, even if source is an absolute path

Message ID f08ea0a9-a2a5-b95a-997e-e4ca21b7c37c@pwned.gg
State New
Headers show

Commit Message

Ximin Luo Oct. 21, 2016, 10:56 a.m. UTC
Richard Biener:
> On Tue, Oct 18, 2016 at 2:35 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>

>> Thanks, I'll add the Changelog entry. My computer isn't very powerful, so I didn't bootstrap it yet, I only tested it on a stage1 compiler, on Debian testing/unstable. I'll find some time to bootstrap it and test it fully over the next few days.

>>

>> Shall I also get rid of the Darwin force_at_comp_dir stuff? Looking into it a bit more, my patch basically obsoletes the need for this so I can delete that as well.

> 

> That would be nice.

> 


Hi,

Attached is the ChangeLog plus updated patch, rebased against the 2016-10-16 snapshot. Also I noticed I got the wrong bug number, the correct one is 77985 not 77895.

I've tested it on a Debian testing/unstable x86_64-linux-gnu system. The results are good, the same tests fail both before and after the patch, and we have 2 new expected successes. Unfortunately I don't have access (and am unlikely to get access) to a Darwin system to test it on.

Snippets of the test logs are attached. The full logs are about 200MB each in size (4MB XZ-compressed, each) so I guessed I shouldn't send them via email... The snippets were grepped from the logs using the '^FAIL: \|^# of\|pr77985' pattern. You can diff them to check that the results are same in both cases.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
2016-10-18  Ximin Luo  <infinity0@pwned.gg>

	PR debug/77985
	* dwarf2out.c (file_table_relative_p): Remove.
	(gen_compile_unit_die, dwarf2out_early_finish): Emit DW_AT_comp_dir
	for absolute paths. As a consequence of this, PR 53453 (2012-05-29)
	is no longer necessary and therefore also reverted, as follows:
	* doc/tm.texi: Update.
	* doc/tm.texi.in (SDB and DWARF) <TARGET_FORCE_AT_COMP_DIR>: Remove @hook.
	* target.def (force_at_comp_dir): Remove hook.
	* config/darwin.h (TARGET_FORCE_AT_COMP_DIR): Remove define.

Comments

Richard Biener Oct. 24, 2016, 8:47 a.m. UTC | #1
On Fri, Oct 21, 2016 at 12:56 PM, Ximin Luo <infinity0@pwned.gg> wrote:
> Richard Biener:

>> On Tue, Oct 18, 2016 at 2:35 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>>

>>> Thanks, I'll add the Changelog entry. My computer isn't very powerful, so I didn't bootstrap it yet, I only tested it on a stage1 compiler, on Debian testing/unstable. I'll find some time to bootstrap it and test it fully over the next few days.

>>>

>>> Shall I also get rid of the Darwin force_at_comp_dir stuff? Looking into it a bit more, my patch basically obsoletes the need for this so I can delete that as well.

>>

>> That would be nice.

>>

>

> Hi,

>

> Attached is the ChangeLog plus updated patch, rebased against the 2016-10-16 snapshot. Also I noticed I got the wrong bug number, the correct one is 77985 not 77895.

>

> I've tested it on a Debian testing/unstable x86_64-linux-gnu system. The results are good, the same tests fail both before and after the patch, and we have 2 new expected successes. Unfortunately I don't have access (and am unlikely to get access) to a Darwin system to test it on.

>

> Snippets of the test logs are attached. The full logs are about 200MB each in size (4MB XZ-compressed, each) so I guessed I shouldn't send them via email... The snippets were grepped from the logs using the '^FAIL: \|^# of\|pr77985' pattern. You can diff them to check that the results are same in both cases.


The patch is ok.  Do you have commit privileges?

Thanks,
Richard.

> X

>

> --

> GPG: ed25519/56034877E1F87C35

> GPG: rsa4096/1318EFAC5FBBDBCE

> https://github.com/infinity0/pubkeys.git
Ximin Luo Oct. 24, 2016, 10:53 a.m. UTC | #2
Richard Biener:
> On Fri, Oct 21, 2016 at 12:56 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>> Richard Biener:

>>> On Tue, Oct 18, 2016 at 2:35 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>>>

>>>> Thanks, I'll add the Changelog entry. My computer isn't very powerful, so I didn't bootstrap it yet, I only tested it on a stage1 compiler, on Debian testing/unstable. I'll find some time to bootstrap it and test it fully over the next few days.

>>>>

>>>> Shall I also get rid of the Darwin force_at_comp_dir stuff? Looking into it a bit more, my patch basically obsoletes the need for this so I can delete that as well.

>>>

>>> That would be nice.

>>>

>>

>> Hi,

>>

>> Attached is the ChangeLog plus updated patch, rebased against the 2016-10-16 snapshot. Also I noticed I got the wrong bug number, the correct one is 77985 not 77895.

>>

>> I've tested it on a Debian testing/unstable x86_64-linux-gnu system. The results are good, the same tests fail both before and after the patch, and we have 2 new expected successes. Unfortunately I don't have access (and am unlikely to get access) to a Darwin system to test it on.

>>

>> Snippets of the test logs are attached. The full logs are about 200MB each in size (4MB XZ-compressed, each) so I guessed I shouldn't send them via email... The snippets were grepped from the logs using the '^FAIL: \|^# of\|pr77985' pattern. You can diff them to check that the results are same in both cases.

> 

> The patch is ok.  Do you have commit privileges?

> 


No, I don't.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
Richard Biener Oct. 24, 2016, 11:57 a.m. UTC | #3
On Mon, Oct 24, 2016 at 12:53 PM, Ximin Luo <infinity0@pwned.gg> wrote:
> Richard Biener:

>> On Fri, Oct 21, 2016 at 12:56 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>> Richard Biener:

>>>> On Tue, Oct 18, 2016 at 2:35 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>>>>

>>>>> Thanks, I'll add the Changelog entry. My computer isn't very powerful, so I didn't bootstrap it yet, I only tested it on a stage1 compiler, on Debian testing/unstable. I'll find some time to bootstrap it and test it fully over the next few days.

>>>>>

>>>>> Shall I also get rid of the Darwin force_at_comp_dir stuff? Looking into it a bit more, my patch basically obsoletes the need for this so I can delete that as well.

>>>>

>>>> That would be nice.

>>>>

>>>

>>> Hi,

>>>

>>> Attached is the ChangeLog plus updated patch, rebased against the 2016-10-16 snapshot. Also I noticed I got the wrong bug number, the correct one is 77985 not 77895.

>>>

>>> I've tested it on a Debian testing/unstable x86_64-linux-gnu system. The results are good, the same tests fail both before and after the patch, and we have 2 new expected successes. Unfortunately I don't have access (and am unlikely to get access) to a Darwin system to test it on.

>>>

>>> Snippets of the test logs are attached. The full logs are about 200MB each in size (4MB XZ-compressed, each) so I guessed I shouldn't send them via email... The snippets were grepped from the logs using the '^FAIL: \|^# of\|pr77985' pattern. You can diff them to check that the results are same in both cases.

>>

>> The patch is ok.  Do you have commit privileges?

>>

>

> No, I don't.


Ok, I included the patch in a x86_64 bootstrap & regtest and committed
it as r241473.

Richard.

> X

>

> --

> GPG: ed25519/56034877E1F87C35

> GPG: rsa4096/1318EFAC5FBBDBCE

> https://github.com/infinity0/pubkeys.git
Ximin Luo Oct. 24, 2016, 12:42 p.m. UTC | #4
Richard Biener:
> On Mon, Oct 24, 2016 at 12:53 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>> Richard Biener:

>>> On Fri, Oct 21, 2016 at 12:56 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>>> Richard Biener:

>>>>> On Tue, Oct 18, 2016 at 2:35 PM, Ximin Luo <infinity0@pwned.gg> wrote:

>>>>>>

>>>>>> Thanks, I'll add the Changelog entry. My computer isn't very powerful, so I didn't bootstrap it yet, I only tested it on a stage1 compiler, on Debian testing/unstable. I'll find some time to bootstrap it and test it fully over the next few days.

>>>>>>

>>>>>> Shall I also get rid of the Darwin force_at_comp_dir stuff? Looking into it a bit more, my patch basically obsoletes the need for this so I can delete that as well.

>>>>>

>>>>> That would be nice.

>>>>>

>>>>

>>>> Hi,

>>>>

>>>> Attached is the ChangeLog plus updated patch, rebased against the 2016-10-16 snapshot. Also I noticed I got the wrong bug number, the correct one is 77985 not 77895.

>>>>

>>>> I've tested it on a Debian testing/unstable x86_64-linux-gnu system. The results are good, the same tests fail both before and after the patch, and we have 2 new expected successes. Unfortunately I don't have access (and am unlikely to get access) to a Darwin system to test it on.

>>>>

>>>> Snippets of the test logs are attached. The full logs are about 200MB each in size (4MB XZ-compressed, each) so I guessed I shouldn't send them via email... The snippets were grepped from the logs using the '^FAIL: \|^# of\|pr77985' pattern. You can diff them to check that the results are same in both cases.

>>>

>>> The patch is ok.  Do you have commit privileges?

>>>

>>

>> No, I don't.

> 

> Ok, I included the patch in a x86_64 bootstrap & regtest and committed

> it as r241473.

> 


Great, thanks!

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
diff mbox

Patch

Index: gcc-7-20161016/gcc/dwarf2out.c
===================================================================
--- gcc-7-20161016.orig/gcc/dwarf2out.c
+++ gcc-7-20161016/gcc/dwarf2out.c
@@ -22053,7 +22053,7 @@  gen_compile_unit_die (const char *filena
     {
       add_name_attribute (die, filename);
       /* Don't add cwd for <built-in>.  */
-      if (!IS_ABSOLUTE_PATH (filename) && filename[0] != '<')
+      if (filename[0] != '<')
 	add_comp_dir_attribute (die);
     }
 
@@ -26416,20 +26416,6 @@  prune_unused_types (void)
     prune_unmark_dies (ctnode->root_die);
 }
 
-/* Set the parameter to true if there are any relative pathnames in
-   the file table.  */
-int
-file_table_relative_p (dwarf_file_data **slot, bool *p)
-{
-  struct dwarf_file_data *d = *slot;
-  if (!IS_ABSOLUTE_PATH (d->filename))
-    {
-      *p = true;
-      return 0;
-    }
-  return 1;
-}
-
 /* Helpers to manipulate hash table of comdat type units.  */
 
 struct comdat_type_hasher : nofree_ptr_hash <comdat_type_node>
@@ -28243,15 +28229,7 @@  dwarf2out_early_finish (const char *file
   /* 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));
-  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)
-    {
-      bool p = false;
-      file_table->traverse<bool *, file_table_relative_p> (&p);
-      if (p)
-	add_comp_dir_attribute (comp_unit_die ());
-    }
+  add_comp_dir_attribute (comp_unit_die ());
 
   /* With LTO early dwarf was really finished at compile-time, so make
      sure to adjust the phase after annotating the LTRANS CU DIE.  */
Index: gcc-7-20161016/gcc/testsuite/gcc.dg/debug/dwarf2/pr77985.c
===================================================================
--- /dev/null
+++ gcc-7-20161016/gcc/testsuite/gcc.dg/debug/dwarf2/pr77985.c
@@ -0,0 +1,9 @@ 
+/* DW_AT_comp_dir is emitted even if the file is compiled via an absolute path,
+   as is the case in the gcc testsuite.  */
+/* { dg-do compile } */
+/* { dg-options "-g -dA" } */
+/* { dg-final { scan-assembler "DW_AT_comp_dir:" } } */
+
+void func (void)
+{
+}
Index: gcc-7-20161016/gcc/config/darwin.h
===================================================================
--- gcc-7-20161016.orig/gcc/config/darwin.h
+++ gcc-7-20161016/gcc/config/darwin.h
@@ -424,8 +424,6 @@  extern GTY(()) int darwin_ms_struct;
 
 #define TARGET_WANT_DEBUG_PUB_SECTIONS true
 
-#define TARGET_FORCE_AT_COMP_DIR true
-
 /* When generating stabs debugging, use N_BINCL entries.  */
 
 #define DBX_USE_BINCL
Index: gcc-7-20161016/gcc/doc/tm.texi
===================================================================
--- gcc-7-20161016.orig/gcc/doc/tm.texi
+++ gcc-7-20161016/gcc/doc/tm.texi
@@ -9784,10 +9784,6 @@  tables, and hence is desirable if it wor
 True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted.  These sections are not used on most platforms, and in particular GDB does not use them.
 @end deftypevr
 
-@deftypevr {Target Hook} bool TARGET_FORCE_AT_COMP_DIR
-True if the @code{DW_AT_comp_dir} attribute should be emitted for each  compilation unit.  This attribute is required for the darwin linker  to emit debug information.
-@end deftypevr
-
 @deftypevr {Target Hook} bool TARGET_DELAY_SCHED2
 True if sched2 is not to be run at its normal place.
 This usually means it will be run as part of machine-specific reorg.
Index: gcc-7-20161016/gcc/doc/tm.texi.in
===================================================================
--- gcc-7-20161016.orig/gcc/doc/tm.texi.in
+++ gcc-7-20161016/gcc/doc/tm.texi.in
@@ -7084,8 +7084,6 @@  tables, and hence is desirable if it wor
 
 @hook TARGET_WANT_DEBUG_PUB_SECTIONS
 
-@hook TARGET_FORCE_AT_COMP_DIR
-
 @hook TARGET_DELAY_SCHED2
 
 @hook TARGET_DELAY_VARTRACK
Index: gcc-7-20161016/gcc/target.def
===================================================================
--- gcc-7-20161016.orig/gcc/target.def
+++ gcc-7-20161016/gcc/target.def
@@ -6057,13 +6057,6 @@  DEFHOOKPOD
  bool, false)
 
 DEFHOOKPOD
-(force_at_comp_dir,
- "True if the @code{DW_AT_comp_dir} attribute should be emitted for each \
- compilation unit.  This attribute is required for the darwin linker \
- to emit debug information.",
- bool, false)
-
-DEFHOOKPOD
 (delay_sched2, "True if sched2 is not to be run at its normal place.\n\
 This usually means it will be run as part of machine-specific reorg.",
 bool, false)