From a6e464ae019d39af515fe0e2be9a949ed75bce92 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Sun, 9 Mar 2003 01:20:03 +0000 Subject: [PATCH] aout.h (CRIS_CPP_SUBTARGET_SPEC): Move -D__AOUT__ to... * config/cris/aout.h (CRIS_CPP_SUBTARGET_SPEC): Move -D__AOUT__ to... (TARGET_OS_CPP_BUILTINS): New macro. * config/cris/cris.h (CRIS_CPP_SUBTARGET_SPEC): Move -D__ELF__ to... (TARGET_OS_CPP_BUILTINS): New macro. (CPP_PREDEFINES): Don't define. Move old definitions and... (CPP_SPEC): ...move -D__CRIS_ABI_version=2 to... (TARGET_CPU_CPP_BUILTINS): New macro. * config/cris/linux.h (CRIS_CPP_SUBTARGET_SPEC): Move constant definitions and the optional __PIC__, __pic__ and __NO_UNDERSCORES__ definitions to... (TARGET_OS_CPP_BUILTINS): New macro. From-SVN: r64014 --- gcc/ChangeLog | 12 ++++++++++++ gcc/config/cris/aout.h | 16 ++++++++++++++-- gcc/config/cris/cris.h | 25 +++++++++++++++++++------ gcc/config/cris/linux.h | 29 ++++++++++++++++++++++++----- 4 files changed, 69 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c95dc4e2678..a64ec2376fd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 2003-03-09 Hans-Peter Nilsson + * config/cris/aout.h (CRIS_CPP_SUBTARGET_SPEC): Move -D__AOUT__ to... + (TARGET_OS_CPP_BUILTINS): New macro. + * config/cris/cris.h (CRIS_CPP_SUBTARGET_SPEC): Move -D__ELF__ to... + (TARGET_OS_CPP_BUILTINS): New macro. + (CPP_PREDEFINES): Don't define. Move old definitions and... + (CPP_SPEC): ...move -D__CRIS_ABI_version=2 to... + (TARGET_CPU_CPP_BUILTINS): New macro. + * config/cris/linux.h (CRIS_CPP_SUBTARGET_SPEC): Move constant + definitions and the optional __PIC__, __pic__ and + __NO_UNDERSCORES__ definitions to... + (TARGET_OS_CPP_BUILTINS): New macro. + * flags.h (flag_leading_underscore): Declare. * c-opts.c (c_common_post_options): On fopen failure, return diff --git a/gcc/config/cris/aout.h b/gcc/config/cris/aout.h index 8c4e7b7f6dc..db98c3fe957 100644 --- a/gcc/config/cris/aout.h +++ b/gcc/config/cris/aout.h @@ -64,8 +64,7 @@ Boston, MA 02111-1307, USA. */ #undef CRIS_CPP_SUBTARGET_SPEC #define CRIS_CPP_SUBTARGET_SPEC \ - "-D__AOUT__\ - %{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\ + "%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\ %{!nostdinc:\ %{!mbest-lib-options:%{isystem*}}\ -isystem elinux/include%s\ @@ -118,6 +117,19 @@ Boston, MA 02111-1307, USA. */ #undef CRIS_SUBTARGET_DEFAULT #define CRIS_SUBTARGET_DEFAULT 0 + +/* Node: Run-time Target */ + +/* For the cris-*-aout subtarget. */ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__AOUT__"); \ + } \ + while (0) + + /* Node: Storage Layout */ /* We can align to 16 bits (only) with CRIS a.out. */ diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index d3d44e8252f..13bff9cee3b 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -116,8 +116,7 @@ extern const char *cris_elinux_stacksize_str; Note that -melf overrides -maout. */ #define CPP_SPEC \ - "-D__CRIS_ABI_version=2\ - %{mtune=*:-D__tune_%* %{mtune=v*:-D__CRIS_arch_tune=%*}}\ + "%{mtune=*:-D__tune_%* %{mtune=v*:-D__CRIS_arch_tune=%*}}\ %{mtune=etrax4:-D__tune_v3 -D__CRIS_arch_tune=3}\ %{mtune=etrax100:-D__tune_v8 -D__CRIS_arch_tune=8}\ %{mtune=svinto:-D__tune_v8 -D__CRIS_arch_tune=8}\ @@ -141,8 +140,7 @@ extern const char *cris_elinux_stacksize_str; /* For the cris-*-elf subtarget. */ #define CRIS_CPP_SUBTARGET_SPEC \ - "-D__ELF__\ - %{mbest-lib-options:\ + "%{mbest-lib-options:\ %{!moverride-best-lib-options:\ %{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v10 -D__CRIS_arch_tune=10}}}}}" @@ -246,8 +244,23 @@ extern const char *cris_elinux_stacksize_str; /* Node: Run-time Target */ -/* Only keep the non-varying ones here. */ -#define CPP_PREDEFINES "-Dcris -DCRIS -DGNU_CRIS" +#define TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("cris"); \ + builtin_define_std ("CRIS"); \ + builtin_define_std ("GNU_CRIS"); \ + builtin_define ("__CRIS_ABI_version=2"); \ + } \ + 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; diff --git a/gcc/config/cris/linux.h b/gcc/config/cris/linux.h index 546f38101b9..f85743f7a9a 100644 --- a/gcc/config/cris/linux.h +++ b/gcc/config/cris/linux.h @@ -1,5 +1,5 @@ /* Definitions for GCC. Part of the machine description for CRIS. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Axis Communications. Written by Hans-Peter Nilsson. This file is part of GCC. @@ -47,10 +47,7 @@ Boston, MA 02111-1307, USA. */ #undef CRIS_CPP_SUBTARGET_SPEC #define CRIS_CPP_SUBTARGET_SPEC \ - "-D__gnu_linux__ -D__linux__ -D__unix__ -D__ELF__\ - %{pthread:-D_REENTRANT}\ - %{fPIC|fpic: -D__PIC__ -D__pic__}\ - %{!fleading-underscore:-fno-leading-underscore -D__NO_UNDERSCORES__}\ + "%{pthread:-D_REENTRANT}\ %{!march=*:%{!cpu=*:-D__arch_v10 -D__CRIS_arch_version=10}}\ %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix}\ -Asystem(unix) -Asystem(posix) -Acpu(cris) -Amachine(cris)}}" @@ -99,6 +96,28 @@ Boston, MA 02111-1307, USA. */ %{!r:%{O2|O3: --gc-sections}}" +/* Node: Run-time Target */ + +/* For the cris-*-linux* subtarget. */ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__gnu_linux__"); \ + builtin_define ("__linux__"); \ + builtin_define ("__unix__"); \ + builtin_define ("__ELF__"); \ + if (flag_pic) \ + { \ + builtin_define ("__PIC__"); \ + builtin_define ("__pic__"); \ + } \ + if (flag_leading_underscore <= 0) \ + builtin_define ("__NO_UNDERSCORES__"); \ + } \ + while (0) + + /* Node: Sections */ /* GNU/Linux has crti and crtn and does not need the