Add FreeBSD/MIPS support to GCC.
This commit is contained in:
parent
5555bfc259
commit
4bdc01a9f9
@ -185,3 +185,8 @@ is built with the --enable-threads configure-time option.} \
|
||||
#ifdef HAVE_LD_AS_NEEDED
|
||||
#define USE_LD_AS_NEEDED 1
|
||||
#endif
|
||||
|
||||
#define FBSD_SIZE_TYPE \
|
||||
(POINTER_SIZE == 64 ? "long unsigned int" : "unsigned int")
|
||||
#define FBSD_PTRDIFF_TYPE \
|
||||
(POINTER_SIZE == 64 ? "long int" : "int")
|
||||
|
@ -63,15 +63,26 @@ Boston, MA 02110-1301, USA. */
|
||||
/* All FreeBSD Architectures support the ELF object file format. */
|
||||
#undef OBJECT_FORMAT_ELF
|
||||
#define OBJECT_FORMAT_ELF 1
|
||||
#define TARGET_ELF 1
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#undef NO_IMPLICIT_EXTERN_C
|
||||
#define NO_IMPLICIT_EXTERN_C 1
|
||||
|
||||
/* Make gcc agree with FreeBSD's standard headers (<machine/ansi.h>, etc...) */
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE FBSD_SIZE_TYPE
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE FBSD_PTRDIFF_TYPE
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "int"
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 32
|
||||
#undef WINT_TYPE
|
||||
#define WINT_TYPE "int"
|
||||
#undef WINT_TYPE_SIZE
|
||||
#define WINT_TYPE_SIZE 32
|
||||
|
||||
#ifdef FREEBSD_NATIVE
|
||||
#define LIBSTDCXX_PROFILE "-lstdc++_p"
|
||||
@ -91,6 +102,6 @@ Boston, MA 02110-1301, USA. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
||||
|
||||
/* Define this so we can compile MS code for use with WINE. */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
|
||||
|
||||
#define TARGET_POSIX_IO
|
||||
|
241
contrib/gcc/config/mips/freebsd.h
Normal file
241
contrib/gcc/config/mips/freebsd.h
Normal file
@ -0,0 +1,241 @@
|
||||
/* Definitions for MIPS varients running FreeBSD with ELF format
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
Continued by David O'Brien <obrien@freebsd.org>
|
||||
|
||||
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 2, 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 COPYING. If not, write to
|
||||
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/* This defines which switch letters take arguments. -G is a MIPS
|
||||
special. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) \
|
||||
(FBSD_SWITCH_TAKES_ARG (CHAR) \
|
||||
|| (CHAR) == 'R' \
|
||||
|| (CHAR) == 'G')
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS /* mips.h bogusly defines it. */
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER}, \
|
||||
{ "fbsd_link_spec", FBSD_LINK_SPEC }
|
||||
|
||||
/* config/mips/mips.h defines CC1_SPEC,
|
||||
but gives us an "out" with SUBTARGET_CC1_SPEC. */
|
||||
#undef SUBTARGET_CC1_SPEC
|
||||
#define SUBTARGET_CC1_SPEC "%{profile:-p}"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for FreeBSD. 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
|
||||
combinations of options at link-time. We like to support here for
|
||||
as many of the other GNU linker options as possible. But I don't
|
||||
have the time to search for those flags. I am sure how to add
|
||||
support for -soname shared_object_name. H.J.
|
||||
|
||||
When the -shared link option is used a final link is not being
|
||||
done. */
|
||||
|
||||
#define FBSD_LINK_SPEC "\
|
||||
%{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic: -export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic} "
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
|
||||
%{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
|
||||
%(fbsd_link_spec) "
|
||||
#if 0
|
||||
%(endian_spec)
|
||||
#endif
|
||||
|
||||
/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
|
||||
but trashed by config/mips/elf.h. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC FBSD_STARTFILE_SPEC
|
||||
|
||||
/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC FBSD_ENDFILE_SPEC
|
||||
|
||||
/* Reset our LIB_SPEC which was properly set in config/freebsd.h
|
||||
but trashed by config/mips/elf.h. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC FBSD_LIB_SPEC
|
||||
|
||||
/* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC. */
|
||||
#undef SUBTARGET_CPP_SPEC
|
||||
#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
|
||||
|
||||
|
||||
/************************[ Target stuff ]***********************************/
|
||||
|
||||
/* Define the actual types of some ANSI-mandated types.
|
||||
Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
|
||||
c-common.c, and config/<arch>/<arch>.h. */
|
||||
|
||||
#if TARGET_ENDIAN_DEFAULT != 0
|
||||
#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mips)");
|
||||
#else
|
||||
#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mipsel)");
|
||||
#endif
|
||||
|
||||
/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for FreeBSD.
|
||||
Specifically, they define too many namespace-invasive macros. Override
|
||||
them here. Note this is structured for easy comparison to the version
|
||||
in mips.h. */
|
||||
|
||||
#undef TARGET_CPU_CPP_BUILTINS
|
||||
#define TARGET_CPU_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_assert ("machine=mips"); \
|
||||
builtin_assert ("cpu=mips"); \
|
||||
builtin_define ("__mips__"); \
|
||||
\
|
||||
if (TARGET_64BIT) \
|
||||
builtin_define ("__mips64__"); \
|
||||
\
|
||||
if (TARGET_FLOAT64) \
|
||||
builtin_define ("__mips_fpr=64"); \
|
||||
else \
|
||||
builtin_define ("__mips_fpr=32"); \
|
||||
\
|
||||
if (TARGET_MIPS16) \
|
||||
builtin_define ("__mips16"); \
|
||||
\
|
||||
MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
|
||||
MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
|
||||
\
|
||||
if (ISA_MIPS3) \
|
||||
builtin_define ("__mips=3"); \
|
||||
else if (ISA_MIPS4) \
|
||||
builtin_define ("__mips=4"); \
|
||||
else if (ISA_MIPS32) \
|
||||
{ \
|
||||
builtin_define ("__mips=32"); \
|
||||
builtin_define ("__mips_isa_rev=1"); \
|
||||
} \
|
||||
else if (ISA_MIPS32R2) \
|
||||
{ \
|
||||
builtin_define ("__mips=32"); \
|
||||
builtin_define ("__mips_isa_rev=2"); \
|
||||
} \
|
||||
else if (ISA_MIPS64) \
|
||||
{ \
|
||||
builtin_define ("__mips=64"); \
|
||||
builtin_define ("__mips_isa_rev=1"); \
|
||||
} \
|
||||
\
|
||||
if (TARGET_HARD_FLOAT) \
|
||||
builtin_define ("__mips_hard_float"); \
|
||||
else if (TARGET_SOFT_FLOAT) \
|
||||
builtin_define ("__mips_soft_float"); \
|
||||
\
|
||||
if (TARGET_SINGLE_FLOAT) \
|
||||
builtin_define ("__mips_single_float"); \
|
||||
\
|
||||
if (TARGET_BIG_ENDIAN) \
|
||||
builtin_define ("__MIPSEB__"); \
|
||||
else \
|
||||
builtin_define ("__MIPSEL__"); \
|
||||
\
|
||||
/* No language dialect defines. */ \
|
||||
\
|
||||
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"); \
|
||||
else \
|
||||
builtin_define ("__mips_o32"); \
|
||||
\
|
||||
if (TARGET_ABICALLS) \
|
||||
builtin_define ("__ABICALLS__"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Default to the mips32 ISA */
|
||||
#undef DRIVER_SELF_SPECS
|
||||
#define DRIVER_SELF_SPECS \
|
||||
"%{!EB:%{!EL:%(endian_spec)}}", \
|
||||
"%{!march=*: -march=mips32}"
|
||||
|
||||
#if 0
|
||||
/* Don't default to pcc-struct-return, we want to retain compatibility with
|
||||
older gcc versions AND pcc-struct-return is nonreentrant.
|
||||
(even though the SVR4 ABI for the i386 says that records and unions are
|
||||
returned in memory). */
|
||||
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
#endif
|
||||
|
||||
|
||||
/************************[ Assembler stuff ]********************************/
|
||||
|
||||
#undef SUBTARGET_ASM_SPEC
|
||||
#define SUBTARGET_ASM_SPEC \
|
||||
"%{!mno-abicalls: %{!fno-PIC:%{!fno-pic:-KPIC}}}"
|
||||
|
||||
/* -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
|
||||
|
||||
/* 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. */
|
||||
#undef BSS_SECTION_ASM_OP
|
||||
#define BSS_SECTION_ASM_OP "\t.section\t.bss"
|
||||
|
||||
/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
|
||||
separate, explicit argument. If you define this macro, it is used
|
||||
in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
|
||||
handling the required alignment of the variable. The alignment is
|
||||
specified as the number of bits.
|
||||
|
||||
Try to use function `asm_output_aligned_bss' defined in file
|
||||
`varasm.c' when defining this macro. */
|
||||
#undef ASM_OUTPUT_ALIGNED_BSS
|
||||
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
||||
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
|
||||
|
||||
/* Standard AT&T UNIX 'as' local label spelling. */
|
||||
#undef LOCAL_LABEL_PREFIX
|
||||
#define LOCAL_LABEL_PREFIX "."
|
||||
|
||||
|
||||
/************************[ Debugger stuff ]*********************************/
|
||||
|
@ -174,7 +174,7 @@ OBJ_GRPS = STD DIV
|
||||
# Floating point emulation functions
|
||||
#
|
||||
.if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "powerpc" || \
|
||||
${TARGET_ARCH} == "sparc64"
|
||||
${TARGET_ARCH} == "sparc64" || ${TARGET_ARCH} == "mips"
|
||||
|
||||
FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT
|
||||
DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES
|
||||
|
@ -24,7 +24,7 @@ VERSION_MAP= ${SRCDIR}/libgomp.map
|
||||
|
||||
# Target-specific OpenMP configuration
|
||||
.if ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == i386 || \
|
||||
${MACHINE_ARCH} == powerpc
|
||||
${MACHINE_ARCH} == powerpc || ${MACHINE_ARCH} == mips
|
||||
OMP_LOCK_ALIGN = 4
|
||||
OMP_LOCK_KIND= 4
|
||||
OMP_LOCK_SIZE= 4
|
||||
|
@ -59,7 +59,7 @@
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if the target supports thread-local storage. */
|
||||
#if !defined(__sparc64__) && !defined(__arm__)
|
||||
#if !defined(__sparc64__) && !defined(__arm__) && !defined(__mips__)
|
||||
#define HAVE_TLS 1
|
||||
#endif
|
||||
|
||||
|
@ -15,6 +15,9 @@ GCC_CPU= ${TARGET_ARCH}
|
||||
.if ${TARGET_ARCH} == "ia64"
|
||||
TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD
|
||||
.endif
|
||||
.if ${TARGET_ARCH} == "mips"
|
||||
TARGET_CPU_DEFAULT= 16
|
||||
.endif
|
||||
.if ${TARGET_ARCH} == "sparc64"
|
||||
TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
|
||||
.endif
|
||||
|
@ -33,6 +33,7 @@ TARGET_INC+= ${GCC_CPU}/unix.h
|
||||
TARGET_INC+= ${GCC_CPU}/att.h
|
||||
.endif
|
||||
TARGET_INC+= dbxelf.h
|
||||
TARGET_INC+= elfos-undef.h
|
||||
TARGET_INC+= elfos.h
|
||||
TARGET_INC+= freebsd-native.h
|
||||
TARGET_INC+= freebsd-spec.h
|
||||
@ -45,7 +46,7 @@ TARGET_INC+= ${GCC_CPU}/sysv4.h
|
||||
.if ${TARGET_ARCH} == "amd64"
|
||||
TARGET_INC+= ${GCC_CPU}/x86-64.h
|
||||
.endif
|
||||
.if ${TARGET_ARCH} == "arm"
|
||||
.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "mips"
|
||||
TARGET_INC+= ${GCC_CPU}/elf.h
|
||||
.endif
|
||||
.if ${TARGET_ARCH} == "arm"
|
||||
|
9
gnu/usr.bin/cc/cc_tools/elfos-undef.h
Normal file
9
gnu/usr.bin/cc/cc_tools/elfos-undef.h
Normal file
@ -0,0 +1,9 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/* This header exists to avoid editing contrib/gcc/config/elfos.h - which
|
||||
isn't coded to be defensive as it should... */
|
||||
|
||||
#undef ASM_DECLARE_OBJECT_NAME
|
||||
#undef ASM_OUTPUT_IDENT
|
||||
#undef IDENT_ASM_OP
|
||||
#undef READONLY_DATA_SECTION_ASM_OP
|
Loading…
x
Reference in New Issue
Block a user