From ae3a18f4e2a7e07008554ba531054bf8f0bb9c0f Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Thu, 6 Aug 2015 21:54:56 +0100 Subject: [PATCH] mingw-w64-cross-binutils: add my armv7-w64-mingw32 port --- .../0007-armv7-w64-mingw32.patch | 1306 +++++++++++++++++ mingw-w64-cross-binutils/PKGBUILD | 17 +- 2 files changed, 1319 insertions(+), 4 deletions(-) create mode 100644 mingw-w64-cross-binutils/0007-armv7-w64-mingw32.patch diff --git a/mingw-w64-cross-binutils/0007-armv7-w64-mingw32.patch b/mingw-w64-cross-binutils/0007-armv7-w64-mingw32.patch new file mode 100644 index 00000000..9e1794de --- /dev/null +++ b/mingw-w64-cross-binutils/0007-armv7-w64-mingw32.patch @@ -0,0 +1,1306 @@ +diff -Naur binutils-2.25-orig/bfd/coff-arm.c binutils-2.25/bfd/coff-arm.c +--- binutils-2.25-orig/bfd/coff-arm.c 2014-10-14 08:32:02.000000000 +0100 ++++ binutils-2.25/bfd/coff-arm.c 2015-06-30 09:26:43.160240200 +0100 +@@ -146,7 +146,12 @@ + } + + /* Now let bfd_perform_relocation finish everything up. */ ++#ifndef ARM_WINNT + return bfd_reloc_continue; ++#else ++ /* This seems to fix ARM_32 relocations */ ++ return bfd_reloc_ok; ++#endif + } + + /* If USER_LABEL_PREFIX is defined as "_" (see coff_arm_is_local_label_name() +@@ -163,15 +168,19 @@ + /* These most certainly belong somewhere else. Just had to get rid of + the manifest constants in the code. */ + +-#ifdef ARM_WINCE ++#if defined(ARM_WINCE) || defined(ARM_WINNT) + +-#define ARM_26D 0 +-#define ARM_32 1 +-#define ARM_RVA32 2 +-#define ARM_26 3 +-#define ARM_THUMB12 4 +-#define ARM_SECTION 14 +-#define ARM_SECREL 15 ++#define ARM_26D 0 ++#define ARM_32 1 ++#define ARM_RVA32 2 ++#define ARM_26 3 ++#define ARM_THUMB12 4 ++#define ARM_SECTION 14 ++#define ARM_SECREL 15 ++#define ARM_MOV32T 17 ++#define ARM_BRANCH20T 18 ++#define ARM_BRANCH24T 20 ++#define ARM_BLX23T 21 + + #else + +@@ -193,21 +202,181 @@ + + #endif + ++#ifdef ARM_WINNT ++static bfd_reloc_status_type bfd_coff_generic_reloc ++ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); ++static bfd_reloc_status_type coff_reloc_mov32t ++ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); ++#else + static bfd_reloc_status_type aoutarm_fix_pcrel_26_done + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + static bfd_reloc_status_type aoutarm_fix_pcrel_26 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + static bfd_reloc_status_type coff_thumb_pcrel_12 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +-#ifndef ARM_WINCE ++#endif ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + static bfd_reloc_status_type coff_thumb_pcrel_9 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + static bfd_reloc_status_type coff_thumb_pcrel_23 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + #endif + ++#ifdef ARM_WINNT ++static bfd_reloc_status_type ++bfd_coff_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, ++ arelent *reloc_entry, ++ asymbol *symbol, ++ void * 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->address += input_section->output_offset; ++ return bfd_reloc_ok; ++ } ++ ++ return bfd_reloc_continue; ++} ++#endif ++ + static reloc_howto_type aoutarm_std_reloc_howto[] = + { ++#ifdef ARM_WINNT ++ EMPTY_HOWTO (-1), ++ HOWTO (ARM_32, ++ 0, ++ 2, ++ 32, ++ FALSE, ++ 0, ++ complain_overflow_bitfield, ++ coff_arm_reloc, ++ "ARM_32", ++ TRUE, /* partial_inplace. */ ++ 0xffffffff, ++ 0xffffffff, ++ FALSE), ++ HOWTO (ARM_RVA32, ++ 0, ++ 2, ++ 32, ++ FALSE, ++ 0, ++ complain_overflow_bitfield, ++ coff_arm_reloc, ++ "ARM_RVA32", ++ TRUE, /* partial_inplace. */ ++ 0xffffffff, ++ 0xffffffff, ++ PCRELOFFSET), ++ EMPTY_HOWTO (-1), ++ HOWTO (ARM_THUMB12, ++ 1, ++ 1, ++ 11, ++ TRUE, ++ 0, ++ complain_overflow_signed, ++ bfd_coff_generic_reloc, ++ "ARM_THUMB12", ++ FALSE, ++ 0x000007ff, ++ 0x000007ff, ++ PCRELOFFSET), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ EMPTY_HOWTO (-1), ++ HOWTO (ARM_SECTION, ++ 0, ++ 1, ++ 16, ++ FALSE, ++ 0, ++ complain_overflow_bitfield, ++ coff_arm_reloc, ++ "ARM_SECTION", ++ TRUE, /* partial_inplace. */ ++ 0x0000ffff, ++ 0x0000ffff, ++ PCRELOFFSET), ++ HOWTO (ARM_SECREL, ++ 0, ++ 2, ++ 32, ++ FALSE, ++ 0, ++ complain_overflow_bitfield, ++ coff_arm_reloc, ++ "ARM_SECREL", ++ TRUE, /* partial_inplace. */ ++ 0xffffffff, ++ 0xffffffff, ++ PCRELOFFSET), ++ EMPTY_HOWTO (-1), /* ARM_MOV32A */ ++ HOWTO (ARM_MOV32T, ++ 0, ++ 4, ++ 64, ++ FALSE, ++ 0, ++ complain_overflow_bitfield, ++ coff_reloc_mov32t, ++ "ARM_MOV32T", ++ FALSE, /* partial_inplace. */ ++ 0x040f70ff040f70ffll, ++ 0x040f70ff040f70ffll, ++ FALSE), ++ HOWTO (ARM_BRANCH20T, ++ 1, ++ 2, ++ 19, ++ TRUE, ++ 0, ++ complain_overflow_bitfield, ++ bfd_coff_generic_reloc, ++ "ARM_BRANCH20T", ++ FALSE, /* partial_inplace. */ ++ 0x043f2fff, ++ 0x043f2fff, ++ PCRELOFFSET), ++ EMPTY_HOWTO (-1), /* unallocated */ ++ HOWTO (ARM_BRANCH24T, ++ 1, ++ 2, ++ 24, ++ TRUE, ++ 0, ++ complain_overflow_bitfield, ++ bfd_coff_generic_reloc, ++ "ARM_BRANCH24T", ++ FALSE, /* partial_inplace. */ ++ 0x07ff2fff, ++ 0x07ff2fff, ++ PCRELOFFSET), ++ HOWTO (ARM_BLX23T, ++ 2, ++ 2, ++ 24, ++ TRUE, ++ 0, ++ complain_overflow_bitfield, ++ bfd_coff_generic_reloc, ++ "ARM_BLX23T", ++ FALSE, /* partial_inplace. */ ++ 0x07ff2fff, ++ 0x07ff2fff, ++ PCRELOFFSET), ++#endif + #ifdef ARM_WINCE + HOWTO (ARM_26D, + 2, +@@ -309,7 +478,8 @@ + 0xffffffff, + 0xffffffff, + PCRELOFFSET), +-#else /* not ARM_WINCE */ ++#endif ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + HOWTO (ARM_8, + 0, + 0, +@@ -494,7 +664,7 @@ + 0x07ff07ff, + 0x07ff07ff, + PCRELOFFSET) +-#endif /* not ARM_WINCE */ ++#endif + }; + + #define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto) +@@ -537,7 +707,7 @@ + if (rel->r_type == ARM_RVA32) + *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase; + +-#if defined COFF_WITH_PE && defined ARM_WINCE ++#if defined COFF_WITH_PE && (defined(ARM_WINCE) || defined(ARM_WINNT)) + if (rel->r_type == ARM_SECREL) + { + bfd_vma osect_vma; +@@ -565,6 +735,22 @@ + return howto; + } + ++#ifdef ARM_WINNT ++/* Used by the assembler. */ ++ ++static bfd_reloc_status_type ++coff_reloc_mov32t (bfd *abfd ATTRIBUTE_UNUSED, ++ arelent *reloc_entry ATTRIBUTE_UNUSED, ++ asymbol *symbol ATTRIBUTE_UNUSED, ++ void * data ATTRIBUTE_UNUSED, ++ asection *input_section ATTRIBUTE_UNUSED, ++ bfd *output_bfd ATTRIBUTE_UNUSED, ++ char **error_message ATTRIBUTE_UNUSED) ++{ ++ /* This is dead simple at present. */ ++ return bfd_reloc_ok; ++} ++#else + /* Used by the assembler. */ + + static bfd_reloc_status_type +@@ -808,6 +994,7 @@ + input_section, output_bfd, error_message, + b12); + } ++#endif /* not ARM_WINNT */ + + static const struct reloc_howto_struct * + coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code) +@@ -826,10 +1013,20 @@ + + switch (code) + { ++#ifdef ARM_WINNT ++ ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_BLX23T); ++ ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_BLX23T); ++ ASTD (BFD_RELOC_THUMB_PCREL_BRANCH25, ARM_BRANCH24T); ++ ASTD (BFD_RELOC_THUMB_PCREL_BRANCH20, ARM_BRANCH20T); ++ ASTD (BFD_RELOC_ARM_THUMB_MOVW, ARM_MOV32T); ++ ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_BLX23T); ++#endif + #ifdef ARM_WINCE ++ ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26); ++#endif ++#if defined(ARM_WINCE) || defined(ARM_WINNT) + ASTD (BFD_RELOC_32, ARM_32); + ASTD (BFD_RELOC_RVA, ARM_RVA32); +- ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26); + ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12); + ASTD (BFD_RELOC_32_SECREL, ARM_SECREL); + #else +@@ -876,7 +1073,7 @@ + #define BADMAG(x) ARMBADMAG(x) + #define ARM 1 /* Customize coffcode.h. */ + +-#ifndef ARM_WINCE ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + /* Make sure that the 'r_offset' field is copied properly + so that identical binaries will compare the same. */ + #define SWAP_IN_RELOC_OFFSET H_GET_32 +@@ -952,7 +1149,7 @@ + return FALSE; + } + +-#ifndef ARM_WINCE ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + /* The thumb form of a long branch is a bit finicky, because the offset + encoding is split over two fields, each in it's own instruction. They + can occur in any order. So given a thumb form of long branch, and an +@@ -1036,7 +1233,7 @@ + + return myh; + } +-#endif /* not ARM_WINCE */ ++#endif /* not ARM_WINCE && not ARM_WINNT*/ + + static struct coff_link_hash_entry * + find_arm_glue (struct bfd_link_info *info, +@@ -1101,7 +1298,7 @@ + */ + + #define THUMB2ARM_GLUE_SIZE (globals->support_old_code ? 20 : 8) +-#ifndef ARM_WINCE ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + static const insn16 t2a1_bx_pc_insn = 0x4778; + static const insn16 t2a2_noop_insn = 0x46c0; + static const insn32 t2a3_b_insn = 0xea000000; +@@ -1214,6 +1411,7 @@ + if (howto == NULL) + return FALSE; + ++#ifndef ARM_WINNT + /* The relocation_section function will skip pcrel_offset relocs + when doing a relocatable link. However, we want to convert + ARM_26 to ARM_26D relocs if possible. We return a fake howto in +@@ -1258,7 +1456,7 @@ + if (howto->pc_relative && !info->relocatable) + addend -= 8; + #endif +- ++#endif + /* If we are doing a relocatable link, then we can just ignore + a PC relative reloc that is pcrel_offset. It will already + have the correct value. If this is not a relocatable link, +@@ -1408,7 +1606,7 @@ + } + } + +-#ifndef ARM_WINCE ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + /* Note: We used to check for ARM_THUMB9 and ARM_THUMB12. */ + else if (howto->type == ARM_THUMB23) + { +@@ -1581,7 +1779,28 @@ + if (done) + rstat = bfd_reloc_ok; +-#ifndef ARM_WINCE +- /* Only perform this fix during the final link, not a relocatable link. */ ++#ifdef ARM_WINNT ++ else if (howto->type == ARM_MOV32T) ++{ ++ ++ // (TargetAddr + ImageBase) >> 0 ++ // (TargetAddr + ImageBase) >> 16 ++ ++ //rel stands for relocation not relative ++ //what address is this ? current ? check rel->r_vaddr also ++ bfd_vma address = rel->r_vaddr - input_section->vma; ++ // ++ // ++ // what is contents ? input_bfd ? ++ ++ int size = bfd_get_reloc_size (howto); //should be 8 ++ ++ _bfd_error_handler (_("Test: address: %08x, realdir: %08x, sectionvma: %08x,"), ++ address, rel->r_vaddr, input_section->vma); ++ ++ //bfd_put_32 (input_bfd, x, location); ++ ++} ++#elif !defined(ARM_WINCE) + else if (! info->relocatable + && howto->type == ARM_THUMB23) + { +@@ -1877,7 +2097,7 @@ + return; + } + +-#ifndef ARM_WINCE ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + static void + record_thumb_to_arm_glue (struct bfd_link_info * info, + struct coff_link_hash_entry * h) +@@ -1952,7 +2172,7 @@ + + return; + } +-#endif /* not ARM_WINCE */ ++#endif /* not ARM_WINCE && not ARM_WINNT */ + + /* Select a BFD to be used to hold the sections used by the glue code. + This function is called from the linker scripts in ld/emultempl/ +@@ -2093,7 +2313,7 @@ + record_arm_to_thumb_glue (info, h); + break; + +-#ifndef ARM_WINCE ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + case ARM_THUMB23: + /* This one is a call from thumb code. We used to look + for ARM_THUMB9 and ARM_THUMB12 as well. We need to look +diff -Naur binutils-2.25-orig/bfd/coffcode.h binutils-2.25/bfd/coffcode.h +--- binutils-2.25-orig/bfd/coffcode.h 2014-12-23 08:47:10.000000000 +0000 ++++ binutils-2.25/bfd/coffcode.h 2015-06-30 05:00:16.199391000 +0100 +@@ -2127,10 +2127,14 @@ + case ARMMAGIC: + case ARMPEMAGIC: + case THUMBPEMAGIC: ++ case ARMNTPEMAGIC: + arch = bfd_arch_arm; + machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); + if (machine == bfd_mach_arm_unknown) + { ++#ifdef ARM_WINNT ++ machine = bfd_mach_arm_XScale; ++#else + switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) + { + case F_ARM_2: machine = bfd_mach_arm_2; break; +@@ -2147,6 +2151,7 @@ + currently the XScale. */ + case F_ARM_5: machine = bfd_mach_arm_XScale; break; + } ++#endif + } + break; + #endif +@@ -2897,12 +2902,17 @@ + + #ifdef ARMMAGIC + case bfd_arch_arm: ++#ifdef ARM_WINNT ++ * magicp = ARMNTPEMAGIC; ++#endif + #ifdef ARM_WINCE + * magicp = ARMPEMAGIC; +-#else ++#endif ++#if ! defined(ARM_WINCE) && ! defined(ARM_WINNT) + * magicp = ARMMAGIC; + #endif + * flagsp = 0; ++#ifndef ARM_WINNT + if (APCS_SET (abfd)) + { + if (APCS_26_FLAG (abfd)) +@@ -2931,6 +2941,7 @@ + case bfd_mach_arm_5TE: * flagsp |= F_ARM_5; break; + case bfd_mach_arm_XScale: * flagsp |= F_ARM_5; break; + } ++#endif + return TRUE; + #endif + +@@ -3142,8 +3153,12 @@ + #ifdef COFF_IMAGE_WITH_PE + int page_size; + ++#ifdef ARM_WINNT ++ if (coff_data (abfd)->link_info) ++#else + if (coff_data (abfd)->link_info + || (pe_data (abfd) && pe_data (abfd)->pe_opthdr.FileAlignment)) ++#endif + { + page_size = pe_data (abfd)->pe_opthdr.FileAlignment; + +@@ -5402,6 +5417,10 @@ + } + #endif + ++#ifndef coff_bfd_link_hash_table_free ++#define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free ++#endif ++ + /* If coff_relocate_section is defined, we can use the optimized COFF + backend linker. Otherwise we must continue to use the old linker. */ + +diff -Naur binutils-2.25-orig/bfd/config.bfd binutils-2.25/bfd/config.bfd +--- binutils-2.25-orig/bfd/config.bfd 2014-10-14 08:32:02.000000000 +0100 ++++ binutils-2.25/bfd/config.bfd 2015-06-30 04:26:43.239482900 +0100 +@@ -306,6 +306,12 @@ + targ_underscore=no + targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX" + ;; ++ arm*-*-mingw32* | arm*-*-cygwin*) ++ targ_defvec=arm_pe_winnt_le_vec ++ targ_selvecs="arm_pe_winnt_le_vec arm_pe_winnt_be_vec arm_pei_winnt_le_vec arm_pei_winnt_be_vec" ++ targ_underscore=no ++ targ_cflags="-DARM_WINNT -DARM_COFF_BUGFIX" ++ ;; + arm-*-pe*) + targ_defvec=arm_pe_le_vec + targ_selvecs="arm_pe_le_vec arm_pe_be_vec arm_pei_le_vec arm_pei_be_vec" +diff -Naur binutils-2.25-orig/bfd/configure binutils-2.25/bfd/configure +--- binutils-2.25-orig/bfd/configure 2014-12-23 14:22:04.000000000 +0000 ++++ binutils-2.25/bfd/configure 2015-06-30 04:26:43.255099400 +0100 +@@ -15322,12 +15322,16 @@ + arm_pe_epoc_le_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; + arm_pe_wince_be_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_pe_wince_le_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pe_winnt_be_vec) tb="$tb pe-arm-winnt.lo pe-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pe_winnt_le_vec) tb="$tb pe-arm-winnt.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_be_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_le_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_epoc_be_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_epoc_le_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_wince_be_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_wince_le_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pei_winnt_be_vec) tb="$tb pei-arm-winnt.lo pei-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pei_winnt_le_vec) tb="$tb pei-arm-winnt.lo pei-arm.lo peigen.lo cofflink.lo " ;; + avr_elf32_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; + bfin_elf32_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; + bfin_elf32_fdpic_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; +diff -Naur binutils-2.25-orig/bfd/configure.ac binutils-2.25/bfd/configure.ac +--- binutils-2.25-orig/bfd/configure.ac 2014-10-14 08:32:02.000000000 +0100 ++++ binutils-2.25/bfd/configure.ac 2015-06-30 04:26:43.270725400 +0100 +@@ -723,12 +723,16 @@ + arm_pe_epoc_le_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; + arm_pe_wince_be_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_pe_wince_le_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pe_winnt_be_vec) tb="$tb pe-arm-winnt.lo pe-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pe_winnt_le_vec) tb="$tb pe-arm-winnt.lo pe-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_be_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_le_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_epoc_be_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_epoc_le_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_wince_be_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; + arm_pei_wince_le_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pei_winnt_be_vec) tb="$tb pei-arm-winnt.lo pei-arm.lo peigen.lo cofflink.lo " ;; ++ arm_pei_winnt_le_vec) tb="$tb pei-arm-winnt.lo pei-arm.lo peigen.lo cofflink.lo " ;; + avr_elf32_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; + bfin_elf32_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; + bfin_elf32_fdpic_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; +diff -Naur binutils-2.25-orig/bfd/pe-arm-winnt.c binutils-2.25/bfd/pe-arm-winnt.c +--- binutils-2.25-orig/bfd/pe-arm-winnt.c 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.25/bfd/pe-arm-winnt.c 2015-06-30 04:26:43.270725400 +0100 +@@ -0,0 +1,45 @@ ++/* BFD back-end for ARM WINNT PE files. ++ Copyright (C) 2006-2014 Free Software Foundation, Inc. ++ ++ This file is part of BFD, the Binary File Descriptor library. ++ ++ This program 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 3 of the License, or ++ (at your option) any later version. ++ ++ This program 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 this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++ MA 02110-1301, USA. */ ++ ++#define TARGET_UNDERSCORE 0 ++#define USER_LABEL_PREFIX "" ++ ++#define TARGET_LITTLE_SYM arm_pe_winnt_le_vec ++#define TARGET_LITTLE_NAME "pe-arm-winnt-little" ++#define TARGET_BIG_SYM arm_pe_winnt_be_vec ++#define TARGET_BIG_NAME "pe-arm-winnt-big" ++ ++#define bfd_arm_allocate_interworking_sections \ ++ bfd_arm_winnt_pe_allocate_interworking_sections ++#define bfd_arm_get_bfd_for_interworking \ ++ bfd_arm_winnt_pe_get_bfd_for_interworking ++#define bfd_arm_process_before_allocation \ ++ bfd_arm_winnt_pe_process_before_allocation ++ ++#define LOCAL_LABEL_PREFIX "." ++ ++#include "sysdep.h" ++#include "bfd.h" ++ ++#undef bfd_pe_print_pdata ++#define bfd_pe_print_pdata _bfd_pe_print_ce_compressed_pdata ++ ++#include "pe-arm.c" ++ +diff -Naur binutils-2.25-orig/bfd/pei-arm-winnt.c binutils-2.25/bfd/pei-arm-winnt.c +--- binutils-2.25-orig/bfd/pei-arm-winnt.c 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.25/bfd/pei-arm-winnt.c 2015-06-30 04:26:43.270725400 +0100 +@@ -0,0 +1,31 @@ ++/* BFD back-end for ARM WINNT PE IMAGE COFF files. ++ Copyright (C) 2006-2014 Free Software Foundation, Inc. ++ ++ This file is part of BFD, the Binary File Descriptor library. ++ ++ This program 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 3 of the License, or ++ (at your option) any later version. ++ ++ This program 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 this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++ MA 02110-1301, USA. */ ++ ++#define TARGET_UNDERSCORE 0 ++#define USER_LABEL_PREFIX "" ++ ++#define TARGET_LITTLE_SYM arm_pei_winnt_le_vec ++#define TARGET_LITTLE_NAME "pei-arm-winnt-little" ++#define TARGET_BIG_SYM arm_pei_winnt_be_vec ++#define TARGET_BIG_NAME "pei-arm-winnt-big" ++ ++#define LOCAL_LABEL_PREFIX "." ++ ++#include "pei-arm.c" +diff -Naur binutils-2.25-orig/bfd/peicode.h binutils-2.25/bfd/peicode.h +--- binutils-2.25-orig/bfd/peicode.h 2014-12-23 08:47:10.000000000 +0000 ++++ binutils-2.25/bfd/peicode.h 2015-06-30 05:48:17.383337900 +0100 +@@ -719,6 +719,13 @@ + 16, 12 + }, + #endif ++#ifdef ARMNTPEMAGIC ++ { ARMNTPEMAGIC, ++ { 0x40, 0xf2, 0x00, 0x0c, 0xc0, 0xf2, ++ 0x00, 0x0c, 0xdc, 0xf8, 0x00, 0xf0 }, ++ 12, 0 ++ }, ++#endif + { 0, { 0 }, 0, 0 } + }; + +@@ -1163,6 +1170,17 @@ + } + #endif + break; ++ ++ case IMAGE_FILE_MACHINE_ARMNT: ++#ifdef ARMNTPEMAGIC ++ { ++ extern const bfd_target TARGET_LITTLE_SYM; ++ ++ if (abfd->xvec == & TARGET_LITTLE_SYM) ++ magic = ARMNTPEMAGIC; ++ } ++#endif ++ break; + + case IMAGE_FILE_MACHINE_POWERPC: + /* We no longer support PowerPC. */ +diff -Naur binutils-2.25-orig/bfd/peXXigen.c binutils-2.25/bfd/peXXigen.c +--- binutils-2.25-orig/bfd/peXXigen.c 2014-12-23 08:47:10.000000000 +0000 ++++ binutils-2.25/bfd/peXXigen.c 2015-06-30 04:26:43.286382900 +0100 +@@ -756,6 +756,10 @@ + PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, + aouthdr_out->standard.text_start); + ++#ifdef ARM_WINNT ++ aouthdr_out->standard.entry[0] |= 1; ++#endif ++ + #if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) + /* PE32+ does not have data_start member! */ + PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, +@@ -781,6 +785,9 @@ + H_PUT_32 (abfd, extra->CheckSum, aouthdr_out->CheckSum); + H_PUT_16 (abfd, extra->Subsystem, aouthdr_out->Subsystem); + H_PUT_16 (abfd, extra->DllCharacteristics, aouthdr_out->DllCharacteristics); ++#ifdef ARM_WINNT ++ H_PUT_16 (abfd, 0x8540,aouthdr_out->DllCharacteristics); ++#endif + PUT_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, extra->SizeOfStackReserve, + aouthdr_out->SizeOfStackReserve); + PUT_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, extra->SizeOfStackCommit, +@@ -880,6 +887,10 @@ + H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr); + H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags); + ++#ifdef ARM_WINNT ++ filehdr_out->f_flags[0] &= ~IMAGE_FILE_RELOCS_STRIPPED; ++#endif ++ + /* Put in extra dos header stuff. This data remains essentially + constant, it just has to be tacked on to the beginning of all exes + for NT. */ +diff -Naur binutils-2.25-orig/bfd/targets.c binutils-2.25/bfd/targets.c +--- binutils-2.25-orig/bfd/targets.c 2014-11-04 09:54:41.000000000 +0000 ++++ binutils-2.25/bfd/targets.c 2015-06-30 04:26:43.301981000 +0100 +@@ -597,12 +597,16 @@ + extern const bfd_target arm_pe_epoc_le_vec; + extern const bfd_target arm_pe_wince_be_vec; + extern const bfd_target arm_pe_wince_le_vec; ++extern const bfd_target arm_pe_winnt_be_vec; ++extern const bfd_target arm_pe_winnt_le_vec; + extern const bfd_target arm_pei_be_vec; + extern const bfd_target arm_pei_le_vec; + extern const bfd_target arm_pei_epoc_be_vec; + extern const bfd_target arm_pei_epoc_le_vec; + extern const bfd_target arm_pei_wince_be_vec; + extern const bfd_target arm_pei_wince_le_vec; ++extern const bfd_target arm_pei_winnt_be_vec; ++extern const bfd_target arm_pei_winnt_le_vec; + extern const bfd_target avr_elf32_vec; + extern const bfd_target bfin_elf32_vec; + extern const bfd_target bfin_elf32_fdpic_vec; +@@ -990,12 +994,16 @@ + &arm_pe_epoc_le_vec, + &arm_pe_wince_be_vec, + &arm_pe_wince_le_vec, ++ &arm_pe_winnt_be_vec, ++ &arm_pe_winnt_le_vec, + &arm_pei_be_vec, + &arm_pei_le_vec, + &arm_pei_epoc_be_vec, + &arm_pei_epoc_le_vec, + &arm_pei_wince_be_vec, + &arm_pei_wince_le_vec, ++ &arm_pei_winnt_be_vec, ++ &arm_pei_winnt_le_vec, + + &avr_elf32_vec, + +diff -Naur binutils-2.25-orig/binutils/configure binutils-2.25/binutils/configure +--- binutils-2.25-orig/binutils/configure 2014-12-23 14:22:06.000000000 +0000 ++++ binutils-2.25/binutils/configure 2015-06-30 04:26:43.317599200 +0100 +@@ -14118,6 +14118,16 @@ + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; ++ arm*-*-mingw* | arm*-*-cygwin*) ++ BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' ++ if test -z "$DLLTOOL_DEFAULT"; then ++ DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINNT" ++ fi ++ DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINNT -DDLLTOOL_ARM" ++ BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ++ BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' ++ BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' ++ ;; + arm-*-pe*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then +diff -Naur binutils-2.25-orig/binutils/configure.ac binutils-2.25/binutils/configure.ac +--- binutils-2.25-orig/binutils/configure.ac 2014-11-04 09:54:41.000000000 +0000 ++++ binutils-2.25/binutils/configure.ac 2015-06-30 04:26:43.317599200 +0100 +@@ -303,6 +303,16 @@ + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; ++ arm*-*-mingw* | arm*-*-cygwin*) ++ BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' ++ if test -z "$DLLTOOL_DEFAULT"; then ++ DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE" ++ fi ++ DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM" ++ BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ++ BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' ++ BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' ++ ;; + arm-*-pe*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then +diff -Naur binutils-2.25-orig/binutils/dlltool.c binutils-2.25/binutils/dlltool.c +--- binutils-2.25-orig/binutils/dlltool.c 2014-10-14 08:32:02.000000000 +0100 ++++ binutils-2.25/binutils/dlltool.c 2015-06-30 07:39:20.959620600 +0100 +@@ -444,6 +444,10 @@ + static const char *mname = "arm-wince"; + #endif + ++#ifdef DLLTOOL_DEFAULT_ARM_WINNT ++static const char *mname = "arm-winnt"; ++#endif ++ + #ifdef DLLTOOL_DEFAULT_I386 + static const char *mname = "i386"; + #endif +@@ -529,6 +533,14 @@ + 0, 0, 0, 0 + }; + ++static const unsigned char thumb2_jtab[] = ++{ ++ 0x40, 0xf2, 0x00, 0x0c, /* mov.w ip, #0 */ ++ 0xc0, 0xf2, 0x00, 0x0c, /* mov.t ip, #0 */ ++ 0xdc, 0xf8, 0x00, 0xf0, /* ldr.w pc, [ip] */ ++ 0, 0, 0, 0 ++}; ++ + static const unsigned char arm_interwork_jtab[] = + { + 0x04, 0xc0, 0x9f, 0xe5, /* ldr ip, [pc] */ +@@ -761,6 +773,16 @@ + i386_x64_dljtab, sizeof (i386_x64_dljtab), 2, 9, 14, i386_x64_trampoline + } + , ++ { ++#define MARM_WINNT 12 ++ "arm-winnt", ".byte", ".short", ".long", ".asciz", "@", ++ "mov.w\tip,:lower16:\t.short\nmov.t\tip,:upper16:\t.short\nldr.w\tpc,[ip]", ++ ".global", ".space", ".align\t2",".align\t4", "", ++ "pe-arm-winnt-little", bfd_arch_arm, ++ thumb2_jtab, sizeof (thumb2_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 } + }; + +@@ -911,6 +933,7 @@ + case MMCORE_ELF_LE: + case MARM_EPOC: + case MARM_WINCE: ++ case MARM_WINNT: + break; + default: + /* xgettext:c-format */ +@@ -937,6 +960,7 @@ + case MMCORE_ELF_LE: + case MARM_EPOC: + case MARM_WINCE: ++ case MARM_WINNT: + return ".rva\t"; + default: + /* xgettext:c-format */ +@@ -961,6 +985,7 @@ + case MMCORE_ELF_LE: + case MARM_EPOC: + case MARM_WINCE: ++ case MARM_WINNT: + break; + case M386: + case MX86: +diff -Naur binutils-2.25-orig/configure.ac binutils-2.25/configure.ac +--- binutils-2.25-orig/configure.ac 2014-12-23 14:38:42.000000000 +0000 ++++ binutils-2.25/configure.ac 2015-06-30 04:26:43.333224700 +0100 +@@ -757,6 +757,9 @@ + x86_64-*-mingw*) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; ++ arm*-w64-mingw*) ++ noconfigdirs="$noconfigdirs ${libgcj}" ++ ;; + mmix-*-*) + noconfigdirs="$noconfigdirs target-libffi target-boehm-gc" + ;; +diff -Naur binutils-2.25-orig/gas/config/tc-arm.c binutils-2.25/gas/config/tc-arm.c +--- binutils-2.25-orig/gas/config/tc-arm.c 2014-10-14 08:32:03.000000000 +0100 ++++ binutils-2.25/gas/config/tc-arm.c 2015-06-30 04:26:43.364474600 +0100 +@@ -138,7 +138,11 @@ + static int warn_on_deprecated = TRUE; + + /* Understand CodeComposer Studio assembly syntax. */ ++#ifdef TE_WINNT ++bfd_boolean codecomposer_syntax = TRUE; ++#else + bfd_boolean codecomposer_syntax = FALSE; ++#endif + + /* Variables that we set while parsing command-line options. Once all + options have been read we re-process these values to set the real +@@ -868,7 +872,11 @@ + + /* This array holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful. */ ++#ifdef TE_WINNT ++char arm_comment_chars[] = "@;"; ++#else + char arm_comment_chars[] = "@"; ++#endif + + /* This array holds the chars that only start a comment at the beginning of + a line. If the line seems to have the form '# 123 filename' +@@ -879,7 +887,11 @@ + /* Also note that comments like this one will always work. */ + const char line_comment_chars[] = "#"; + ++#ifdef TE_WINNT ++char arm_line_separator_chars[] = "\0\0"; ++#else + char arm_line_separator_chars[] = ";"; ++#endif + + /* Chars that can be used to separate mant + from exp in floating point numbers. */ +@@ -3474,17 +3486,21 @@ + pool->symbol = NULL; + } + +-#ifdef OBJ_ELF ++#if defined(OBJ_ELF) || defined(TE_WINNT) + /* Forward declarations for functions below, in the MD interface + section. */ + static void fix_new_arm (fragS *, int, short, expressionS *, int, int); ++#endif ++#ifdef OBJ_ELF + static valueT create_unwind_entry (int); + static void start_unwind_section (const segT, int); + static void add_unwind_opcode (valueT, int); + static void flush_pending_unwind (void); ++#endif + + /* Directives: Data. */ + ++#if defined(OBJ_ELF) || defined(TE_WINNT) + static void + s_arm_elf_cons (int nbytes) + { +@@ -3737,7 +3753,9 @@ + + demand_empty_rest_of_line (); + } ++#endif + ++#ifdef OBJ_ELF + /* Directives: AEABI stack-unwind tables. */ + + /* Parse an unwind_fnstart directive. Simply records the current location. */ +@@ -4693,13 +4711,17 @@ + { "object_arch", s_arm_object_arch, 0 }, + { "fpu", s_arm_fpu, 0 }, + { "arch_extension", s_arm_arch_extension, 0 }, +-#ifdef OBJ_ELF ++#if defined(OBJ_ELF) || defined(TE_WINNT) + { "word", s_arm_elf_cons, 4 }, + { "long", s_arm_elf_cons, 4 }, + { "inst.n", s_arm_elf_inst, 2 }, + { "inst.w", s_arm_elf_inst, 4 }, + { "inst", s_arm_elf_inst, 0 }, + { "rel31", s_arm_rel31, 0 }, ++#else ++ { "word", cons, 4}, ++#endif ++#ifdef OBJ_ELF + { "fnstart", s_arm_unwind_fnstart, 0 }, + { "fnend", s_arm_unwind_fnend, 0 }, + { "cantunwind", s_arm_unwind_cantunwind, 0 }, +@@ -4715,8 +4737,6 @@ + { "eabi_attribute", s_arm_eabi_attribute, 0 }, + { "tlsdescseq", s_arm_tls_descseq, 0 }, + #else +- { "word", cons, 4}, +- + /* These are used for dwarf. */ + {"2byte", cons, 2}, + {"4byte", cons, 4}, +@@ -21520,7 +21540,7 @@ + case BFD_RELOC_ARM_PCREL_BRANCH: + case BFD_RELOC_ARM_PCREL_JUMP: + case BFD_RELOC_ARM_PLT32: +-#ifdef TE_WINCE ++#if defined(TE_WINCE) || defined(TE_WINNT) + /* When handling fixups immediately, because we have already + discovered the value of a symbol, or the address of the frag involved + we must account for the offset by +8, as the OS loader will never see the reloc. +@@ -22654,7 +22674,7 @@ + case BFD_RELOC_32_SECREL: + #endif + if (fixP->fx_done || !seg->use_rela_p) +-#ifdef TE_WINCE ++#if defined(TE_WINCE) || defined (TE_WINNT) + /* For WinCE we only do this for pcrel fixups. */ + if (fixP->fx_done || fixP->fx_pcrel) + #endif +diff -Naur binutils-2.25-orig/gas/config/tc-arm.h binutils-2.25/gas/config/tc-arm.h +--- binutils-2.25-orig/gas/config/tc-arm.h 2014-10-14 08:32:03.000000000 +0100 ++++ binutils-2.25/gas/config/tc-arm.h 2015-06-30 04:26:43.364474600 +0100 +@@ -65,6 +65,8 @@ + # if defined TE_PE + # if defined TE_EPOC + # define TARGET_FORMAT (target_big_endian ? "epoc-pe-arm-big" : "epoc-pe-arm-little") ++# elif defined TE_WINNT ++# define TARGET_FORMAT (target_big_endian ? "pe-arm-winnt-big" : "pe-arm-winnt-little") + # elif defined TE_WINCE + # define TARGET_FORMAT (target_big_endian ? "pe-arm-wince-big" : "pe-arm-wince-little") + # else +diff -Naur binutils-2.25-orig/gas/config/te-winnt-pe.h binutils-2.25/gas/config/te-winnt-pe.h +--- binutils-2.25-orig/gas/config/te-winnt-pe.h 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.25/gas/config/te-winnt-pe.h 2015-06-30 04:26:43.380111600 +0100 +@@ -0,0 +1,21 @@ ++/* Copyright (C) 2007-2014 Free Software Foundation, Inc. ++ ++ This file is part of GAS, the GNU Assembler. ++ ++ GAS 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 3, ++ or (at your option) any later version. ++ ++ GAS 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 GAS; see the file COPYING. If not, write to the Free ++ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA ++ 02110-1301, USA. */ ++ ++#define TE_WINNT ++#include "te-pe.h" +diff -Naur binutils-2.25-orig/gas/configure.tgt binutils-2.25/gas/configure.tgt +--- binutils-2.25-orig/gas/configure.tgt 2014-10-14 08:32:03.000000000 +0100 ++++ binutils-2.25/gas/configure.tgt 2015-06-30 04:26:43.380111600 +0100 +@@ -154,6 +154,8 @@ + arm-epoc-pe) fmt=coff em=epoc-pe ;; + arm-wince-pe | arm-*-wince | arm*-*-mingw32ce* | arm*-*-cegcc*) + fmt=coff em=wince-pe ;; ++ arm*-*-mingw* | arm*-*-cygwin*) ++ fmt=coff em=winnt-pe ;; + arm-*-pe) fmt=coff em=pe ;; + arm-*-riscix*) fmt=aout em=riscix ;; + +diff -Naur binutils-2.25-orig/include/coff/arm.h binutils-2.25/include/coff/arm.h +--- binutils-2.25-orig/include/coff/arm.h 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/include/coff/arm.h 2015-06-30 05:40:16.594702400 +0100 +@@ -81,10 +81,10 @@ + + #define ARMPEMAGIC 0x1c0 + #define THUMBPEMAGIC 0x1c2 +-#define ARMV7PEMAGIC 0x1c4 ++#define ARMNTPEMAGIC 0x1c4 + + #undef ARMBADMAG +-#define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC) && ((x).f_magic != ARMV7PEMAGIC)) ++#define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC) && ((x).f_magic != ARMNTPEMAGIC)) + + #define OMAGIC 0404 /* object files, eg as output */ + #define ZMAGIC 0413 /* demand load format, eg normal ld output */ +@@ -102,7 +102,7 @@ + #define _LIT ".rdata" + + /********************** RELOCATION DIRECTIVES **********************/ +-#ifdef ARM_WINCE ++#if defined (ARM_WINCE) || defined (ARM_WINNT) + struct external_reloc + { + char r_vaddr[4]; +diff -Naur binutils-2.25-orig/include/coff/pe.h binutils-2.25/include/coff/pe.h +--- binutils-2.25-orig/include/coff/pe.h 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/include/coff/pe.h 2015-06-30 04:28:27.600863700 +0100 +@@ -149,6 +149,7 @@ + #define IMAGE_FILE_MACHINE_SH4 0x01a6 + #define IMAGE_FILE_MACHINE_SH5 0x01a8 + #define IMAGE_FILE_MACHINE_THUMB 0x01c2 ++#define IMAGE_FILE_MACHINE_ARMNT 0x01c4 + #define IMAGE_FILE_MACHINE_TRICORE 0x0520 + #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 + #define IMAGE_FILE_MACHINE_AMD64 0x8664 +diff -Naur binutils-2.25-orig/ld/configure.tgt binutils-2.25/ld/configure.tgt +--- binutils-2.25-orig/ld/configure.tgt 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/ld/configure.tgt 2015-06-30 04:26:43.395723600 +0100 +@@ -77,6 +77,11 @@ + LIB_PATH='${tooldir}/lib/w32api' ;; + arm-wince-pe | arm-*-wince | arm*-*-mingw32ce*) + targ_emul=arm_wince_pe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;; ++arm*-*-mingw*) ++ targ_emul=arm_winnt_pe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;; ++arm*-*-cygwin*) ++ targ_emul=arm_winnt_pe ; targ_extra_ofiles="deffilep.o pe-dll.o" ; ++ test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;; + arm-*-pe) targ_emul=armpe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;; + arm-*-aout | armel-*-aout) targ_emul=armaoutl ;; + armeb-*-aout) targ_emul=armaoutb ;; +@@ -821,7 +826,7 @@ + NATIVE_LIB_DIRS='/lib' + ;; + +-i[03-9x]86-*-cygwin* | x86_64-*-cygwin*) ++i[03-9x]86-*-cygwin* | x86_64-*-cygwin* | arm*-*-cygwin*) + NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api' + ;; + +diff -Naur binutils-2.25-orig/ld/emulparams/arm_winnt_pe.sh binutils-2.25/ld/emulparams/arm_winnt_pe.sh +--- binutils-2.25-orig/ld/emulparams/arm_winnt_pe.sh 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.25/ld/emulparams/arm_winnt_pe.sh 2015-06-30 04:26:43.395723600 +0100 +@@ -0,0 +1,11 @@ ++ARCH=arm ++SCRIPT_NAME=pe ++OUTPUT_FORMAT="pei-arm-winnt-little" ++LITTLE_OUTPUT_FORMAT="pei-arm-winnt-little" ++BIG_OUTPUT_FORMAT="pei-arm-winnt-big" ++RELOCATEABLE_OUTPUT_FORMAT="pe-arm-winnt-little" ++TEMPLATE_NAME=pe ++SUBSYSTEM=PE_DEF_SUBSYSTEM ++INITIAL_SYMBOL_CHAR=\"\" ++TARGET_PAGE_SIZE=0x1000 ++GENERATE_AUTO_IMPORT_SCRIPT=1 +diff -Naur binutils-2.25-orig/ld/emultempl/pe.em binutils-2.25/ld/emultempl/pe.em +--- binutils-2.25-orig/ld/emultempl/pe.em 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/ld/emultempl/pe.em 2015-06-30 04:26:43.395723600 +0100 +@@ -41,6 +41,7 @@ + + #if defined(TARGET_IS_armpe) \ + || defined(TARGET_IS_arm_epoc_pe) \ ++ || defined(TARGET_IS_arm_winnt_pe) \ + || defined(TARGET_IS_arm_wince_pe) + #define bfd_arm_allocate_interworking_sections \ + bfd_${EMULATION_NAME}_allocate_interworking_sections +@@ -96,6 +97,7 @@ + || defined(TARGET_IS_shpe) \ + || defined(TARGET_IS_armpe) \ + || defined(TARGET_IS_arm_epoc_pe) \ ++ || defined(TARGET_IS_arm_winnt_pe) \ + || defined(TARGET_IS_arm_wince_pe) + #define DLL_SUPPORT + #endif +@@ -106,7 +108,9 @@ + #define DEFAULT_PSEUDO_RELOC_VERSION 1 + #endif + +-#if defined(TARGET_IS_i386pe) || ! defined(DLL_SUPPORT) ++#if defined(TARGET_IS_i386pe) \ ++ || defined(TARGET_IS_arm_winnt_pe) \ ++ || ! defined(DLL_SUPPORT) + #define PE_DEF_SUBSYSTEM 3 + #else + #undef NT_EXE_IMAGE_BASE +@@ -1523,6 +1527,7 @@ + #if defined (TARGET_IS_i386pe) \ + || defined (TARGET_IS_armpe) \ + || defined (TARGET_IS_arm_epoc_pe) \ ++ || defined (TARGET_IS_arm_winnt_pe) \ + || defined (TARGET_IS_arm_wince_pe) + if (!link_info.relocatable) + pe_dll_build_sections (link_info.output_bfd, &link_info); +@@ -1534,7 +1539,8 @@ + #endif + #endif /* DLL_SUPPORT */ + +-#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe) ++#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) \ ++ || defined (TARGET_IS_arm_winnt_pe) || defined(TARGET_IS_arm_wince_pe) + if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL) + { + /* The arm backend needs special fields in the output hash structure. +@@ -1859,7 +1865,8 @@ + ppc_allocate_toc_section (&link_info); + #endif /* TARGET_IS_ppcpe */ + +-#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe) ++#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) \ ++ || defined (TARGET_IS_arm_winnt_pe) || defined(TARGET_IS_arm_wince_pe) + /* FIXME: we should be able to set the size of the interworking stub + section. + +@@ -1881,7 +1888,7 @@ + + /* We have seen it all. Allocate it, and carry on. */ + bfd_arm_allocate_interworking_sections (& link_info); +-#endif /* TARGET_IS_armpe || TARGET_IS_arm_epoc_pe || TARGET_IS_arm_wince_pe */ ++#endif + + before_allocation_default (); + } +@@ -1999,6 +2006,9 @@ + #ifdef TARGET_IS_arm_epoc_pe + pe_dll_id_target ("epoc-pei-arm-little"); + #endif ++#ifdef TARGET_IS_arm_winnt_pe ++ pe_dll_id_target ("pei-arm-winnt-little"); ++#endif + #ifdef TARGET_IS_arm_wince_pe + pe_dll_id_target ("pei-arm-wince-little"); + #endif +@@ -2011,7 +2021,8 @@ + static void + gld_${EMULATION_NAME}_finish (void) + { +-#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe) ++#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) \ ++ || defined(TARGET_IS_arm_winnt_pe) || defined(TARGET_IS_arm_wince_pe) + struct bfd_link_hash_entry * h; + + if (thumb_entry_symbol != NULL) +@@ -2051,7 +2062,7 @@ + else + einfo (_("%P: warning: cannot find thumb start symbol %s\n"), thumb_entry_symbol); + } +-#endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe) */ ++#endif + + finish_default (); + +diff -Naur binutils-2.25-orig/ld/Makefile.am binutils-2.25/ld/Makefile.am +--- binutils-2.25-orig/ld/Makefile.am 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/ld/Makefile.am 2015-06-30 04:26:43.411346700 +0100 +@@ -156,6 +156,7 @@ + earcelf.c \ + earm_epoc_pe.c \ + earm_wince_pe.c \ ++ earm_winnt_pe.c \ + earmaoutb.c \ + earmaoutl.c \ + earmcoff.c \ +@@ -688,6 +689,9 @@ + earm_wince_pe.c: $(srcdir)/emulparams/arm_wince_pe.sh \ + $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} + ++earm_winnt_pe.c: $(srcdir)/emulparams/arm_winnt_pe.sh \ ++ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} ++ + earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} + +diff -Naur binutils-2.25-orig/ld/Makefile.in binutils-2.25/ld/Makefile.in +--- binutils-2.25-orig/ld/Makefile.in 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/ld/Makefile.in 2015-06-30 04:26:43.411346700 +0100 +@@ -464,6 +464,7 @@ + earcelf.c \ + earm_epoc_pe.c \ + earm_wince_pe.c \ ++ earm_winnt_pe.c \ + earmaoutb.c \ + earmaoutl.c \ + earmcoff.c \ +@@ -1059,6 +1060,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earcelf.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_epoc_pe.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_wince_pe.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_winnt_pe.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmaoutb.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmaoutl.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmcoff.Po@am__quote@ +@@ -2129,6 +2131,9 @@ + earm_wince_pe.c: $(srcdir)/emulparams/arm_wince_pe.sh \ + $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} + ++earm_winnt_pe.c: $(srcdir)/emulparams/arm_winnt_pe.sh \ ++ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} ++ + earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} + +diff -Naur binutils-2.25-orig/ld/pe-dll.c binutils-2.25/ld/pe-dll.c +--- binutils-2.25-orig/ld/pe-dll.c 2014-10-14 08:32:04.000000000 +0100 ++++ binutils-2.25/ld/pe-dll.c 2015-06-30 04:26:43.426981700 +0100 +@@ -245,6 +245,7 @@ + #define PE_ARCH_arm 4 + #define PE_ARCH_arm_epoc 5 + #define PE_ARCH_arm_wince 6 ++#define PE_ARCH_arm_winnt 7 + + /* Don't make it constant as underscore mode gets possibly overriden + by target or -(no-)leading-underscore option. */ +@@ -314,6 +315,15 @@ + FALSE, + autofilter_symbollist_generic + }, ++ { ++ "pei-arm-winnt-little", ++ "pe-arm-winnt-little", ++ 17, /* ARM_MOV32T on Windows NT, see bfd/coff-arm.c. */ ++ PE_ARCH_arm_winnt, ++ bfd_arch_arm, ++ FALSE, ++ autofilter_symbollist_generic ++ }, + { NULL, NULL, 0, 0, 0, FALSE, NULL } + }; + +@@ -2113,6 +2123,7 @@ + case PE_ARCH_arm: + case PE_ARCH_arm_epoc: + case PE_ARCH_arm_wince: ++ case PE_ARCH_arm_winnt: + jmp_bytes = jmp_arm_bytes; + jmp_byte_count = sizeof (jmp_arm_bytes); + break; +@@ -2201,6 +2212,7 @@ + case PE_ARCH_arm: + case PE_ARCH_arm_epoc: + case PE_ARCH_arm_wince: ++ case PE_ARCH_arm_winnt: + quick_reloc (abfd, 8, BFD_RELOC_32, 2); + break; + default: diff --git a/mingw-w64-cross-binutils/PKGBUILD b/mingw-w64-cross-binutils/PKGBUILD index 4c25c0e2..b0aeb096 100644 --- a/mingw-w64-cross-binutils/PKGBUILD +++ b/mingw-w64-cross-binutils/PKGBUILD @@ -1,4 +1,5 @@ # Maintainer: Alexey Pavlov +# Contributor: Martell Malone _realname=binutils _mingw_suff=mingw-w64-cross @@ -21,6 +22,7 @@ source=(#"ftp://mirrors.kernel.org/sources.redhat.com/binutils/snapshots/binutil ftp://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2{,.sig} 0001-enable-gold-on.mingw32.patch 0002-check-for-unusual-file-harder.patch + 0007-armv7-w64-mingw32.patch 0008-fix-libiberty-makefile.mingw.patch 0009-fix-libiberty-configure.mingw.patch 0110-binutils-mingw-gnu-print.patch @@ -32,6 +34,7 @@ md5sums=('d9f3303f802a5b6b0bb73a335ab89d66' 'SKIP' 'f3be04ed70b9d352a2c0e2a80b0706b2' '2cc89a3c09cafa30c91ac890d3c68932' + 'cc3b99f0233366f43d5e9ac91f640030' 'df13a2462c24d14376a09ec1d1609519' '9cd71d49b765932a9701b66dfde00775' '1c34f5ee0ee5d5008a617e1638362d43' @@ -39,13 +42,15 @@ md5sums=('d9f3303f802a5b6b0bb73a335ab89d66' '83e26439fa877c6407fe3b84cdb01e76' 'c0eaa32bbc4239ebb9bdd95c129ca56a' 'ac0c62e2653558f7aab8c32ffa23dd4a') -_targets="i686-w64-mingw32 x86_64-w64-mingw32" + +_targets="i686-w64-mingw32 x86_64-w64-mingw32 armv7-w64-mingw32" prepare() { cd ${srcdir}/binutils-${pkgver} patch -p1 -i ${srcdir}/0001-enable-gold-on.mingw32.patch patch -p1 -i ${srcdir}/0002-check-for-unusual-file-harder.patch + patch -p1 -i ${srcdir}/0007-armv7-w64-mingw32.patch patch -p1 -i ${srcdir}/0008-fix-libiberty-makefile.mingw.patch patch -p1 -i ${srcdir}/0009-fix-libiberty-configure.mingw.patch patch -p1 -i ${srcdir}/0110-binutils-mingw-gnu-print.patch @@ -66,18 +71,22 @@ build() { for _target in ${_targets}; do mkdir -p ${srcdir}/binutils-build-${_target} && cd ${srcdir}/binutils-build-${_target} - if [ "${_target}" = "x86_64-w64-mingw32" ]; then - local _conf='--enable-64-bit-bfd' + if [ "${_target}" != "armv7-w64-mingw32" ]; then + local _conf='--enable-lto' else local _conf='' fi + + if [ "${_target}" = "x86_64-w64-mingw32" ]; then + _conf+=' --enable-64-bit-bfd' + fi + ${srcdir}/binutils-${pkgver}/configure \ --build=${CHOST} \ --host=${CHOST} \ --target=${_target} \ --prefix=/opt \ --disable-werror \ - --enable-lto \ --with-libiconv-prefix=/usr \ $_conf