diff options
author | Matt Austern <austern@apple.com> | 2004-03-12 17:09:03 +0000 |
---|---|---|
committer | Matt Austern <austern@gcc.gnu.org> | 2004-03-12 17:09:03 +0000 |
commit | 4746cf844723522037d0f0688f2189edd706e7b7 (patch) | |
tree | caa8a2f6e25f2a2ca455a215f64f01003c8ba7c4 /gcc/varasm.c | |
parent | cd33cf6e2f13de407e2e308f10f77b52dad6c3de (diff) | |
download | gcc-4746cf844723522037d0f0688f2189edd706e7b7.zip gcc-4746cf844723522037d0f0688f2189edd706e7b7.tar.gz gcc-4746cf844723522037d0f0688f2189edd706e7b7.tar.bz2 |
Enabled linkonce support for Darwin.
* target.h (struct gcc_target): New target hook, unwind_label.
* target-def.h (TARGET_ASM_EMIT_UNWIND_LABEL): New hook.
* output.h (default_emit_unwind_label): New function.
* default.h (TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY): New macro.
(TARGET_USES_WEAK_UNWIND_INFO): New target macro.
(TARGET_SUPPORTS_HIDDEN): New target macro.
* dwarf2out.c (struct dw_fde_struct): Add field for function decl
that corresponds to this FDE.
(FRAME_BEGIN_LABEL): Allow target to override default label.
(output_call_frame_info): If FDEs are linknonce, then use extra
indirection for FDE encoding, output a label for each FDE, and
output an empty label for each function without an FDE.
(dwarf2out_begin_prologue): Set up decl field when creating an FDE.
* varasm.c (globalize_decl): Call ASM_MAKE_LABEL_LINKONCE for
decls with DECL_ONE_ONLY set, if that macro is defined.
(make_decl_one_only): Don't use DECL_COMMON if we're compiling
for a SUPPORTS_ONE_ONLY target.
* config/darwin-protos.h (darwin_unique_section): Declare.
(darwin_asm_named_section): Likewise.
(darwin_section_type_flags): Likewise.
(darwin_non_lazy_pcrel): Likewise.
(darwin_emit_unwind_label): Likewise.
(darwin_make_decl_one_only): Likewise.
* config/darwin.c (machopic_finish): Get rid of tweak that
eliminate stubs for symbols that are defined.
(darwin_encode_section_info): Don't treat weak functions as defined.
(darwin_make_decl_one_only): Define.
(darwin_asm_named_section): Likewise.
(darwin_section_type_flags): Likewise.
(darwin_unique_section): Likewise.
(darwin_emit_unwind_label): Likewise.
(darwin_non_lazy_pcrel): Likewise.
(darwin_asm_output_dwarf_delta): Difference between two labels is
local only if both labels are local.
* config/darwin.h (MAKE_DECL_ONE_ONLY): Define.
(ASM_MAKE_LABEL_LINKONCE): Likewise.
(TARGET_SUPPORTS_HIDDEN): Likewise.
(TARGET_USES_WEAK_UNWIND_INFO): Likewise.
(TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY): Likewise.
(FRAME_BEGIN_LABEL): Likewise.
(ASM_DECLARE_OBJECT_NAME): Make references to weak symbols indirect.
(ASM_DECLARE_FUNCTION_NAME): Likewise.
(darwin_eh_frame_section): Give __eh_frame section the coalesced flag.
(TARGET_ASM_UNIQUE_SECTION): Define.
(EH_FRAME_SECTION_NAME): Define.
(EH_FRAME_SECTION_ATTR): Likewise.
(ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Likewise.
(TARGET_ASM_NAMED_SECTION): Likewise.
(TARGET_SECTION_TYPE_FLAGS): Likewise.
* doc/tm.texi: Document TARGET_USES_WEAK_UNWIND_INFO,
TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY, TARGET_SUPPORTS_HIDDEN,
TARGET_ASM_EMIT_UNWIND_LABEL.
* cp/decl2.c (maybe_make_one_only): Look at
TARGET_EXPLICIT_INSTANTIATION_ONE_ONLY when deciding whether
to make an explicit instantiation weak.
* cp/method.c (use_thunk): Make sure we call comdat_linkage
when appropriate.
* cp/pt.c (do_type_instantiation): On systems where weak symbols
don't go in a static archive's TOC, explicit instantiation of a
class must imply *explicit* instantiation of its memeber.
From-SVN: r79394
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 061cbca..6a32ccc 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4104,6 +4104,9 @@ globalize_decl (tree decl) } return; } +#elif defined(ASM_MAKE_LABEL_LINKONCE) + if (DECL_ONE_ONLY (decl)) + ASM_MAKE_LABEL_LINKONCE (asm_out_file, name); #endif (*targetm.asm_out.globalize_label) (asm_out_file, name); @@ -4228,16 +4231,16 @@ make_decl_one_only (tree decl) TREE_PUBLIC (decl) = 1; - if (TREE_CODE (decl) == VAR_DECL - && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)) - DECL_COMMON (decl) = 1; - else if (SUPPORTS_ONE_ONLY) + if (SUPPORTS_ONE_ONLY) { #ifdef MAKE_DECL_ONE_ONLY MAKE_DECL_ONE_ONLY (decl); #endif DECL_ONE_ONLY (decl) = 1; } + else if (TREE_CODE (decl) == VAR_DECL + && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)) + DECL_COMMON (decl) = 1; else if (SUPPORTS_WEAK) DECL_WEAK (decl) = 1; else @@ -4917,6 +4920,16 @@ default_globalize_label (FILE * stream, const char *name) } #endif /* GLOBAL_ASM_OP */ +/* Default function to output a label for unwind information. The + default is to do nothing. A target that needs nonlocal labels for + unwind information must provide its own function to do this. */ +void +default_emit_unwind_label (FILE * stream ATTRIBUTE_UNUSED, + tree decl ATTRIBUTE_UNUSED, + int empty ATTRIBUTE_UNUSED) +{ +} + /* This is how to output an internal numbered label where PREFIX is the class of label and LABELNO is the number within the class. */ |