aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2009-08-28 09:04:52 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2009-08-28 09:04:52 +0000
commit7e49a4b3969b940d0165515374f81c0307965d45 (patch)
tree3e42ebb98788d56f06fc541c25397579d2c0909d /gcc/dwarf2out.c
parent72129a2509b0f79a94bcc96392f33228813e8bb2 (diff)
downloadgcc-7e49a4b3969b940d0165515374f81c0307965d45.zip
gcc-7e49a4b3969b940d0165515374f81c0307965d45.tar.gz
gcc-7e49a4b3969b940d0165515374f81c0307965d45.tar.bz2
collect2.c (DO_COLLECT_EXPORT_LIST): New internal macro, always defined.
* collect2.c (DO_COLLECT_EXPORT_LIST): New internal macro, always defined. Reflect definition or absence of such for COLLECT_EXPORT_LIST. Readability helper. (scanfilter): New enum, to help control what symbols are to be considered or ignored by scan_prog_file. (enum pass): Rename as "scanpass", moved together with scanfilter prior to scan_prog_file's prototype. (scan_prog_file): Accept and honor scanpass and scanfilter arguments. Group prototype with the scanpass/scanfilter definitions, factorize head comments for the several implementations at the prototype. (main): Reorganize the first pass link control to let AIX drag only the needed frame tables in executables. Prevent frame tables collection during the scan aimed at static ctors. Pre-link and scan for frame tables later to compensate. * doc/tm.texi (ASM_OUTPUT_DWARF_TABLE_REF): New macro. A C statement to issue assembly directives that create a reference to the given DWARF table identifier label from the current function section. * dwarf2out.c (switch_to_eh_frame_section): Add a BACK argument to differentiate first time section entry. Only emit a .data tables start identifier label the first time around. (switch_to_frame_table_section): New function. Helper for output_call_frame_info to switch possibly BACK into the eh_frame or the debug_frame section depending on FOR_EH. (output_call_frame_info): Use helper to first enter the proper frame section. (output_fde): Use ASM_OUTPUT_DWARF_TABLE_REF when defined to emit a link to the frame table start label from each function section. * config/rs6000/rs6000.c (rs6000_aix_asm_output_dwarf_table_ref): New function. Implementation of ASM_OUTPUT_DWARF_TABLE_REF. * config/rs6000/rs6000-protos.h: Declare it. * config/rs6000/aix.h (ASM_OUTPUT_DWARF_TABLE_REF): Define. From-SVN: r151157
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c63
1 files changed, 45 insertions, 18 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ad956f8..04f8758 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -2932,12 +2932,12 @@ dw_cfi_oprnd2_desc (enum dwarf_call_frame_info cfi)
#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
-/* Switch to eh_frame_section. If we don't have an eh_frame_section,
- switch to the data section instead, and write out a synthetic label
- for collect2. */
+/* Switch [BACK] to eh_frame_section. If we don't have an eh_frame_section,
+ switch to the data section instead, and write out a synthetic start label
+ for collect2 the first time around. */
static void
-switch_to_eh_frame_section (void)
+switch_to_eh_frame_section (bool back)
{
tree label;
@@ -2980,11 +2980,15 @@ switch_to_eh_frame_section (void)
/* We have no special eh_frame section. Put the information in
the data section and emit special labels to guide collect2. */
switch_to_section (data_section);
- label = get_file_function_name ("F");
- ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
- targetm.asm_out.globalize_label (asm_out_file,
- IDENTIFIER_POINTER (label));
- ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+
+ if (!back)
+ {
+ label = get_file_function_name ("F");
+ ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
+ targetm.asm_out.globalize_label (asm_out_file,
+ IDENTIFIER_POINTER (label));
+ ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+ }
}
}
@@ -3534,6 +3538,20 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
output_cfi (cfi, fde, for_eh);
}
+ /* If we are to emit a ref/link from function bodies to their frame tables,
+ do it now. This is typically performed to make sure that tables
+ associated with functions are dragged with them and not discarded in
+ garbage collecting links. We need to do this on a per function basis to
+ cope with -ffunction-sections. */
+
+#ifdef ASM_OUTPUT_DWARF_TABLE_REF
+ /* Switch to the function section, emit the ref to the tables, and
+ switch *back* into the table section. */
+ switch_to_section (function_section (fde->decl));
+ ASM_OUTPUT_DWARF_TABLE_REF (section_start_label);
+ switch_to_frame_table_section (for_eh, true);
+#endif
+
/* Pad the FDE out to an address sized boundary. */
ASM_OUTPUT_ALIGN (asm_out_file,
floor_log2 ((for_eh ? PTR_SIZE : DWARF2_ADDR_SIZE)));
@@ -3543,6 +3561,22 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
}
+/* Switch [BACK] to the eh or debug frame table section, depending on
+ FOR_EH. */
+static void
+switch_to_frame_table_section (int for_eh, bool back)
+{
+ if (for_eh)
+ switch_to_eh_frame_section (back);
+ else
+ {
+ if (!debug_frame_section)
+ debug_frame_section = get_section (DEBUG_FRAME_SECTION,
+ SECTION_DEBUG, NULL);
+ switch_to_section (debug_frame_section);
+ }
+}
+
/* Output the call frame information used to record information
that relates to calculating the frame pointer, and records the
location of saved registers. */
@@ -3613,15 +3647,8 @@ output_call_frame_info (int for_eh)
if (flag_debug_asm)
app_enable ();
- if (for_eh)
- switch_to_eh_frame_section ();
- else
- {
- if (!debug_frame_section)
- debug_frame_section = get_section (DEBUG_FRAME_SECTION,
- SECTION_DEBUG, NULL);
- switch_to_section (debug_frame_section);
- }
+ /* Switch to the proper frame section, first time. */
+ switch_to_frame_table_section (for_eh, false);
ASM_GENERATE_INTERNAL_LABEL (section_start_label, FRAME_BEGIN_LABEL, for_eh);
ASM_OUTPUT_LABEL (asm_out_file, section_start_label);