On Mon, Mar 23, 2020 at 02:10:08PM +0100, Tobias Burnus wrote:
> As discussed in IRC, it makes sense to use '$' or '.' as
> separator instead of '_' – and, if it is not available,
> use a '__' prefix besides the '_' suffix separator.
> 
> OK?

Ok (the function does what we want, although for vars is a little bit
misnamed).

> lto/lto.c – used $ or . in generated linkptr name
> 
>       * lto.c (offload_handle_link_vars): Reduce chance of
>       naming clashes of generated linkptr variable.
> 
> diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
> index 467b922eedf..cd34d6c9e7a 100644
> --- a/gcc/lto/lto.c
> +++ b/gcc/lto/lto.c
> @@ -561,11 +561,9 @@ offload_handle_link_vars (void)
>                         DECL_ATTRIBUTES (var->decl)))
>        {
>       tree type = build_pointer_type (TREE_TYPE (var->decl));
> -     tree var_name = DECL_ASSEMBLER_NAME (var->decl);
> -     char *new_name
> -       = ACONCAT ((IDENTIFIER_POINTER (var_name), "_linkptr", NULL));
>       tree link_ptr_var = build_decl (UNKNOWN_LOCATION, VAR_DECL,
> -                                     get_identifier (new_name), type);
> +                                     clone_function_name (var->decl,
> +                                                          "linkptr"), type);
>       TREE_USED (link_ptr_var) = 1;
>       TREE_STATIC (link_ptr_var) = 1;
>       DECL_ARTIFICIAL (link_ptr_var) = 1;


        Jakub

Reply via email to