Skip to content

Instantly share code, notes, and snippets.

@7shi
Created March 29, 2010 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7shi/347696 to your computer and use it in GitHub Desktop.
Save 7shi/347696 to your computer and use it in GitHub Desktop.
--- gcc/config.gcc.orig 2010-03-29 17:07:55.000000000 +0900
+++ gcc/config.gcc 2010-03-29 17:34:50.000000000 +0900
@@ -1822,6 +1822,10 @@
tmake_file="mips/t-r3900 mips/t-libgcc-mips16"
use_fixproto=yes
;;
+mips*-*-pe)
+ tm_defines="${tm_defines} TARGET_ENDIAN_DEFALUT=0 TARGET_MIPS_PE=1"
+ configure_default_options="{ { NULL, NULL} }"
+ ;;
mmix-knuth-mmixware)
need_64bit_hwint=yes
;;
--- gcc/config/mips/mips.h.orig 2010-03-29 17:52:33.000000000 +0900
+++ gcc/config/mips/mips.h 2010-03-29 18:57:49.000000000 +0900
@@ -976,6 +976,7 @@
COFF debugging info. */
#ifndef SUBTARGET_ASM_DEBUGGING_SPEC
+#ifndef TARGET_MIPS_PE
#define SUBTARGET_ASM_DEBUGGING_SPEC "\
%{g} %{g0} %{g1} %{g2} %{g3} \
%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
@@ -983,6 +984,14 @@
%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
%{gcoff*:-mdebug} %{!gcoff*:-no-mdebug}"
+#else
+#define SUBTARGET_ASM_DEBUGGING_SPEC "\
+%{g} %{g0} %{g1} %{g2} %{g3} \
+%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
+%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
+%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
+%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3}"
+#endif
#endif
/* SUBTARGET_ASM_SPEC is always passed to the assembler. It may be
@@ -1063,6 +1072,7 @@
Do not define this macro if it does not need to do anything. */
+#ifndef TARGET_MIPS_PE
#define EXTRA_SPECS \
{ "subtarget_cc1_spec", SUBTARGET_CC1_SPEC }, \
{ "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
@@ -1072,6 +1082,17 @@
{ "asm_abi_default_spec", "-" MULTILIB_ABI_DEFAULT }, \
{ "endian_spec", ENDIAN_SPEC }, \
SUBTARGET_EXTRA_SPECS
+#else
+#define EXTRA_SPECS \
+ { "subtarget_cc1_spec", SUBTARGET_CC1_SPEC }, \
+ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
+ { "subtarget_asm_optimizing_spec", SUBTARGET_ASM_OPTIMIZING_SPEC }, \
+ { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \
+ { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
+ { "asm_abi_default_spec", "" }, \
+ { "endian_spec", ENDIAN_SPEC }, \
+ SUBTARGET_EXTRA_SPECS
+#endif
#ifndef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS
@@ -2632,7 +2653,17 @@
is not declared before the .ent directive elsewhere. */
#undef ASM_DECLARE_FUNCTION_NAME
+#ifndef TARGET_MIPS_PE
#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)
+#else
+#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
+ if (TREE_PUBLIC (DECL)) \
+ { \
+ fprintf (STREAM, "\t.def\t"); \
+ assemble_name (STREAM, NAME); \
+ fprintf (STREAM, ";\t.scl\t%d;\t.type\t%d;\t.endef\n", 2, 32); \
+ }
+#endif
#ifndef FUNCTION_NAME_ALREADY_DECLARED
#define FUNCTION_NAME_ALREADY_DECLARED 0
--- gcc/config/mips/mips.c.orig 2010-03-29 18:43:32.000000000 +0900
+++ gcc/config/mips/mips.c 2010-03-29 18:43:51.000000000 +0900
@@ -7100,6 +7100,7 @@
causes unwanted warnings from the native linker. */
if (!TARGET_IRIX)
{
+#ifndef TARGET_MIPS_PE
/* Record the ABI itself. Modern versions of binutils encode
this information in the ELF header flags, but GDB needs the
information in order to correctly debug binaries produced by
@@ -7107,6 +7108,7 @@
gdb/mips-tdep.c. */
fprintf (asm_out_file, "\t.section .mdebug.%s\n\t.previous\n",
mips_mdebug_abi_name ());
+#endif
/* There is no ELF header flag to distinguish long32 forms of the
EABI from long64 forms. Emit a special section to help tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment