This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: flag_external and DECL_EXTERNAL documentation
- To: David Korn <dkorn at pixelpower dot com>
- Subject: Re: PATCH: flag_external and DECL_EXTERNAL documentation
- From: Lars Brinkhoff <lars dot spam at nocrew dot org>
- Date: 02 Feb 2001 12:12:02 +0100
- Cc: 'Jason Merrill' <jason at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Organization: nocrew
- References: <718D38CAB6E0D011B2C90060970C28A5642661@EXCHANGESERVER>
David Korn <email@example.com> writes:
> >From: Jason Merrill [mailto:firstname.lastname@example.org]
> >> In the back end I'm currently writing, whenever a function call is to
> >> be generated I need to know whether the function is defined in the
> >> current translation unit or not.
> >The rs6000 port uses
> > ((TREE_ASM_WRITTEN || !TREE_PUBLIC) && ! DECL_WEAK).
> ...to set the SYMBOL_REF_FLAG, by any chance ? There's a couple of
> catches with that that I've discovered. One is that TREE_ASM_WRITTEN isn't
> set until the final pass begins outputting assembler, so this will only spot
> public (global) functions, and not (what would be described in C as)
> module static functions. You might like to search the archives for a
> thread or two with "tests TREE_ASM_WRITTEN too early" in the subject line;
> deciding that a function exists in the current translation unit turns out to
> be quite tricky.
So have you found any solution? In my case, the assembler *requires*
calls to locally-defined functions to use short jumps, so I'm even
more desperate to find out how to detect those functions.
For now, I have resorted to a C-specific hack in c-decl.c:grokdeclarator()
which sets a flag when a function is declared "extern".