diff options
author | Richard Henderson <rth@redhat.com> | 2002-05-19 02:50:27 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2002-05-19 02:50:27 -0700 |
commit | 47754fd5485a059bba7dd059b719a1d02ff38585 (patch) | |
tree | 09e048642c8026646ba3670cb08ad9d367efeca8 /gcc/varasm.c | |
parent | c2f22a1230cef5fb0aa370b243c67d3ce61ab931 (diff) | |
download | gcc-47754fd5485a059bba7dd059b719a1d02ff38585.zip gcc-47754fd5485a059bba7dd059b719a1d02ff38585.tar.gz gcc-47754fd5485a059bba7dd059b719a1d02ff38585.tar.bz2 |
target-def.h (TARGET_BINDS_LOCAL_P): New.
* target-def.h (TARGET_BINDS_LOCAL_P): New.
* target.h (struct gcc_target): Move boolean fields to the end.
Add binds_local_p.
* varasm.c (default_binds_local_p): New.
* output.h: Declare it.
* config/alpha/alpha.c (alpha_encode_section_info): Use the new hook.
* config/cris/cris.c (cris_encode_section_info): Likewise.
* config/i386/i386.c (i386_encode_section_info): Likewise.
* config/ia64/ia64.c (ia64_encode_section_info): Likewise.
* config/sh/sh.c (sh_encode_section_info): Likewise.
* doc/tm.texi (TARGET_IN_SMALL_DATA_P): New.
(TARGET_BINDS_LOCAL_P): New.
From-SVN: r53620
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 797b676..6d7732d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -5545,3 +5545,45 @@ default_strip_name_encoding (str) { return str + (*str == '*'); } + +/* Assume ELF-ish defaults, since that's pretty much the most liberal + wrt cross-module name binding. */ + +bool +default_binds_local_p (exp) + tree exp; +{ + bool local_p; + + /* A non-decl is an entry in the constant pool. */ + if (!DECL_P (exp)) + local_p = true; + /* A variable is considered "local" if it is defined by this module. */ + if (MODULE_LOCAL_P (exp)) + local_p = true; + /* Otherwise, variables defined outside this object may not be local. */ + else if (DECL_EXTERNAL (exp)) + local_p = false; + /* Linkonce and weak data are never local. */ + else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp)) + local_p = false; + /* Static variables are always local. */ + else if (! TREE_PUBLIC (exp)) + local_p = true; + /* If PIC, then assume that any global name can be overridden by + symbols resolved from other modules. */ + else if (flag_pic) + local_p = false; + /* Uninitialized COMMON variable may be unified with symbols + resolved from other modules. */ + else if (DECL_COMMON (exp) + && (DECL_INITIAL (exp) == NULL + || DECL_INITIAL (exp) == error_mark_node)) + local_p = false; + /* Otherwise we're left with initialized (or non-common) global data + which is of necessity defined locally. */ + else + local_p = true; + + return local_p; +} |