summaryrefslogtreecommitdiffhomepage
path: root/patches/binutils-2.24.51.local.patch
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2017-01-20 17:52:34 +0100
committerLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2017-01-20 17:55:09 +0100
commitbbbbdb9bd3ffd1de751b78a71cba929020b234a4 (patch)
tree5b11329427923075ebd261291acf6795051a3520 /patches/binutils-2.24.51.local.patch
parent231456623ea62bd7b836de44336d9e7b5cf88880 (diff)
downloadmidipix_build-bbbbdb9bd3ffd1de751b78a71cba929020b234a4.tar.bz2
midipix_build-bbbbdb9bd3ffd1de751b78a71cba929020b234a4.tar.xz
build.sh: fetch ${GITROOT}/ports/chainport during `init' target and apply patches found within.
build/pkg.build, etc/build.usage, vars/{build,chainport}.vars: adds newly introduced `init' target. patches/{binutils,gmp,lib{elf,ffi}}-*.patch: moved to chainport repository.
Diffstat (limited to 'patches/binutils-2.24.51.local.patch')
-rw-r--r--patches/binutils-2.24.51.local.patch739
1 files changed, 0 insertions, 739 deletions
diff --git a/patches/binutils-2.24.51.local.patch b/patches/binutils-2.24.51.local.patch
deleted file mode 100644
index ae088616..00000000
--- a/patches/binutils-2.24.51.local.patch
+++ /dev/null
@@ -1,739 +0,0 @@
-diff -ru --new-file a/bfd/midipix.h b/bfd/midipix.h
---- a/bfd/midipix.h 1969-12-31 19:00:00.000000000 -0500
-+++ b/bfd/midipix.h 2015-03-11 17:23:18.492453732 -0400
-@@ -0,0 +1,10 @@
-+#ifndef MIDIPIX_H
-+#define MIDIPIX_H
-+
-+#define PE_TARGET_MIDIPIX
-+
-+#define PE_DSO_SUFFIX ".so"
-+#define PE_DSOLIB_SUFFIX ".dso.a"
-+#define PE_IMPLIB_SUFFIX ".lib.a"
-+
-+#endif
---- a/ld/configure 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/configure 2015-03-11 20:01:08.888756786 -0400
-@@ -19773,3 +19773,23 @@
- $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
- fi
-
-+sed -i -e 's/@pe_executable_name@/'$PE_EXECUTABLE_NAME'/g' Makefile
-+sed -i -e 's/@pe_crt_section@/'$PE_CRT_SECTION'/g' Makefile
-+sed -i -e 's/@pe_cygwin_fork_support@/'$PE_CYGWIN_FORK_SUPPORT'/g' Makefile
-+
-+#PE custom import library support
-+if [ -f peimplib.h ]; then
-+ echo 'build directory is not clean (peimplib.h already exists)'
-+ exit 2
-+fi
-+
-+touch peimplib.h || exit 2
-+
-+case $target_os in
-+ *midipix*)
-+ cat >> peimplib.h << EOF
-+
-+/* midipix supersystem support */
-+#include "midipix.h"
-+EOF
-+esac
-diff -ru --new-file a/ld/emultempl/pe.em b/ld/emultempl/pe.em
---- a/ld/emultempl/pe.em 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/emultempl/pe.em 2015-11-25 09:02:09.729144140 -0500
-@@ -35,6 +35,18 @@
- only determine if the subsystem is console or windows in order to select
- the correct entry point by default. */
-
-+
-+#include "peimplib.h"
-+
-+#ifndef PE_IMPLIB_SUFFIX
-+#define PE_IMPLIB_SUFFIX ".dll.a"
-+#endif
-+
-+#ifndef PE_DSO_SUFFIX
-+#define PE_DSO_SUFFIX ".dll"
-+#endif
-+
-+
- #define TARGET_IS_${EMULATION_NAME}
-
- /* Do this before including bfd.h, so we prototype the right functions. */
-@@ -132,7 +144,7 @@
- static char * thumb_entry_symbol = NULL;
- static lang_assignment_statement_type *image_base_statement = 0;
- static unsigned short pe_dll_characteristics = 0;
--static bfd_boolean insert_timestamp = TRUE;
-+static bfd_boolean insert_timestamp = 0;
- static const char *emit_build_id;
-
- #ifdef DLL_SUPPORT
-@@ -471,8 +483,8 @@
- specifically set with --image-base\n"));
- fprintf (file, _(" --disable-auto-image-base Do not auto-choose image base. (default)\n"));
- fprintf (file, _(" --dll-search-prefix=<string> When linking dynamically to a dll without\n\
-- an importlib, use <string><basename>.dll\n\
-- in preference to lib<basename>.dll \n"));
-+ an importlib, use <string><basename>"PE_DSO_SUFFIX"\n\
-+ in preference to lib<basename>"PE_DSO_SUFFIX" \n"));
- fprintf (file, _(" --enable-auto-import Do sophisticated linking of _sym to\n\
- __imp_sym for DATA references\n"));
- fprintf (file, _(" --disable-auto-import Do not auto-import DATA items from DLLs\n"));
-@@ -1698,7 +1710,7 @@
- extension, and use that for the remainder of the
- comparisons. */
- pnt = strrchr (is3->the_bfd->filename, '.');
-- if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
-+ if (pnt != NULL && filename_cmp (pnt, PE_DSO_SUFFIX) == 0)
- break;
- }
-
-@@ -1733,7 +1745,7 @@
- then leave the filename alone. */
- pnt = strrchr (is->the_bfd->filename, '.');
-
-- if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
-+ if (is_ms_arch && (filename_cmp (pnt, PE_DSO_SUFFIX) == 0))
- {
- int idata2 = 0, reloc_count=0;
- asection *sec;
-@@ -2298,10 +2310,14 @@
- }
- libname_fmt [] =
- {
-+ /* optionally support ldso-specific import libraries */
-+ #ifdef PE_DSOLIB_SUFFIX
-+ { "lib%s"PE_DSOLIB_SUFFIX, FALSE },
-+ #endif
- /* Preferred explicit import library for dll's. */
-- { "lib%s.dll.a", FALSE },
-+ { "lib%s"PE_IMPLIB_SUFFIX, FALSE },
- /* Alternate explicit import library for dll's. */
-- { "%s.dll.a", FALSE },
-+ { "%s"PE_IMPLIB_SUFFIX, FALSE },
- /* "libfoo.a" could be either an import lib or a static lib.
- For backwards compatibility, libfoo.a needs to precede
- libfoo.dll and foo.dll in the search. */
-@@ -2310,10 +2326,10 @@
- { "%s.lib", FALSE },
- #ifdef DLL_SUPPORT
- /* Try "<prefix>foo.dll" (preferred dll name, if specified). */
-- { "%s%s.dll", TRUE },
-+ { "%s%s"PE_DSO_SUFFIX, TRUE },
- #endif
- /* Try "libfoo.dll" (default preferred dll name). */
-- { "lib%s.dll", FALSE },
-+ { "lib%s"PE_DSO_SUFFIX, FALSE },
- /* Finally try 'native' dll name "foo.dll". */
- { "%s.dll", FALSE },
- /* Note: If adding more formats to this table, make sure to check to
-diff -ru --new-file a/ld/emultempl/pep.em b/ld/emultempl/pep.em
---- a/ld/emultempl/pep.em 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/emultempl/pep.em 2015-11-25 09:02:21.153143987 -0500
-@@ -42,6 +42,18 @@
- /* For WINDOWS_XP64 and higher */
- /* Based on pe.em, but modified for 64 bit support. */
-
-+
-+#include "peimplib.h"
-+
-+#ifndef PE_IMPLIB_SUFFIX
-+#define PE_IMPLIB_SUFFIX ".dll.a"
-+#endif
-+
-+#ifndef PE_DSO_SUFFIX
-+#define PE_DSO_SUFFIX ".dll"
-+#endif
-+
-+
- #define TARGET_IS_${EMULATION_NAME}
-
- #define COFF_IMAGE_WITH_PE
-@@ -147,7 +159,7 @@
- static int support_old_code = 0;
- static lang_assignment_statement_type *image_base_statement = 0;
- static unsigned short pe_dll_characteristics = 0;
--static bfd_boolean insert_timestamp = TRUE;
-+static bfd_boolean insert_timestamp = 0;
- static const char *emit_build_id;
-
- #ifdef DLL_SUPPORT
-@@ -434,8 +446,8 @@
- unless user specifies one\n"));
- fprintf (file, _(" --disable-auto-image-base Do not auto-choose image base. (default)\n"));
- fprintf (file, _(" --dll-search-prefix=<string> When linking dynamically to a dll without\n\
-- an importlib, use <string><basename>.dll\n\
-- in preference to lib<basename>.dll \n"));
-+ an importlib, use <string><basename>"PE_DSO_SUFFIX"\n\
-+ in preference to lib<basename>"PE_DSO_SUFFIX" \n"));
- fprintf (file, _(" --enable-auto-import Do sophisticated linking of _sym to\n\
- __imp_sym for DATA references\n"));
- fprintf (file, _(" --disable-auto-import Do not auto-import DATA items from DLLs\n"));
-@@ -1635,7 +1647,7 @@
- extension, and use that for the remainder of the
- comparisons. */
- pnt = strrchr (is3->the_bfd->filename, '.');
-- if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
-+ if (pnt != NULL && filename_cmp (pnt, PE_DSO_SUFFIX) == 0)
- break;
- }
-
-@@ -1670,7 +1682,7 @@
- then leave the filename alone. */
- pnt = strrchr (is->the_bfd->filename, '.');
-
-- if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
-+ if (is_ms_arch && (filename_cmp (pnt, PE_DSO_SUFFIX) == 0))
- {
- int idata2 = 0, reloc_count=0;
- asection *sec;
-@@ -2062,10 +2074,14 @@
- }
- libname_fmt [] =
- {
-+ /* optionally support ldso-specific import libraries */
-+ #ifdef PE_DSOLIB_SUFFIX
-+ { "lib%s"PE_DSOLIB_SUFFIX, FALSE },
-+ #endif
- /* Preferred explicit import library for dll's. */
-- { "lib%s.dll.a", FALSE },
-+ { "lib%s"PE_IMPLIB_SUFFIX, FALSE },
- /* Alternate explicit import library for dll's. */
-- { "%s.dll.a", FALSE },
-+ { "%s"PE_IMPLIB_SUFFIX, FALSE },
- /* "libfoo.a" could be either an import lib or a static lib.
- For backwards compatibility, libfoo.a needs to precede
- libfoo.dll and foo.dll in the search. */
-@@ -2074,10 +2090,10 @@
- { "%s.lib", FALSE },
- #ifdef DLL_SUPPORT
- /* Try "<prefix>foo.dll" (preferred dll name, if specified). */
-- { "%s%s.dll", TRUE },
-+ { "%s%s"PE_DSO_SUFFIX, TRUE },
- #endif
- /* Try "libfoo.dll" (default preferred dll name). */
-- { "lib%s.dll", FALSE },
-+ { "lib%s"PE_DSO_SUFFIX, FALSE },
- /* Finally try 'native' dll name "foo.dll". */
- { "%s.dll", FALSE },
- /* Note: If adding more formats to this table, make sure to check to
-diff -ru --new-file a/ld/configure.tgt b/ld/configure.tgt
---- a/ld/configure.tgt 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/configure.tgt 2015-03-11 20:09:20.564772519 -0400
-@@ -319,6 +319,11 @@
- test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
- i[3-7]86-*-mingw32*) targ_emul=i386pe ;
- targ_extra_ofiles="deffilep.o pe-dll.o" ;;
-+i[3-7]86-*-midipix*) targ_emul=i386pe ;
-+ targ_extra_ofiles="deffilep.o pe-dll.o" ;
-+ PE_EXECUTABLE_NAME=a.out ;
-+ PE_CRT_SECTION=no ;
-+ PE_CYGWIN_FORK_SUPPORT=no ;;
- x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
- targ_extra_emuls=i386pe ;
- targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
-@@ -329,7 +333,13 @@
- x86_64-*-mingw*) targ_emul=i386pep ;
- targ_extra_emuls=i386pe
- targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
--i[3-7]86-*-interix*) targ_emul=i386pe_posix;
-+x86_64-*-midipix*) targ_emul=i386pep ;
-+ targ_extra_emuls=i386pe ;
-+ targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;
-+ PE_EXECUTABLE_NAME=a.out ;
-+ PE_CRT_SECTION=no ;
-+ PE_CYGWIN_FORK_SUPPORT=no ;;
-+i[3-7]86-*-interix*) targ_emul=i386pe_posix ;
- targ_extra_ofiles="deffilep.o pe-dll.o" ;;
- i[3-7]86-*-beospe*) targ_emul=i386beos ;;
- i[3-7]86-*-beos*) targ_emul=elf_i386_be ;;
-@@ -825,6 +836,10 @@
- *-*-linux*)
- ;;
-
-+*-*-midipix*)
-+ NATIVE_LIB_DIRS=
-+ ;;
-+
- *-*-netbsd*)
- ;;
-
-diff -ru --new-file a/ld/Makefile.in b/ld/Makefile.in
---- a/ld/Makefile.in 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/Makefile.in 2015-03-11 20:09:38.972773108 -0400
-@@ -54,6 +54,9 @@
- host_triplet = @host@
- target_triplet = @target@
- bin_PROGRAMS = ld-new$(EXEEXT)
-+PE_EXECUTABLE_NAME = @pe_executable_name@
-+PE_CRT_SECTION = @pe_crt_section@
-+PE_CYGWIN_FORK_SUPPORT = @pe_cygwin_fork_support@
-
- # Automake 1.9 will only build info files in the objdir if they are
- # mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
-@@ -831,7 +833,7 @@
- POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
-
- # These all start with e so 'make clean' can find them.
--GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@
-+GENSCRIPTS = EXECUTABLE_NAME='${PE_EXECUTABLE_NAME}' PE_CRT_SECTION='${PE_CRT_SECTION}' PE_CYGWIN_FORK_SUPPORT='${PE_CYGWIN_FORK_SUPPORT}' LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@
- GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
- ELF_DEPS = $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/scripttempl/DWARF.sc
- ELF_GEN_DEPS = $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/emultempl/genelf.em $(srcdir)/scripttempl/DWARF.sc
-diff -ru --new-file a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
---- a/ld/scripttempl/pep.sc 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/scripttempl/pep.sc 2015-03-11 20:10:05.324773952 -0400
-@@ -92,12 +92,17 @@
- ${RELOCATING+ *(.gcc_except_table)}
- }
-
-+EOF
-+if [ x"$PE_CYGWIN_FORK_SUPPORT" != xno ]; then cat << EOF
- /* The Cygwin32 library uses a section to avoid copying certain data
- on fork. This used to be named ".data$nocopy". The linker used
- to include this between __data_start__ and __data_end__, but that
- breaks building the cygwin32 dll. Instead, we name the section
- ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
-
-+EOF
-+fi
-+cat << EOF
- .data ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- ${RELOCATING+__data_start__ = . ;}
-@@ -106,7 +111,12 @@
- ${R_DATA}
- *(.jcr)
- ${RELOCATING+__data_end__ = . ;}
-+EOF
-+if [ x"$PE_CYGWIN_FORK_SUPPORT" != xno ]; then cat << EOF
- ${RELOCATING+*(.data_cygwin_nocopy)}
-+EOF
-+fi
-+cat << EOF
- }
-
- .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
-@@ -170,6 +180,8 @@
- ${RELOCATING+__IAT_end__ = .;}
- ${R_IDATA67}
- }
-+EOF
-+if [ x"$PE_CRT_SECTION" != xno ]; then cat << EOF
- .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- ${RELOCATING+___crt_xc_start__ = . ;}
-@@ -188,6 +200,9 @@
- ${R_CRT_XT}
- ${RELOCATING+___crt_xt_end__ = . ;}
- }
-+EOF
-+fi
-+cat << EOF
-
- /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
- at the end of the .tls section. This is important because _tls_start MUST
-diff -ru --new-file a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
---- a/ld/scripttempl/pe.sc 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/scripttempl/pe.sc 2015-03-11 20:10:10.036774102 -0400
-@@ -92,12 +92,17 @@
- ${RELOCATING+ *(.gcc_except_table)}
- }
-
-+EOF
-+if [ x"$PE_CYGWIN_FORK_SUPPORT" != xno ]; then cat << EOF
- /* The Cygwin32 library uses a section to avoid copying certain data
- on fork. This used to be named ".data$nocopy". The linker used
- to include this between __data_start__ and __data_end__, but that
- breaks building the cygwin32 dll. Instead, we name the section
- ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
-
-+EOF
-+fi
-+cat << EOF
- .data ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- ${RELOCATING+__data_start__ = . ;}
-@@ -106,7 +111,12 @@
- ${R_DATA}
- *(.jcr)
- ${RELOCATING+__data_end__ = . ;}
-+EOF
-+if [ x"$PE_CYGWIN_FORK_SUPPORT" != xno ]; then cat << EOF
- ${RELOCATING+*(.data_cygwin_nocopy)}
-+EOF
-+fi
-+cat << EOF
- }
-
- .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
-@@ -165,6 +175,8 @@
- ${RELOCATING+__IAT_end__ = .;}
- ${R_IDATA67}
- }
-+EOF
-+if [ x"$PE_CRT_SECTION" != xno ]; then cat << EOF
- .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- ${RELOCATING+___crt_xc_start__ = . ;}
-@@ -183,6 +195,9 @@
- ${R_CRT_XT}
- ${RELOCATING+___crt_xt_end__ = . ;}
- }
-+EOF
-+fi
-+cat << EOF
-
- /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
- at the end of section. This is important because _tls_start MUST
-diff -ru --new-file a/binutils/winduni.c b/binutils/winduni.c
---- a/binutils/winduni.c 2014-07-03 01:37:23.000000000 -0400
-+++ b/binutils/winduni.c 2015-02-14 11:18:32.987163288 -0500
-@@ -57,7 +57,7 @@
- /* Codepages mapped. */
- static local_iconv_map codepages[] =
- {
-- { 0, "MS-ANSI" },
-+ { 0, "cp1252" },
- { 1, "WINDOWS-1252" },
- { 437, "MS-ANSI" },
- { 737, "MS-GREEK" },
-diff -ru a/ld/pe-dll.c b/ld/pe-dll.c
---- a/ld/pe-dll.c 2014-07-03 01:37:48.000000000 -0400
-+++ b/ld/pe-dll.c 2015-06-13 20:08:00.160401506 -0400
-@@ -40,6 +40,7 @@
- #include "coff/internal.h"
- #include "../bfd/libcoff.h"
- #include "deffile.h"
-+#include "peimplib.h"
-
- #ifdef pe_use_x86_64
-
-@@ -234,7 +235,11 @@
- { STRING_COMMA_LEN ("impure_ptr") },
- { STRING_COMMA_LEN ("_impure_ptr") },
- { STRING_COMMA_LEN ("_fmode") },
-+ #ifdef PE_TARGET_MIDIPIX
-+ /* (default) excluded symbols are defined by the caller (specs, etc.) */
-+ #else
- { STRING_COMMA_LEN ("environ") },
-+ #endif
- { NULL, 0 }
- };
-
-@@ -644,10 +649,13 @@
- {
- int i, j;
- struct bfd_link_hash_entry *blhe;
-+ struct bfd_link_hash_entry *blhew;
- bfd *b;
- struct bfd_section *s;
- def_file_export *e = 0;
- bfd_boolean resort_needed;
-+ char *weaksym;
-+ char *objsym;
-
- if (!pe_def_file)
- pe_def_file = def_file_empty ();
-@@ -737,6 +745,16 @@
- if (is_import (sn))
- continue;
-
-+ if (!strncmp (sn, ".weak.", 6) && strchr (sn + 6, '.'))
-+ {
-+ objsym = strdup (sn);
-+ weaksym = strdup (sn + 6);
-+ *(strchr (weaksym, '.')) = '\0';
-+ sn = weaksym;
-+ }
-+ else
-+ weaksym = 0;
-+
- name = xmalloc (strlen ("__imp_") + strlen (sn) + 1);
- sprintf (name, "%s%s", "__imp_", sn);
-
-@@ -745,7 +763,8 @@
- free (name);
-
- if (blhe && blhe->type == bfd_link_hash_defined)
-- continue;
-+ if (strncmp (blhe->u.def.section->name, ".got$", 5))
-+ continue;
- }
-
- if (pe_details->underscored && *sn == '_')
-@@ -761,7 +780,20 @@
- /* Fill data flag properly, from dlltool.c. */
- if (!is_dup)
- p->flag_data = !(symbols[j]->flags & BSF_FUNCTION);
-+
-+ if (weaksym)
-+ {
-+ blhew = bfd_link_hash_lookup (info->hash, weaksym,
-+ FALSE, FALSE, FALSE);
-+ if (blhew->type != bfd_link_hash_defined)
-+ {
-+ free (p->internal_name);
-+ p->internal_name = objsym;
-+ }
-+ }
- }
-+ if (weaksym)
-+ free (weaksym);
- }
- }
- }
-@@ -910,6 +942,7 @@
-
- if (blhe
- && (blhe->type == bfd_link_hash_defined
-+ || (blhe->type == bfd_link_hash_defweak)
- || (blhe->type == bfd_link_hash_common)))
- {
- count_exported++;
-@@ -919,7 +952,7 @@
- /* Only fill in the sections. The actual offsets are computed
- in fill_exported_offsets() after common symbols are laid
- out. */
-- if (blhe->type == bfd_link_hash_defined)
-+ if ((blhe->type == bfd_link_hash_defined) || (blhe->type == bfd_link_hash_defweak))
- exported_symbol_sections[i] = blhe->u.def.section;
- else
- exported_symbol_sections[i] = blhe->u.c.p->section;
-diff -ru --new-file a/bfd/config.bfd b/bfd/config.bfd
---- a/bfd/config.bfd 2014-07-03 01:37:20.000000000 -0400
-+++ b/bfd/config.bfd 2015-02-14 11:27:08.199179775 -0500
-@@ -679,7 +679,7 @@
- targ_archs="$targ_archs bfd_arm_arch"
- want64=true
- ;;
-- x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
-+ x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin | x86_64-*-midipix*)
- targ_defvec=x86_64_pe_vec
- targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_be_vec x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec"
- want64=true
-@@ -731,7 +731,7 @@
- targ_defvec=i386_elf32_vec
- targ_selvecs=i386_coff_vec
- ;;
-- i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
-+ i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe | i[3-7]86-*-midipix*)
- targ_defvec=i386_pe_vec
- targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec"
- targ_underscore=yes
-diff -ru --new-file a/binutils/configure b/binutils/configure
---- a/binutils/configure 2014-07-03 01:37:22.000000000 -0400
-+++ b/binutils/configure 2015-09-13 21:35:09.738957435 -0400
-@@ -14015,7 +14015,7 @@
- BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
- BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
- ;;
-- x86_64-*-mingw* | x86_64-*-cygwin*)
-+ x86_64-*-mingw* | x86_64-*-midipix* | x86_64-*-cygwin*)
- BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
- if test -z "$DLLTOOL_DEFAULT"; then
- DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
-@@ -14025,7 +14025,7 @@
- BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
- BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
- ;;
-- i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
-+ i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-midipix* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
- BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
- if test -z "$DLLTOOL_DEFAULT"; then
- DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
-diff -ru --new-file a/configure b/configure
---- a/configure 2014-07-03 01:37:23.000000000 -0400
-+++ b/configure 2015-03-11 17:07:15.820422926 -0400
-@@ -3428,6 +3428,9 @@
- x86_64-*-mingw*)
- noconfigdirs="$noconfigdirs ${libgcj}"
- ;;
-+ *-midipix*)
-+ noconfigdirs="$noconfigdirs ${libgcj}"
-+ ;;
- mmix-*-*)
- noconfigdirs="$noconfigdirs target-libffi target-boehm-gc"
- ;;
-@@ -3549,6 +3552,9 @@
- *-*-mingw*)
- noconfigdirs="$noconfigdirs target-newlib target-libgloss"
- ;;
-+ *-*-midipix*)
-+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
-+ ;;
- *-*-netbsd*)
- noconfigdirs="$noconfigdirs target-newlib target-libgloss"
- ;;
-@@ -6257,7 +6263,7 @@
-
- target_elf=no
- case $target in
-- *-darwin* | *-aix* | *-cygwin* | *-mingw* | *-aout* | *-*coff* | \
-+ *-darwin* | *-aix* | *-cygwin* | *-mingw* | *-midipix* | *-aout* | *-*coff* | \
- *-msdosdjgpp* | *-vms* | *-wince* | *-*-pe* | \
- alpha*-dec-osf* | *-interix* | hppa[12]*-*-hpux*)
- target_elf=no
-diff -ru --new-file a/gas/configure.tgt b/gas/configure.tgt
---- a/gas/configure.tgt 2014-07-03 01:37:25.000000000 -0400
-+++ b/gas/configure.tgt 2015-02-14 11:27:08.223179776 -0500
-@@ -262,7 +262,7 @@
- i*) fmt=coff em=pe ;;
- esac ;;
- i386-*-interix*) fmt=coff em=interix ;;
-- i386-*-mingw*)
-+ i386-*-mingw* | i386-*-midipix*)
- case ${cpu} in
- x86_64*) fmt=coff em=pep ;;
- i*) fmt=coff em=pe ;;
-diff -ru a/bfd/cofflink.c b/bfd/cofflink.c
---- a/bfd/cofflink.c 2014-07-03 01:37:20.000000000 -0400
-+++ b/bfd/cofflink.c 2015-06-13 20:22:46.000389638 -0400
-@@ -202,6 +202,7 @@
- bfd_size_type symesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
-+ char *weaksym;
-
- *pneeded = FALSE;
-
-@@ -236,6 +237,16 @@
- && CONST_STRNEQ (name, "__imp_"))
- h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
-
-+ if (!h && !strncmp (name, ".weak.", 6) && strchr (name + 6, '.'))
-+ {
-+ weaksym = strdup (name + 6);
-+ *(strchr (weaksym, '.')) = '\0';
-+ h = bfd_link_hash_lookup (info->hash, weaksym, FALSE, FALSE, TRUE);
-+ name = weaksym;
-+ }
-+ else
-+ weaksym = 0;
-+
- /* We are only interested in symbols that are currently
- undefined. If a symbol is currently known to be common,
- COFF linkers do not bring in an object file which defines
-@@ -249,6 +260,9 @@
- *pneeded = TRUE;
- return TRUE;
- }
-+
-+ if (weaksym)
-+ free (weaksym);
- }
-
- esym += (sym.n_numaux + 1) * symesz;
-@@ -320,6 +334,7 @@
- bfd_byte *esym;
- bfd_byte *esym_end;
- bfd_size_type amt;
-+ char *weaksym;
-
- symcount = obj_raw_syment_count (abfd);
-
-@@ -476,6 +491,20 @@
- addit = FALSE;
- }
-
-+ if (!strncmp (name, ".weak.", 6) && strchr (name + 6, '.'))
-+ {
-+ if (! (bfd_coff_link_add_one_symbol
-+ (info, abfd, name, flags, section, value,
-+ (const char *) NULL, copy, FALSE,
-+ (struct bfd_link_hash_entry **) sym_hash)))
-+ goto error_return;
-+
-+ weaksym = strdup (name + 6);
-+ *(strchr(weaksym, '.')) = 0;
-+ name = weaksym;
-+ flags |= BSF_WEAK;
-+ }
-+
- if (addit)
- {
- if (! (bfd_coff_link_add_one_symbol
-diff -ru a/bfd/linker.c b/bfd/linker.c
---- a/bfd/linker.c 2014-07-03 01:37:21.000000000 -0400
-+++ b/bfd/linker.c 2015-06-06 17:51:24.148275212 -0400
-@@ -1050,6 +1050,7 @@
- struct archive_hash_table arsym_hash;
- unsigned int indx;
- struct bfd_link_hash_entry **pundef;
-+ char *weaksym;
-
- if (! bfd_has_map (abfd))
- {
-@@ -1073,6 +1074,13 @@
- struct archive_hash_entry *arh;
- struct archive_list *l, **pp;
-
-+ if (!strncmp (arsym->name, ".weak.", 6) && strchr (arsym->name + 6, '.'))
-+ {
-+ weaksym = strdup (arsym->name + 6);
-+ *(strchr (weaksym, '.')) = '\0';
-+ arsym->name = weaksym;
-+ }
-+
- arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE);
- if (arh == NULL)
- goto error_return;
-diff -ru a/gas/config/tc-i386.c b/gas/config/tc-i386.c
---- a/gas/config/tc-i386.c 2014-07-03 01:37:25.000000000 -0400
-+++ b/gas/config/tc-i386.c 2015-06-12 22:40:37.100250091 -0400
-@@ -9148,25 +9148,6 @@
- value += md_pcrel_from (fixP);
- #endif
- }
--#if defined (OBJ_COFF) && defined (TE_PE)
-- if (fixP->fx_addsy != NULL
-- && S_IS_WEAK (fixP->fx_addsy)
-- /* PR 16858: Do not modify weak function references. */
-- && ! fixP->fx_pcrel)
-- {
--#if !defined (TE_PEP)
-- /* For x86 PE weak function symbols are neither PC-relative
-- nor do they set S_IS_FUNCTION. So the only reliable way
-- to detect them is to check the flags of their containing
-- section. */
-- if (S_GET_SEGMENT (fixP->fx_addsy) != NULL
-- && S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_CODE)
-- ;
-- else
--#endif
-- value -= S_GET_VALUE (fixP->fx_addsy);
-- }
--#endif
-
- /* Fix a few things - the dynamic linker expects certain values here,
- and we must not disappoint it. */
-@@ -9237,8 +9218,11 @@
- fixP->fx_done = 0;
- /* Remember value for tc_gen_reloc. */
- fixP->fx_addnumber = value;
-- /* Clear out the frag for now. */
-- value = 0;
-+ /* for data symbols, cancel the effect of the relocation */
-+ if (!((S_GET_SEGMENT (fixP->fx_addsy)->flags) & SEC_CODE))
-+ value = -S_GET_VALUE (fixP->fx_addsy);
-+ else
-+ value = 0;
- }
- #endif
- else if (use_rela_relocations)
-
---- a/binutils/rename.c 2014-07-03 01:37:22.000000000 -0400
-+++ b/binutils/rename.c 2015-11-25 23:13:38.086948592 -0500
-@@ -167,7 +167,10 @@
- && s.st_nlink == 1)
- )
- {
-- ret = rename (from, to);
-+ if ((ret = rename (from, to)))
-+ if (!(ret = simple_copy (from, to)))
-+ unlink (from);
-+
- if (ret == 0)
- {
- if (exists)