summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 04:38:34 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 04:38:34 +0000
commit4e734737ebdda3742b6f70feb54eae73ceb7244a (patch)
treefa27438a1c94ce52d7c3c3a81bffb4ee14c9a76b /gcc/config
parentc8e9e836bb851a653ced882cf40d556c61ec88d5 (diff)
downloadgcc-4e734737ebdda3742b6f70feb54eae73ceb7244a.tar.gz
* configure.in (sh-*-linux*): Added.
* configure: Rebuilt. * config/sh/t-linux: New file. * config/sh/sh.h (USERMODE_BIT): Define. (TARGET_USERMODE): Likewise. (TARGET_SWITCHES): New switches for the bits above. (INITIALIZE_TRAMPOLINE): Call __ic_invalidate in USERMODE. * config/sh/linux.h: New file. * config/sh/lib1funcs.asm (GLOBAL): Don't prefix symbols with underscore on linux. (L_sdivsi3, L_udivsi3): Define for linux. (L_ic_invalidate): Define. * invoke.texi (SH Options): Document -musermode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36227 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/sh/lib1funcs.asm30
-rw-r--r--gcc/config/sh/linux.h90
-rw-r--r--gcc/config/sh/sh.h12
-rw-r--r--gcc/config/sh/t-linux11
4 files changed, 141 insertions, 2 deletions
diff --git a/gcc/config/sh/lib1funcs.asm b/gcc/config/sh/lib1funcs.asm
index 7d7d44c5200..5fc90e24921 100644
--- a/gcc/config/sh/lib1funcs.asm
+++ b/gcc/config/sh/lib1funcs.asm
@@ -42,6 +42,10 @@ Boston, MA 02111-1307, USA. */
#define LOCAL(X) L_##X
#endif
+#ifdef __linux__
+#define GLOBAL(X) __##X
+#endif
+
#ifndef GLOBAL
#define GLOBAL(X) ___##X
#endif
@@ -903,7 +907,7 @@ GLOBAL(sdivsi3_i4):
#ifdef L_sdivsi3
/* __SH4_SINGLE_ONLY__ keeps this part for link compatibility with
sh3e code. */
-#if ! defined(__SH4__) && ! defined (__SH4_SINGLE__)
+#if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)
!!
!! Steve Chamberlain
!! sac@cygnus.com
@@ -1105,7 +1109,7 @@ L1:
#ifdef L_udivsi3
/* __SH4_SINGLE_ONLY__ keeps this part for link compatibility with
sh3e code. */
-#if ! defined(__SH4__) && ! defined (__SH4_SINGLE__)
+#if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)
!!
!! Steve Chamberlain
!! sac@cygnus.com
@@ -1207,3 +1211,25 @@ LOCAL(set_fpscr_L1):
#endif /* ELF */
#endif /* SH3E / SH4 */
#endif /* L_set_fpscr */
+#ifdef L_ic_invalidate
+#if defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
+ .global GLOBAL(ic_invalidate)
+GLOBAL(ic_invalidate):
+ ocbwb @r4
+ mova 0f,r0
+ mov.w 1f,r1
+ sub r0,r4
+ and r1,r4
+ add #4,r4
+ braf r4
+ nop
+1:
+ .short 0x1fe0
+ nop
+0:
+ .rept 2048
+ rts
+ nop
+ .endr
+#endif /* SH4 */
+#endif /* L_ic_invalidate */
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
new file mode 100644
index 00000000000..07de9152368
--- /dev/null
+++ b/gcc/config/sh/linux.h
@@ -0,0 +1,90 @@
+/* Definitions for SH running Linux-based GNU systems using ELF
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
+
+This file is part of GNU CC.
+
+GNU CC 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.
+
+GNU CC 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 program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Run-time Target Specification. */
+#undef TARGET_VERSION
+#define TARGET_VERSION fputs (" (SH GNU/Linux with ELF)", stderr);
+
+/* Return to the original ELF way. */
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "long int"
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+#undef CPP_SPEC
+#define CPP_SPEC \
+ "%{mb:-D__BIG_ENDIAN__} \
+ %{!mb:-D__LITTLE_ENDIAN__} \
+ %{m3e:-D__SH3E__} \
+ %{m4:-D__SH4__} \
+ %{!m3e:%{!m4:-D__SH3__ -D__sh3__}} \
+ %{fPIC:-D__PIC__ -D__pic__} \
+ %{fpic:-D__PIC__ -D__pic__} \
+ %{posix:-D_POSIX_SOURCE} \
+ %{pthread:-D_REENTRANT -D_PTHREADS}"
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -Dlinux -Asystem(posix)"
+
+#undef ASM_SPEC
+#define ASM_SPEC "%{!mb:-little} %{mrelax:-relax}"
+
+#undef CC1_SPEC
+#define CC1_SPEC \
+ "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}"
+
+#undef CC1PLUS_SPEC
+#define CC1PLUS_SPEC \
+ "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{!mb:-m shlelf_linux} %{mrelax:-relax} \
+ %{shared:-shared} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld.so.1} \
+ %{!rpath:-rpath /lib}} \
+ %{static:-static}"
+
+#undef LIB_SPEC
+#define LIB_SPEC \
+ "%{shared: -lc} \
+ %{!shared: %{pthread:-lthread} \
+ %{profile:-lc_p} %{!profile: -lc}}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+ "%{!shared: \
+ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+ %{!p:%{profile:gcrt1.o%s} \
+ %{!profile:crt1.o%s}}}} \
+ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 6e73788e22e..78efca5d1a3 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -109,6 +109,7 @@ extern int target_flags;
#define SPACE_BIT (1<<13)
#define BIGTABLE_BIT (1<<14)
#define RELAX_BIT (1<<15)
+#define USERMODE_BIT (1<<16)
#define HITACHI_BIT (1<<22)
#define NOMACSAVE_BIT (1<<23)
#define PREFERGOT_BIT (1<<24)
@@ -184,6 +185,9 @@ extern int target_flags;
/* Nonzero if generating code for a little endian SH. */
#define TARGET_LITTLE_ENDIAN (target_flags & LITTLE_ENDIAN_BIT)
+/* Nonzero if we should do everything in userland. */
+#define TARGET_USERMODE (target_flags & USERMODE_BIT)
+
/* Nonzero if we should prefer @GOT calls when generating PIC. */
#define TARGET_PREFERGOT (target_flags & PREFERGOT_BIT)
@@ -210,6 +214,7 @@ extern int target_flags;
{"prefergot", PREFERGOT_BIT}, \
{"relax", RELAX_BIT}, \
{"space", SPACE_BIT}, \
+ {"usermode", USERMODE_BIT}, \
SUBTARGET_SWITCHES \
{"", TARGET_DEFAULT} \
}
@@ -1201,6 +1206,13 @@ extern int current_function_anonymous_args;
emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 12)), \
(FNADDR)); \
if (TARGET_HARVARD) \
+ { \
+ if (TARGET_USERMODE) \
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__ic_invalidate"),\
+ 0, VOIDmode, 1, (TRAMP), SImode); \
+ else \
+ emit_insn (gen_ic_invalidate_line (TRAMP)); \
+ } \
emit_insn (gen_ic_invalidate_line (TRAMP)); \
}
diff --git a/gcc/config/sh/t-linux b/gcc/config/sh/t-linux
new file mode 100644
index 00000000000..c7fe9e9d8e3
--- /dev/null
+++ b/gcc/config/sh/t-linux
@@ -0,0 +1,11 @@
+TARGET_LIBGCC2_CFLAGS = -fpic
+LIBGCC1 = libgcc1-asm.a
+LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movstr \
+ _movstr_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
+ _ic_invalidate
+
+MULTILIB_OPTIONS= mb m3e/m4
+MULTILIB_DIRNAMES=
+MULTILIB_MATCHES =
+
+EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o