From 638c962f0a007ff2f59dc07b211a8c2579294e20 Mon Sep 17 00:00:00 2001 From: Jack Howarth Date: Tue, 29 May 2012 23:44:09 +0000 Subject: [PATCH] re PR debug/53453 (darwin linker expects both AT_name and AT_comp_dir debug notes) 2012-05-29 Jack Howarth PR debug/53453 * doc/tm.texi: Update. * doc/tm.texi.in (SDB and DWARF) : 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. From-SVN: r187994 --- gcc/ChangeLog | 9 +++++++++ gcc/config/darwin.h | 2 ++ gcc/doc/tm.texi | 4 ++++ gcc/doc/tm.texi.in | 2 ++ gcc/dwarf2out.c | 2 +- gcc/target.def | 7 +++++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea8f7ec0a79..68b37a07bf9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-05-29 Jack Howarth + + PR debug/53453 + * doc/tm.texi: Update. + * doc/tm.texi.in (SDB and DWARF) : 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. + 2012-05-29 Jack Howarth * config/darwin.h (STARTFILE_SPEC): Do not use -lbundle1.o when diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 80ff0b060b7..5855778109d 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -416,6 +416,8 @@ 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 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f7b2838efd8..aeccc79f39f 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -9493,6 +9493,10 @@ tables, and hence is desirable if it works. 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. @end deftypevr diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index a54b2298f4b..31dedad8a22 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -9392,6 +9392,8 @@ tables, and hence is desirable if it works. @hook TARGET_WANT_DEBUG_PUB_SECTIONS +@hook TARGET_FORCE_AT_COMP_DIR + @hook TARGET_DELAY_SCHED2 @hook TARGET_DELAY_VARTRACK diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b233d30ce46..6085a947541 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22078,7 +22078,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) { diff --git a/gcc/target.def b/gcc/target.def index fd2bf8a7e33..3463600f99a 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2748,6 +2748,13 @@ DEFHOOKPOD in particular GDB does not use them.", 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. \ This usually means it will be run as part of machine-specific reorg.", -- 2.30.2