From: Jack Howarth Date: Tue, 16 Apr 2013 17:09:14 +0000 (+0000) Subject: backport: re PR debug/53453 (darwin linker expects both AT_name and AT_comp_dir debug... X-Git-Tag: releases/gcc-4.7.4~716 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25dda4f6cce0f1494f403c2c86149fccc6bcfcbf;p=thirdparty%2Fgcc.git backport: re PR debug/53453 (darwin linker expects both AT_name and AT_comp_dir debug notes) 2013-04-16 Jack Howarth Backport from mainline 2012-05-29 Jack Howarth * config/darwin.h (STARTFILE_SPEC): Use -no_new_main with -lgcrt1.o on Darwin >= 12. (DARWIN_CRT1_SPEC): Use -lcrt1.10.6.o when Darwin >= 10 and < 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. From-SVN: r198005 --- diff --git a/ChangeLog b/ChangeLog index 7d255b3aefa7..0b3489b43d70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2013-04-16 Jack Howarth + + Backport from mainline + 2012-05-29 Jack Howarth + * config/darwin.h (STARTFILE_SPEC): Use -no_new_main with -lgcrt1.o + on Darwin >= 12. + (DARWIN_CRT1_SPEC): Use -lcrt1.10.6.o when Darwin >= 10 and < 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. + 2013-04-11 Release Manager * GCC 4.7.3 released. diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 3e6efd790613..5855778109d0 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -356,7 +356,9 @@ extern GTY(()) int darwin_ms_struct; %{!Zbundle:%{pg:%{static:-lgcrt0.o} \ %{!static:%{object:-lgcrt0.o} \ %{!object:%{preload:-lgcrt0.o} \ - %{!preload:-lgcrt1.o %(darwin_crt2)}}}} \ + %{!preload:-lgcrt1.o \ + %:version-compare(>= 10.8 mmacosx-version-min= -no_new_main) \ + %(darwin_crt2)}}}} \ %{!pg:%{static:-lcrt0.o} \ %{!static:%{object:-lcrt0.o} \ %{!object:%{preload:-lcrt0.o} \ @@ -379,7 +381,7 @@ extern GTY(()) int darwin_ms_struct; #define DARWIN_CRT1_SPEC \ "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lcrt1.10.5.o) \ - %:version-compare(>= 10.6 mmacosx-version-min= -lcrt1.10.6.o) \ + %:version-compare(>< 10.6 10.8 mmacosx-version-min= -lcrt1.10.6.o) \ %{fgnu-tm: -lcrttms.o}" /* Default Darwin ASM_SPEC, very simple. */ @@ -414,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.in b/gcc/doc/tm.texi.in index 0e4856f73c70..afb3e441060c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -9388,6 +9388,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 4ac66f90d562..b99e45bc3679 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22538,7 +22538,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 fd107fb6d81f..338c531cac67 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2757,6 +2757,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.",