Created
November 17, 2011 22:39
-
-
Save 7shi/1374792 to your computer and use it in GitHub Desktop.
patches for mipsel-pe-gcc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur binutils-2.21.1.orig/bfd/config.bfd binutils-2.21.1/bfd/config.bfd | |
--- binutils-2.21.1.orig/bfd/config.bfd 2011-04-01 21:02:42 +0900 | |
+++ binutils-2.21.1/bfd/config.bfd 2011-11-17 07:40:22 +0900 | |
@@ -132,11 +132,6 @@ | |
exit 1 | |
;; | |
- mips*-*-pe*) | |
- echo "This target is obsolete and has been removed." | |
- exit 1 | |
- ;; | |
- | |
plugin) | |
targ_defvec=plugin_vec | |
targ_selvecs="plugin_vec" | |
@@ -983,6 +978,11 @@ | |
targ_defvec=bfd_elf32_bigmips_vec | |
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" | |
;; | |
+ mips*-*-pe* | mips*-*-mingw*) | |
+ targ_defvec=mipslpe_vec | |
+ targ_selvecs="mipslpe_vec mipslpei_vec" | |
+ targ_underscore=yes | |
+ ;; | |
mips*-*-none) | |
targ_defvec=bfd_elf32_bigmips_vec | |
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" | |
diff -ur binutils-2.21.1.orig/bfd/pe-mips.c binutils-2.21.1/bfd/pe-mips.c | |
--- binutils-2.21.1.orig/bfd/pe-mips.c 2010-06-27 13:07:53 +0900 | |
+++ binutils-2.21.1/bfd/pe-mips.c 2011-11-17 07:40:35 +0900 | |
@@ -151,6 +151,48 @@ | |
} | |
#endif | |
+/* ECOFF relocs are either against external symbols, or against | |
+ sections. If we are producing relocatable output, and the reloc | |
+ is against an external symbol, and nothing has given us any | |
+ additional addend, the resulting reloc will also be against the | |
+ same symbol. In such a case, we don't want to change anything | |
+ about the way the reloc is handled, since it will all be done at | |
+ final link time. Rather than put special case code into | |
+ bfd_perform_relocation, all the reloc types use this howto | |
+ function. It just short circuits the reloc if producing | |
+ relocatable output against an external symbol. */ | |
+ | |
+static bfd_reloc_status_type mips_generic_reloc | |
+ PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data, | |
+ asection *section, bfd *output_bfd, char **error)); | |
+ | |
+static bfd_reloc_status_type | |
+mips_generic_reloc (abfd, | |
+ reloc_entry, | |
+ symbol, | |
+ data, | |
+ input_section, | |
+ output_bfd, | |
+ error_message) | |
+ bfd *abfd ATTRIBUTE_UNUSED; | |
+ arelent *reloc_entry; | |
+ asymbol *symbol; | |
+ PTR data ATTRIBUTE_UNUSED; | |
+ asection *input_section; | |
+ bfd *output_bfd; | |
+ char **error_message ATTRIBUTE_UNUSED; | |
+{ | |
+ if (output_bfd != (bfd *) NULL | |
+ && (symbol->flags & BSF_SECTION_SYM) == 0 | |
+ && reloc_entry->addend == 0) | |
+ { | |
+ reloc_entry->address += input_section->output_offset; | |
+ return bfd_reloc_ok; | |
+ } | |
+ | |
+ return bfd_reloc_continue; | |
+} | |
+ | |
#ifndef PCRELOFFSET | |
#define PCRELOFFSET FALSE | |
#endif | |
@@ -291,7 +333,24 @@ | |
EMPTY_HOWTO (11), | |
EMPTY_HOWTO (12), | |
EMPTY_HOWTO (13), | |
- EMPTY_HOWTO (14), | |
+ | |
+ /* FIXME: This relocation is used (internally only) to represent branches | |
+ when assembling. It should never appear in output files, and | |
+ be removed. (It used to be used for embedded-PIC support.) */ | |
+ HOWTO (MIPS_R_PCREL16, /* type */ | |
+ 2, /* rightshift */ | |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
+ 16, /* bitsize */ | |
+ TRUE, /* pc_relative */ | |
+ 0, /* bitpos */ | |
+ complain_overflow_signed, /* complain_on_overflow */ | |
+ mips_generic_reloc, /* special_function */ | |
+ "PCREL16", /* name */ | |
+ TRUE, /* partial_inplace */ | |
+ 0xffff, /* src_mask */ | |
+ 0xffff, /* dst_mask */ | |
+ TRUE), /* pcrel_offset */ | |
+ | |
EMPTY_HOWTO (15), | |
EMPTY_HOWTO (16), | |
EMPTY_HOWTO (17), | |
@@ -498,6 +557,9 @@ | |
case BFD_RELOC_RVA: | |
mips_type = MIPS_R_RVA; | |
break; | |
+ case BFD_RELOC_16_PCREL_S2: | |
+ mips_type = MIPS_R_PCREL16; | |
+ break; | |
default: | |
return NULL; | |
} | |
diff -ur binutils-2.21.1.orig/bfd/peicode.h binutils-2.21.1/bfd/peicode.h | |
--- binutils-2.21.1.orig/bfd/peicode.h 2010-05-26 16:37:36 +0900 | |
+++ binutils-2.21.1/bfd/peicode.h 2011-11-17 07:40:30 +0900 | |
@@ -953,7 +953,7 @@ | |
pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 0, BFD_RELOC_HI16_S, | |
(struct bfd_symbol **) imp_sym, | |
imp_index); | |
- pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text); | |
+ /*pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text);*/ | |
pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 4, BFD_RELOC_LO16, | |
(struct bfd_symbol **) imp_sym, | |
imp_index); | |
diff -ur binutils-2.21.1.orig/binutils/dlltool.c binutils-2.21.1/binutils/dlltool.c | |
--- binutils-2.21.1.orig/binutils/dlltool.c 2010-10-31 02:14:02 +0900 | |
+++ binutils-2.21.1/binutils/dlltool.c 2011-11-17 07:38:30 +0900 | |
@@ -589,6 +589,14 @@ | |
static bfd_vma ppc_glue_insn = 0x80410004; | |
#endif | |
+static const unsigned char mips_jtab[] = | |
+{ | |
+ 0x00, 0x00, 0x08, 0x3c, /* lui $t0,<high:__imp_function> */ | |
+ 0x00, 0x00, 0x08, 0x8d, /* lw $t0,<low:__imp_function> */ | |
+ 0x08, 0x00, 0x00, 0x01, /* jr $t0 */ | |
+ 0x00, 0x00, 0x00, 0x00 /* nop */ | |
+}; | |
+ | |
static const char i386_trampoline[] = | |
"\tpushl %%ecx\n" | |
"\tpushl %%edx\n" | |
@@ -746,6 +754,16 @@ | |
i386_dljtab, sizeof (i386_dljtab), 2, 7, 12, i386_trampoline | |
} | |
, | |
+ { | |
+#define MMIPS 12 | |
+ "mips", ".byte", ".short", ".long", ".asciz", "#", | |
+ "lui\t$t0,*\nlw\t$t0,*\njr\t$t0\nnop", | |
+ ".global", ".space", ".align\t2",".align\t4", "-EL", | |
+ "pe-mips",bfd_arch_mips, | |
+ mips_jtab, sizeof (mips_jtab), 0, | |
+ 0, 0, 0, 0, 0, 0 | |
+ } | |
+ , | |
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } | |
}; | |
@@ -895,6 +913,7 @@ | |
case MMCORE_ELF_LE: | |
case MARM_EPOC: | |
case MARM_WINCE: | |
+ case MMIPS: | |
break; | |
default: | |
/* xgettext:c-format */ | |
@@ -921,6 +940,7 @@ | |
case MMCORE_ELF_LE: | |
case MARM_EPOC: | |
case MARM_WINCE: | |
+ case MMIPS: | |
return ".rva\t"; | |
default: | |
/* xgettext:c-format */ | |
@@ -945,6 +965,7 @@ | |
case MMCORE_ELF_LE: | |
case MARM_EPOC: | |
case MARM_WINCE: | |
+ case MMIPS: | |
break; | |
case M386: | |
case MX86: | |
@@ -2459,7 +2480,7 @@ | |
if (! exp->data) | |
{ | |
exp_label = bfd_make_empty_symbol (abfd); | |
- exp_label->name = make_imp_label ("", exp->name); | |
+ exp_label->name = make_imp_label ("", xlate(exp->name)); | |
/* On PowerPC, the function name points to a descriptor in | |
the rdata section, the first element of which is a | |
@@ -2559,6 +2580,7 @@ | |
case TEXT: | |
if (! exp->data) | |
{ | |
+ int mips = machine == MMIPS ? 1 : 0; | |
si->size = HOW_JTAB_SIZE; | |
si->data = xmalloc (HOW_JTAB_SIZE); | |
memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE); | |
@@ -2566,9 +2588,10 @@ | |
/* Add the reloc into idata$5. */ | |
rel = xmalloc (sizeof (arelent)); | |
- rpp = xmalloc (sizeof (arelent *) * (delay ? 4 : 2)); | |
+ rpp = xmalloc (sizeof (arelent *) * ((delay ? 4 : 2) + mips)); | |
rpp[0] = rel; | |
rpp[1] = 0; | |
+ if (mips) rpp[2] = 0; | |
rel->address = HOW_JTAB_ROFF; | |
rel->addend = 0; | |
@@ -2576,14 +2599,14 @@ | |
if (delay) | |
{ | |
rel2 = xmalloc (sizeof (arelent)); | |
- rpp[1] = rel2; | |
+ rpp[1 + mips] = rel2; | |
rel2->address = HOW_JTAB_ROFF2; | |
rel2->addend = 0; | |
rel3 = xmalloc (sizeof (arelent)); | |
- rpp[2] = rel3; | |
+ rpp[2 + mips] = rel3; | |
rel3->address = HOW_JTAB_ROFF3; | |
rel3->addend = 0; | |
- rpp[3] = 0; | |
+ rpp[3 + mips] = 0; | |
} | |
if (machine == MPPC) | |
@@ -2598,6 +2621,18 @@ | |
BFD_RELOC_32_PCREL); | |
rel->sym_ptr_ptr = iname_pp; | |
} | |
+ else if (machine == MMIPS) | |
+ { | |
+ arelent *relm = xmalloc (sizeof (arelent)); | |
+ rpp[1] = relm; | |
+ rel->howto = bfd_reloc_type_lookup (abfd, | |
+ BFD_RELOC_HI16_S); | |
+ rel->sym_ptr_ptr = iname_pp; | |
+ relm->address = rel->address + 4; | |
+ relm->howto = bfd_reloc_type_lookup (abfd, | |
+ BFD_RELOC_LO16); | |
+ relm->sym_ptr_ptr = iname_pp; | |
+ } | |
else | |
{ | |
rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); | |
@@ -2613,7 +2648,7 @@ | |
} | |
sec->orelocation = rpp; | |
- sec->reloc_count = delay ? 3 : 1; | |
+ sec->reloc_count = (delay ? 3 : 1) + mips; | |
} | |
break; | |
diff -ur binutils-2.21.1.orig/gas/config/tc-mips.c binutils-2.21.1/gas/config/tc-mips.c | |
--- binutils-2.21.1.orig/gas/config/tc-mips.c 2011-03-16 17:36:16 +0900 | |
+++ binutils-2.21.1/gas/config/tc-mips.c 2011-11-19 06:18:41 +0900 | |
@@ -1212,7 +1212,9 @@ | |
{"text", s_change_sec, 't'}, | |
{"word", s_cons, 2}, | |
+#ifdef MIPS_STABS_ELF | |
{ "extern", ecoff_directive_extern, 0}, | |
+#endif | |
{ NULL, NULL, 0 }, | |
}; | |
@@ -2828,12 +2830,9 @@ | |
: nops_for_insn_or_target (history, ip)); | |
if (nops > 0) | |
{ | |
- fragS *old_frag; | |
- unsigned long old_frag_offset; | |
int i; | |
- old_frag = frag_now; | |
- old_frag_offset = frag_now_fix (); | |
+ (void) frag_now_fix (); | |
for (i = 0; i < nops; i++) | |
emit_nop (); | |
@@ -12254,7 +12253,8 @@ | |
|| fixP->fx_r_type == BFD_RELOC_MIPS_SUB | |
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT | |
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY | |
- || fixP->fx_r_type == BFD_RELOC_MIPS_TLS_DTPREL64); | |
+ || fixP->fx_r_type == BFD_RELOC_MIPS_TLS_DTPREL64 | |
+ || fixP->fx_r_type == BFD_RELOC_16_PCREL_S2); | |
buf = (bfd_byte *) (fixP->fx_frag->fr_literal + fixP->fx_where); | |
@@ -12610,10 +12610,10 @@ | |
void | |
s_change_section (int ignore ATTRIBUTE_UNUSED) | |
{ | |
-#ifdef OBJ_ELF | |
char *section_name; | |
char c; | |
char next_c = 0; | |
+#ifdef OBJ_ELF | |
int section_type; | |
int section_flag; | |
int section_entry_size; | |
@@ -12621,6 +12621,7 @@ | |
if (!IS_ELF) | |
return; | |
+#endif | |
section_name = input_line_pointer; | |
c = get_symbol_end (); | |
@@ -12633,9 +12634,14 @@ | |
/* just after name is now '\0'. */ | |
*input_line_pointer = c; | |
input_line_pointer = section_name; | |
+#ifdef OBJ_ELF | |
obj_elf_section (ignore); | |
+#else | |
+ obj_coff_section (ignore); | |
+#endif | |
return; | |
} | |
+#ifdef OBJ_ELF | |
input_line_pointer++; | |
/* Do we have .section Name<,type><,flag><,entry_size><,alignment> */ | |
diff -ur binutils-2.21.1.orig/gas/configure.tgt binutils-2.21.1/gas/configure.tgt | |
--- binutils-2.21.1.orig/gas/configure.tgt 2011-04-01 21:02:42 +0900 | |
+++ binutils-2.21.1/gas/configure.tgt 2011-11-17 07:40:40 +0900 | |
@@ -283,7 +283,7 @@ | |
mips-*-ultrix*) fmt=ecoff endian=little ;; | |
mips-*-osf*) fmt=ecoff endian=little ;; | |
mips-*-ecoff*) fmt=ecoff ;; | |
- mips-*-pe*) fmt=coff endian=little em=pe ;; | |
+ mips-*-pe* | mips-*-mingw*) fmt=coff endian=little em=pe ;; | |
mips-*-irix6*) fmt=elf em=irix ;; | |
mips-*-irix5*) fmt=elf em=irix ;; | |
mips-*-irix*) fmt=ecoff em=irix ;; | |
diff -ur binutils-2.21.1.orig/include/coff/ecoff.h binutils-2.21.1/include/coff/ecoff.h | |
--- binutils-2.21.1.orig/include/coff/ecoff.h 2010-04-15 19:26:07 +0900 | |
+++ binutils-2.21.1/include/coff/ecoff.h 2011-11-17 07:40:23 +0900 | |
@@ -148,10 +148,18 @@ | |
/* gcc also uses mips-tfile to output COFF debugging information. | |
These are the values it uses when outputting the .type directive. | |
These should also be in a shared include file. */ | |
+#ifndef N_BTMASK | |
#define N_BTMASK (017) | |
+#endif | |
+#ifndef N_TMASK | |
#define N_TMASK (060) | |
+#endif | |
+#ifndef N_BTSHFT | |
#define N_BTSHFT (4) | |
+#endif | |
+#ifndef N_TSHIFT | |
#define N_TSHIFT (2) | |
+#endif | |
/********************** AUX **********************/ | |
diff -ur binutils-2.21.1.orig/include/coff/mipspe.h binutils-2.21.1/include/coff/mipspe.h | |
--- binutils-2.21.1.orig/include/coff/mipspe.h 2010-04-15 19:26:07 +0900 | |
+++ binutils-2.21.1/include/coff/mipspe.h 2011-11-17 07:40:38 +0900 | |
@@ -65,3 +65,8 @@ | |
#define MIPS_R_SECRELHI 13 /* PAIR follows */ | |
#define MIPS_R_RVA 34 /* 0x22 */ | |
#define MIPS_R_PAIR 37 /* 0x25 - symndx is really a signed 16-bit addend */ | |
+ | |
+/* FIXME: This relocation is used (internally only) to represent branches | |
+ when assembling. It should never appear in output files, and | |
+ be removed. (It used to be used for embedded-PIC support.) */ | |
+#define MIPS_R_PCREL16 14 | |
diff -ur binutils-2.21.1.orig/ld/configure.tgt binutils-2.21.1/ld/configure.tgt | |
--- binutils-2.21.1.orig/ld/configure.tgt 2011-04-01 21:03:54 +0900 | |
+++ binutils-2.21.1/ld/configure.tgt 2011-11-17 07:40:51 +0900 | |
@@ -368,7 +368,8 @@ | |
microblaze*-linux*) | |
targ_emul="elf32mb_linux" ;; | |
microblaze*) targ_emul=elf32microblaze ;; | |
-mips*-*-pe) targ_emul=mipspe ; | |
+mips*-*-pe | mips*-*-mingw*) | |
+ targ_emul=mipspe ; | |
targ_extra_ofiles="deffilep.o pe-dll.o" ;; | |
mips*-dec-ultrix*) targ_emul=mipslit ;; | |
mips*-dec-osf*) targ_emul=mipslit ;; | |
diff -ur binutils-2.21.1.orig/ld/emultempl/pe.em binutils-2.21.1/ld/emultempl/pe.em | |
--- binutils-2.21.1.orig/ld/emultempl/pe.em 2011-06-27 16:39:14 +0900 | |
+++ binutils-2.21.1/ld/emultempl/pe.em 2011-11-17 07:40:32 +0900 | |
@@ -105,7 +105,7 @@ | |
#define DEFAULT_PSEUDO_RELOC_VERSION 1 | |
#endif | |
-#if defined(TARGET_IS_i386pe) || ! defined(DLL_SUPPORT) | |
+#if defined(TARGET_IS_i386pe) || defined(TARGET_IS_mipspe) || ! defined(DLL_SUPPORT) | |
#define PE_DEF_SUBSYSTEM 3 | |
#else | |
#undef NT_EXE_IMAGE_BASE | |
@@ -1288,13 +1288,12 @@ | |
|| defined (TARGET_IS_arm_epoc_pe) \ | |
|| defined (TARGET_IS_arm_wince_pe) | |
if (!link_info.relocatable) | |
- pe_dll_build_sections (link_info.output_bfd, &link_info); | |
#else | |
if (link_info.shared) | |
+#endif | |
pe_dll_build_sections (link_info.output_bfd, &link_info); | |
else | |
pe_exe_build_sections (link_info.output_bfd, &link_info); | |
-#endif | |
#endif /* DLL_SUPPORT */ | |
#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe) | |
diff -ur binutils-2.21.1.orig/ld/pe-dll.c binutils-2.21.1/ld/pe-dll.c | |
--- binutils-2.21.1.orig/ld/pe-dll.c 2011-05-11 16:31:32 +0900 | |
+++ binutils-2.21.1/ld/pe-dll.c 2011-11-17 07:40:34 +0900 | |
@@ -2162,7 +2162,7 @@ | |
break; | |
case PE_ARCH_mips: | |
quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2); | |
- quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */ | |
+ /*quick_reloc (abfd, 0, BFD_RELOC_LO16, 0);*/ /* MIPS_R_PAIR */ | |
quick_reloc (abfd, 4, BFD_RELOC_LO16, 2); | |
break; | |
case PE_ARCH_arm: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur gcc-3.4.6.orig/gcc/Makefile.in gcc-3.4.6/gcc/Makefile.in | |
--- gcc-3.4.6.orig/gcc/Makefile.in 2005-02-24 18:26:59 +0900 | |
+++ gcc-3.4.6/gcc/Makefile.in 2011-11-17 23:37:28 +0900 | |
@@ -354,7 +354,7 @@ | |
# Control whether to run fixproto and fixincludes. | |
STMP_FIXPROTO = @STMP_FIXPROTO@ | |
-STMP_FIXINC = @STMP_FIXINC@ | |
+STMP_FIXINC = #@STMP_FIXINC@ | |
# Test to see whether <limits.h> exists in the system header files. | |
LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] | |
@@ -543,7 +543,7 @@ | |
# It is convenient for configure to add the assignment at the beginning, | |
# so don't override it here. | |
-USE_COLLECT2 = collect2$(exeext) | |
+USE_COLLECT2 = #collect2$(exeext) | |
# List of extra C and assembler files to add to static and shared libgcc2. | |
# Assembler files should have names ending in `.asm'. | |
diff -ur gcc-3.4.6.orig/gcc/config/mips/mips.h gcc-3.4.6/gcc/config/mips/mips.h | |
--- gcc-3.4.6.orig/gcc/config/mips/mips.h 2004-07-15 09:42:49 +0900 | |
+++ gcc-3.4.6/gcc/config/mips/mips.h 2011-11-18 07:21:35 +0900 | |
@@ -1069,6 +1069,7 @@ | |
/* SUBTARGET_ASM_DEBUGGING_SPEC handles passing debugging options to | |
the assembler. It may be overridden by subtargets. */ | |
#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} \ | |
@@ -1076,6 +1077,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} \ | |
%(mdebug_asm_spec)" | |
+#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 | |
/* Beginning with gas 2.13, -mdebug must be passed to correctly handle COFF | |
@@ -1138,12 +1147,21 @@ | |
/* CC1_SPEC is the set of arguments to pass to the compiler proper. */ | |
#ifndef CC1_SPEC | |
+#ifndef TARGET_MIPS_PE | |
+#define CC1_SPEC "\ | |
+%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ | |
+%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ | |
+%{save-temps: } \ | |
+%(subtarget_cc1_spec)" | |
+#else | |
#define CC1_SPEC "\ | |
%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ | |
%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ | |
+%{!fshort-wchar:%{!fno-short-wchar:-fshort-wchar}} \ | |
%{save-temps: } \ | |
%(subtarget_cc1_spec)" | |
#endif | |
+#endif | |
/* Preprocessor specs. */ | |
@@ -1165,6 +1183,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 }, \ | |
@@ -1179,6 +1198,17 @@ | |
{ "asm_abi_default_spec", ASM_ABI_DEFAULT_SPEC }, \ | |
{ "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 | |
@@ -3245,7 +3275,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 | |
@@ -3448,3 +3488,11 @@ | |
" TEXT_SECTION_ASM_OP); | |
#endif | |
#endif | |
+ | |
+#ifdef TARGET_MIPS_PE | |
+ | |
+/* Switch into a generic section. */ | |
+#undef TARGET_ASM_NAMED_SECTION | |
+#define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section | |
+ | |
+#endif | |
diff -ur gcc-3.4.6.orig/gcc/config.gcc gcc-3.4.6/gcc/config.gcc | |
--- gcc-3.4.6.orig/gcc/config.gcc 2005-07-20 06:08:48 +0900 | |
+++ gcc-3.4.6/gcc/config.gcc 2011-11-17 23:48:32 +0900 | |
@@ -1665,6 +1665,9 @@ | |
tmake_file=mips/t-r3900 | |
use_fixproto=yes | |
;; | |
+mips*-*-pe) | |
+ tm_defines="${tm_defines} TARGET_ENDIAN_DEFAULT=0 TARGET_MIPS_PE=1" | |
+ ;; | |
mmix-knuth-mmixware) | |
need_64bit_hwint=yes | |
;; | |
diff -ur gcc-3.4.6.orig/gcc/varasm.c gcc-3.4.6/gcc/varasm.c | |
--- gcc-3.4.6.orig/gcc/varasm.c 2005-03-03 05:57:53 +0900 | |
+++ gcc-3.4.6/gcc/varasm.c 2011-11-18 07:31:15 +0900 | |
@@ -1909,8 +1909,10 @@ | |
abort (); | |
} | |
+#ifndef TARGET_MIPS_PE | |
if (force) | |
abort (); | |
+#endif | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment