* config.gcc (sh-wrs-vxworks): Don't include dbxelf.h. Include
sh/elf.h, vx-common.h and vxworks.h.
* config/sh/sh.h: Include config/vxworks-dummy.h.
(SUBTARGET_OVERRIDE_OPTIONS): Define.
(OVERRIDE_OPTIONS): Use it.
* config/sh/sh.md (GOTaddr2picreg): Add suport for VxWorks RTPs.
(vxworks_picreg): New pattern.
* config/sh/vxworks.h (TARGET_OS_CPP_BUILTINS): Use
VXWORKS_OS_CPP_BUILTINS.
(LIB_SPEC, LINK_SPEC, STARTFILE_SPEC, ENDFILE_SPEC): Redefine
to their VXWORKS_* equivalents.
(SUBTARGET_OVERRIDE_OPTIONS, SUBTARGET_CPP_SPEC): Define.
(SUBTARGET_LINK_EMUL_SUFFIX, FUNCTION_PROFILER): Define.
* config/sh/lib1funcs.asm (NO_FPSCR_VALUES): Define for VxWorks PIC.
(set_fpscr, ic_invalidate): Add VxWorks PIC sequences.
* config/sh/t-vxworks (MULTILIB_OPTIONS): Add m4a, -mrtp and
-mrtp/-fPIC multilibs.
(MULTILIB_EXCEPTIONS): Generalize globs accordingly.
(MULTILIB_MATCHES, EXTRA_MULTILIB_PARTS): Define.
(MULTILIB_OSDIRNAMES): Delete.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124145
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-04-25 Richard Sandiford <richard@codesourcery.com>
+
+ * config.gcc (sh-wrs-vxworks): Don't include dbxelf.h. Include
+ sh/elf.h, vx-common.h and vxworks.h.
+ * config/sh/sh.h: Include config/vxworks-dummy.h.
+ (SUBTARGET_OVERRIDE_OPTIONS): Define.
+ (OVERRIDE_OPTIONS): Use it.
+ * config/sh/sh.md (GOTaddr2picreg): Add suport for VxWorks RTPs.
+ (vxworks_picreg): New pattern.
+ * config/sh/vxworks.h (TARGET_OS_CPP_BUILTINS): Use
+ VXWORKS_OS_CPP_BUILTINS.
+ (LIB_SPEC, LINK_SPEC, STARTFILE_SPEC, ENDFILE_SPEC): Redefine
+ to their VXWORKS_* equivalents.
+ (SUBTARGET_OVERRIDE_OPTIONS, SUBTARGET_CPP_SPEC): Define.
+ (SUBTARGET_LINK_EMUL_SUFFIX, FUNCTION_PROFILER): Define.
+ * config/sh/lib1funcs.asm (NO_FPSCR_VALUES): Define for VxWorks PIC.
+ (set_fpscr, ic_invalidate): Add VxWorks PIC sequences.
+ * config/sh/t-vxworks (MULTILIB_OPTIONS): Add m4a, -mrtp and
+ -mrtp/-fPIC multilibs.
+ (MULTILIB_EXCEPTIONS): Generalize globs accordingly.
+ (MULTILIB_MATCHES, EXTRA_MULTILIB_PARTS): Define.
+ (MULTILIB_OSDIRNAMES): Delete.
+
2007-04-25 Anatoly Sokolov <aesok@post.ru>
PR target/18989
;;
sh-wrs-vxworks)
tmake_file="$tmake_file sh/t-sh sh/t-elf sh/t-vxworks"
- tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/embed-elf.h sh/vxworks.h"
+ tm_file="${tm_file} elfos.h svr4.h sh/elf.h sh/embed-elf.h vx-common.h vxworks.h sh/vxworks.h"
;;
sh-*-*)
tm_file="${tm_file} dbxcoff.h sh/coff.h"
#include "lib1funcs.h"
+/* t-vxworks needs to build both PIC and non-PIC versions of libgcc,
+ so it is more convenient to define NO_FPSCR_VALUES here than to
+ define it on the command line. */
+#if defined __vxworks && defined __PIC__
+#define NO_FPSCR_VALUES
+#endif
+
#if ! __SH5__
#ifdef L_ashiftrt
.global GLOBAL(ashiftrt_r4_0)
lds r4,fpscr
#ifdef __PIC__
mov.l r12,@-r15
+#ifdef __vxworks
+ mov.l LOCAL(set_fpscr_L0_base),r12
+ mov.l LOCAL(set_fpscr_L0_index),r0
+ mov.l @r12,r12
+ mov.l @(r0,r12),r12
+#else
mova LOCAL(set_fpscr_L0),r0
mov.l LOCAL(set_fpscr_L0),r12
add r0,r12
+#endif
mov.l LOCAL(set_fpscr_L1),r0
mov.l @(r0,r12),r1
mov.l @r15+,r12
#endif
.align 2
#ifdef __PIC__
+#ifdef __vxworks
+LOCAL(set_fpscr_L0_base):
+ .long ___GOTT_BASE__
+LOCAL(set_fpscr_L0_index):
+ .long ___GOTT_INDEX__
+#else
LOCAL(set_fpscr_L0):
.long _GLOBAL_OFFSET_TABLE_
+#endif
LOCAL(set_fpscr_L1):
.long GLOBAL(fpscr_values@GOT)
#else
.global GLOBAL(ic_invalidate)
HIDDEN_FUNC(GLOBAL(ic_invalidate))
GLOBAL(ic_invalidate):
- mov.l 0f,r1
#ifdef __pic__
- mova 0f,r0
- mov.l 1f,r2
+#ifdef __vxworks
+ mov.l 1f,r1
+ mov.l 2f,r0
+ mov.l @r1,r1
+ mov.l 0f,r2
+ mov.l @(r0,r1),r0
+#else
+ mov.l 1f,r1
+ mova 1f,r0
+ mov.l 0f,r2
add r1,r0
+#endif
mov.l @(r0,r2),r1
+#else
+ mov.l 0f,r1
#endif
ocbwb @r4
mov.l @(8,r1),r0
0: .long GLOBAL(ic_invalidate_array)
#else /* __pic__ */
.global GLOBAL(ic_invalidate_array)
- /* ??? Why won't the assembler allow to add these two constants? */
-0: .long _GLOBAL_OFFSET_TABLE_
-1: .long GLOBAL(ic_invalidate_array)@GOT
+0: .long GLOBAL(ic_invalidate_array)@GOT
+#ifdef __vxworks
+1: .long ___GOTT_BASE__
+2: .long ___GOTT_INDEX__
+#else
+1: .long _GLOBAL_OFFSET_TABLE_
+#endif
ENDFUNC(GLOBAL(ic_invalidate))
#endif /* __pic__ */
#endif /* SH4 */
#ifndef GCC_SH_H
#define GCC_SH_H
+#include "config/vxworks-dummy.h"
+
#define TARGET_VERSION \
fputs (" (Hitachi SH)", stderr);
#define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL
#endif
+#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
+
#define OVERRIDE_OPTIONS \
do { \
int regno; \
\
+ SUBTARGET_OVERRIDE_OPTIONS; \
if (flag_finite_math_only == 2) \
flag_finite_math_only \
= !flag_signaling_nans && TARGET_SH2E && ! TARGET_IEEE; \
(set (match_dup 0) (plus:SI (match_dup 0) (reg:SI R0_REG)))]
"" "
{
+ if (TARGET_VXWORKS_RTP)
+ {
+ rtx gott_base = gen_rtx_SYMBOL_REF (Pmode, VXWORKS_GOTT_BASE);
+ rtx gott_index = gen_rtx_SYMBOL_REF (Pmode, VXWORKS_GOTT_INDEX);
+ emit_insn (gen_vxworks_picreg (gott_base, gott_index));
+ DONE;
+ }
+
operands[0] = gen_rtx_REG (Pmode, PIC_REG);
operands[1] = gen_rtx_SYMBOL_REF (VOIDmode, GOT_SYMBOL_NAME);
}
")
+;; A helper for GOTaddr2picreg to finish up the initialization of the
+;; PIC register.
+
+(define_expand "vxworks_picreg"
+ [(set (reg:SI PIC_REG)
+ (const:SI (unspec:SI [(match_operand:SI 0 "" "")] UNSPEC_PIC)))
+ (set (reg:SI R0_REG)
+ (const:SI (unspec:SI [(match_operand:SI 1 "" "")] UNSPEC_PIC)))
+ (set (reg:SI PIC_REG)
+ (mem:SI (reg:SI PIC_REG)))
+ (set (reg:SI PIC_REG)
+ (mem:SI (plus:SI (reg:SI PIC_REG)
+ (reg:SI R0_REG))))]
+ "TARGET_VXWORKS_RTP")
+
(define_insn "*ptb"
[(set (match_operand 0 "target_reg_operand" "=b")
(const (unspec [(match_operand 1 "" "Csy")]
# Multilibs for VxWorks.
-MULTILIB_OPTIONS = m2/m3/m4 ml
-
-MULTILIB_EXCEPTIONS = ml m2/ml
-
-MULTILIB_OSDIRNAMES = \
- m2=!SH7600gnu \
- m3=!SH7700gnu m3/ml=!SH7700gnule \
- m4=!SH7750gnu m4/ml=!SH7750gnule
+MULTILIB_OPTIONS = mrtp fPIC m2/m3/m4/m4a ml
+# Don't build -fPIC without -mrtp, or -ml without -m3/-m4.
+MULTILIB_EXCEPTIONS = fPIC* ml* mrtp/ml* mrtp/fPIC/ml* *m2/ml*
+MULTILIB_MATCHES = m2=m4-nofpu fPIC=fpic
+# Restore a variable from t-vxworks clobbered by t-elf.
+EXTRA_MULTILIB_PARTS =
#define TARGET_OS_CPP_BUILTINS() \
- do { \
- builtin_define ("__vxworks"); \
- builtin_define ("CPU=SH7000"); \
- } while (0)
-
-/* VxWorks does all the library stuff itself. */
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-/* VxWorks uses object files, not loadable images. Make the linker just
- combine objects. */
-#undef LINK_SPEC
-#define LINK_SPEC "-r"
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC ""
-
-#undef TARGET_VERSION
+ do \
+ { \
+ builtin_define ("CPU=SH7000"); \
+ VXWORKS_OS_CPP_BUILTINS (); \
+ } \
+ while (0)
+
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS VXWORKS_OVERRIDE_OPTIONS
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC VXWORKS_ADDITIONAL_CPP_SPEC
+
+#undef SUBTARGET_LINK_EMUL_SUFFIX
+#define SUBTARGET_LINK_EMUL_SUFFIX "_vxworks"
+
+#undef LIB_SPEC
+#define LIB_SPEC VXWORKS_LIB_SPEC
+#undef LINK_SPEC
+#define LINK_SPEC VXWORKS_LINK_SPEC " " SH_LINK_SPEC
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
+
+#undef TARGET_VERSION
#define TARGET_VERSION fputs (" (SH/VxWorks)", stderr);
/* There is no default multilib. */
#undef MULTILIB_DEFAULTS
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER VXWORKS_FUNCTION_PROFILER