This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: External or local SYMBOL_REF?
- To: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Subject: Re: External or local SYMBOL_REF?
- From: lars brinkhoff <lars at nocrew dot org>
- Date: 19 Sep 2000 19:09:47 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <200009181305.OAA31836@phal.cygnus.co.uk>
Joern Rennecke <amylaar@cygnus.co.uk> writes:
> > If I have an rtx x for which GET_CODE (x) == SYMBOL_REF, how do I
> > find out whether the symbol is external or local?
> There no such information in the rtl in general.
> You can arrange for the inforamation to be extracted from the tree and
> encoded in the name of the symbol by defining ENCODE_SECTION_INFO.
Thanks. This seems to work well:
#define ENCODE_SECTION_INFO(DECL) encode_section_info(DECL)
#define SYMBOL_REF_EXTERNAL SYMBOL_REF_FLAG
void
encode_section_info (decl)
tree decl;
{
enum tree_code code = TREE_CODE (decl);
if (code == VAR_DECL || code == FUNCTION_DECL)
SYMBOL_REF_EXTERNAL (XEXP (DECL_RTL (decl), 0)) = !TREE_STATIC (decl);
}