This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][revised] PR debug/53453 ensure debug notes linked on darwin

   The attached patch solves PR53453. The upcoming dsymutil release will now issue
a warning when no debug notes are emitted for an object file on linkage. This causes
several thousand failures in the FSF gcc testsuite. The origin of this problem is
that the darwin linker requires the presence of both AT_name and AT_comp_dir attributes
for each object file otherwise their debug notes will be omitted on linkage. The 
patch adds a new TARGET_FORCE_AT_COMP_DIR target hook for darwin so that AT_comp_dir 
will be present for all object files. Bootstrap and regression tested on x86_64-apple-darwin12.

Okay for gcc trunk and later gcc-4_7-branch and gcc-4_6-branch?
ps Note that this is a pre-existing problem on darwin and that the newer dsymutil simply
has alerted us to the issue.
pps Added correction of s/AT_comp_dir/DW_AT_comp_dir/g to gcc/target.def change.

2012-05-24  Jack Howarth  <>

	PR debug/53453
	* doc/tm.texi: Update.
	* doc/ (SDB and DWARF) <TARGET_FORCE_AT_COMP_DIR>: Add @hook.
	* target-def (force_at_comp_dir): New hook.
	* config/darwin.h (TARGET_FORCE_AT_COMP_DIR): Define.
	* dwarf2out.c (dwarf2out_finish): Check targetm.force_at_comp_dir.

Index: gcc/doc/
--- gcc/doc/	(revision 187856)
+++ gcc/doc/	(working copy)
@@ -9392,6 +9392,8 @@ tables, and hence is desirable if it wor
Index: gcc/target.def
--- gcc/target.def	(revision 187856)
+++ gcc/target.def	(working copy)
@@ -2749,6 +2749,13 @@ DEFHOOKPOD
  bool, false)
+ "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)
 (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.",
 bool, false)
Index: gcc/dwarf2out.c
--- gcc/dwarf2out.c	(revision 187856)
+++ gcc/dwarf2out.c	(working copy)
@@ -21949,7 +21949,7 @@ dwarf2out_finish (const char *filename)
   /* 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))
+  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)
Index: gcc/config/darwin.h
--- gcc/config/darwin.h	(revision 187856)
+++ gcc/config/darwin.h	(working copy)
@@ -414,6 +414,8 @@ extern GTY(()) int darwin_ms_struct;
 /* When generating stabs debugging, use N_BINCL entries.  */
 #define DBX_USE_BINCL

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]