diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2006-12-12 03:58:52 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2006-12-11 19:58:52 -0800 |
commit | c47c29c8964d7c80329574f4a3b9c70f2fa533b4 (patch) | |
tree | 39fa7bd559e89365079d4e0441db0929ccb97dd5 /gcc/varasm.c | |
parent | 864abd46caa11641fe0588e31d1e19135c29f476 (diff) | |
download | gcc-c47c29c8964d7c80329574f4a3b9c70f2fa533b4.tar.gz |
re PR middle-end/17982 (stop calling assemble_external before final assembly output time)
2006-12-11 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/17982
PR middle-end/20218
* cgraphunit.c (cgraph_optimize): Remove call to
process_pending_assemble_externals.
* config/elfos.h (ASM_OUTPUT_EXTERNAL): New.
* config/ia64/hpux.h (TARGET_ASM_FILE_END): Removed.
* config/ia64/ia64.c (ia64_asm_output_external): Rewritten.
(ia64_hpux_add_extern_decl): Removed.
(ia64_hpux_file_end): Likewise.
(extern_func_list): Likewise.
(extern_func_head): Likewise.
* output.h (assemble_external): Update comments.
(default_elf_asm_output_external): New.
(maybe_assemble_visibility): New.
* toplev.c (compile_file): Update comment.
* varasm.c (assemble_external): Always put it on
pending_assemble_externals.
(maybe_assemble_visibility): Make it extern and return int.
(default_elf_asm_output_external): New.
From-SVN: r119764
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 9d5c838b59b..ff1ee6e0577 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -126,7 +126,6 @@ static unsigned HOST_WIDE_INT array_size_for_constructor (tree); static unsigned min_align (unsigned, unsigned); static void output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int); static void globalize_decl (tree); -static void maybe_assemble_visibility (tree); #ifdef BSS_SECTION_ASM_OP #ifdef ASM_OUTPUT_BSS static void asm_output_bss (FILE *, tree, const char *, @@ -1964,11 +1963,10 @@ assemble_external (tree decl ATTRIBUTE_UNUSED) if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)) return; - if (flag_unit_at_a_time) - pending_assemble_externals = tree_cons (0, decl, - pending_assemble_externals); - else - assemble_external_real (decl); + /* We want to output external symbols at very last to check if they + are references or not. */ + pending_assemble_externals = tree_cons (0, decl, + pending_assemble_externals); #endif } @@ -5071,13 +5069,18 @@ default_assemble_visibility (tree decl, int vis) /* A helper function to call assemble_visibility when needed for a decl. */ -static void +int maybe_assemble_visibility (tree decl) { enum symbol_visibility vis = DECL_VISIBILITY (decl); if (vis != VISIBILITY_DEFAULT) - targetm.asm_out.visibility (decl, vis); + { + targetm.asm_out.visibility (decl, vis); + return 1; + } + else + return 0; } /* Returns 1 if the target configuration supports defining public symbols @@ -6327,4 +6330,19 @@ elf_record_gcc_switches (print_switch_type type, const char * name) return 0; } +/* Emit text to declare externally defined symbols. It is needed to + properly support non-default visibility. */ +void +default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED, + tree decl, + const char *name ATTRIBUTE_UNUSED) +{ + /* We output the name if and only if TREE_SYMBOL_REFERENCED is + set in order to avoid putting out names that are never really + used. */ + if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) + && targetm.binds_local_p (decl)) + maybe_assemble_visibility (decl); +} + #include "gt-varasm.h" |