From mboxrd@z Thu Jan 1 00:00:00 1970 From: lars brinkhoff To: Joern Rennecke Cc: gcc@gcc.gnu.org Subject: Re: External or local SYMBOL_REF? Date: Tue, 19 Sep 2000 10:10:00 -0000 Message-id: <8566nspauc.fsf@junk.nocrew.org> References: <200009181305.OAA31836@phal.cygnus.co.uk> X-SW-Source: 2000-09/msg00449.html Joern Rennecke 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); }