External or local SYMBOL_REF?

lars brinkhoff lars@nocrew.org
Tue Sep 19 10:10:00 GMT 2000


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);
}


More information about the Gcc mailing list