Commit 4e2e315f by Neil Booth Committed by Neil Booth

c-cppbuiltin.c (TARGET_OS_CPP_BUILTINS, [...]): Default here.

	* c-cppbuiltin.c (TARGET_OS_CPP_BUILTINS, TARGET_OBJFMT_CPP_BUILTINS):
	Default here.
	(c_cpp_builtins): Invoke TARGET_OBJFMT_CPP_BUILTINS().
	* defaults.h: Don't default TARGET_OS_CPP_BUILTINS here.
	* config/elfos.h (TARGET_OBJFMT_CPP_BUILTINS): Define __ELF__.
	* config/freebsd-spec.h, config/netbsd-elf.h, config/alpha/gnu.h,
	config/arm/linux-elf.h, config/arm/rtems-elf.h,
	config/arm/unknown-elf.h, config/cris/cris.h, config/cris/linux.h,
	config/h8300/elf.h, config/i370/linux.h, config/i386/beos-elf.h,
	config/i386/gnu.h, config/i386/linux.h, config/i386/linux64.h,
	config/i386/moss.h, config/i386/rtemself.h, config/ia64/ia64.h,
	config/m68k/rtemself.h, config/mcore/mcore-elf.h, config/mips/linux.h,
	config/pa/pa-linux.h, config/rs6000/linux.h, config/rs6000/linux64.h,
	config/rs6000/sysv4.h, config/rs6000/vxworks.h, config/s390/linux.h,
	config/sh/coff.h, config/sh/elf.h, config/sh/rtemself.h,
	config/sh/sh.h, config/sparc/linux.h, config/sparc/linux64.h,
	config/sparc/openbsd64.h, config/sparc/sp64-elf.h,
	config/sparc/sp86x-elf.h, config/xtensa/elf.h, config/xtensa/linux.h:
	Don't define __ELF__.
	* config/alpha.h, config/m68k/linux.h (TARGET_OBJFMT_CPP_BUILTINS):
	Define __ELF__.
	* doc/cpp.texi: Document __ELF__.
	* doc/tm.texi: Document TARGET_OBJFMT_CPP_BUILTINS.

From-SVN: r66926
parent 25903d03
2003-05-18 Neil Booth <neil@daikokuya.co.uk>
* c-cppbuiltin.c (TARGET_OS_CPP_BUILTINS, TARGET_OBJFMT_CPP_BUILTINS):
Default here.
(c_cpp_builtins): Invoke TARGET_OBJFMT_CPP_BUILTINS().
* defaults.h: Don't default TARGET_OS_CPP_BUILTINS here.
* config/elfos.h (TARGET_OBJFMT_CPP_BUILTINS): Define __ELF__.
* config/freebsd-spec.h, config/netbsd-elf.h, config/alpha/gnu.h,
config/arm/linux-elf.h, config/arm/rtems-elf.h,
config/arm/unknown-elf.h, config/cris/cris.h, config/cris/linux.h,
config/h8300/elf.h, config/i370/linux.h, config/i386/beos-elf.h,
config/i386/gnu.h, config/i386/linux.h, config/i386/linux64.h,
config/i386/moss.h, config/i386/rtemself.h, config/ia64/ia64.h,
config/m68k/rtemself.h, config/mcore/mcore-elf.h, config/mips/linux.h,
config/pa/pa-linux.h, config/rs6000/linux.h, config/rs6000/linux64.h,
config/rs6000/sysv4.h, config/rs6000/vxworks.h, config/s390/linux.h,
config/sh/coff.h, config/sh/elf.h, config/sh/rtemself.h,
config/sh/sh.h, config/sparc/linux.h, config/sparc/linux64.h,
config/sparc/openbsd64.h, config/sparc/sp64-elf.h,
config/sparc/sp86x-elf.h, config/xtensa/elf.h, config/xtensa/linux.h:
Don't define __ELF__.
* config/alpha.h, config/m68k/linux.h (TARGET_OBJFMT_CPP_BUILTINS):
Define __ELF__.
* doc/cpp.texi: Document __ELF__.
* doc/tm.texi: Document TARGET_OBJFMT_CPP_BUILTINS. *
2003-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
......
......@@ -32,6 +32,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h"
#include "tm_p.h" /* Target prototypes. */
#ifndef TARGET_OS_CPP_BUILTINS
# define TARGET_OS_CPP_BUILTINS()
#endif
#ifndef TARGET_OBJFMT_CPP_BUILTINS
# define TARGET_OBJFMT_CPP_BUILTINS()
#endif
#ifndef REGISTER_PREFIX
#define REGISTER_PREFIX ""
#endif
......@@ -387,6 +395,7 @@ c_cpp_builtins (pfile)
# define builtin_assert(TXT) cpp_assert (pfile, TXT)
TARGET_CPU_CPP_BUILTINS ();
TARGET_OS_CPP_BUILTINS ();
TARGET_OBJFMT_CPP_BUILTINS ();
}
/* Pass an object-like macro. If it doesn't lie in the user's
......
......@@ -35,8 +35,13 @@ Boston, MA 02111-1307, USA. */
#undef ASM_FINAL_SPEC
#undef CPP_SUBTARGET_SPEC
#define CPP_SUBTARGET_SPEC "-D__ELF__"
/* alpha/ doesn't use elfos.h for some reason. */
#define TARGET_OBJFMT_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
} \
while (0)
#undef CC1_SPEC
#define CC1_SPEC "%{G*}"
......
......@@ -7,7 +7,6 @@
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define ("__GNU__"); \
builtin_define ("__ELF__"); \
builtin_define ("__gnu_hurd__"); \
builtin_define ("_LONGLONG"); \
builtin_define_std ("unix"); \
......
......@@ -94,7 +94,6 @@
builtin_define_std ("unix"); \
builtin_define_std ("linux"); \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} while (0)
......
......@@ -27,6 +27,5 @@
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define ("__rtems__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=rtems"); \
} while (0)
......@@ -43,7 +43,7 @@
/* The __USES_INITFINI__ define is tested in newlib/libc/sys/arm/crt0.S
to see if it needs to invoked _init() and _fini(). */
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "-D__ELF__ -D__USES_INITFINI__"
#define SUBTARGET_CPP_SPEC "-D__USES_INITFINI__"
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
......
......@@ -254,14 +254,6 @@ extern const char *cris_elinux_stacksize_str;
} \
while (0)
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
} \
while (0)
/* This needs to be at least 32 bits. */
extern int target_flags;
......
......@@ -106,7 +106,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("__gnu_linux__"); \
builtin_define ("__linux__"); \
builtin_define ("__unix__"); \
builtin_define ("__ELF__"); \
if (flag_pic) \
{ \
builtin_define ("__PIC__"); \
......
......@@ -21,6 +21,12 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define TARGET_OBJFMT_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
} \
while (0)
/* Define a symbol indicating that we are using elfos.h.
Some CPU specific configuration files use this. */
......
......@@ -62,7 +62,6 @@ Boston, MA 02111-1307, USA. */
else \
builtin_define ("__FreeBSD__"); \
builtin_define_std ("unix"); \
builtin_define ("__ELF__"); \
builtin_define ("__KPRINTF_ATTRIBUTE__"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=bsd"); \
......
/* Target OS preprocessor built-ins. */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
} \
while (0)
/* Undefine some macros defined in h8300 that conflict with elfos.h . */
#undef SDB_DEBUGGING_INFO
#undef DBX_DEBUGGING_INFO
......
......@@ -38,7 +38,6 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("unix"); \
builtin_define_std ("linux"); \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=posix"); \
} while (0)
......
......@@ -58,7 +58,6 @@ Boston, MA 02111-1307, USA. */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
builtin_define ("__BEOS__"); \
builtin_define ("__INTEL__"); \
builtin_define ("_X86_"); \
......
......@@ -9,7 +9,6 @@
{ \
builtin_define_std ("MACH"); \
builtin_define_std ("unix"); \
builtin_define ("__ELF__"); \
builtin_define ("__GNU__"); \
builtin_define ("__gnu_hurd__"); \
builtin_assert ("system=gnu"); \
......
......@@ -79,7 +79,6 @@ Boston, MA 02111-1307, USA. */
{ \
builtin_define_std ("linux"); \
builtin_define_std ("unix"); \
builtin_define ("__ELF__"); \
builtin_define ("__gnu_linux__"); \
builtin_assert ("system=posix"); \
if (flag_pic) \
......
......@@ -29,7 +29,6 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("linux"); \
builtin_define_std ("unix"); \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=posix"); \
if (flag_pic) \
{ \
......
......@@ -24,7 +24,6 @@ Boston, MA 02111-1307, USA. */
do \
{ \
builtin_define_std ("moss"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=posix"); \
if (flag_pic) \
{ \
......
......@@ -25,7 +25,6 @@ Boston, MA 02111-1307, USA. */
do \
{ \
builtin_define ("__rtems__"); \
builtin_define ("__ELF__"); \
builtin_define ("__USE_INIT_FINI__"); \
builtin_assert ("system=rtems"); \
if (!TARGET_80387) \
......
......@@ -39,7 +39,6 @@ do { \
builtin_define("__ia64"); \
builtin_define("__ia64__"); \
builtin_define("__itanium__"); \
builtin_define("__ELF__"); \
if (TARGET_BIG_ENDIAN) \
builtin_define("__BIG_ENDIAN__"); \
} while (0)
......
......@@ -106,12 +106,18 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("linux"); \
builtin_define_std ("unix"); \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} \
while (0)
#define TARGET_OBJFMT_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
} \
while (0)
#undef CPP_SPEC
#ifdef USE_GNULIBC_1
#if TARGET_DEFAULT & MASK_68881
......
......@@ -30,7 +30,6 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("mc68000"); \
builtin_define ("__USE_INIT_FINI__"); \
builtin_define ("__rtems__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=rtems"); \
} \
while (0)
......@@ -25,13 +25,6 @@ Boston, MA 02111-1307, USA. */
/* Run-time Target Specification. */
#define TARGET_VERSION fputs (" (Motorola MCORE/elf)", stderr)
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
} \
while (0)
/* Use DWARF2 debugging info. */
#define DWARF2_DEBUGGING_INFO 1
......
......@@ -120,7 +120,6 @@ void FN () \
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_define ("__PIC__"); \
builtin_define ("__pic__"); \
builtin_define_std ("unix"); \
......
......@@ -24,7 +24,6 @@ Boston, MA 02111-1307, USA. */
do \
{ \
NETBSD_OS_CPP_BUILTINS_COMMON(); \
builtin_define ("__ELF__"); \
} \
while (0)
......
......@@ -56,7 +56,6 @@ Boston, MA 02111-1307, USA. */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ELF__"); \
builtin_define ("__gnu_linux__"); \
builtin_define_std ("linux"); \
builtin_define_std ("unix"); \
......
......@@ -29,7 +29,6 @@
do \
{ \
builtin_define_std ("PPC"); \
builtin_define ("__ELF__"); \
builtin_define_std ("powerpc"); \
builtin_assert ("cpu=powerpc"); \
builtin_assert ("machine=powerpc"); \
......
......@@ -170,7 +170,6 @@
builtin_define ("__powerpc__"); \
builtin_define ("__powerpc64__"); \
builtin_define ("__PIC__"); \
builtin_define ("__ELF__"); \
builtin_assert ("cpu=powerpc64"); \
builtin_assert ("machine=powerpc64"); \
} \
......
......@@ -1071,7 +1071,7 @@ extern int fixuplabelno;
/* FreeBSD support. */
#define CPP_OS_FREEBSD_SPEC "\
-D__ELF__ -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
-D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
-Acpu=powerpc -Amachine=powerpc"
#define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
......@@ -1190,7 +1190,7 @@ ncrtn.o%s"
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
#define CPP_OS_NETBSD_SPEC "\
-D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__"
-D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
/* WindISS support. */
......
......@@ -39,7 +39,7 @@
#define SUBTARGET_EXTRA_SPECS /* none needed */
#define CPP_SPEC \
"-DCPU_FAMILY=PPC -D__ppc -D__EABI__ -D__ELF__ \
"-DCPU_FAMILY=PPC -D__ppc -D__EABI__ \
%{t403: -DCPU=PPC403 -D_SOFT_FLOAT ; \
t405: -DCPU=PPC405 -D_SOFT_FLOAT ; \
t440: -DCPU=PPC440 -D_SOFT_FLOAT ; \
......
......@@ -57,7 +57,6 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("unix"); \
builtin_assert ("system=linux"); \
builtin_assert ("system=unix"); \
builtin_define ("__ELF__"); \
builtin_define ("__gnu_linux__"); \
if (flag_pic) \
{ \
......
......@@ -72,6 +72,4 @@ Boston, MA 02111-1307, USA. */
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%d\n", (int)(SIZE)))
#define TARGET_OBJFMT_CPP_BUILTINS()
#define DWARF2_UNWIND_INFO 0
......@@ -58,11 +58,6 @@ Boston, MA 02111-1307, USA. */
fprintf ((FILE), "\t.little\n"); \
} while (0)
/* Let code know that this is ELF. */
#define TARGET_OBJFMT_CPP_BUILTINS() builtin_define ("__ELF__")
#undef SIZE_TYPE
#define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int")
......
......@@ -23,6 +23,5 @@ Boston, MA 02111-1307, USA. */
#define TARGET_OS_CPP_BUILTINS() do { \
builtin_define( "__rtems__" ); \
builtin_define( "__ELF__" ); \
builtin_assert( "system=rtems" ); \
} while (0)
......@@ -79,7 +79,6 @@ do { \
builtin_define ("__pic__"); \
builtin_define ("__PIC__"); \
} \
TARGET_OBJFMT_CPP_BUILTINS (); \
} while (0)
/* We can not debug without a frame pointer. */
......
......@@ -25,7 +25,6 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("unix"); \
builtin_define_std ("linux"); \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} \
......
......@@ -26,7 +26,6 @@ Boston, MA 02111-1307, USA. */
builtin_define_std ("linux"); \
builtin_define ("_LONGLONG"); \
builtin_define ("__gnu_linux__"); \
builtin_define ("__ELF__"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} \
......
......@@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */
builtin_define ("__sparcv9__"); \
builtin_define ("__sparc_v9__"); \
builtin_define ("__arch64__"); \
builtin_define ("__ELF__"); \
} \
while (0)
......
......@@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA. */
do \
{ \
builtin_define_std ("sparc"); \
builtin_define ("__ELF__"); \
} \
while (0)
......
......@@ -24,7 +24,6 @@ Boston, MA 02111-1307, USA. */
do \
{ \
builtin_define ("__sparclite86x__"); \
builtin_define ("__ELF__"); \
} \
while (0)
......
......@@ -19,11 +19,6 @@ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define ("__ELF__"); \
} while (0)
#define TARGET_SECTION_TYPE_FLAGS xtensa_multibss_section_type_flags
/* Don't assume anything about the header files. */
......
......@@ -23,7 +23,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
do { \
builtin_define_std ("linux"); \
builtin_define_std ("unix"); \
builtin_define ("__ELF__"); \
builtin_define ("__gnu_linux__"); \
builtin_assert ("system=posix"); \
} while (0)
......
......@@ -47,10 +47,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
# define TARGET_ESC 033
#endif
#ifndef TARGET_OS_CPP_BUILTINS
# define TARGET_OS_CPP_BUILTINS()
#endif
/* Store in OUTPUT a string (made with alloca) containing an
assembler-name for a local static variable or function named NAME.
LABELNO is an integer which is different for each call. */
......
......@@ -1945,6 +1945,9 @@ incremented on every @samp{#include} directive and decremented at the
end of every included file. It starts out at 0, it's value within the
base file specified on the command line.
@item __ELF__
This macro is defined if the target uses the ELF object format.
@item __VERSION__
This macro expands to a string constant which describes the version of
the compiler in use. You should not rely on its contents having any
......
......@@ -655,6 +655,13 @@ preprocessing.
Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
and is used for the target operating system instead.
@findex TARGET_OBJFMT_CPP_BUILTINS
@item TARGET_OBJFMT_CPP_BUILTINS()
Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
and is used for the target object format. @file{elfos.h} uses this
macro to define @code{__ELF__}, so you probably do not need to define
it yourself.
@findex extern int target_flags
@item extern int target_flags;
This declaration should be present.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment