diff options
author | sje <sje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-24 19:40:12 +0000 |
---|---|---|
committer | sje <sje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-24 19:40:12 +0000 |
commit | 9afff52dab85b10e858e0b2b5adf9d6f47f475d6 (patch) | |
tree | 13559698c1afb4d85fe748d845c52d2e03712729 /gcc/config | |
parent | 32875ae1539a38675063d51563416a67017d3af3 (diff) | |
download | gcc-9afff52dab85b10e858e0b2b5adf9d6f47f475d6.tar.gz |
* target.h (globalize_decl_name): New.
* target-def.h (TARGET_ASM_GLOBALIZE_DECL_NAME): New.
* output.h (default_globalize_decl_name): New.
* varasm.c (asm_output_bss): Use globalize_decl_name instead of
globalize_label.
(globalize_decl): Ditto.
(default_globalize_decl_name): New.
* config/ia64/ia64.c (ia64_globalize_decl_name): New.
(ia64_handle_version_id_attribute): New.
(TARGET_ASM_GLOBALIZE_DECL_NAME): New.
(ia64_asm_output_external): Use globalize_decl_name instead
of globalize_label.
* doc/extend.texi (version_id): New pragma.
* doc/tm.texi (ARGET_ASM_GLOBALIZE_DECL_NAME): New target hook.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121128 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/ia64/ia64.c | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index dc4cb39e2c1..36c0d63e1ae 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -242,6 +242,7 @@ static void bundling (FILE *, int, rtx, rtx); static void ia64_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); static void ia64_file_start (void); +static void ia64_globalize_decl_name (FILE *, tree); static section *ia64_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT); @@ -265,6 +266,7 @@ static void ia64_vms_init_libfuncs (void) ATTRIBUTE_UNUSED; static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *); +static tree ia64_handle_version_id_attribute (tree *, tree, tree, int, bool *); static void ia64_encode_section_info (tree, rtx, int); static rtx ia64_struct_value_rtx (tree, int); static tree ia64_gimplify_va_arg (tree, tree, tree *, tree *); @@ -282,6 +284,8 @@ static const struct attribute_spec ia64_attribute_table[] = /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ { "syscall_linkage", 0, 0, false, true, true, NULL }, { "model", 1, 1, true, false, false, ia64_handle_model_attribute }, + { "version_id", 1, 1, true, false, false, + ia64_handle_version_id_attribute }, { NULL, 0, 0, false, false, false, NULL } }; @@ -391,6 +395,9 @@ static const struct attribute_spec ia64_attribute_table[] = #undef TARGET_ASM_FILE_START #define TARGET_ASM_FILE_START ia64_file_start +#undef TARGET_ASM_GLOBALIZE_DECL_NAME +#define TARGET_ASM_GLOBALIZE_DECL_NAME ia64_globalize_decl_name + #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS ia64_rtx_costs #undef TARGET_ADDRESS_COST @@ -2226,6 +2233,24 @@ emit_safe_across_calls (void) fputc ('\n', asm_out_file); } +/* Globalize a declaration. */ + +static void +ia64_globalize_decl_name (FILE * stream, tree decl) +{ + const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); + tree version_attr = lookup_attribute ("version_id", DECL_ATTRIBUTES (decl)); + if (version_attr) + { + tree v = TREE_VALUE (TREE_VALUE (version_attr)); + const char *p = TREE_STRING_POINTER (v); + fprintf (stream, "\t.alias %s#, \"%s{%s}\"\n", name, name, p); + } + targetm.asm_out.globalize_label (stream, name); + if (TREE_CODE (decl) == FUNCTION_DECL) + ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "function"); +} + /* Helper function for ia64_compute_frame_size: find an appropriate general register to spill some special register to. SPECIAL_SPILL_MASK contains bits in GR0 to GR31 that have already been allocated by this routine. @@ -9189,10 +9214,7 @@ ia64_asm_output_external (FILE *file, tree decl, const char *name) need something for external functions. */ if ((TARGET_HPUX_LD || !TARGET_GNU_AS) && TREE_CODE (decl) == FUNCTION_DECL) - { - ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"); - (*targetm.asm_out.globalize_label) (file, name); - } + (*targetm.asm_out.globalize_decl_name) (file, decl); else if (need_visibility && !TARGET_GNU_AS) (*targetm.asm_out.globalize_label) (file, name); } @@ -9778,4 +9800,27 @@ ia64_optimization_options (int level ATTRIBUTE_UNUSED, } +/* HP-UX version_id attribute. + For object foo, if the version_id is set to 1234 put out an alias + of '.alias foo "foo{1234}" We can't use "foo{1234}" in anything + other than an alias statement because it is an illegal symbol name. */ + +static tree +ia64_handle_version_id_attribute (tree *node ATTRIBUTE_UNUSED, + tree name ATTRIBUTE_UNUSED, + tree args, + int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) +{ + tree arg = TREE_VALUE (args); + + if (TREE_CODE (arg) != STRING_CST) + { + error("version attribute is not a string"); + *no_add_attrs = true; + return NULL_TREE; + } + return NULL_TREE; +} + #include "gt-ia64.h" |