Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to output standard-compliant .debug_abbrev section #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions gcc/dwarf2out.c
Original file line number Diff line number Diff line change
Expand Up @@ -3697,6 +3697,14 @@ output_abbrev_section ()

fprintf (asm_out_file, "\t%s\t0,0\n", ASM_BYTE_OP);
}

if (flag_dwarf_bugfix)
{
/* We need to properly terminate the abbrev table for this
compilation unit, as per the standard, and not rely on
workarounds in e.g. gdb. */
fprintf (asm_out_file, "\t%s\t0\n", ASM_BYTE_OP);
}
}

/* Output location description stack opcode's operands (if any). */
Expand Down
3 changes: 3 additions & 0 deletions gcc/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,6 @@ extern enum graph_dump_types graph_dump_format;

/* Nonzero if ASM output should use hex instead of decimal. */
extern int flag_hex_asm;

/* Nonzero if dwarf bug should be fixed. */
extern int flag_dwarf_bugfix;
5 changes: 5 additions & 0 deletions gcc/toplev.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ int flag_instrument_function_entry_exit = 0;
/* Use hex instead of decimal in ASM output. */
int flag_hex_asm = 0;

/* Output standard-compliant dwarf .debug_abbrev section. */
int flag_dwarf_bugfix = 0;

typedef struct
{
char *string;
Expand Down Expand Up @@ -724,6 +727,8 @@ lang_independent_options f_options[] =
"Instrument function entry/exit with profiling calls"},
{"hex-asm", &flag_hex_asm, 1,
"Use hex instead of decimal in assembly output"},
{"dwarf-bugfix", &flag_dwarf_bugfix, 1,
"Output standard-compliant dwarf .debug_abbrev section"},
};

#define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
Expand Down