Commit 7e49a4b3 by Olivier Hainque Committed by Olivier Hainque

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
parent 72129a25
2009-08-28 Olivier Hainque <hainque@adacore.com>
* 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.
2009-08-27 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (split_branches): Check the result of
......
......@@ -43,6 +43,12 @@
collect has a chance to see them, so scan the object files directly. */
#define COLLECT_EXPORT_LIST
/* Issue assembly directives that create a reference to the given DWARF table
identifier label from the current function section. This is defined to
ensure we drag frame frame tables associated with needed function bodies in
a link with garbage collection activated. */
#define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
/* Handle #pragma weak and #pragma pack. */
#define HANDLE_SYSV_PRAGMA 1
......
......@@ -179,6 +179,8 @@ extern int rs6000_memory_move_cost (enum machine_mode, enum reg_class, int);
extern bool rs6000_tls_referenced_p (rtx);
extern void rs6000_conditional_register_usage (void);
extern void rs6000_aix_asm_output_dwarf_table_ref (char *);
/* Declare functions in rs6000-c.c */
extern void rs6000_pragma_longcall (struct cpp_reader *);
......
......@@ -17612,6 +17612,15 @@ create_TOC_reference (rtx symbol)
gen_rtx_UNSPEC (Pmode, gen_rtvec (1, symbol), UNSPEC_TOCREL)));
}
/* Issue assembly directives that create a reference to the given DWARF
FRAME_TABLE_LABEL from the current function section. */
void
rs6000_aix_asm_output_dwarf_table_ref (char * frame_table_label)
{
fprintf (asm_out_file, "\t.ref %s\n",
TARGET_STRIP_NAME_ENCODING (frame_table_label));
}
/* If _Unwind_* has been called from within the same module,
toc register is not guaranteed to be saved to 40(1) on function
entry. Save it there in that case. */
......
......@@ -9159,6 +9159,13 @@ A C statement to issue assembly directives that create a self-relative
reference to the given @var{label}, using an integer of the given @var{size}.
@end defmac
@defmac ASM_OUTPUT_DWARF_TABLE_REF (@var{label})
A C statement to issue assembly directives that create a reference to
the DWARF table identifier @var{label} from the current section. This
is used on some systems to avoid garbage collecting a DWARF table which
is referenced by a function.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *@var{FILE}, int @var{size}, rtx @var{x})
If defined, this target hook is a function which outputs a DTP-relative
reference to the given TLS symbol of the specified size.
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment