summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-09-10 16:20:12 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-09-10 16:20:12 +0000
commitdc82911ae9236515748693d3963bcf4c56827fcb (patch)
tree8bef2126f3e8958ec809d6c2daa98b5b5c3ee171 /gnu
parent36d49cd50053863a5be92acea80b623036ea9c84 (diff)
Add infrastructure to build GCC 4.2.1 for OpenBSD/mips64. Only tested on
loongson (mips64el). ok miod@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/gcc/gcc/config/mips/mips.h1
-rw-r--r--gnu/gcc/gcc/config/mips/openbsd.h228
-rw-r--r--gnu/usr.bin/cc/Makefile.tgt8
-rw-r--r--gnu/usr.bin/cc/cc_tools/Makefile14
-rw-r--r--gnu/usr.bin/cc/libgcc/Makefile34
5 files changed, 213 insertions, 72 deletions
diff --git a/gnu/gcc/gcc/config/mips/mips.h b/gnu/gcc/gcc/config/mips/mips.h
index ba77d8636af..f1080fc05d7 100644
--- a/gnu/gcc/gcc/config/mips/mips.h
+++ b/gnu/gcc/gcc/config/mips/mips.h
@@ -880,6 +880,7 @@ extern const struct mips_rtx_cost_data *mips_cost;
#define SUBTARGET_CPP_SPEC ""
#endif
+#undef CPP_SPEC
#define CPP_SPEC "%(subtarget_cpp_spec)"
/* This macro defines names of additional specifications to put in the specs
diff --git a/gnu/gcc/gcc/config/mips/openbsd.h b/gnu/gcc/gcc/config/mips/openbsd.h
index 69cc0c6ad1a..bf382ca5792 100644
--- a/gnu/gcc/gcc/config/mips/openbsd.h
+++ b/gnu/gcc/gcc/config/mips/openbsd.h
@@ -1,5 +1,6 @@
-/* Configuration for a MIPS ABI32 OpenBSD target.
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
+/* Configuration file for a mips64 OpenBSD target.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -18,50 +19,18 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* Definitions needed for OpenBSD, to avoid picking mips 'defaults'. */
-
-/* GAS must know this. */
-#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "%{fPIC|fPIE:-KPIC}"
-
-#define AS_NEEDS_DASH_FOR_PIPED_INPUT
-
-/* CPP specific OpenBSD specs. */
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
-
-/* Needed for ELF (inspired by netbsd-elf). */
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* The profiling lib spec here is not really correct but we leave
- it as it is until we have some kind of profiling working. */
-#define LIB_SPEC OBSD_LIB_SPEC
-
-/* mips assembler uses .set for arcane purposes. __attribute__((alias))
- and friends won't work until we get recent binutils with .weakext
- support. */
-#undef SET_ASM_OP
-
-#define TARGET_OS_CPP_BUILTINS() \
- do { \
- builtin_define ("__unix__"); \
- builtin_define ("__SYSTYPE_BSD__"); \
- builtin_define ("__NO_LEADING_UNDERSCORES__"); \
- builtin_define ("__GP_SUPPORT__"); \
- builtin_define ("__OpenBSD__"); \
- builtin_assert ("system=unix"); \
- builtin_assert ("system=OpenBSD"); \
-} while (0)
-
-/* Layout of source language data types. */
-
-/* This must agree with <machine/ansi.h>. */
+/* This must agree with <machine/_types.h> */
#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
+#define SIZE_TYPE "long unsigned int"
#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
+#define PTRDIFF_TYPE "long int"
+
+#undef INTMAX_TYPE
+#define INTMAX_TYPE "long long int"
+
+#undef UINTMAX_TYPE
+#define UINTMAX_TYPE "long long unsigned int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
@@ -69,30 +38,169 @@ Boston, MA 02110-1301, USA. */
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
-/* Controlling the compilation driver. */
+/* If defined, a C expression whose value is a string containing the
+ assembler operation to identify the following data as
+ uninitialized global data. If not defined, and neither
+ `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
+ uninitialized global data will be output in the data section if
+ `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
+ used. */
+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
+
+#define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss
+
+#undef ASM_DECLARE_OBJECT_NAME
+#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
+
+#undef MD_EXEC_PREFIX
+#undef MD_STARTFILE_PREFIX
+
+/* If we don't set MASK_ABICALLS, we can't default to PIC. */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT MASK_ABICALLS
+
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ OPENBSD_OS_CPP_BUILTINS(); \
+ \
+ if (TARGET_64BIT) \
+ builtin_define ("__mips64__"); \
+ \
+ if (TARGET_ABICALLS) \
+ builtin_define ("__ABICALLS__"); \
+ \
+ if (mips_abi == ABI_EABI) \
+ builtin_define ("__mips_eabi"); \
+ else if (mips_abi == ABI_N32) \
+ builtin_define ("__mips_n32"); \
+ else if (mips_abi == ABI_64) \
+ builtin_define ("__mips_n64"); \
+ else if (mips_abi == ABI_O64) \
+ builtin_define ("__mips_o64"); \
+ \
+ if (mips_abi == ABI_N32) \
+ { \
+ builtin_define ("_ABIN32=2"); \
+ builtin_define ("_MIPS_SIM=_ABIN32"); \
+ builtin_define ("_MIPS_SZLONG=32"); \
+ builtin_define ("_MIPS_SZPTR=32"); \
+ } \
+ else if (mips_abi == ABI_64) \
+ { \
+ builtin_define ("_ABI64=3"); \
+ builtin_define ("_MIPS_SIM=_ABI64"); \
+ builtin_define ("_MIPS_SZLONG=64"); \
+ builtin_define ("_MIPS_SZPTR=64"); \
+ } \
+ else \
+ { \
+ builtin_define ("_ABIO32=1"); \
+ builtin_define ("_MIPS_SIM=_ABIO32"); \
+ builtin_define ("_MIPS_SZLONG=32"); \
+ builtin_define ("_MIPS_SZPTR=32"); \
+ } \
+ if (TARGET_FLOAT64) \
+ builtin_define ("_MIPS_FPSET=32"); \
+ else \
+ builtin_define ("_MIPS_FPSET=16"); \
+ \
+ builtin_define ("_MIPS_SZINT=32"); \
+ } while (0)
-/* LINK_SPEC appropriate for OpenBSD: support for GCC options
- -static, -assert, and -nostdlib. Dynamic loader control. */
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
- %{bestGnum} %{shared} %{non_shared} \
- %{call_shared} %{no_archive} %{exact_version} \
- %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
- %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
- %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
- %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC
+
+/* A standard GNU/Linux mapping. On most targets, it is included in
+ CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
+ and provides this hook instead. */
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "%{profile:-p}"
+/* From iris5.h */
/* -G is incompatible with -KPIC which is the default, so only allow objects
in the small data section if the user explicitly asks for it. */
#undef MIPS_DEFAULT_GVALUE
#define MIPS_DEFAULT_GVALUE 0
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-/* Since gas and gld are standard on OpenBSD, we don't need these. */
-#undef ASM_FINAL_SPEC
+/* Borrowed from sparc/linux.h */
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%(endian_spec) \
+ %{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
+ %{shared:-shared} %{R*} \
+ %{static:-Bstatic} \
+ %{!static:-Bdynamic} \
+ %{assert*} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+
+/* As an elf system, we need crtbegin/crtend stuff. */
#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+ crtbegin%O%s} %{shared:crtbeginS%O%s}"
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+
+#undef SUBTARGET_ASM_SPEC
+#define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
+
+/* The MIPS assembler has different syntax for .set. We set it to
+ .dummy to trap any errors. */
+#undef SET_ASM_OP
+#define SET_ASM_OP "\t.dummy\t"
+
+#undef ASM_OUTPUT_DEF
+#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
+ do { \
+ fputc ( '\t', FILE); \
+ assemble_name (FILE, LABEL1); \
+ fputs ( " = ", FILE); \
+ assemble_name (FILE, LABEL2); \
+ fputc ( '\n', FILE); \
+ } while (0)
+
+#undef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
+ do { \
+ if (!flag_inhibit_size_directive) \
+ { \
+ fputs ("\t.ent\t", STREAM); \
+ assemble_name (STREAM, NAME); \
+ putc ('\n', STREAM); \
+ } \
+ ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
+ assemble_name (STREAM, NAME); \
+ fputs (":\n", STREAM); \
+ } while (0)
+
+#undef ASM_DECLARE_FUNCTION_SIZE
+#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
+ do { \
+ if (!flag_inhibit_size_directive) \
+ { \
+ fputs ("\t.end\t", STREAM); \
+ assemble_name (STREAM, NAME); \
+ putc ('\n', STREAM); \
+ } \
+ } while (0)
+
+/* Tell function_prologue in mips.c that we have already output the .ent/.end
+ pseudo-ops. */
+#undef FUNCTION_NAME_ALREADY_DECLARED
+#define FUNCTION_NAME_ALREADY_DECLARED 1
+
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX "."
+
+/* The glibc _mcount stub will save $v0 for us. Don't mess with saving
+ it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
+ presence of $gp-relative calls. */
+#undef ASM_OUTPUT_REG_PUSH
+#undef ASM_OUTPUT_REG_POP
+
+#undef LIB_SPEC
+#define LIB_SPEC OBSD_LIB_SPEC
-/* Switch into a generic section. */
-#undef TARGET_ASM_NAMED_SECTION
-#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
+#undef ENABLE_EXECUTE_STACK
diff --git a/gnu/usr.bin/cc/Makefile.tgt b/gnu/usr.bin/cc/Makefile.tgt
index 9b19a2716e5..4c91d76c00c 100644
--- a/gnu/usr.bin/cc/Makefile.tgt
+++ b/gnu/usr.bin/cc/Makefile.tgt
@@ -1,5 +1,5 @@
# $FreeBSD: src/gnu/usr.bin/cc/Makefile.tgt,v 1.11.8.1 2009/04/15 03:14:26 kensmith Exp $
-# $OpenBSD: Makefile.tgt,v 1.7 2010/09/09 19:16:50 jsg Exp $
+# $OpenBSD: Makefile.tgt,v 1.8 2010/09/10 16:20:11 kettenis Exp $
TARGET_ARCH?= ${MACHINE_ARCH}
@@ -12,10 +12,12 @@ GCC_CPU= i386
.elif ${TARGET_ARCH} == "hppa"
GCC_CPU= pa
TARGET_CPU_DEFAULT= MASK_PA_11
-.elif ${TARGET_ARCH} == "sh"
-GCC_CPU= sh
+.elif ${TARGET_ARCH} == "mips64" || ${TARGET_ARCH} == "mips64el"
+GCC_CPU= mips
.elif ${TARGET_ARCH} == "powerpc"
GCC_CPU= rs6000
+.elif ${TARGET_ARCH} == "sh"
+GCC_CPU= sh
.elif ${TARGET_ARCH} == "sparc"
GCC_CPU= sparc
TARGET_CPU_DEFAULT= TARGET_CPU_v7
diff --git a/gnu/usr.bin/cc/cc_tools/Makefile b/gnu/usr.bin/cc/cc_tools/Makefile
index 2a200195317..582dd22c11c 100644
--- a/gnu/usr.bin/cc/cc_tools/Makefile
+++ b/gnu/usr.bin/cc/cc_tools/Makefile
@@ -1,5 +1,5 @@
# $FreeBSD: src/gnu/usr.bin/cc/cc_tools/Makefile,v 1.88.8.1 2009/04/15 03:14:26 kensmith Exp $
-# $OpenBSD: Makefile,v 1.7 2010/09/09 19:16:50 jsg Exp $
+# $OpenBSD: Makefile,v 1.8 2010/09/10 16:20:11 kettenis Exp $
.include <bsd.own.mk>
@@ -30,7 +30,8 @@ TARGET_INC+= i386/biarch64.h
.if ${TARGET_ARCH} == "sh"
TARGET_INC+= sh/little.h
.endif
-.if ${TARGET_ARCH} != "arm"
+.if ${TARGET_ARCH} != "arm" && ${TARGET_ARCH} != "mips64" && \
+ ${TARGET_ARCH} != "mips64el"
TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
.endif
.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
@@ -58,6 +59,13 @@ TARGET_INC+= freebsd-spec.h
TARGET_INC+= ${GCC_CPU}/sysv4.h
.endif
.endif
+.if ${TARGET_ARCH} == "mips64" || ${TARGET_ARCH} == "mips64el"
+TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
+TM_DEFINES= MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_64
+.if ${TARGET_ARCH} == "mips64el"
+TM_DEFINES+= TARGET_ENDIAN_DEFAULT=0
+.endif
+.endif
.if ${TARGET_ARCH} == "amd64"
TARGET_INC+= ${GCC_CPU}/x86-64.h
TARGET_INC+= ${GCC_CPU}/openbsd64.h
@@ -231,7 +239,7 @@ GENONLY+= optionlist options.h options.c
tm.h:
TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
HEADERS="${TARGET_INC}" \
- DEFINES="" \
+ DEFINES="${TM_DEFINES}" \
/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
diff --git a/gnu/usr.bin/cc/libgcc/Makefile b/gnu/usr.bin/cc/libgcc/Makefile
index fabe46ef9b3..b768d79b807 100644
--- a/gnu/usr.bin/cc/libgcc/Makefile
+++ b/gnu/usr.bin/cc/libgcc/Makefile
@@ -1,5 +1,5 @@
# $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.58.8.1 2009/04/15 03:14:26 kensmith Exp $
-# $OpenBSD: Makefile,v 1.13 2010/09/09 19:16:50 jsg Exp $
+# $OpenBSD: Makefile,v 1.14 2010/09/10 16:20:11 kettenis Exp $
.include <bsd.own.mk>
@@ -82,19 +82,17 @@ LIB2FUNCS_EXTRA =
LIB2FUNCS_STATIC_EXTRA =
# Defined in libgcc2.c, included only in the static library.
-# KAN: Excluded _sf_to_tf and _df_to_tf as TPBIT_FUNCS are not
-# built on any of our platforms.
LIB2FUNCS_ST = _eprintf __gcc_bcmp
FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
_fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
_lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
- _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf
+ _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf _sf_to_tf
DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
_fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
_lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
- _df_to_sf _thenan_df _df_to_usi _usi_to_df
+ _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df
TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
_fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
@@ -194,18 +192,42 @@ OBJ_GRPS = STD DIV
#
# Floating point emulation functions
#
-.if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "powerpc" || \
+.if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "mips64" || \
+ ${TARGET_ARCH} == "mips64el" || ${TARGET_ARCH} == "powerpc" || \
${TARGET_ARCH} == "sparc" || ${TARGET_ARCH} == "sparc64"
FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT
DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES
+.if ${TARGET_ARCH} == "mips64" || ${TARGET_ARCH} == "mips64el"
+FPBIT_CFLAGS += -DTMODES
+DPBIT_CFLAGS += -DTMODES
+.endif
+
+.if ${TARGET_ARCH} == "mips64el"
+FPBIT_CFLAGS += -DFLOAT_BIT_ORDER_MISMATCH
+DPBIT_CFLAGS += -DFLOAT_BIT_ORDER_MISMATCH
+.endif
+
FPBIT_CFILE = config/fp-bit.c
DPBIT_CFILE = config/fp-bit.c
OBJ_GRPS += FPBIT DPBIT
.endif
+.if ${TARGET_ARCH} == "mips64" || ${TARGET_ARCH} == "mips64el"
+
+TPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DTFLOAT
+
+.if ${TARGET_ARCH} == "mips64el"
+TPBIT_CFLAGS += -DFLOAT_BIT_ORDER_MISMATCH
+.endif
+
+TPBIT_CFILE = config/fp-bit.c
+
+OBJ_GRPS += TPBIT
+.endif
+
#-----------------------------------------------------------------------
#
# Generic build rules for object groups defined above