public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robert Lipe <robertl@sco.com>
To: Jason Merrill <jason@cygnus.com>
Cc: wilson@cygnus.com, egcs@cygnus.com
Subject: Re: dwarf2 debug dependent upon GAS?
Date: Sun, 28 Feb 1999 22:53:00 -0000	[thread overview]
Message-ID: <19990225225502.W17655@rjlhome.sco.com> (raw)
Message-ID: <19990228225300.8wkBxkJYbGOkFB2kP2szqZRzVoP3QQdqdLJtwOSm8fs@z> (raw)
In-Reply-To: <u9u2w9j4jr.fsf@yorick.cygnus.com>

>  > What would be the best way to handle this?  Something like letting
>  > ASM_OUTPUT_SECTION_NAME watch for the first time any of the 'debug_'
>  > sections are emitted and then letting it emit a symbol of the same name?
> 
> Nah, just spit out the useful ones in dwarf2out_init.
> 
>  > The random symbol could be the section name, right?
> 
> I'd suggest a variant on the section name so we can use that solution for
> all targets.

This turned ugly.  In the process it became a spokesperson for use of
ANSI string pasting, but I know that's a no-no for us.

It does allow an empty C file to assemble and link on SVR5 when using
-gdwarf-2.  Still, it "feels" wrong.  Before I continue down this path,
can you please tell me if I should perhaps go a different way?

Thanx,
RJL




Index: dwarf2out.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarf2out.c,v
retrieving revision 1.85
diff -u -p -r1.85 dwarf2out.c
--- dwarf2out.c	1999/02/24 17:48:42	1.85
+++ dwarf2out.c	1999/02/26 04:50:54
@@ -2613,6 +2613,7 @@ static unsigned lookup_filename		PROTO((
 #define STR_SECTION		".debug_str"
 #endif
 
+
 /* Standard ELF section names for compiled code and data.  */
 #ifndef TEXT_SECTION
 #define TEXT_SECTION		".text"
@@ -2624,6 +2625,16 @@ static unsigned lookup_filename		PROTO((
 #define BSS_SECTION		".bss"
 #endif
 
+dyn_string_t abbrev_section_base;
+dyn_string_t debug_line_section_base;
+dyn_string_t debug_info_section_base;
+dyn_string_t text_section_base;
+
+#define ABBREV_SECTION_BASE	ABBREV_SECTION "_base"
+#define DEBUG_LINE_SECTION_BASE	DEBUG_LINE_SECTION "_base"
+#define DEBUG_INFO_SECTION_BASE	DEBUG_INFO_SECTION "_base"
+#define TEXT_SECTION_BASE	TEXT_SECTION "_base"
+
 
 /* Definitions of defaults for formats and names of various special
    (artificial) labels which may be generated within this file (when the -g
@@ -5423,7 +5434,7 @@ output_compilation_unit_header ()
     fprintf (asm_out_file, "\t%s DWARF version number", ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (ABBREV_SECTION));
+  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (abbrev_section_base->s));
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
 	     ASM_COMMENT_START);
@@ -5496,7 +5507,7 @@ output_pubnames ()
     fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_INFO_SECTION));
+  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (debug_info_section_base->s));
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
 	     ASM_COMMENT_START);
@@ -5577,7 +5588,7 @@ output_aranges ()
     fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_INFO_SECTION));
+  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (debug_info_section_base->s));
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
 	     ASM_COMMENT_START);
@@ -5603,13 +5614,13 @@ output_aranges ()
 	     ASM_COMMENT_START, 2 * PTR_SIZE);
 
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION));
+  ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (text_section_base->s));
   if (flag_debug_asm)
     fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
 
   fputc ('\n', asm_out_file);
   ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label,
-			       stripattributes (TEXT_SECTION));
+			       stripattributes (text_section_base->s));
   if (flag_debug_asm)
     fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
 
@@ -5794,7 +5805,7 @@ output_line_info ()
   fputc ('\n', asm_out_file);
   ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
   fputc ('\n', asm_out_file);
-  ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION));
+  ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (text_section_base->s));
   fputc ('\n', asm_out_file);
 
   /* Generate the line number to PC correspondence table, encoded as
@@ -9851,6 +9862,29 @@ dwarf2out_init (asm_out_file, main_input
   gen_compile_unit_die (main_input_filename);
 
   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
+
+  abbrev_section_base = dyn_string_new (32);
+  text_section_base = dyn_string_new (32);
+  debug_info_section_base = dyn_string_new (32);
+  debug_line_section_base = dyn_string_new (32);
+
+  dyn_string_append(abbrev_section_base, ABBREV_SECTION);
+  dyn_string_append(abbrev_section_base, "_base");
+  dyn_string_append(text_section_base, TEXT_SECTION);
+  dyn_string_append(text_section_base, "_base");
+  dyn_string_append(debug_info_section_base, DEBUG_INFO_SECTION);
+  dyn_string_append(debug_info_section_base, "_base");
+  dyn_string_append(debug_line_section_base, DEBUG_LINE_SECTION);
+  dyn_string_append(debug_line_section_base, "_base");
+
+  ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
+  ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_base->s);
+  ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
+  ASM_OUTPUT_LABEL (asm_out_file, text_section_base->s);
+  ASM_OUTPUT_SECTION (asm_out_file, DEBUG_INFO_SECTION);
+  ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_base->s);
+  ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
+  ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_base->s);
 }
 
 /* Output stuff that dwarf requires at the end of every file,
@@ -9911,7 +9945,7 @@ dwarf2out_finish ()
   if (line_info_table_in_use > 1 || separate_line_info_table_in_use)
     {
       fputc ('\n', asm_out_file);
-      ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
+      ASM_OUTPUT_SECTION (asm_out_file, debug_line_section_base->s);
       output_line_info ();
 
       /* We can only use the low/high_pc attributes if all of the code
@@ -9919,11 +9953,11 @@ dwarf2out_finish ()
       if (separate_line_info_table_in_use == 0)
 	{
 	  add_AT_lbl_id (comp_unit_die, DW_AT_low_pc,
-			 stripattributes (TEXT_SECTION));
+			 stripattributes (text_section_base->s));
 	  add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
 	}
 
-      add_AT_section_offset (comp_unit_die, DW_AT_stmt_list, DEBUG_LINE_SECTION);
+      add_AT_section_offset (comp_unit_die, DW_AT_stmt_list, debug_line_section_base->s);
     }
 
   /* Output the abbreviation table.  */

  reply	other threads:[~1999-02-28 22:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com>
1999-02-22 17:24 ` Jim Wilson
     [not found]   ` < 199902230124.RAA24440@rtl.cygnus.com >
1999-02-22 21:32     ` Robert Lipe
     [not found]       ` < 19990222233200.P325@rjlhome.sco.com >
1999-02-23  7:04         ` Brian Ford
     [not found]           ` < Pine.SGI.4.03.9902230903340.512-100000@uscream.vss.fsi.com >
1999-02-23  8:41             ` Robert Lipe
     [not found]               ` < 19990223104109.E2294@rjlhome.sco.com >
1999-02-23  9:03                 ` Brian Ford
1999-02-28 22:53                   ` Brian Ford
1999-02-23 17:39               ` Daniel Berlin
1999-02-28 22:53                 ` Daniel Berlin
1999-02-28 22:53               ` Robert Lipe
1999-02-28 22:53           ` Brian Ford
1999-02-23 14:19         ` Jim Wilson
1999-02-28 22:53           ` Jim Wilson
1999-02-28 22:53       ` Robert Lipe
1999-02-28 22:53   ` Jim Wilson
     [not found] ` <199902230124.RAA24440.cygnus.egcs@rtl.cygnus.com>
1999-02-25 12:05   ` Jason Merrill
     [not found]     ` <19990225143649.I17655@rjlhome.sco.com>
1999-02-25 18:13       ` Jason Merrill
     [not found]         ` < u9u2w9j4jr.fsf@yorick.cygnus.com >
1999-02-25 20:55           ` Robert Lipe [this message]
1999-02-25 21:02             ` Jason Merrill
     [not found]               ` < u9d82xiwp5.fsf@yorick.cygnus.com >
1999-02-25 21:21                 ` Robert Lipe
1999-02-25 21:27                   ` Jason Merrill
1999-02-28 22:53                     ` Jason Merrill
1999-02-28 22:53                   ` Robert Lipe
1999-02-25 22:16                 ` Robert Lipe
1999-02-25 22:31                   ` Jason Merrill
     [not found]                     ` < u93e3tism2.fsf@yorick.cygnus.com >
1999-02-25 23:25                       ` Robert Lipe
     [not found]                         ` < 19990226012522.D17655@rjlhome.sco.com >
1999-02-28  0:57                           ` Jeffrey A Law
1999-02-28 22:53                             ` Jeffrey A Law
1999-02-28 22:53                         ` Robert Lipe
1999-02-28 22:53                     ` Jason Merrill
1999-02-28 22:53                   ` Robert Lipe
1999-02-28 22:53               ` Jason Merrill
1999-02-25 21:19             ` Jason Merrill
1999-02-28 22:53               ` Jason Merrill
1999-02-28 22:53             ` Robert Lipe
1999-02-28 22:53         ` Jason Merrill
1999-02-28 22:53     ` Jason Merrill
1999-02-21 12:47 Robert Lipe
     [not found] ` < 19990221144644.M8783@rjlhome.sco.com >
1999-02-21 14:51   ` Jeffrey A Law
1999-02-28 22:53     ` Jeffrey A Law
1999-02-28 22:53 ` Robert Lipe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990225225502.W17655@rjlhome.sco.com \
    --to=robertl@sco.com \
    --cc=egcs@cygnus.com \
    --cc=jason@cygnus.com \
    --cc=wilson@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).