This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to get decl which decl2 is alias for?


Hello,

when compiling following testcase

extern char **_dl_argv_internal __attribute__ ((visibility ("hidden")));
extern char **_dl_argv_internal __attribute__ ((alias ("_dl_argv")));
char **_dl_argv;
extern char *foo;
void
dl_main ()
{ 
  char *x = _dl_argv_internal[0];
  foo = x++;
}

the decl for _dl_argv_internal is not TREE_STATIC (decl):
Is it correct?

 <var_decl 0x2a95627a80 _dl_argv_internal
    type <pointer_type 0x2a956279a0
        type <pointer_type 0x2a955d1b60 type <integer_type 0x2a955bb620 char>
            unsigned SI
            size <integer_cst 0x2a955c36c0 constant 32>
            unit size <integer_cst 0x2a955c3780 constant 4>
            align 32 symtab 0 alias set 5
            pointer_to_this <pointer_type 0x2a956279a0>>
        unsigned SI size <integer_cst 0x2a955c36c0 32> unit size <integer_cst 0x2a955c3780 4>
        align 32 symtab 0 alias set 3>
    unsigned asm_written used public common defer-output SI file /suse/zlomekj/r.c line 2 size <integer_cst 0x2a955c36c0 32> unit size <integer_cst 0x2a955c3780 4>
    align 32 attributes <tree_list 0x2a9562e330>
    (mem/f:SI (symbol_ref/v:SI ("_dl_argv_internal")) [3 _dl_argv_internal+0 S4 A32]) chain <type_decl 0x2a955f9540 _Bool>>

If it is correct, how can I find the decl (for _dl_argv) which this decl is
alias for?
There is only a name of the variable in DECL_ATTRIBUTES (decl):

 <tree_list 0x2a9562e330
    purpose <identifier_node 0x2a9562dd00 alias>
    value <tree_list 0x2a9562e2a0
        value <string_cst 0x2a9562e120 type <array_type 0x2a95627c40>
            readonly constant static "_dl_argv\000">>
    chain <tree_list 0x2a955f3fc0
        purpose <identifier_node 0x2a9562dc80 visibility>
        value <tree_list 0x2a955f3f60
            value <string_cst 0x2a955f3de0 type <array_type 0x2a956278c0>
                readonly constant static "hidden\000">>>>

Thanks.

Josef


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]