[binutils] Fix detection of little endian PPC64 binaries. Resolves: #1095885
Nicholas Clifton
nickc at fedoraproject.org
Fri May 9 10:16:44 UTC 2014
commit cb51b833f934c8bb90f0fde38a37eedb9f7c28d6
Author: Nick Clifton <nickc at redhat.com>
Date: Fri May 9 11:16:41 2014 +0100
Fix detection of little endian PPC64 binaries.
Resolves: #1095885
binutils-2.24-ldforcele.patch | 58 +++++++++++++++++++++++++++++++++++++++++
binutils.spec | 15 ++++++++++-
2 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/binutils-2.24-ldforcele.patch b/binutils-2.24-ldforcele.patch
new file mode 100644
index 0000000..6a46c78
--- /dev/null
+++ b/binutils-2.24-ldforcele.patch
@@ -0,0 +1,58 @@
+Common subdirectories: ../binutils-2.24.orig/ld/emulparams and ld/emulparams
+Common subdirectories: ../binutils-2.24.orig/ld/emultempl and ld/emultempl
+diff -cp ../binutils-2.24.orig/ld/ldlang.c ld/ldlang.c
+*** ../binutils-2.24.orig/ld/ldlang.c 2014-05-09 10:35:04.589504928 +0100
+--- ld/ldlang.c 2014-05-09 10:35:55.515661478 +0100
+*************** lang_add_output_format (const char *form
+*** 7096,7101 ****
+--- 7096,7113 ----
+ && little != NULL)
+ format = little;
+
++ if (getenv ("LD_FORCE_LE") != NULL)
++ {
++ if (strcmp (format, "elf64-powerpc") == 0)
++ format = "elf64-powerpcle";
++ else if (strcmp (format, "elf32-powerpc") == 0)
++ format = "elf32-powerpcle";
++ else if (strcmp (format, "elf64-big") == 0)
++ format = "elf64-little";
++ else if (strcmp (format, "elf32-big") == 0)
++ format = "elf32-little";
++ }
++
+ output_target = format;
+ }
+ }
+Only in ld: ldlang.c.orig
+diff -cp ../binutils-2.24.orig/ld/ldmain.c ld/ldmain.c
+*** ../binutils-2.24.orig/ld/ldmain.c 2014-05-09 10:35:04.593504941 +0100
+--- ld/ldmain.c 2014-05-09 10:35:55.515661478 +0100
+*************** get_emulation (int argc, char **argv)
+*** 603,608 ****
+--- 603,620 ----
+ }
+ }
+
++ if ((strncmp (emulation, "elf64ppc", 8) == 0
++ || strncmp (emulation, "elf32ppc", 8) == 0)
++ && getenv ("LD_FORCE_LE") != NULL)
++ {
++ size_t len = strlen (emulation);
++ char *le = xmalloc (len + 2);
++ memcpy (le, emulation, 5);
++ le[5] = 'l';
++ memcpy (le + 6, emulation + 5, len - 4);
++ emulation = le;
++ }
++
+ return emulation;
+ }
+
+Only in ld: ldmain.c.orig
+Common subdirectories: ../binutils-2.24.orig/ld/ldscripts and ld/ldscripts
+Common subdirectories: ../binutils-2.24.orig/ld/.libs and ld/.libs
+Common subdirectories: ../binutils-2.24.orig/ld/po and ld/po
+Common subdirectories: ../binutils-2.24.orig/ld/scripttempl and ld/scripttempl
+Common subdirectories: ../binutils-2.24.orig/ld/testsuite and ld/testsuite
+Common subdirectories: ../binutils-2.24.orig/ld/tmpdir and ld/tmpdir
diff --git a/binutils.spec b/binutils.spec
index e6ee7b0..bf151c2 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.24
-Release: 13%{?dist}
+Release: 14%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@@ -57,6 +57,8 @@ Patch16: binutils-2.24-DW_FORM_ref_addr.patch
Patch17: binutils-2.24-set-section-macros.patch
# Fix detections of uncompressed .debug_str sections that look like they have been compressed.
Patch18: binutils-2.24-fake-zlib-sections.patch
+# Fix detections little endian PPC shared libraries
+Patch19: binutils-2.24-ldforcele.patch
Provides: bundled(libiberty)
@@ -177,6 +179,9 @@ using libelf instead of BFD.
%patch16 -p0 -b .ref-addr~
%patch17 -p0 -b .sec-macros~
%patch18 -p0 -b .fake-zlib~
+%ifarch ppc64le
+%patch19 -p0 -b .ldforcele~
+%endif
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@@ -231,6 +236,11 @@ case %{binutils_target} in ppc*|ppc64*)
;;
esac
+case %{binutils_target} in ppc64le*)
+ CARGS="$CARGS --enable-targets=powerpc-linux"
+ ;;
+esac
+
%if 0%{?_with_debug:1}
CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0"
%define enable_shared 0
@@ -482,6 +492,9 @@ exit 0
%endif # %{isnative}
%changelog
+* Fri May 09 2014 Nick Clifton <nickc at redhat.com> - 2.24-14
+- Fix detection of little endian PPC64 binaries. (#1095885)
+
* Mon Apr 28 2014 Nick Clifton <nickc at redhat.com> - 2.24-13
- Fix detection of uncompressed .debug_str sections. (#1082370)
More information about the scm-commits
mailing list