This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Xilinx MicroBlaze support - 1 of 4
- From: Michael Eager <eager at eagercon dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 05 Jan 2010 18:26:36 -0800
- Subject: [PATCH] Xilinx MicroBlaze support - 1 of 4
Attached is the first of four patches which add
support for the Xilinx MicroBlaze processor.
Configuration patches.
2010-01-05 Michael Eager <eager@eagercon.com>
* config.guess: Add microblaze-xilinx-elf
* configure: Add target-libssp to noconfigdirs.
* configure.ac: Same.
* microblaze/linux.h: Add microblaze-linux defines.
* microblaze/t-microblaze: Add makefile.
* gcc/config.gcc: Add cpu_type, tm_files.
* gcc/configure: Add microblaze-*.*.
* gcc/configure.ac: Same.
* doc/invoke.texi: Add microblaze options.
* gcc/rtl.h(MICROBLAZE): Add VAR_SECTION, SHIFT_TYPE.
* libgcc/config.host: Add microblaze-*-*, cpu_type.
* libstdc++-v3/cpu/microblaze/cpu_defines.h:
Add _GLIBCXX_NO_VERBOSE_TERMINATE.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/config.guess gcc/config.guess
--- gcc-head/config.guess 2010-01-05 13:45:25.000000000 -0800
+++ gcc/config.guess 2010-01-05 14:00:26.000000000 -0800
@@ -913,6 +913,9 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
+ microblaze:xilinx:*:*)
+ echo microblaze-xilinx-elf
+ exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/configure gcc/configure
--- gcc-head/configure 2010-01-05 13:45:33.000000000 -0800
+++ gcc/configure 2010-01-05 14:00:26.000000000 -0800
@@ -3627,7 +3627,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
;;
microblaze*)
- noconfigdirs="$noconfigdirs gprof ${libgcj}"
+ noconfigdirs="$noconfigdirs gprof target-libssp ${libgcj}"
;;
mips*-sde-elf*)
skipdirs="$skipdirs target-libiberty"
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/configure.ac gcc/configure.ac
--- gcc-head/configure.ac 2010-01-05 13:49:59.000000000 -0800
+++ gcc/configure.ac 2010-01-05 14:00:26.000000000 -0800
@@ -860,7 +860,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
;;
microblaze*)
- noconfigdirs="$noconfigdirs gprof ${libgcj}"
+ noconfigdirs="$noconfigdirs gprof target-libssp ${libgcj}"
;;
mips*-sde-elf*)
skipdirs="$skipdirs target-libiberty"
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/config/microblaze/linux.h gcc/gcc/config/microblaze/linux.h
--- gcc-head/gcc/config/microblaze/linux.h 1969-12-31 16:00:00.000000000 -0800
+++ gcc/gcc/config/microblaze/linux.h 2010-01-05 14:00:26.000000000 -0800
@@ -0,0 +1,87 @@
+/* Definitions for MicroBlaze running Linux.
+ Copyright 2009, 2010 Free Software Foundation, Inc.
+
+Contributed by Michael Eager <eager@eagercon.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+
+#define SYSROOT_SUFFIX_SPEC ""
+#define SYSROOT_HEADERS_SUFFIX_SPEC ""
+
+/* Redefine the entire default search path for include files so that
+ it will be generated by compiler dynamically on base of the compiler's
+ binary location. */
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS \
+ { \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 1 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 1 }, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 1 }, \
+ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 }, \
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 }, \
+ { "/usr/include", 0, 0, 1, 1 }, \
+ { 0, 0, 0, 0, 0 } \
+ }
+
+/* Define the macro to 1 to enable changes made in the gcc.c file
+ to exclude host library directories such as /lib and /libexec from the
+ default search path for libraries. */
+#define TARGET_SYSTEM_ROOT_RELOCATABLE_ONLY 1
+
+/* Linux and BlueCat-specific declarations */
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ LINUX_TARGET_OS_CPP_BUILTINS(); \
+ if (flag_pic) \
+ { \
+ builtin_define ("__PIC__"); \
+ builtin_define ("__pic__"); \
+ } \
+ } \
+ while (0)
+
+
+/* Target CPU builtins */
+#undef TARGET_CPU_CPP_BUILTINS
+#define TARGET_CPU_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("_BIG_ENDIAN"); \
+ builtin_define ("__MICROBLAZE__"); \
+ builtin_define ("__microblaze__"); \
+ \
+ builtin_assert ("cpu=microblaze"); \
+ builtin_assert ("machine=microblaze"); \
+} while (0)
+
+
+#define DYNAMIC_LINKER "/lib/ld.so.1"
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "dynamic_linker", DYNAMIC_LINKER }
+
+#undef LINK_SPEC
+#define LINK_SPEC "%{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker %(dynamic_linker)}} \
+ %{static:-static}}"
+
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/config/microblaze/t-microblaze gcc/gcc/config/microblaze/t-microblaze
--- gcc-head/gcc/config/microblaze/t-microblaze 1969-12-31 16:00:00.000000000 -0800
+++ gcc/gcc/config/microblaze/t-microblaze 2010-01-05 14:00:26.000000000 -0800
@@ -0,0 +1,37 @@
+# Other functions
+LIB2FUNCS_EXTRA = $(srcdir)/config/microblaze/divsi3_table.c \
+ $(srcdir)/config/microblaze/stack_overflow_exit.asm \
+ $(srcdir)/config/microblaze/mulsi3.asm \
+ $(srcdir)/config/microblaze/modsi3.asm \
+ $(srcdir)/config/microblaze/moddi3.asm \
+ $(srcdir)/config/microblaze/umodsi3.asm \
+ $(srcdir)/config/microblaze/divsi3.asm \
+ $(srcdir)/config/microblaze/udivsi3.asm
+
+# For C++ crtstuff
+EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) crti$(objext) crtn$(objext)
+
+# Build multiple copies of ?crt{i,n}.o, one for each target switch.
+$(T)crti$(objext): $(srcdir)/config/microblaze/crti.s
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c $(srcdir)/config/microblaze/crti.s -o $(T)crti$(objext)
+
+$(T)crtn$(objext): $(srcdir)/config/microblaze/crtn.s
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c $(srcdir)/config/microblaze/crtn.s -o $(T)crtn$(objext)
+
+# We want fine grained libraries, so use the new code
+# to build the floating point emulation libraries.
+FPBIT = fp-bit.c
+DPBIT = dp-bit.c
+
+fp-bit.c: $(srcdir)/config/fp-bit.c
+ echo '#define FLOAT' > fp-bit.c
+ cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+ cat $(srcdir)/config/fp-bit.c > dp-bit.c
+
+MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high
+MULTILIB_DIRNAMES = bs m mh
+MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high
+#MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul
+#MULTILIB_DIRNAMES = bs m
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/config.gcc gcc/gcc/config.gcc
--- gcc-head/gcc/config.gcc 2010-01-05 13:46:00.000000000 -0800
+++ gcc/gcc/config.gcc 2010-01-05 16:13:24.000000000 -0800
@@ -321,11 +321,14 @@ m32r*-*-*)
m68k-*-*)
extra_headers=math-68881.h
;;
+microblaze*-*-*)
+ cpu_type=microblaze
+ ;;
mips*-*-*)
cpu_type=mips
need_64bit_hwint=yes
extra_headers="loongson.h"
- ;;
+ ;;
picochip-*-*)
cpu_type=picochip
;;
@@ -1648,6 +1651,16 @@ mep-*-*)
fi
use_gcc_stdint=wrap
;;
+microblaze*-linux*)
+ tm_file="microblaze/microblaze.h dbxelf.h linux.h microblaze/linux.h"
+ tmake_file="t-slibgcc-elf-ver t-slibgcc-nolc-override t-linux microblaze/t-microblaze"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o"
+ use_fixproto=no
+ ;;
+microblaze*-*-*)
+ tm_file="dbxelf.h microblaze/microblaze.h"
+ tmake_file=microblaze/t-microblaze
+ ;;
mips-sgi-irix[56]*)
tm_file="elfos.h ${tm_file} mips/iris.h"
tmake_file="mips/t-iris mips/t-slibgcc-irix"
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/configure gcc/gcc/configure
--- gcc-head/gcc/configure 2010-01-05 13:46:24.000000000 -0800
+++ gcc/gcc/configure 2010-01-05 14:00:26.000000000 -0800
@@ -23895,7 +23895,7 @@ case "$target" in
i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
| x86_64*-*-* | hppa*-*-* | arm*-*-* \
| xstormy16*-*-* | cris-*-* | crisv32-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \
- | spu-*-* | fido*-*-* | m32c-*-*)
+ | spu-*-* | fido*-*-* | m32c-*-* | microblaze-*-*)
insn="nop"
;;
ia64*-*-* | s390*-*-*)
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/configure.ac gcc/gcc/configure.ac
--- gcc-head/gcc/configure.ac 2010-01-05 13:48:41.000000000 -0800
+++ gcc/gcc/configure.ac 2010-01-05 14:00:26.000000000 -0800
@@ -3467,7 +3467,7 @@ case "$target" in
i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
| x86_64*-*-* | hppa*-*-* | arm*-*-* \
| xstormy16*-*-* | cris-*-* | crisv32-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \
- | spu-*-* | fido*-*-* | m32c-*-*)
+ | spu-*-* | fido*-*-* | m32c-*-* | microblaze-*-*)
insn="nop"
;;
ia64*-*-* | s390*-*-*)
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/doc/invoke.texi gcc/gcc/doc/invoke.texi
--- gcc-head/gcc/doc/invoke.texi 2010-01-05 13:46:04.000000000 -0800
+++ gcc/gcc/doc/invoke.texi 2010-01-05 14:00:26.000000000 -0800
@@ -673,6 +673,12 @@ Objective-C and Objective-C++ Dialects}.
-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
+@emph{MicroBlaze Options}
+@gccoptlist{-mxl-soft-mul -mxl-soft-div -mxl-barrel-shift -msoft-float @gol
+-mhard-float -mxl-pattern-compare -msmall-divides -mxl-stack-check @gol
+-mxl-gp-opt -mno-clearbss -mxl-multiply-high -mxl-float-convert @gol
+-mmemcpy -mxl-float-sqrt -mcpu=@var{cpu-type} -mtune=@var{cpu-type}}
+
@emph{MeP Options}
@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
@@ -9541,6 +9547,7 @@ platform.
* M68hc1x Options::
* MCore Options::
* MeP Options::
+* MicroBlaze Options::
* MIPS Options::
* MMIX Options::
* MN10300 Options::
@@ -13283,6 +13290,77 @@ value is 0x1000.
@end table
+@node MicroBlaze Options
+@subsection MicroBlaze Options
+@cindex MicroBlaze Options
+
+@table @gcctabopt
+
+@item -mxl-soft-mul
+@opindex mxl-soft-mul
+Use software multiply emulation (default).
+
+@item -mxl-soft-div
+@opindex mxl-soft-div
+Use software emulation for divides (default).
+
+@item -mxl-barrel-shift
+@opindex mxl-barrel-shift
+Use the hardware barrel shifter.
+
+@item -msoft-float
+@opindex msoft-float
+Use software emulation for floating point (default).
+
+@item -mhard-float
+@opindex mhard-float
+Use hardware floating point instructions.
+
+@item -mxl-pattern-compare
+@opindex mxl-pattern-compare
+Use pattern compare instructions.
+
+@item -msmall-divides
+@opindex msmall-divides
+Use table lookup optimization for small signed integer divisions.
+
+@item -mxl-stack-check
+@opindex mxl-stack-check
+Check for stack overflow at runtime.
+
+@item -mxl-gp-opt
+@opindex mxl-gp-opt
+se GP relative sdata/sbss sections.
+
+@item -mno-clearbss
+@opindex mno-clearbss
+Clear the BSS to zero and place zero initialized in BSS.
+
+@item -mxl-multiply-high
+@opindex mxl-multiply-high
+Use multiply high instructions for high part of 32x32 multiply.
+
+@item -mxl-float-convert
+@opindex mxl-float-convert
+Use hardware floating point converstion instructions.
+
+@item -mmemcpy
+@opindex mmemcpy
+Don't optimize block moves, use memcpy.
+
+@item -mxl-float-sqrt
+@opindex mxl-float-sqrt
+Use hardware floating point square root instruction.
+
+@item -mcpu=@var{cpu-type}
+@opindex mcpu=
+Use features of and schedule code for given CPU.
+Supported values are in the format vX.YY.Z, where X is a major version, YY
+is the minor version, and Z is compatiblity code. Example values are
+@samp{v3.00.a}, @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b},
+@samp{v5.00.b}, @samp{v6.00.a}.
+@end table
+
@node MeP Options
@subsection MeP Options
@cindex MeP options
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/gcc/rtl.h gcc/gcc/rtl.h
--- gcc-head/gcc/rtl.h 2010-01-05 13:45:59.000000000 -0800
+++ gcc/gcc/rtl.h 2010-01-05 14:00:26.000000000 -0800
@@ -1538,6 +1538,11 @@ do { \
#ifndef USE_STORE_PRE_DECREMENT
#define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
#endif
+
+#ifdef MICROBLAZE
+#define VAR_SECTION(RTX) ((RTX)->var_section)
+#define SHIFT_TYPE(RTX) ((RTX)->shift_type)
+#endif
/* Nonzero when we are generating CONCATs. */
extern int generating_concat_p;
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/libgcc/config.host gcc/libgcc/config.host
--- gcc-head/libgcc/config.host 2010-01-05 13:45:39.000000000 -0800
+++ gcc/libgcc/config.host 2010-01-05 14:00:26.000000000 -0800
@@ -105,6 +105,9 @@ m32r*-*-*)
;;
m68k-*-*)
;;
+microblaze*-*-*)
+ cpu_type=microblaze
+ ;;
mep*-*-*)
;;
mips*-*-*)
@@ -395,6 +398,8 @@ mcore-*-elf)
;;
mcore-*-pe*)
;;
+microblaze-*-*)
+ ;;
mips-sgi-irix[56]*)
;;
mips*-*-netbsd*) # NetBSD/mips, either endian.
diff -urNp --exclude '*.swp' --exclude DEV-PHASE --exclude '\.svn' --exclude CVS gcc-head/libstdc++-v3/config/cpu/microblaze/cpu_defines.h gcc/libstdc++-v3/config/cpu/microblaze/cpu_defines.h
--- gcc-head/libstdc++-v3/config/cpu/microblaze/cpu_defines.h 1969-12-31 16:00:00.000000000 -0800
+++ gcc/libstdc++-v3/config/cpu/microblaze/cpu_defines.h 2010-01-05 14:00:26.000000000 -0800
@@ -0,0 +1,37 @@
+// Specific definitions for Xilinx MicroBlaze platforms -*- C++ -*-
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+// Optimize memory size for embedded systems
+// -- Use abort for eh terminate
+#define _GLIBCXX_NO_VERBOSE_TERMINATE 1
+
+#endif