changeset 6247:5f6066327bdf

Fix cross/binutils build for FreeBSD
author Masamichi Hosoda <trueroad@users.noreply.github.com>
date Sun, 19 Oct 2014 10:49:39 +0900
parents c029f241ea49
children 863c4ab222bc
files gub/specs/cross/binutils.py patches/binutils-2.24-freebsd4.patch
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gub/specs/cross/binutils.py	Sun Oct 19 10:32:13 2014 +0900
+++ b/gub/specs/cross/binutils.py	Sun Oct 19 10:49:39 2014 +0900
@@ -59,3 +59,8 @@
         # Must ONLY do target stuff, otherwise cross executables cannot find their libraries
 #        self.map_locate (lambda logger,file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s', 'libtool')
         self.map_locate (lambda logger, file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s/libiberty', 'libtool')
+
+class Binutils__freebsd__x86 (Binutils):
+    patches = Binutils.patches + [
+        'binutils-2.24-freebsd4.patch' # This patch will not be needed from binutils 2.25.
+        ]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/binutils-2.24-freebsd4.patch	Sun Oct 19 10:49:39 2014 +0900
@@ -0,0 +1,30 @@
+From: H.J. Lu <hjl.tools@gmail.com>
+Date: Mon, 29 Sep 2014 15:35:49 +0000 (-0700)
+Subject: Fix build for OLD_FREEBSD_ABI_LABEL
+X-Git-Url: http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=cf7363b42b2fdc9fd108bed8d53b35adf4d52ad5
+
+Fix build for OLD_FREEBSD_ABI_LABEL
+
+	PR ld/17440
+	* elf32-i386.c (elf_i386_fbsd_post_process_headers): Fix build
+	for OLD_FREEBSD_ABI_LABEL.
+---
+
+diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
+index a00d47c..afa21b5 100644
+--- a/bfd/elf32-i386.c
++++ b/bfd/elf32-i386.c
+@@ -5120,8 +5120,11 @@ elf_i386_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info)
+   _bfd_elf_post_process_headers (abfd, info);
+ 
+ #ifdef OLD_FREEBSD_ABI_LABEL
+-  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
+-  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
++  {
++    /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
++    Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
++    memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
++  }
+ #endif
+ }
+