pkgsrc-ng/lang/gcc45/patches/patch-gcc_config_mips_netbsd.h
Lionel Sambuc 612ad0a18c lang/gcc45
2016-01-22 00:09:29 +01:00

122 lines
4.0 KiB
C

$NetBSD$
--- gcc/config/mips/netbsd.h.orig Thu Aug 2 10:49:31 2007
+++ gcc/config/mips/netbsd.h
@@ -40,16 +40,63 @@ along with GCC; see the file COPYING3. If not see
if (TARGET_ABICALLS) \
builtin_define ("__ABICALLS__"); \
\
- if (mips_abi == ABI_EABI) \
- builtin_define ("__mips_eabi"); \
- else if (mips_abi == ABI_N32) \
+ /* The GNU C++ standard library requires this. */ \
+ if (c_dialect_cxx ()) \
+ builtin_define ("_GNU_SOURCE"); \
+ \
+ if (mips_abi == ABI_N32) \
+ { \
builtin_define ("__mips_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 ("__mips_n64"); \
+ builtin_define ("_ABI64=3"); \
+ builtin_define ("_MIPS_SIM=_ABI64"); \
+ builtin_define ("_MIPS_SZLONG=64"); \
+ builtin_define ("_MIPS_SZPTR=64"); \
+ } \
else if (mips_abi == ABI_O64) \
+ { \
builtin_define ("__mips_o64"); \
+ builtin_define ("_ABIO64=4"); \
+ builtin_define ("_MIPS_SIM=_ABIO64"); \
+ builtin_define ("_MIPS_SZLONG=64"); \
+ builtin_define ("_MIPS_SZPTR=64"); \
} \
- while (0)
+ else if (mips_abi == ABI_EABI) \
+ { \
+ builtin_define ("__mips_eabi"); \
+ builtin_define ("_ABIEMB=5"); \
+ builtin_define ("_MIPS_SIM=_ABIEMB"); \
+ if (TARGET_LONG64) \
+ builtin_define ("_MIPS_SZLONG=64"); \
+ else \
+ builtin_define ("_MIPS_SZLONG=32"); \
+ if (TARGET_64BIT) \
+ builtin_define ("_MIPS_SZPTR=64"); \
+ else \
+ builtin_define ("_MIPS_SZPTR=32"); \
+ } \
+ else \
+ { \
+ builtin_define ("__mips_o32"); \
+ 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)
/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
Specifically, they define too many namespace-invasive macros. Override
@@ -105,6 +152,11 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("__mips=64"); \
builtin_define ("__mips_isa_rev=1"); \
} \
+ else if (ISA_MIPS64R2) \
+ { \
+ builtin_define ("__mips=64"); \
+ builtin_define ("__mips_isa_rev=2"); \
+ } \
\
if (TARGET_HARD_FLOAT) \
builtin_define ("__mips_hard_float"); \
@@ -148,10 +200,11 @@ along with GCC; see the file COPYING3. If not see
#undef LINK_SPEC
#define LINK_SPEC \
- "%{EL:-m elf32lmip} \
- %{EB:-m elf32bmip} \
+ "%{EL:-m elf32ltsmip} \
+ %{EB:-m elf32btsmip} \
%(endian_spec) \
- %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
+ %{G*} %{mips1} %{mips2} %{mips3} %{mips4} \
+ %{mips32} %{mips32r2} %{mips64} %{mips64r2} \
%{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
%(netbsd_link_spec)"
@@ -192,6 +245,14 @@ along with GCC; see the file COPYING3. If not see
/* Make gcc agree with <machine/ansi.h> */
+#undef SIZE_TYPE
+#define SIZE_TYPE ((POINTER_SIZE == 64 || TARGET_NEWABI) \
+ ? "long unsigned int" : "unsigned int")
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE ((POINTER_SIZE == 64 || TARGET_NEWABI) \
+ ? "long int" : "int")
+
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
@@ -200,3 +261,6 @@ along with GCC; see the file COPYING3. If not see
#undef WINT_TYPE
#define WINT_TYPE "int"
+
+#undef TARGET_WRITABLE_EH_FRAME
+#define TARGET_WRITABLE_EH_FRAME (flag_pic && TARGET_SHARED)