Patchwork backport darwin12 fixes to gcc-4_7-branch

login
register
mail settings
Submitter Jack Howarth
Date June 18, 2012, 4:36 p.m.
Message ID <20120618163647.GA26121@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/165523/
State New
Headers show

Comments

Jack Howarth - June 18, 2012, 4:36 p.m.
The attached patch backports...

http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01710.html
http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01707.html

which implement changes for darwin12 and later. Bootstrap
and regression tested on current x86_64-apple-darwin12.

http://gcc.gnu.org/ml/gcc-testresults/2012-06/msg01547.html

Okay for gcc-4_7-branch?
        Jack

2012-06-17  Jack Howarth  <howarth@bromo.med.uc.edu>

	Backport from mainline
	2012-05-29  Jack Howarth  <howarth@bromo.med.uc.edu>
	* 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  <howarth@bromo.med.uc.edu>
	PR debug/53453
	* doc/tm.texi: Update.
	* doc/tm.texi.in (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.
Mike Stump - June 19, 2012, 7:07 p.m.
Ok.
Mike Stump - April 17, 2013, 4:18 p.m.
On Jun 18, 2012, at 9:36 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>  The attached patch backports...
> 
> http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01710.html
> http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01707.html
> 
> which implement changes for darwin12 and later. Bootstrap
> and regression tested on current x86_64-apple-darwin12.
> 
> http://gcc.gnu.org/ml/gcc-testresults/2012-06/msg01547.html
> 
> Okay for gcc-4_7-branch?

Committed 198005.
Committed 198012.
Committed 198031.

http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01181.html is the original request, since it's been a while since people saw it last.

Patch

Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 188717)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -9386,6 +9386,8 @@  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/target.def
===================================================================
--- gcc/target.def	(revision 188717)
+++ gcc/target.def	(working copy)
@@ -2748,6 +2748,13 @@  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.  \
 This usually means it will be run as part of machine-specific reorg.",
 bool, false)
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 188717)
+++ gcc/dwarf2out.c	(working copy)
@@ -22501,7 +22501,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 188717)
+++ gcc/config/darwin.h	(working copy)
@@ -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