[ColdFire 8/63] Share ASM_SPEC code between targets
Richard Sandiford
richard@codesourcery.com
Wed Jan 10 10:46:00 GMT 2007
Each m68k subtarget has its own ASM_SPEC to pass down target selection
options. Some of these specs are more exhaustive than others.
This patch defines an %(asm_cpu_spec) which can be used by all targets,
and which passes down all known target selection options. The patch is
needed by the forthcoming -mcpu=* and -march=* support.
Richard
gcc/
200x-xx-xx Richard Sandiford <richard@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
* config/m68k/m68k.h (ASM_CPU_SPEC, ASM_SPEC, EXTRA_SPECS)
(SUBTARGET_EXTRA_SPECS): New macros.
* config/m68k/linux.h (ASM_SPEC): Remove CPU flags;
use %(asm_cpu_spec) instead.
* config/m68k/m68k-none.h (ASM_SPEC): Likewise.
* config/m68k/openbsd.h (ASM_SPEC): Likewise.
* config/m68k/netbsd-elf.h (ASM_SPEC): Likewise.
(EXTRA_SPECS): Rename to...
(SUBTARGET_EXTRA_SPECS): ...this.
Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h 2007-01-09 15:01:49.000000000 +0000
+++ gcc/config/m68k/m68k.h 2007-01-09 15:01:51.000000000 +0000
@@ -39,6 +39,25 @@ #define OPTION_DEFAULT_SPECS \
%{!m68332:%{!m5200:%{!m5206e:%{!m528x:%{!m5307:%{!m5407:%{!mcfv4e:\
-%(VALUE)}}}}}}}}}}}}}}}}}}}" },
+/* Pass flags to gas indicating which type of processor we have. This
+ can be simplified when we can rely on the assembler supporting .cpu
+ and .arch directives. */
+
+#define ASM_CPU_SPEC "\
+%{m68851}%{mno-68851} %{m68881}%{mno-68881} %{msoft-float:-mno-float} \
+%{m68000}%{m68302}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}\
+%{m68040}%{m68020-40:-m68040}%{m68020-60:-m68040}\
+%{m68060}%{mcpu32}%{m68332}%{m5200}%{m5206e}%{m528x}%{m5307}%{m5407}%{mcfv4e}\
+"
+
+#define ASM_SPEC "%(asm_cpu_spec)"
+
+#define EXTRA_SPECS \
+ { "asm_cpu_spec", ASM_CPU_SPEC }, \
+ SUBTARGET_EXTRA_SPECS
+
+#define SUBTARGET_EXTRA_SPECS
+
/* Note that some other tm.h files include this one and then override
many of the definitions that relate to assembler syntax. */
Index: gcc/config/m68k/linux.h
===================================================================
--- gcc/config/m68k/linux.h 2007-01-09 15:01:49.000000000 +0000
+++ gcc/config/m68k/linux.h 2007-01-09 15:01:51.000000000 +0000
@@ -23,6 +23,11 @@ the Free Software Foundation; either ver
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (68k GNU/Linux with ELF)");
+/* Add %(asm_cpu_spec) to the svr4.h definition of ASM_SPEC. */
+#undef ASM_SPEC
+#define ASM_SPEC \
+ "%(asm_cpu_spec) %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*}"
+
/* for 68k machines this only needs to be TRUE for the 68000 */
#undef STRICT_ALIGNMENT
@@ -85,13 +90,6 @@ #define TARGET_OBJFMT_CPP_BUILTINS() \
#undef CPP_SPEC
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
-/* We override the ASM_SPEC from svr4.h because we must pass -m68040 down
- to the assembler. */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
-%{m68040} %{m68060:-m68040}"
-
/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
for the special GCC options -static and -shared, which allow us to
link things in one of these three modes by applying the appropriate
Index: gcc/config/m68k/m68k-none.h
===================================================================
--- gcc/config/m68k/m68k-none.h 2007-01-09 15:01:49.000000000 +0000
+++ gcc/config/m68k/m68k-none.h 2007-01-09 15:01:51.000000000 +0000
@@ -18,13 +18,9 @@ the Free Software Foundation; either ver
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* Pass flags to gas indicating which type of processor we have. */
-
#undef ASM_SPEC
-#define ASM_SPEC "\
-%{m68851}%{mno-68851}%{m68881}%{mno-68881}%{msoft-float:-mno-68881} %{m68000}%{m68302}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}%{m68040}%{m68020-40:-mc68040} %{m68020-60:-mc68040} %{m68060}%{mcpu32}%{m68332}%{m5200}%{m5206e}%{m528x}%{m5307}%{m5407}%{mcfv4e} \
-%{fPIC:--pcrel} %{fpic:--pcrel} %{msep-data:--pcrel} %{mid-shared-library:--pcrel} \
-"
+#define ASM_SPEC "%(asm_cpu_spec) %{fPIC:--pcrel} %{fpic:--pcrel} \
+ %{msep-data:--pcrel} %{mid-shared-library:--pcrel}"
/* cc1/cc1plus always receives all the -m flags. If the specs strings above
are consistent with the flags in m68k.opt, there should be no need for
Index: gcc/config/m68k/openbsd.h
===================================================================
--- gcc/config/m68k/openbsd.h 2007-01-09 15:01:42.000000000 +0000
+++ gcc/config/m68k/openbsd.h 2007-01-09 15:01:51.000000000 +0000
@@ -34,9 +34,8 @@ #define TARGET_OS_CPP_BUILTINS() \
#undef CPP_SPEC
#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
-/* m68k as needs to know about the processor subtype. */
#undef ASM_SPEC
-#define ASM_SPEC "%{m68030} %{m68040} %{m68060} %{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
+#define ASM_SPEC "%(asm_cpu_spec) %{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
#define AS_NEEDS_DASH_FOR_PIPED_INPUT
Index: gcc/config/m68k/netbsd-elf.h
===================================================================
--- gcc/config/m68k/netbsd-elf.h 2007-01-09 15:01:49.000000000 +0000
+++ gcc/config/m68k/netbsd-elf.h 2007-01-09 15:01:51.000000000 +0000
@@ -46,7 +46,8 @@ #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
#endif
-#define EXTRA_SPECS \
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
@@ -66,13 +67,11 @@ #define TARGET_VERSION \
#define CPP_SPEC NETBSD_CPP_SPEC
-/* Provide an ASM_SPEC appropriate for NetBSD m68k ELF targets. We pass
- on some CPU options, as well as PIC code generation options. */
+/* Provide an ASM_SPEC appropriate for NetBSD m68k ELF targets. We need
+ to passn PIC code generation options. */
#undef ASM_SPEC
-#define ASM_SPEC \
- "%{m68010} %{m68020} %{m68030} %{m68040} %{m68060} \
- %{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
+#define ASM_SPEC "%(asm_cpu_spec) %{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
#define AS_NEEDS_DASH_FOR_PIPED_INPUT
More information about the Gcc-patches
mailing list