summaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorsterling <sterling@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-06 23:15:25 +0000
committersterling <sterling@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-06 23:15:25 +0000
commitb35329c7fe71b2c466a2071d414613b3e3273827 (patch)
treefebfaf6088d8ca6dd6bcd34ff4948244ce49af9b /gcc/gcc.c
parent20f6e7a3aaaff6f730a461ddd9fee6447f6a77cc (diff)
downloadgcc-b35329c7fe71b2c466a2071d414613b3e3273827.tar.gz
gcc/ChangeLog
2012-11-06 Sterling Augustine <saugustine@google.com> Cary Coutant <ccoutant@google.com> * common.opt (gno-split-dwarf, gsplit-dwarf): New switches. * doc/invoke.texi (Debugging Options): Document them. * gcc.c (replace_extension_spec_func): New function. (ASM_FINAL_SPEC): Adjust. (static_spec_functions): Add new field for replace-extension. (check_live_switch): Adjust comment. Add case for 'g'. * opts.c (finish_options): Set x_debug_generate_pub_sections based on x_dwarf_split_debug_info. (common_handle_option): Add case for OPT_gsplit_dwarf. * dwarf2out.h (addr_table_entry_struct): Add forward declaration. (dw_val_struct): Add val_entry pointer. * dwarf2out.c: (debug_skeleton_info_section, debug_skeleton_abbrev_section, debug_addr_section, debug_skeleton_line_section, debug_str_offsets_section): New globals. (NOT_INDEXED, NO_INDEX_ASSIGNED): New defines. (indirect_string_node): New field index. (ate_kind): New enum with fields ate_kind_rtc, ate_kind_rtx_dtprel, ate_kind_label. (addr_table_entry): New structure and type. (dw_loc_list_struct): Add field begin_entry. (new_loc_desc): Initialize val_entry. (size_of_loc_descr, output_loc_operands, output_loc_operands_raw): Add cases for DW_OP_GNU_addr_index and DW_OP_const_index. (build_cfa_loc): Initialize val_entry. (AT_index, add_addr_table_entry, remove_addr_table_entry, add_AT_lbl_id): New functions. (add_AT_addr, add_AT_range_list): New parameter force_direct. (output_die_abbrevs): New function. (add_ranges_by_labels): New parameter force_direct. (output_line_info): New parameter prologue_only. (dtprel_bool): New enum with dtprel_false and dtprel_true. (dw_addr_op, new_addr_loc_descr): New functions. (DEBUG_DWO_INFO_SECTION, DEBUG_DWO_ABBREV_SECTION, DEBUG_ADDR_SECTION, DEBUG_NORM_MACINFO_SECTION, DEBUG_DWO_MACINFO_SECTION, DEBUG_MACINFO_SECTION, DEBUG_NORM_MACRO_SECTION, DEBUG_DWO_MACRO_SECTION, DEBUG_MACRO_SECTION, DEBUG_DWO_LINE_SECTION, DEBUG_DWO_LOC_SECTION, DEBUG_NORM_STR_OFFSETS_SECTION, DEBUG_DWO_STR_OFFSETS_SECTION, DEBUG_STR_OFFSETS_SECTION, DEBUG_DWO_STR_SECTION, DEBUG_NORM_STR_SECTION, DEBUG_STR_SECTION, DEBUG_MACRO_SECTION_FLAGS, DEBUG_SKELETON_LINE_SECTION_LABEL, DEBUG_SKELETON_INFO_SECTION_LABEL, DEBUG_ADDR_SECTION_LABEL DEBUG_SKELETON_ABBREV_SECTION_LABEL): New macros. (DEBUG_STR_SECTION_FLAGS): Adjust. (TEXT_SECTION_LABEL, COLD_TEXT_SECTION_LABEL, DEBUG_LINE_SECTION_LABEL, DEBUG_INFO_SECTION_LABEL, DEBUG_ABBREV_SECTION_LABEL, DEBUG_ADDR_SECTION_LABEL, DEBUG_LOC_SECTION_LABEL, DEBUG_RANGES_SECTION_LABEL, DEBUG_MACINFO_SECTION_LABEL, DEBUG_MACRO_SECTION_LABEL): Adjust indentation. (debug_skeleton_abbrev_section_label, debug_addr_section_label, debug_skeleton_line_section_label, debug_skeleton_info_section_label): New global variables. (add_AT_flag, add_AT_int, add_AT_unsigned, add_AT_double, add_AT_vec, add_AT_data8): Initialize val_entry. (add_AT_low_high_pc): New parameter force_direct. Handle dwarf_split_debug_info. (set_indirect_string, find_AT_string_form): New functions. (AT_string_form): Adjust to call find_AT_string_from. (add_AT_die_ref, add_AT_fde_ref, add_AT_loc, add_AT_list): Initialize val_entry. (addr_index_table): New global variable. (addr_table_entry_do_hash, addr_table_entry_eq, add_addr_table_entry, init_addr_table_entry, remove_addr_table_entry, index_addr_table_entry, remove_loc_list_addr_table_entries): New functions. (add_AT_addr, add_AT_lbl_id, add_AT_range_list): New parameter force_direct. Handle dwarf_split_debug_info. (add_AT_file, add_AT_vms_delta, add_AT_lineptr, add_AT_macptr, add_AT_offset): Initialize val_entry. (UNRELOCATED_OFFSET, RELOCATED_OFFSET): New defines. (size_of_die): Handle dwarf_split_debug_info. (size_of_aranges, value_format): Call AT_class. Check AT_index. (output_die_abbrevs): New function. (output_abbrev_section): Call output_die_abbrevs. (new_loc_list): Initialize begin_entry. (output_loc_list): Handle dwarf_split_debug_info. (output_range_list_offset, output_loc_list_offset, output_attr_index_or_value, ): New functions. (output_die): Fix call to dw2_asm_output_data. Call output_attr_index_or_value and output_range_list_offset. Adjust logic around dw_val_class_str. (add_top_lebel_skeleton_die_attrs, get_skeleton_type_unit, output_skeleton_debug_sections): New functions. (output_comdat_type_unit, output_pubname, output_aranges): Handle dwarf_split_debug_info. (add_ranges_by_labels): New parameter force_direct. (mem_loc_descriptor, loc_descr): Call new_addr_loc_descr. (loc_list_from_tree, add_const_value_attribtue): Use dtprel_bools in place of generic integer. (dwarf2out_vms_debug_main_pointer, gen_entry_point_die, gen_label_die, gen_call_site_die, gen_subprogram_die, gen_variable_die, add_high_low_attributes): Adjust calls to add_AT_lbl_id. (output_macinfo_op): Adjust indirect_string_logic. (save_macinfo_strings): New function. (output_macinfo): Adjust. (dwarf2out_init): Handle dwarf_split_debug_info. (index_string, output_index_string_offset, output_index_string): New functions. (output_indirect_string): Adjust. (output_indirect_strings, output_addr_table_entry, output_addr_table): New functions. (resolve_addr_in_expr, hash_loc_operands): Handle DW_OP_GNU_addr_index and DW_OP_GNU_const_index. Handle dwarf_split_debug_info. Call remove_loc_list_addr_table_entries and remove_addr_table_entry. (index_location_lists): New function. (dwarf2out_finish): Handle dwarf_split_debug_info. New variable main_comp_unit_die. Adjust calls to add_AT_low_high_pc, add_ranges_by_labels, add_AT_addr, and add_AT_lineptr. Call save_macinfo_strings and output_indirect_strings. include/ChangeLog 2012-10-29 Sterling Augustine <saugustine@google.com> Cary Coutant <ccoutant@google.com> * dwarf2.h (dwarf_location_list_entry_type): New enum with fields DW_LLE_GNU_end_of_list_entry, DW_LLE_GNU_base_address_selection_entry, DW_LLE_GNU_start_end_entry and DW_LLE_GNU_start_length_entry. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193267 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c47
1 files changed, 43 insertions, 4 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bbca6d84e33..a795981f002 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -267,6 +267,7 @@ static const char *compare_debug_dump_opt_spec_function (int, const char **);
static const char *compare_debug_self_opt_spec_function (int, const char **);
static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
static const char *pass_through_libs_spec_func (int, const char **);
+static const char *replace_extension_spec_func (int, const char **);
/* The Specs Language
@@ -447,7 +448,7 @@ ignored. White space may also appear anywhere on the left side of the
colon in these constructs, except between . or * and the corresponding
word.
-The -O, -f, -m, and -W switches are handled specifically in these
+The -O, -f, -g, -m, and -W switches are handled specifically in these
constructs. If another value of -O or the negated form of a -f, -m, or
-W switch is found later in the command line, the earlier switch
value is ignored, except with {S*} where S is just one letter; this
@@ -480,7 +481,14 @@ proper position among the other output files. */
/* config.h can define ASM_FINAL_SPEC to run a post processor after
the assembler has run. */
#ifndef ASM_FINAL_SPEC
-#define ASM_FINAL_SPEC ""
+#define ASM_FINAL_SPEC \
+ "%{gsplit-dwarf: \n\
+ objcopy --extract-dwo \
+ %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \
+ %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} \n\
+ objcopy --strip-dwo \
+ %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \
+ }"
#endif
/* config.h can define CPP_SPEC to provide extra args to the C preprocessor
@@ -1262,6 +1270,7 @@ static const struct spec_function static_spec_functions[] =
{ "compare-debug-self-opt", compare_debug_self_opt_spec_function },
{ "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
{ "pass-through-libs", pass_through_libs_spec_func },
+ { "replace-extension", replace_extension_spec_func },
#ifdef EXTRA_SPEC_FUNCTIONS
EXTRA_SPEC_FUNCTIONS
#endif
@@ -5814,7 +5823,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
on the command line. PREFIX_LENGTH is the length of XXX in an {XXX*}
spec, or -1 if either exact match or %* is used.
- A -O switch is obsoleted by a later -O switch. A -f, -m, or -W switch
+ A -O switch is obsoleted by a later -O switch. A -f, -g, -m, or -W switch
whose value does not begin with "no-" is obsoleted by the same value
with the "no-", similarly for a switch with the "no-" prefix. */
@@ -5851,7 +5860,7 @@ check_live_switch (int switchnum, int prefix_length)
}
break;
- case 'W': case 'f': case 'm':
+ case 'W': case 'f': case 'm': case 'g':
if (! strncmp (name + 1, "no-", 3))
{
/* We have Xno-YYY, search for XYYY. */
@@ -8380,3 +8389,33 @@ pass_through_libs_spec_func (int argc, const char **argv)
}
return prepended;
}
+
+/* %:replace-extension spec function. Replaces the extension of the
+ first argument with the second argument. */
+
+const char *
+replace_extension_spec_func (int argc, const char **argv)
+{
+ char *name;
+ char *p;
+ char *result;
+ int i;
+
+ if (argc != 2)
+ fatal_error ("too few arguments to %%:replace-extension");
+
+ name = xstrdup (argv[0]);
+
+ for (i = strlen(name) - 1; i >= 0; i--)
+ if (IS_DIR_SEPARATOR (name[i]))
+ break;
+
+ p = strrchr (name + i + 1, '.');
+ if (p != NULL)
+ *p = '\0';
+
+ result = concat (name, argv[1], NULL);
+
+ free (name);
+ return result;
+}