From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Lipe To: Jason Merrill Cc: wilson@cygnus.com, egcs@cygnus.com Subject: Re: dwarf2 debug dependent upon GAS? Date: Sun, 28 Feb 1999 22:53:00 -0000 Message-ID: <19990226001542.Z17655@rjlhome.sco.com> References: <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com> <199902230124.RAA24440.cygnus.egcs@rtl.cygnus.com> <19990225143649.I17655@rjlhome.sco.com> X-SW-Source: 1999-02n/msg01315.html Message-ID: <19990228225300.rGY5dK1_ZVKmoWIMk_dNsFisrBwLUULO8U1G-Ae6gP8@z> > I don't think we need anything so complex. I'd look at the code in > dwarfout.c; TEXT_BEGIN_LABEL et al. Of course, you don't need all of the > labels rfg defined there... Yes, that is indeed more appealing. With this installed, an empty C program will assemble and link on SVR5. If you're OK with this approach, I'll send in a ChangeLog and describe what I did and why as comments in the code. If the comment in dwarfout.c before TEXT_BEGIN_LABEL is to be believed, we might have to make these labels '.Lblah'. My assembler doesn't make them global with just the leading dot. Your call. Thanx for the help. RJL Index: dwarf2out.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarf2out.c,v retrieving revision 1.85 diff -c -5 -p -r1.85 dwarf2out.c *** dwarf2out.c 1999/02/24 17:48:42 1.85 --- dwarf2out.c 1999/02/26 06:10:59 *************** static unsigned lookup_filename PROTO(( *** 2622,2632 **** --- 2622,2648 ---- #endif #ifndef BSS_SECTION #define BSS_SECTION ".bss" #endif + /* Labels we insert at beginning sections we can reference instead of + the section names themselves. */ + #ifndef TEXT_SECTION_LABEL + #define TEXT_SECTION_LABEL ".text_label" + #endif + #ifndef DEBUG_LINE_SECTION_LABEL + #define DEBUG_LINE_SECTION_LABEL ".debug_line_label" + #endif + #ifndef DEBUG_INFO_SECTION_LABEL + #define DEBUG_INFO_SECTION_LABEL ".debug_info_label" + #endif + #ifndef ABBREV_SECTION_LABEL + #define ABBREV_SECTION_LABEL ".debug_abbrev_label" + #endif + + /* Definitions of defaults for formats and names of various special (artificial) labels which may be generated within this file (when the -g options is used and DWARF_DEBUGGING_INFO is in effect. If necessary, these may be overridden from within the tm.h file, but typically, overriding these defaults is unnecessary. */ *************** output_compilation_unit_header () *** 5421,5431 **** ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION); if (flag_debug_asm) 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)); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section", ASM_COMMENT_START); fputc ('\n', asm_out_file); --- 5437,5447 ---- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION); if (flag_debug_asm) 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_LABEL)); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section", ASM_COMMENT_START); fputc ('\n', asm_out_file); *************** output_pubnames () *** 5494,5504 **** if (flag_debug_asm) 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)); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.", ASM_COMMENT_START); fputc ('\n', asm_out_file); --- 5510,5520 ---- if (flag_debug_asm) 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_LABEL)); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.", ASM_COMMENT_START); fputc ('\n', asm_out_file); *************** output_aranges () *** 5575,5585 **** ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION); if (flag_debug_asm) 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)); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.", ASM_COMMENT_START); fputc ('\n', asm_out_file); --- 5591,5601 ---- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION); if (flag_debug_asm) 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_LABEL)); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.", ASM_COMMENT_START); fputc ('\n', asm_out_file); *************** output_aranges () *** 5601,5617 **** if (flag_debug_asm) fprintf (asm_out_file, "\t%s Pad to %d byte boundary", ASM_COMMENT_START, 2 * PTR_SIZE); fputc ('\n', asm_out_file); ! ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION)); 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)); if (flag_debug_asm) fprintf (asm_out_file, "%s Length", ASM_COMMENT_START); fputc ('\n', asm_out_file); for (i = 0; i < arange_table_in_use; ++i) --- 5617,5633 ---- if (flag_debug_asm) fprintf (asm_out_file, "\t%s Pad to %d byte boundary", ASM_COMMENT_START, 2 * PTR_SIZE); fputc ('\n', asm_out_file); ! ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION_LABEL)); 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_LABEL)); if (flag_debug_asm) fprintf (asm_out_file, "%s Length", ASM_COMMENT_START); fputc ('\n', asm_out_file); for (i = 0; i < arange_table_in_use; ++i) *************** output_line_info () *** 5792,5809 **** fputc ('\n', asm_out_file); output_uleb128 (1 + PTR_SIZE); 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)); fputc ('\n', asm_out_file); /* Generate the line number to PC correspondence table, encoded as a series of state machine operations. */ current_file = 1; current_line = 1; ! strcpy (prev_line_label, stripattributes (TEXT_SECTION)); for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) { register dw_line_info_ref line_info; /* Emit debug info for the address of the current line, choosing --- 5808,5825 ---- fputc ('\n', asm_out_file); output_uleb128 (1 + PTR_SIZE); 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_LABEL)); fputc ('\n', asm_out_file); /* Generate the line number to PC correspondence table, encoded as a series of state machine operations. */ current_file = 1; current_line = 1; ! strcpy (prev_line_label, stripattributes (TEXT_SECTION_LABEL)); for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) { register dw_line_info_ref line_info; /* Emit debug info for the address of the current line, choosing *************** dwarf2out_init (asm_out_file, main_input *** 9849,9858 **** --- 9865,9883 ---- taken as being relative to the directory from which the compiler was invoked when the given (base) source file was compiled. */ gen_compile_unit_die (main_input_filename); ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0); + + ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION); + ASM_OUTPUT_LABEL (asm_out_file, ABBREV_SECTION_LABEL); + ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION); + ASM_OUTPUT_LABEL (asm_out_file, TEXT_SECTION_LABEL); + ASM_OUTPUT_SECTION (asm_out_file, DEBUG_INFO_SECTION); + ASM_OUTPUT_LABEL (asm_out_file, DEBUG_INFO_SECTION_LABEL); + ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION); + ASM_OUTPUT_LABEL (asm_out_file, DEBUG_LINE_SECTION_LABEL); } /* Output stuff that dwarf requires at the end of every file, and generate the DWARF-2 debugging info. */ *************** dwarf2out_finish () *** 9917,9931 **** /* We can only use the low/high_pc attributes if all of the code was in .text. */ if (separate_line_info_table_in_use == 0) { add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, ! stripattributes (TEXT_SECTION)); 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); } /* Output the abbreviation table. */ fputc ('\n', asm_out_file); ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION); --- 9942,9956 ---- /* We can only use the low/high_pc attributes if all of the code was in .text. */ if (separate_line_info_table_in_use == 0) { add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, ! stripattributes (TEXT_SECTION_LABEL)); 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_LABEL); } /* Output the abbreviation table. */ fputc ('\n', asm_out_file); ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);