This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: flag_external and DECL_EXTERNAL documentation

David Korn <> writes:
> >From: Jason Merrill []
> >> 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
> 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".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]