This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: correct place for code.
- From: Ian Lance Taylor <iant at google dot com>
- To: IainS <developer at sandoe-acoustics dot co dot uk>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 14 Jan 2009 17:44:28 -0800
- Subject: Re: correct place for code.
- References: <341CF03E-15DD-4BD1-9059-FA1AFCE29211@sandoe-acoustics.co.uk>
IainS <developer@sandoe-acoustics.co.uk> writes:
> I need to make a test expanded from ASM_OUTPUT_LABEL_REF that is
> language dependent (on objc/objcxx).
>
> It's not clear where the best/proper place to put the code is.
>
> if I put it in {stub,act}-objc.c that's fine for c, c++, objc and
> objc++ ...
> ... but it means that stub-objc then needs to be linked with jc1 and
> f951
> ... and anyway the test is target-specific so perhaps it belongs
> better somewhere in config/...
>
> if I put it in config/target.c then the c_dialect variable
> (c_language) is not available from jc1 or f951 - although,
> obviously, a dummy definition could be made to satisfy the reference.
>
> Is there a "best practice" or "known way" to solve this?
In general this can not be done. gcc has a pretty strong split
between the frontend and the backend. You can't refer to frontend
structures in the backend.
It's pretty hard to think of any reason why something as low-level as
ASM_OUTPUT_LABEL_REF would want to look at anything in the frontend.
You are probably working at the wrong level.
Ian