This is the mail archive of the gcc-patches@gcc.gnu.org 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]
Other format: [Raw text]

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
> >>--target=powerpc-xilinx-eabi.
> >>
> >>-- 
> >>Michael Eager	 eager@eagercon.com
> >>1960 Park Blvd., Palo Alto, CA 94306  650-325-8077
> >
> >
> >>2008-11-18  Michael Eager <eager@eagercon.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.  
> >This
> >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
> >defined.
> 
> 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
have:

#define TARGET_OS_SYSV_CPP_BUILTINS()		\
  do						\
    {						\
      if (target_flags_explicit			\
	  & MASK_RELOCATABLE)			\
	builtin_define ("_RELOCATABLE");	\
    }						\
  while (0)

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
meissner@linux.vnet.ibm.com


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