This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[csl-sol210] Patch to add option to disable use of DW_FORM_strp


This patch against csl-sol210-3_4-branch adds a command-line option to
disable the use of DW_FORM_strp for the sake of tools which
postprocess the object files and have problems with relocations
arising from the use of DW_FORM_strp.

Bootstrapped with no regressions on i386-pc-solaris2.10.1.  Applied to
csl-sol210-3_4-branch.  Any comments on whether a similar patch would
make sense for mainline GCC?

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2005-05-05  Michael Pogue  <michael.pogue@sun.com>
            Joseph S. Myers  <joseph@codesourcery.com>

	* gcc/common.opt (-fdwarf2-indirect-strings): New option.
	* gcc/doc/invoke.texi (-fdwarf2-indirect-strings): Document.
	* gcc/flags.h (flag_dwarf2_indirect_strings): New.
	* gcc/toplev.c (flag_dwarf2_indirect_strings): New.
	* gcc/opts.c (common_handle_option): Handle
	-fdwarf2-indirect-strings.
	* gcc/dwarf2out.c (AT_string_form): Check
	flag_dwarf2_indirect_strings.
	* gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-strp-1.c: New test.

diff -rupN GCC.orig/gcc/common.opt GCC/gcc/common.opt
--- GCC.orig/gcc/common.opt	2004-10-28 03:43:09.000000000 +0000
+++ GCC/gcc/common.opt	2005-05-04 21:14:34.000000000 +0000
@@ -302,6 +302,10 @@ fdump-unnumbered
 Common
 Suppress output of instruction numbers and line number notes in debugging dumps
 
+fdwarf2-indirect-strings
+Common
+Enable use of indirect strings in DWARF2 debug info
+
 feliminate-dwarf2-dups
 Common
 Perform DWARF2 duplicate elimination
diff -rupN GCC.orig/gcc/doc/invoke.texi GCC/gcc/doc/invoke.texi
--- GCC.orig/gcc/doc/invoke.texi	2004-10-06 20:15:08.000000000 +0000
+++ GCC/gcc/doc/invoke.texi	2005-05-04 21:17:32.000000000 +0000
@@ -249,6 +249,7 @@ in the following sections.
 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
+-fdwarf2-indirect-strings @gol
 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs @gol
 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
 -ftest-coverage  -ftime-report @gol
@@ -3117,6 +3118,14 @@ Compress DWARF2 debugging information by
 information about each symbol.  This option only makes sense when
 generating DWARF2 debugging information with @option{-gdwarf-2}.
 
+@item -fdwarf2-indirect-strings
+@opindex fdwarf2-indirect-strings
+Enable use of @code{DW_FORM_strp} for strings in DWARF2 debugging
+information.  This is on by default.  To output strings using
+@code{DW_FORM_string} only, use
+@option{-fno-dwarf2-indirect-strings}.  This option only makes sense
+when generating DWARF2 debugging information with @option{-gdwarf-2}.
+
 @cindex @command{prof}
 @item -p
 @opindex p
diff -rupN GCC.orig/gcc/dwarf2out.c GCC/gcc/dwarf2out.c
--- GCC.orig/gcc/dwarf2out.c	2004-10-25 21:46:45.000000000 +0000
+++ GCC/gcc/dwarf2out.c	2005-05-04 21:14:34.000000000 +0000
@@ -4654,6 +4654,9 @@ AT_string_form (dw_attr_ref a)
       if (node->form)
 	return node->form;
 
+      if (!flag_dwarf2_indirect_strings)
+	return DW_FORM_string;
+
       len = strlen (node->str) + 1;
 
       /* If the string is shorter or equal to the size of the reference, it is
diff -rupN GCC.orig/gcc/flags.h GCC/gcc/flags.h
--- GCC.orig/gcc/flags.h	2004-02-18 00:09:04.000000000 +0000
+++ GCC/gcc/flags.h	2005-05-04 21:14:34.000000000 +0000
@@ -698,6 +698,10 @@ extern int flag_eliminate_dwarf2_dups;
 
 extern int flag_eliminate_unused_debug_types;
 
+/* Nonzero means we should use DWARF2 indirect strings when appropriate. */
+
+extern int flag_dwarf2_indirect_strings;
+
 /* Nonzero means to collect statistics which might be expensive
    and to print them when we are done.  */
 extern int flag_detailed_statistics;
diff -rupN GCC.orig/gcc/opts.c GCC/gcc/opts.c
--- GCC.orig/gcc/opts.c	2004-02-18 00:09:04.000000000 +0000
+++ GCC/gcc/opts.c	2005-05-04 21:14:34.000000000 +0000
@@ -968,6 +968,10 @@ common_handle_option (size_t scode, cons
       flag_dump_unnumbered = value;
       break;
 
+    case OPT_fdwarf2_indirect_strings:
+      flag_dwarf2_indirect_strings = value;
+      break;
+
     case OPT_feliminate_dwarf2_dups:
       flag_eliminate_dwarf2_dups = value;
       break;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-strp-1.c GCC/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-strp-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-strp-1.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-strp-1.c	2005-05-04 21:19:23.000000000 +0000
@@ -0,0 +1,7 @@
+/* Test -fno-dwarf2-indirect-strings.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-2 -fno-dwarf2-indirect-strings -dA" } */
+/* { dg-final { scan-assembler-not "DW_FORM_strp" } } */
+
+struct abcdefghijklmnop { int abcdefghijklmnop; } x;
diff -rupN GCC.orig/gcc/toplev.c GCC/gcc/toplev.c
--- GCC.orig/gcc/toplev.c	2004-07-26 14:42:11.000000000 +0000
+++ GCC/gcc/toplev.c	2005-05-04 21:14:34.000000000 +0000
@@ -388,6 +388,10 @@ int flag_eliminate_dwarf2_dups = 0;
 
 int flag_eliminate_unused_debug_types = 1;
 
+/* Nonzero means we should use DWARF2 indirect strings when appropriate. */
+
+int flag_dwarf2_indirect_strings = 1;
+
 /* Nonzero means emit debugging information only for symbols which are used.  */
 int flag_debug_only_used_symbols = 0;
 


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