This is the mail archive of the
mailing list for the GCC project.
Re: Support Xilinx PowerPC target boards
On Wed, Nov 19, 2008 at 09:48:07AM -0800, Michael Eager wrote:
> Michael Meissner wrote:
> >On Tue, Nov 18, 2008 at 08:56:20AM -0800, Michael Eager wrote:
> >>The attached patch adds default board configuration for
> >>Michael Eager firstname.lastname@example.org
> >>1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
> >>2008-11-18 Michael Eager <email@example.com>
> >> * config/rs6000/xilinx.h: New, options for
> >> --target=powerpc-xilinx-eabi
> >> * config.gcc: Include xilinx.h
> >Rather than defining the defines in CPP_OS_DEFAULT_SPEC, it would be
> >better to
> >define these in TARGET_OS_CPP_BUILTINS or TARGET_OS_SYSV_CPP_BUILTINS.
> >way, if the user uses the -std=<xxx> call, it will only define __FOO__,
> >and if
> >the user doesn't use -std=<xxx>, it will define FOO and __FOO__. Hopefully
> >Xilinx can change their header files to use either FOO or __FOO__ being
> It doesn't appear that this would permit defines which are conditional
> on command line options.
Sure it does. For example, from the sysv4.h file in the rs6000 directory we
#define TARGET_OS_SYSV_CPP_BUILTINS() \
if (target_flags_explicit \
& MASK_RELOCATABLE) \
builtin_define ("_RELOCATABLE"); \
Which only defines _RELOCATABLE if -mrelocatable was used. You should be able
to use just about any tests you want.
In the old days, we needed to the -Dxxxx in CPP_SPEC because the preprocessor
was a separate program from the compiler proper. Since 3.3, the preprocessor
has been folded into the compiler binary, and you can now use target tests to
define whatever macros you need.
There are several functions in c-cppbuiltin.c you can use:
builtin_define_std -- If the macro is in the user's name space (i.e. does not
begin with "__" or "_" and an upper case letter), define __<name>, __<name>__.
If the iso flag is not set, also define <name>.
builtin_define_with_value -- Define a macro with a string value.
builtin_define_with_int_value -- Define a macro with an integer value.
builtin_define -- Define a single macro.
builtin_assert -- Define an assert.
Note, the calls to builtin_define, etc. have to be in the macros ultimately
expanded by the macros TARGET_CPU_CPP_BUILTINS, TARGET_OS_CPP_BUILTINS, or
TARGET_OBJFMT_CPP_BUILTINS, or in a function in rs6000-c.c.
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA