Browse Source

binutils package update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 7 years ago
parent
commit
59b976bc2a
  1. 38
      SOURCES/binutils-2.19.50.0.1-output-format.sed
  2. 14
      SOURCES/binutils-2.20.51.0.10-ppc64-pie.patch
  3. 11
      SOURCES/binutils-2.20.51.0.10-sec-merge-emit.patch
  4. 302
      SOURCES/binutils-2.20.51.0.2-libtool-lib64.patch
  5. 21
      SOURCES/binutils-2.22.52.0.1-export-demangle.h.patch
  6. 32
      SOURCES/binutils-2.22.52.0.4-no-config-h-check.patch
  7. 38
      SOURCES/binutils-2.23.52.0.1-find-separate-debug-file.patch
  8. 38
      SOURCES/binutils-2.25-set-long-long.patch
  9. 44
      SOURCES/binutils-2.25-version.patch
  10. 845
      SOURCES/binutils-2.25.1-objdump-speedup.patch
  11. 3590
      SOURCES/binutils-2.27-ARMv8.2.patch
  12. 10
      SOURCES/binutils-2.27-DW_AT_export_symbols.patch
  13. 367
      SOURCES/binutils-2.27-aarch64-copy-relocs.patch
  14. 25
      SOURCES/binutils-2.27-aarch64-ifunc.patch
  15. 2317
      SOURCES/binutils-2.27-cve-bugs.patch
  16. 84
      SOURCES/binutils-2.27-filename-in-error-messages.patch
  17. 1717
      SOURCES/binutils-2.27-gold.patch
  18. 271
      SOURCES/binutils-2.27-local-dynsym-count.patch
  19. 2097
      SOURCES/binutils-2.27-monotonic-section-offsets.patch
  20. 4350
      SOURCES/binutils-2.27-objdump-improvements.patch
  21. 606
      SOURCES/binutils-2.27-power9.2.patch
  22. 87
      SOURCES/binutils-2.27-power9.3.patch
  23. 452
      SOURCES/binutils-2.27-power9.patch
  24. 14
      SOURCES/binutils-2.27-ppc-stubs.patch
  25. 79
      SOURCES/binutils-2.27-ppc64-discarded-plt-sections.patch
  26. 41
      SOURCES/binutils-2.27-remove-dwarf2-minmax.patch
  27. 24
      SOURCES/binutils-2.27-remove-pr19784-test.patch
  28. 76
      SOURCES/binutils-2.27-revert-PLT-elision.patch
  29. 354
      SOURCES/binutils-2.27-s390-pgste-marker.patch
  30. 44
      SOURCES/binutils-2.27-s390-plt.patch
  31. 10
      SOURCES/binutils-2.27-s390-pr19719.patch
  32. 1064
      SOURCES/binutils-2.27-s390x-arch12.patch
  33. 43
      SOURCES/binutils-2.27-s390x-check-for-NULL-pointers.patch
  34. 22
      SOURCES/binutils-2.27-s390x-complain-missing-fPIC.patch
  35. 18
      SOURCES/binutils-2.27-skip-ld-aarch64-ifunc-exec-tests.patch
  36. 26
      SOURCES/binutils-2.27-skip-rp14918-test-for-arm.patch
  37. 1515
      SOURCES/binutils-2.27-suppress-R_X86_64_GOTPCRELX.patch
  38. 141
      SOURCES/binutils-SUPPRESS-PPC-TLBIE-CHECK.patch
  39. 104
      SOURCES/binutils-coverty-fixes.patch
  40. 20
      SOURCES/binutils-rh1203449.patch
  41. 20
      SOURCES/binutils-rh1300603.patch
  42. 139
      SOURCES/binutils-rh1312876.patch
  43. BIN
      SOURCES/standards.info.gz
  44. 2786
      SPECS/binutils.spec

38
SOURCES/binutils-2.19.50.0.1-output-format.sed

@ -0,0 +1,38 @@
# Generate OUTPUT_FORMAT line for .so files from the system linker output.
# Imported from glibc/Makerules.

/ld.*[ ]-E[BL]/b f
/collect.*[ ]-E[BL]/b f
/OUTPUT_FORMAT[^)]*$/{N
s/\n[ ]*/ /
}
t o
: o
s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
t q
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
t s
s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
t q
d
: s
s/"//g
G
s/\n//
s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
q
: q
s/"//g
p
q
: f
s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
t h
s/^.*[ ]-E\([BL]\)$/,\1/
t h
d
: h
h

14
SOURCES/binutils-2.20.51.0.10-ppc64-pie.patch

@ -0,0 +1,14 @@
*** ../binutils-2.23.51.0.2.orig/bfd/elf64-ppc.c 2012-09-11 12:13:00.637448573 +0100
--- bfd/elf64-ppc.c 2012-09-11 12:13:17.922449052 +0100
*************** ppc64_elf_relocate_section (bfd *output_
*** 13523,13528 ****
--- 13523,13531 ----
{
BFD_ASSERT (h->elf.dynindx != -1);
outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+ if (h->elf.dynindx == -1
+ && h->elf.root.type == bfd_link_hash_undefweak)
+ memset (&outrel, 0, sizeof outrel);
}
else
{

11
SOURCES/binutils-2.20.51.0.10-sec-merge-emit.patch

@ -0,0 +1,11 @@
--- binutils-2.26.orig/bfd/merge.c 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/merge.c 2016-01-25 10:19:56.961381656 +0000
@@ -334,7 +334,7 @@ sec_merge_emit (bfd *abfd, struct sec_me
/* Trailing alignment needed? */
off = sec->size - off;
- if (off != 0)
+ if (off != 0 && alignment_power)
{
if (contents)
memcpy (contents + offset, pad, off);

302
SOURCES/binutils-2.20.51.0.2-libtool-lib64.patch

@ -0,0 +1,302 @@
diff -rcp ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure
*** ../binutils-2.20.51.0.7.original/bfd/configure 2010-04-08 14:53:48.000000000 +0100
--- ./bfd/configure 2010-04-08 14:56:50.000000000 +0100
*************** fi
*** 10762,10771 ****
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
--- 10762,10795 ----
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/binutils/configure ./binutils/configure
*** ../binutils-2.20.51.0.7.original/binutils/configure 2010-04-08 14:53:45.000000000 +0100
--- ./binutils/configure 2010-04-08 14:56:21.000000000 +0100
*************** fi
*** 10560,10569 ****
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
--- 10560,10593 ----
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/gas/configure ./gas/configure
*** ../binutils-2.20.51.0.7.original/gas/configure 2010-04-08 14:53:47.000000000 +0100
--- ./gas/configure 2010-04-08 14:57:24.000000000 +0100
*************** fi
*** 10547,10556 ****
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
--- 10547,10580 ----
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/gprof/configure ./gprof/configure
*** ../binutils-2.20.51.0.7.original/gprof/configure 2010-04-08 14:53:45.000000000 +0100
--- ./gprof/configure 2010-04-08 14:57:50.000000000 +0100
*************** fi
*** 10485,10494 ****
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
--- 10485,10518 ----
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/ld/configure ./ld/configure
*** ../binutils-2.20.51.0.7.original/ld/configure 2010-04-08 14:53:44.000000000 +0100
--- ./ld/configure 2010-04-08 14:58:21.000000000 +0100
*************** fi
*** 10966,10975 ****
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
--- 10966,10999 ----
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
Only in .: .#libtool.m4
Only in .: #libtool.m4#
diff -rcp ../binutils-2.20.51.0.7.original/opcodes/configure ./opcodes/configure
*** ../binutils-2.20.51.0.7.original/opcodes/configure 2010-04-08 14:53:45.000000000 +0100
--- ./opcodes/configure 2010-04-08 14:59:10.000000000 +0100
*************** fi
*** 10496,10505 ****
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
--- 10496,10529 ----
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
! sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on

21
SOURCES/binutils-2.22.52.0.1-export-demangle.h.patch

@ -0,0 +1,21 @@
--- a/bfd/Makefile.am 2012-03-06 14:00:33.229957572 +0000
+++ b/bfd/Makefile.am 2012-04-27 16:46:05.410974817 +0100
@@ -18,7 +18,7 @@
bfdlibdir = @bfdlibdir@
bfdincludedir = @bfdincludedir@
bfdlib_LTLIBRARIES = libbfd.la
-bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h
+bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
else !INSTALL_LIBBFD
# Empty these so that the respective installation directories will not be created.
bfdlibdir =
--- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:23:35.054721634 +0000
+++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:25:59.292607840 +0000
@@ -350,6 +350,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -rel
@INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2)
@INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
+@INSTALL_LIBBFD_TRUE@ $(INCDIR)/demangle.h \
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2)
@INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@
@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la

32
SOURCES/binutils-2.22.52.0.4-no-config-h-check.patch

@ -0,0 +1,32 @@
*** ../binutils-2.22.52.0.4.orig/bfd/bfd-in.h 2012-08-02 10:56:34.561769686 +0100
--- bfd/bfd-in.h 2012-08-02 11:13:27.134797755 +0100
***************
*** 25,35 ****
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
- /* PR 14072: Ensure that config.h is included first. */
- #if !defined PACKAGE && !defined PACKAGE_VERSION
- #error config.h must be included before this header
- #endif
-
#ifdef __cplusplus
extern "C" {
#endif
--- 25,30 ----
*** ../binutils-2.22.52.0.4.orig/bfd/bfd-in2.h 2012-08-02 10:56:34.349769680 +0100
--- bfd/bfd-in2.h 2012-08-02 11:13:40.015798113 +0100
***************
*** 32,42 ****
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
- /* PR 14072: Ensure that config.h is included first. */
- #if !defined PACKAGE && !defined PACKAGE_VERSION
- #error config.h must be included before this header
- #endif
-
#ifdef __cplusplus
extern "C" {
#endif
--- 32,37 ----

38
SOURCES/binutils-2.23.52.0.1-find-separate-debug-file.patch

@ -0,0 +1,38 @@
--- a/bfd/opncls.c 2013-03-14 11:25:30.338306122 +0000
+++ b/bfd/opncls.c 2013-03-14 12:20:21.686397360 +0000
@@ -1297,6 +1297,8 @@
bfd_malloc (strlen (debug_file_directory) + 1
+ (canon_dirlen > dirlen ? canon_dirlen : dirlen)
+ strlen (".debug/")
+#define FEDORA_LIB_DEBUG_DIR "/usr/lib/debug/"
+ + strlen (FEDORA_LIB_DEBUG_DIR) + strlen ("usr/")
+ strlen (base)
+ 1);
if (debugfile == NULL)
@@ -1332,6 +1334,26 @@
if (check_func (debugfile, crc32))
goto found;
+ /* Then try in the global debug dir for Fedora libraries. */
+ sprintf (debugfile, "%s%s%s", FEDORA_LIB_DEBUG_DIR, dir, base);
+ if (separate_debug_file_exists (debugfile, crc32))
+ {
+ free (base);
+ free (dir);
+ free (canon_dir);
+ return debugfile;
+ }
+
+ /* Then try in the usr subdirectory of the global debug dir for Fedora libraries. */
+ sprintf (debugfile, "%s/usr%s%s", FEDORA_LIB_DEBUG_DIR, dir, base);
+ if (separate_debug_file_exists (debugfile, crc32))
+ {
+ free (base);
+ free (dir);
+ free (canon_dir);
+ return debugfile;
+ }
+
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
dirlen = strlen (debug_file_directory) - 1;

38
SOURCES/binutils-2.25-set-long-long.patch

@ -0,0 +1,38 @@
diff -up binutils-2.25.orig/bfd/configure.ac binutils-2.25/bfd/configure.ac
--- binutils-2.25.orig/bfd/configure.ac 2014-12-24 10:34:45.590491143 +0000
+++ binutils-2.25/bfd/configure.ac 2014-12-24 10:36:12.997981992 +0000
@@ -183,11 +183,13 @@ if test "x${ac_cv_sizeof_long}" = "x8";
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+fi
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi
diff -up ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure
--- a/bfd/configure 2010-04-08 15:23:58.000000000 +0100
+++ b/bfd/configure 2010-04-08 15:24:06.000000000 +0100
@@ -12819,11 +12819,13 @@
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+fi
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi

44
SOURCES/binutils-2.25-version.patch

@ -0,0 +1,44 @@
--- binutils-2.26.orig/bfd/Makefile.am 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/Makefile.am 2016-01-25 10:13:23.489964145 +0000
@@ -1043,8 +1043,8 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
+ bfd_version_string="\"$(VERSION)-%{release}\"" ;\
+ bfd_soversion="$(VERSION)-%{release}" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
. $(srcdir)/development.sh ;\
@@ -1055,7 +1055,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
fi ;\
$(SED) -e "s,@bfd_version@,$$bfd_version," \
-e "s,@bfd_version_string@,$$bfd_version_string," \
- -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@bfd_version_package@,\"version \"," \
-e "s,@report_bugs_to@,$$report_bugs_to," \
< $(srcdir)/version.h > $@; \
echo "$${bfd_soversion}" > libtool-soversion
--- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:14:17.818297941 +0000
@@ -2111,8 +2111,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
+ bfd_version_string="\"$(VERSION)-%{release}\"" ;\
+ bfd_soversion="$(VERSION)-%{release}" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
. $(srcdir)/development.sh ;\
@@ -2123,7 +2123,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
fi ;\
$(SED) -e "s,@bfd_version@,$$bfd_version," \
-e "s,@bfd_version_string@,$$bfd_version_string," \
- -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@bfd_version_package@,\"version \"," \
-e "s,@report_bugs_to@,$$report_bugs_to," \
< $(srcdir)/version.h > $@; \
echo "$${bfd_soversion}" > libtool-soversion

845
SOURCES/binutils-2.25.1-objdump-speedup.patch

@ -0,0 +1,845 @@
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.25.1/bfd/dwarf2.c
--- binutils.orig/bfd/dwarf2.c 2017-01-16 14:48:05.110778762 +0000
+++ binutils-2.25.1/bfd/dwarf2.c 2017-01-16 14:51:04.915885225 +0000
@@ -144,16 +144,16 @@ struct dwarf2_debug
/* Length of the loaded .debug_str section. */
bfd_size_type dwarf_str_size;
- /* Pointer to the .debug_ranges section loaded into memory. */
+ /* Pointer to the .debug_ranges section loaded into memory. */
bfd_byte *dwarf_ranges_buffer;
- /* Length of the loaded .debug_ranges section. */
+ /* Length of the loaded .debug_ranges section. */
bfd_size_type dwarf_ranges_size;
/* If the most recent call to bfd_find_nearest_line was given an
address in an inlined function, preserve a pointer into the
calling chain for subsequent calls to bfd_find_inliner_info to
- use. */
+ use. */
struct funcinfo *inliner_chain;
/* Section VMAs at the time the stash was built. */
@@ -212,9 +212,12 @@ struct comp_unit
/* Keep the bfd convenient (for memory allocation). */
bfd *abfd;
- /* The lowest and highest addresses contained in this compilation
- unit as specified in the compilation unit header. */
+ /* Linked list of the low and high address ranges contained in this
+ compilation unit as specified in the compilation unit header. */
struct arange arange;
+ /* A single arange containing the lowest and highest
+ addresses covered by the compilation unit. */
+ struct arange minmax;
/* The DW_AT_name attribute (for error messages). */
char *name;
@@ -256,6 +259,12 @@ struct comp_unit
/* A list of the functions found in this comp. unit. */
struct funcinfo *function_table;
+ /* A table of function information references searchable by address. */
+ struct lookup_funcinfo *lookup_funcinfo_table;
+
+ /* Number of functions in the function_table and sorted_function_table. */
+ bfd_size_type number_of_functions;
+
/* A list of the variables found in this comp. unit. */
struct varinfo *variable_table;
@@ -390,7 +399,7 @@ struct info_hash_table
struct bfd_hash_table base;
};
-/* Function to create a new entry in info hash table. */
+/* Function to create a new entry in info hash table. */
static struct bfd_hash_entry *
info_hash_table_newfunc (struct bfd_hash_entry *entry,
@@ -476,7 +485,7 @@ insert_info_hash_table (struct info_hash
}
/* Look up an info entry list from an info hash table. Return NULL
- if there is none. */
+ if there is none. */
static struct info_list_node *
lookup_info_hash_table (struct info_hash_table *hash_table, const char *key)
@@ -517,8 +526,8 @@ read_section (bfd * abfd,
}
if (! msec)
{
- (*_bfd_error_handler) (_("Dwarf Error: Can't find %s section."),
- sec->uncompressed_name);
+ _bfd_error_handler (_("Dwarf Error: Can't find %s section."),
+ sec->uncompressed_name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -546,9 +555,10 @@ read_section (bfd * abfd,
that the client wants. Validate it here to avoid trouble later. */
if (offset != 0 && offset >= *section_size)
{
- (*_bfd_error_handler) (_("Dwarf Error: Offset (%lu)"
- " greater than or equal to %s size (%lu)."),
- (long) offset, section_name, *section_size);
+ /* xgettext: c-format */
+ _bfd_error_handler (_("Dwarf Error: Offset (%lu)"
+ " greater than or equal to %s size (%lu)."),
+ (long) offset, section_name, *section_size);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -1157,8 +1167,8 @@ read_attribute_value (struct attribute *
info_ptr = read_attribute_value (attr, form, unit, info_ptr, info_ptr_end);
break;
default:
- (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %#x."),
- form);
+ _bfd_error_handler (_("Dwarf Error: Invalid or unhandled FORM value: %#x."),
+ form);
bfd_set_error (bfd_error_bad_value);
return NULL;
}
@@ -1213,22 +1223,22 @@ non_mangled (int lang)
struct line_info
{
- struct line_info* prev_line;
- bfd_vma address;
- char *filename;
- unsigned int line;
- unsigned int column;
- unsigned int discriminator;
- unsigned char op_index;
- unsigned char end_sequence; /* End of (sequential) code sequence. */
+ struct line_info * prev_line;
+ bfd_vma address;
+ char * filename;
+ unsigned int line;
+ unsigned int column;
+ unsigned int discriminator;
+ unsigned char op_index;
+ unsigned char end_sequence; /* End of (sequential) code sequence. */
};
struct fileinfo
{
- char *name;
- unsigned int dir;
- unsigned int time;
- unsigned int size;
+ char * name;
+ unsigned int dir;
+ unsigned int time;
+ unsigned int size;
};
struct line_sequence
@@ -1236,11 +1246,13 @@ struct line_sequence
bfd_vma low_pc;
struct line_sequence* prev_sequence;
struct line_info* last_line; /* Largest VMA. */
+ struct line_info** line_info_lookup;
+ bfd_size_type num_lines;
};
struct line_info_table
{
- bfd* abfd;
+ bfd * abfd;
unsigned int num_files;
unsigned int num_dirs;
unsigned int num_sequences;
@@ -1259,23 +1271,37 @@ struct line_info_table
struct funcinfo
{
/* Pointer to previous function in list of all functions. */
- struct funcinfo *prev_func;
+ struct funcinfo * prev_func;
/* Pointer to function one scope higher. */
- struct funcinfo *caller_func;
+ struct funcinfo * caller_func;
/* Source location file name where caller_func inlines this func. */
- char *caller_file;
+ char * caller_file;
/* Source location file name. */
- char *file;
+ char * file;
/* Source location line number where caller_func inlines this func. */
- int caller_line;
+ int caller_line;
/* Source location line number. */
- int line;
- int tag;
- bfd_boolean is_linkage;
- const char *name;
- struct arange arange;
+ int line;
+ int tag;
+ bfd_boolean is_linkage;
+ const char * name;
+ struct arange arange;
/* Where the symbol is defined. */
- asection *sec;
+ asection * sec;
+};
+
+struct lookup_funcinfo
+{
+ /* Function information corresponding to this lookup table entry. */
+ struct funcinfo * funcinfo;
+
+ /* The lowest address for this specific function. */
+ bfd_vma low_addr;
+
+ /* The highest address of this function before the lookup table is sorted.
+ The highest address of all prior functions after the lookup table is
+ sorted, which is used for binary search. */
+ bfd_vma high_addr;
};
struct varinfo
@@ -1446,7 +1472,7 @@ concat_filename (struct line_info_table
{
/* FILE == 0 means unknown. */
if (file)
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: mangled line number section (bad file number)."));
return strdup ("<unknown>");
}
@@ -1502,7 +1528,7 @@ concat_filename (struct line_info_table
}
static bfd_boolean
-arange_add (const struct comp_unit *unit, struct arange *first_arange,
+arange_add (struct comp_unit *unit, struct arange *first_arange,
bfd_vma low_pc, bfd_vma high_pc)
{
struct arange *arange;
@@ -1514,11 +1540,16 @@ arange_add (const struct comp_unit *unit
/* If the first arange is empty, use it. */
if (first_arange->high == 0)
{
- first_arange->low = low_pc;
- first_arange->high = high_pc;
+ unit->minmax.low = first_arange->low = low_pc;
+ unit->minmax.high = first_arange->high = high_pc;
return TRUE;
}
+ if (unit->minmax.low > low_pc)
+ unit->minmax.low = low_pc;
+ if (unit->minmax.high < high_pc)
+ unit->minmax.high = high_pc;
+
/* Next see if we can cheaply extend an existing range. */
arange = first_arange;
do
@@ -1538,7 +1569,7 @@ arange_add (const struct comp_unit *unit
while (arange);
/* Need to allocate a new arange and insert it into the arange list.
- Order isn't significant, so just insert after the first arange. */
+ Order isn't significant, so just insert after the first arange. */
arange = (struct arange *) bfd_alloc (unit->abfd, sizeof (*arange));
if (arange == NULL)
return FALSE;
@@ -1578,17 +1609,62 @@ compare_sequences (const void* a, const
return 0;
}
+/* Construct the line information table for quick lookup. */
+
+static bfd_boolean
+build_line_info_table (struct line_info_table * table,
+ struct line_sequence * seq)
+{
+ bfd_size_type amt;
+ struct line_info** line_info_lookup;
+ struct line_info* each_line;
+ unsigned int num_lines;
+ unsigned int line_index;
+
+ if (seq->line_info_lookup != NULL)
+ return TRUE;
+
+ /* Count the number of line information entries. We could do this while
+ scanning the debug information, but some entries may be added via
+ lcl_head without having a sequence handy to increment the number of
+ lines. */
+ num_lines = 0;
+ for (each_line = seq->last_line; each_line; each_line = each_line->prev_line)
+ num_lines++;
+
+ if (num_lines == 0)
+ return TRUE;
+
+ /* Allocate space for the line information lookup table. */
+ amt = sizeof (struct line_info*) * num_lines;
+ line_info_lookup = (struct line_info**) bfd_alloc (table->abfd, amt);
+ if (line_info_lookup == NULL)
+ return FALSE;
+
+ /* Create the line information lookup table. */
+ line_index = num_lines;
+ for (each_line = seq->last_line; each_line; each_line = each_line->prev_line)
+ line_info_lookup[--line_index] = each_line;
+
+ BFD_ASSERT (line_index == 0);
+
+ seq->num_lines = num_lines;
+ seq->line_info_lookup = line_info_lookup;
+
+ return TRUE;
+}
+
/* Sort the line sequences for quick lookup. */
static bfd_boolean
sort_line_sequences (struct line_info_table* table)
{
- bfd_size_type amt;
- struct line_sequence* sequences;
- struct line_sequence* seq;
- unsigned int n = 0;
- unsigned int num_sequences = table->num_sequences;
- bfd_vma last_high_pc;
+ bfd_size_type amt;
+ struct line_sequence* sequences;
+ struct line_sequence* seq;
+ unsigned int n = 0;
+ unsigned int num_sequences = table->num_sequences;
+ bfd_vma last_high_pc;
if (num_sequences == 0)
return TRUE;
@@ -1609,6 +1685,8 @@ sort_line_sequences (struct line_info_ta
sequences[n].low_pc = seq->low_pc;
sequences[n].prev_sequence = NULL;
sequences[n].last_line = seq->last_line;
+ sequences[n].line_info_lookup = NULL;
+ sequences[n].num_lines = 0;
seq = seq->prev_sequence;
free (last_seq);
}
@@ -1687,7 +1765,7 @@ decode_line_info (struct comp_unit *unit
if (stash->dwarf_line_size < 16)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Line info section is too small (%ld)"),
(long) stash->dwarf_line_size);
bfd_set_error (bfd_error_bad_value);
@@ -1716,7 +1794,8 @@ decode_line_info (struct comp_unit *unit
if (lh.total_length > stash->dwarf_line_size)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext: c-format */
(_("Dwarf Error: Line info data is bigger (0x%lx) than the section (0x%lx)"),
(long) lh.total_length, (long) stash->dwarf_line_size);
bfd_set_error (bfd_error_bad_value);
@@ -1728,7 +1807,7 @@ decode_line_info (struct comp_unit *unit
lh.version = read_2_bytes (abfd, line_ptr, line_end);
if (lh.version < 2 || lh.version > 4)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Unhandled .debug_line version %d."), lh.version);
bfd_set_error (bfd_error_bad_value);
return NULL;
@@ -1737,7 +1816,7 @@ decode_line_info (struct comp_unit *unit
if (line_ptr + offset_size + (lh.version >=4 ? 6 : 5) >= line_end)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Ran out of room reading prologue"));
bfd_set_error (bfd_error_bad_value);
return NULL;
@@ -1762,7 +1841,7 @@ decode_line_info (struct comp_unit *unit
if (lh.maximum_ops_per_insn == 0)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Invalid maximum operations per instruction."));
bfd_set_error (bfd_error_bad_value);
return NULL;
@@ -1782,7 +1861,7 @@ decode_line_info (struct comp_unit *unit
if (line_ptr + (lh.opcode_base - 1) >= line_end)
{
- (*_bfd_error_handler) (_("Dwarf Error: Ran out of room reading opcodes"));
+ _bfd_error_handler (_("Dwarf Error: Ran out of room reading opcodes"));
bfd_set_error (bfd_error_bad_value);
return NULL;
}
@@ -1969,7 +2048,7 @@ decode_line_info (struct comp_unit *unit
line_ptr += exop_len - 1;
break;
default:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: mangled line number section."));
bfd_set_error (bfd_error_bad_value);
line_fail:
@@ -2089,7 +2168,7 @@ lookup_address_in_line_info_table (struc
unsigned int *discriminator_ptr)
{
struct line_sequence *seq = NULL;
- struct line_info *each_line;
+ struct line_info *info;
int low, high, mid;
/* Binary search the array of sequences. */
@@ -2107,26 +2186,43 @@ lookup_address_in_line_info_table (struc
break;
}
- if (seq && addr >= seq->low_pc && addr < seq->last_line->address)
+ /* Check for a valid sequence. */
+ if (!seq || addr < seq->low_pc || addr >= seq->last_line->address)
+ goto fail;
+
+ if (!build_line_info_table (table, seq))
+ goto fail;
+
+ /* Binary search the array of line information. */
+ low = 0;
+ high = seq->num_lines;
+ info = NULL;
+ while (low < high)
{
- /* Note: seq->last_line should be a descendingly sorted list. */
- for (each_line = seq->last_line;
- each_line;
- each_line = each_line->prev_line)
- if (addr >= each_line->address)
- break;
+ mid = (low + high) / 2;
+ info = seq->line_info_lookup[mid];
+ if (addr < info->address)
+ high = mid;
+ else if (addr >= seq->line_info_lookup[mid + 1]->address)
+ low = mid + 1;
+ else
+ break;
+ }
- if (each_line
- && !(each_line->end_sequence || each_line == seq->last_line))
- {
- *filename_ptr = each_line->filename;
- *linenumber_ptr = each_line->line;
- if (discriminator_ptr)
- *discriminator_ptr = each_line->discriminator;
- return seq->last_line->address - seq->low_pc;
- }
+ /* Check for a valid line information entry. */
+ if (info
+ && addr >= info->address
+ && addr < seq->line_info_lookup[mid + 1]->address
+ && !(info->end_sequence || info == seq->last_line))
+ {
+ *filename_ptr = info->filename;
+ *linenumber_ptr = info->line;
+ if (discriminator_ptr)
+ *discriminator_ptr = info->discriminator;
+ return seq->last_line->address - seq->low_pc;
}
+fail:
*filename_ptr = NULL;
return 0;
}
@@ -2134,16 +2230,102 @@ lookup_address_in_line_info_table (struc
/* Read in the .debug_ranges section for future reference. */
static bfd_boolean
-read_debug_ranges (struct comp_unit *unit)
+read_debug_ranges (struct comp_unit * unit)
{
- struct dwarf2_debug *stash = unit->stash;
+ struct dwarf2_debug * stash = unit->stash;
+
return read_section (unit->abfd, &stash->debug_sections[debug_ranges],
stash->syms, 0,
- &stash->dwarf_ranges_buffer, &stash->dwarf_ranges_size);
+ &stash->dwarf_ranges_buffer,
+ &stash->dwarf_ranges_size);
}
/* Function table functions. */
+static int
+compare_lookup_funcinfos (const void * a, const void * b)
+{
+ const struct lookup_funcinfo * lookup1 = a;
+ const struct lookup_funcinfo * lookup2 = b;
+
+ if (lookup1->low_addr < lookup2->low_addr)
+ return -1;
+ if (lookup1->low_addr > lookup2->low_addr)
+ return 1;
+ if (lookup1->high_addr < lookup2->high_addr)
+ return -1;
+ if (lookup1->high_addr > lookup2->high_addr)
+ return 1;
+
+ return 0;
+}
+
+static bfd_boolean
+build_lookup_funcinfo_table (struct comp_unit * unit)
+{
+ struct lookup_funcinfo *lookup_funcinfo_table = unit->lookup_funcinfo_table;
+ unsigned int number_of_functions = unit->number_of_functions;
+ struct funcinfo *each;
+ struct lookup_funcinfo *entry;
+ size_t func_index;
+ struct arange *range;
+ bfd_vma low_addr, high_addr;
+
+ if (lookup_funcinfo_table || number_of_functions == 0)
+ return TRUE;
+
+ /* Create the function info lookup table. */
+ lookup_funcinfo_table = (struct lookup_funcinfo *)
+ bfd_malloc (number_of_functions * sizeof (struct lookup_funcinfo));
+ if (lookup_funcinfo_table == NULL)
+ return FALSE;
+
+ /* Populate the function info lookup table. */
+ func_index = number_of_functions;
+ for (each = unit->function_table; each; each = each->prev_func)
+ {
+ entry = &lookup_funcinfo_table[--func_index];
+ entry->funcinfo = each;
+
+ /* Calculate the lowest and highest address for this function entry. */
+ low_addr = entry->funcinfo->arange.low;
+ high_addr = entry->funcinfo->arange.high;
+
+ for (range = entry->funcinfo->arange.next; range; range = range->next)
+ {
+ if (range->low < low_addr)
+ low_addr = range->low;
+ if (range->high > high_addr)
+ high_addr = range->high;
+ }
+
+ entry->low_addr = low_addr;
+ entry->high_addr = high_addr;
+ }
+
+ BFD_ASSERT (func_index == 0);
+
+ /* Sort the function by address. */
+ qsort (lookup_funcinfo_table,
+ number_of_functions,
+ sizeof (struct lookup_funcinfo),
+ compare_lookup_funcinfos);
+
+ /* Calculate the high watermark for each function in the lookup table. */
+ high_addr = lookup_funcinfo_table[0].high_addr;
+ for (func_index = 1; func_index < number_of_functions; func_index++)
+ {
+ entry = &lookup_funcinfo_table[func_index];
+ if (entry->high_addr > high_addr)
+ high_addr = entry->high_addr;
+ else
+ entry->high_addr = high_addr;
+ }
+
+ unit->lookup_funcinfo_table = lookup_funcinfo_table;
+ return TRUE;
+}
+
/* If ADDR is within UNIT's function tables, set FUNCTION_PTR, and return
TRUE. Note that we need to find the function that has the smallest range
that contains ADDR, to handle inlined functions without depending upon
@@ -2154,37 +2336,77 @@ lookup_address_in_function_table (struct
bfd_vma addr,
struct funcinfo **function_ptr)
{
- struct funcinfo* each_func;
+ unsigned int number_of_functions = unit->number_of_functions;
+ struct lookup_funcinfo* lookup_funcinfo = NULL;
+ struct funcinfo* funcinfo = NULL;
struct funcinfo* best_fit = NULL;
bfd_vma best_fit_len = 0;
+ bfd_size_type low, high, mid, first;
struct arange *arange;
- for (each_func = unit->function_table;
- each_func;
- each_func = each_func->prev_func)
+ if (number_of_functions == 0)
+ return FALSE;
+
+ if (!build_lookup_funcinfo_table (unit))
+ return FALSE;
+
+ if (unit->lookup_funcinfo_table[number_of_functions - 1].high_addr < addr)
+ return FALSE;
+
+ /* Find the first function in the lookup table which may contain the
+ specified address. */
+ low = 0;
+ high = number_of_functions;
+ first = high;
+ while (low < high)
{
- for (arange = &each_func->arange;
- arange;
- arange = arange->next)
+ mid = (low + high) / 2;
+ lookup_funcinfo = &unit->lookup_funcinfo_table[mid];
+ if (addr < lookup_funcinfo->low_addr)
+ high = mid;
+ else if (addr >= lookup_funcinfo->high_addr)
+ low = mid + 1;
+ else
+ high = first = mid;
+ }
+
+ /* Find the 'best' match for the address. The prior algorithm defined the
+ best match as the function with the smallest address range containing
+ the specified address. This definition should probably be changed to the
+ innermost inline routine containing the address, but right now we want
+ to get the same results we did before. */
+ while (first < number_of_functions)
+ {
+ if (addr < unit->lookup_funcinfo_table[first].low_addr)
+ break;
+ funcinfo = unit->lookup_funcinfo_table[first].funcinfo;
+
+ for (arange = &funcinfo->arange; arange; arange = arange->next)
{
- if (addr >= arange->low && addr < arange->high)
+ if (addr < arange->low || addr >= arange->high)
+ continue;
+
+ if (!best_fit
+ || arange->high - arange->low < best_fit_len
+ /* The following comparison is designed to return the same
+ match as the previous algorithm for routines which have the
+ same best fit length. */
+ || (arange->high - arange->low == best_fit_len
+ && funcinfo > best_fit))
{
- if (!best_fit
- || arange->high - arange->low < best_fit_len)
- {
- best_fit = each_func;
- best_fit_len = arange->high - arange->low;
- }
+ best_fit = funcinfo;
+ best_fit_len = arange->high - arange->low;
}
}
- }
- if (best_fit)
- {
- *function_ptr = best_fit;
- return TRUE;
+ first++;
}
- return FALSE;
+
+ if (!best_fit)
+ return FALSE;
+
+ *function_ptr = best_fit;
+ return TRUE;
}
/* If SYM at ADDR is within function table of UNIT, set FILENAME_PTR
@@ -2269,8 +2491,8 @@ lookup_symbol_in_variable_table (struct
*linenumber_ptr = each->line;
return TRUE;
}
- else
- return FALSE;
+
+ return FALSE;
}
static char *
@@ -2326,7 +2548,7 @@ find_abstract_instance_name (struct comp
info_ptr = read_alt_indirect_ref (unit, die_ref);
if (info_ptr == NULL)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Unable to read alt ref %u."), die_ref);
bfd_set_error (bfd_error_bad_value);
return NULL;
@@ -2350,7 +2572,7 @@ find_abstract_instance_name (struct comp
abbrev = lookup_abbrev (abbrev_number, unit->abbrevs);
if (! abbrev)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Could not find abbrev number %u."), abbrev_number);
bfd_set_error (bfd_error_bad_value);
}
@@ -2494,7 +2716,7 @@ scan_unit_for_symbols (struct comp_unit
abbrev = lookup_abbrev (abbrev_number,unit->abbrevs);
if (! abbrev)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: Could not find abbrev number %u."),
abbrev_number);
bfd_set_error (bfd_error_bad_value);
@@ -2513,6 +2735,7 @@ scan_unit_for_symbols (struct comp_unit
func->tag = abbrev->tag;
func->prev_func = unit->function_table;
unit->function_table = func;
+ unit->number_of_functions++;
BFD_ASSERT (!unit->cached);
if (func->tag == DW_TAG_inlined_subroutine)
@@ -2766,7 +2989,8 @@ parse_comp_unit (struct dwarf2_debug *st
if (addr_size > sizeof (bfd_vma))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext: c-format */
(_("Dwarf Error: found address size '%u', this reader"
" can not handle sizes greater than '%u'."),
addr_size,
@@ -2777,7 +3001,7 @@ parse_comp_unit (struct dwarf2_debug *st
if (addr_size != 2 && addr_size != 4 && addr_size != 8)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
("Dwarf Error: found address size '%u', this reader"
" can only handle address sizes '2', '4' and '8'.", addr_size);
bfd_set_error (bfd_error_bad_value);
@@ -2845,7 +3069,7 @@ parse_comp_unit (struct dwarf2_debug *st
low_pc = attr.u.val;
/* If the compilation unit DIE has a DW_AT_low_pc attribute,
this is the base address to use when reading location
- lists or range lists. */
+ lists or range lists. */
if (abbrev->tag == DW_TAG_compile_unit)
unit->base_address = low_pc;
break;
@@ -2867,7 +3091,7 @@ parse_comp_unit (struct dwarf2_debug *st
/* PR 17512: file: 1fe726be. */
if (! is_str_attr (attr.form))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("Dwarf Error: DW_AT_comp_dir attribute encountered with a non-string form."));
comp_dir = NULL;
}
@@ -2919,6 +3143,11 @@ comp_unit_contains_address (struct comp_
if (unit->error)
return FALSE;
+ if (unit->minmax.high < addr || unit->minmax.low > addr)
+ return FALSE;
+
+ /* We know that the address *might* be contained within this comp
+ unit, but we cannot be sure until we check the specific ranges. */
arange = &unit->arange;
do
{
@@ -3116,7 +3345,7 @@ comp_unit_hash_info (struct dwarf2_debug
each_func && okay;
each_func = each_func->prev_func)
{
- /* Skip nameless functions. */
+ /* Skip nameless functions. */
if (each_func->name)
/* There is no need to copy name string into hash table as
name string is either in the dwarf string buffer or
@@ -3498,7 +3727,7 @@ stash_maybe_update_info_hash_tables (str
return TRUE;
}
-/* Check consistency of info hash tables. This is for debugging only. */
+/* Check consistency of info hash tables. This is for debugging only. */
static void ATTRIBUTE_UNUSED
stash_verify_info_hash_table (struct dwarf2_debug *stash)
@@ -3930,7 +4159,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd
stash_maybe_enable_info_hash_tables (abfd, stash);
/* Keep info hash table up to date if they are available. Note that we
- may disable the hash tables if there is any error duing update. */
+ may disable the hash tables if there is any error duing update. */
if (stash->info_hash_status == STASH_INFO_HASH_ON)
stash_maybe_update_info_hash_tables (stash);
@@ -4222,6 +4451,12 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abf
function_table = function_table->prev_func;
}
+ if (each->lookup_funcinfo_table)
+ {
+ free (each->lookup_funcinfo_table);
+ each->lookup_funcinfo_table = NULL;
+ }
+
while (variable_table)
{
if (variable_table->file)
diff -rup binutils.orig/binutils/objdump.c binutils-2.25.1/binutils/objdump.c
--- binutils.orig/binutils/objdump.c 2017-01-16 14:48:06.214761408 +0000
+++ binutils-2.25.1/binutils/objdump.c 2017-01-16 14:50:19.313618730 +0000
@@ -3439,7 +3439,7 @@ display_any_bfd (bfd *file, int level)
}
static void
-display_file (char *filename, char *target)
+display_file (char *filename, char *target, bfd_boolean last_file)
{
bfd *file;
@@ -3458,7 +3458,14 @@ display_file (char *filename, char *targ
display_any_bfd (file, 0);
- bfd_close (file);
+ /* This is an optimization to improve the speed of objdump, especially when
+ dumping a file with lots of associated debug informatiom. Closing such
+ a file can take a non-trivial amount of time as there are lots of lists
+ to walk and buffers to free. This is only really necessary however if
+ we are about to load another file. Otherwise, if we are about to exit,
+ then we can save (a lot of) time by not bothering to do any tidying up. */
+ if (! last_file)
+ bfd_close (file);
}
int
@@ -3736,10 +3743,13 @@ main (int argc, char **argv)
else
{
if (optind == argc)
- display_file ("a.out", target);
+ display_file ("a.out", target, TRUE);
else
for (; optind < argc;)
- display_file (argv[optind++], target);
+ {
+ display_file (argv[optind], target, optind == argc - 1);
+ optind++;
+ }
}
free_only_list ();

3590
SOURCES/binutils-2.27-ARMv8.2.patch

File diff suppressed because it is too large Load Diff

10
SOURCES/binutils-2.27-DW_AT_export_symbols.patch

@ -0,0 +1,10 @@
--- binutils.orig/include/dwarf2.def 2017-08-08 17:40:39.295382994 +0100
+++ binutils-2.27/include/dwarf2.def 2017-08-08 17:44:03.672045965 +0100
@@ -310,6 +310,7 @@ DW_AT (DW_AT_enum_class, 0x6d)
DW_AT (DW_AT_linkage_name, 0x6e)
/* DWARF 5. */
DW_AT (DW_AT_noreturn, 0x87)
+DW_AT (DW_AT_export_symbols, 0x89)
DW_AT_DUP (DW_AT_lo_user, 0x2000) /* Implementation-defined range start. */
DW_AT_DUP (DW_AT_hi_user, 0x3fff) /* Implementation-defined range end. */

367
SOURCES/binutils-2.27-aarch64-copy-relocs.patch

@ -0,0 +1,367 @@
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 1edf2a0..e27f067 100644 (file)
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -6869,6 +6889,31 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
return TRUE;
}
+/* Return true if we need copy relocation against EH. */
+
+static bfd_boolean
+need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh)
+{
+ struct elf_dyn_relocs *p;
+ asection *s;
+
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ /* If there is any pc-relative reference, we need to keep copy relocation
+ to avoid propagating the relocation into runtime that current glibc
+ does not support. */
+ if (p->pc_count)
+ return TRUE;
+
+ s = p->sec->output_section;
+ /* Need copy relocation if it's against read-only section. */
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@@ -6942,6 +6987,19 @@ elfNN_aarch64_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
+ if (ELIMINATE_COPY_RELOCS)
+ {
+ struct elf_aarch64_link_hash_entry *eh;
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ eh = (struct elf_aarch64_link_hash_entry *) h;
+ if (!need_copy_relocation_p (eh))
+ {
+ h->non_got_ref = 0;
+ return TRUE;
+ }
+ }
+
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
an entry for this symbol in the .dynsym section. The dynamic
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-2.d b/ld/testsuite/ld-aarch64/copy-reloc-2.d
new file mode 100644 (file)
index 0000000..87ddccd
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-2.d
@@ -0,0 +1,7 @@
+.*
+DYNAMIC RELOCATION RECORDS
+OFFSET.*TYPE.*VALUE.*
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d b/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d
new file mode 100644 (file)
index 0000000..9657d65
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d
@@ -0,0 +1,4 @@
+.*
+DYNAMIC RELOCATION RECORDS
+OFFSET.*TYPE.*VALUE.*
+.*R_AARCH64_ABS64.*global_a
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s b/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s
new file mode 100644 (file)
index 0000000..d83658c
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s
@@ -0,0 +1,32 @@
+ # expect copy relocation for all these scenarios.
+ .global p
+ .global q
+ .global r
+ .section .data.rel.ro,"aw",%progbits
+ .align 3
+ .type p, %object
+ .size p, 8
+p:
+ .xword global_a
+
+ .type q, %object
+ .size q, 8
+q:
+ .xword global_b
+
+ .type r, %object
+ .size r, 8
+r:
+ # Any pc-rel relocation as no dynamic linker support on AArch64.
+ .xword global_c - .
+
+ .text
+ .global main
+main:
+ # Symbols are referenced by any other relocation against read-only
+ # section.
+ movz x0, :abs_g0_nc:global_a
+ adrp x1, global_b
+ # pc-rel.
+ adrp x2, global_d
+ add x2, x2, #:lo12:global_c
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s b/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s
new file mode 100644 (file)
index 0000000..33227aa
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s
@@ -0,0 +1,7 @@
+ .global p
+ .section .data.rel.ro,"aw",%progbits
+ .align 3
+ .type p, %object
+ .size p, 8
+p:
+ .xword global_a
--- binutils.orig/ld/testsuite/ld-aarch64/copy-reloc-so.s 2017-10-10 16:56:06.347550451 +0100
+++ binutils-2.27/ld/testsuite/ld-aarch64/copy-reloc-so.s 2017-10-10 16:56:25.926321182 +0100
@@ -1,6 +1,25 @@
.global global_a
.type global_a, %object
.size global_a, 4
+
+ .global global_b
+ .type global_b, %object
+ .size global_b, 4
+
+ .global global_c
+ .type global_c, %object
+ .size global_c, 4
+
+ .global global_d
+ .type global_d, %object
+ .size global_d, 4
+
.data
global_a:
.word 0xcafedead
+global_b:
+ .word 0xcafecafe
+global_c:
+ .word 0xdeadcafe
+global_d:
+ .word 0xdeaddead
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2017-10-10 16:56:06.347550451 +0100
+++ binutils-2.27/ld/testsuite/ld-aarch64/aarch64-elf.exp 2017-10-10 16:58:19.629989701 +0100
@@ -292,6 +292,10 @@ set aarch64elflinktests {
{} "copy-reloc-so.so"}
{"ld-aarch64/exe with copy relocation" "-e0 tmpdir/copy-reloc-so.so" "" ""
{copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
+ {"ld-aarch64/exe with copy relocation 2" "-e0 tmpdir/copy-reloc-so.so" "" ""
+ {copy-reloc-exe-2.s} {{objdump -R copy-reloc-2.d}} "copy-reloc-2"}
+ {"ld-aarch64/exe with copy relocation elimination" "-e0 tmpdir/copy-reloc-so.so" "" ""
+ {copy-reloc-exe-eliminate.s} {{objdump -R copy-reloc-eliminate.d}} "copy-reloc-elimination"}
}
run_ld_link_tests $aarch64elflinktests
--- binutils.orig/bfd/elfnn-aarch64.c 2017-10-10 16:56:05.783557056 +0100
+++ binutils-2.27/bfd/elfnn-aarch64.c 2017-10-10 17:15:02.559298576 +0100
@@ -246,7 +246,7 @@
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G1)
-#define ELIMINATE_COPY_RELOCS 0
+#define ELIMINATE_COPY_RELOCS 1
/* Return size of a relocation entry. HTAB is the bfd's
elf_aarch64_link_hash_entry. */
@@ -5154,12 +5154,25 @@ elfNN_aarch64_final_link_relocate (reloc
/* When generating a shared object or relocatable executable, these
relocations are copied into the output file to be resolved at
run time. */
- if (((bfd_link_pic (info) == TRUE)
- || globals->root.is_relocatable_executable)
- && (input_section->flags & SEC_ALLOC)
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ if ((((bfd_link_pic (info) == TRUE)
+ || globals->root.is_relocatable_executable)
+ && (input_section->flags & SEC_ALLOC)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ /* Or we are creating an executable, we may need to keep relocations
+ for symbols satisfied by a dynamic library if we manage to avoid
+ copy relocs for the symbol. */
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (input_section->flags & SEC_ALLOC)
+ && h->dynindx != -1
+ && !h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -6777,15 +6790,22 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
h->plt.refcount -= 1;
break;
+ case BFD_RELOC_AARCH64_ADD_LO12:
case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
+ case BFD_RELOC_AARCH64_LDST128_LO12:
+ case BFD_RELOC_AARCH64_LDST16_LO12:
+ case BFD_RELOC_AARCH64_LDST32_LO12:
+ case BFD_RELOC_AARCH64_LDST64_LO12:
+ case BFD_RELOC_AARCH64_LDST8_LO12:
+ case BFD_RELOC_AARCH64_LD_LO19_PCREL:
case BFD_RELOC_AARCH64_MOVW_G0_NC:
case BFD_RELOC_AARCH64_MOVW_G1_NC:
case BFD_RELOC_AARCH64_MOVW_G2_NC:
case BFD_RELOC_AARCH64_MOVW_G3:
case BFD_RELOC_AARCH64_NN:
- if (h != NULL && bfd_link_executable (info))
+ if (h != NULL && bfd_link_pic (info))
{
if (h->plt.refcount > 0)
h->plt.refcount -= 1;
@@ -7158,6 +7178,41 @@ elfNN_aarch64_check_relocs (bfd *abfd, s
switch (bfd_r_type)
{
+ case BFD_RELOC_AARCH64_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_G1_NC:
+ case BFD_RELOC_AARCH64_MOVW_G2_NC:
+ case BFD_RELOC_AARCH64_MOVW_G3:
+ if (bfd_link_pic (info))
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B: relocation %s against `%s' can not be used when making "
+ "a shared object; recompile with -fPIC"),
+ abfd, elfNN_aarch64_howto_table[howto_index].name,
+ (h) ? h->root.root.string : "a local symbol");
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ /* Fall through. */
+
+ case BFD_RELOC_AARCH64_16_PCREL:
+ case BFD_RELOC_AARCH64_32_PCREL:
+ case BFD_RELOC_AARCH64_64_PCREL:
+ case BFD_RELOC_AARCH64_ADD_LO12:
+ case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
+ case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
+ case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
+ case BFD_RELOC_AARCH64_LDST128_LO12:
+ case BFD_RELOC_AARCH64_LDST16_LO12:
+ case BFD_RELOC_AARCH64_LDST32_LO12:
+ case BFD_RELOC_AARCH64_LDST64_LO12:
+ case BFD_RELOC_AARCH64_LDST8_LO12:
+ case BFD_RELOC_AARCH64_LD_LO19_PCREL:
+ if (h == NULL || bfd_link_pic (info))
+ break;
+ /* Fall through. */
+
case BFD_RELOC_AARCH64_NN:
/* We don't need to handle relocs into sections not going into
@@ -7176,12 +7231,32 @@ elfNN_aarch64_check_relocs (bfd *abfd, s
/* No need to do anything if we're not creating a shared
object. */
- if (! bfd_link_pic (info))
- break;
+ if (!(bfd_link_pic (info)
+ /* If on the other hand, we are creating an executable, we
+ may need to keep relocations for symbols satisfied by a
+ dynamic library if we manage to avoid copy relocs for the
+ symbol.
+
+ NOTE: Currently, there is no support of copy relocs
+ elimination on pc-relative relocation types, because there is
+ no dynamic relocation support for them in glibc. We still
+ record the dynamic symbol reference for them. This is
+ because one symbol may be referenced by both absolute
+ relocation (for example, BFD_RELOC_AARCH64_NN) and
+ pc-relative relocation. We need full symbol reference
+ information to make correct decision later in
+ elfNN_aarch64_adjust_dynamic_symbol. */
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
+ break;
{
struct elf_dyn_relocs *p;
struct elf_dyn_relocs **head;
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
/* We must copy these reloc types into the output file.
Create a reloc section in dynobj and make room for
@@ -7245,6 +7320,8 @@ elfNN_aarch64_check_relocs (bfd *abfd, s
p->count += 1;
+ if (elfNN_aarch64_howto_table[howto_index].pc_relative)
+ p->pc_count += 1;
}
break;
@@ -7348,42 +7425,6 @@ elfNN_aarch64_check_relocs (bfd *abfd, s
break;
}
- case BFD_RELOC_AARCH64_MOVW_G0_NC:
- case BFD_RELOC_AARCH64_MOVW_G1_NC:
- case BFD_RELOC_AARCH64_MOVW_G2_NC:
- case BFD_RELOC_AARCH64_MOVW_G3:
- if (bfd_link_pic (info))
- {
- int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
- (*_bfd_error_handler)
- (_("%B: relocation %s against `%s' can not be used when making "
- "a shared object; recompile with -fPIC"),
- abfd, elfNN_aarch64_howto_table[howto_index].name,
- (h) ? h->root.root.string : "a local symbol");
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
- case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
- case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
- if (h != NULL && bfd_link_executable (info))
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- h->non_got_ref = 1;
- h->plt.refcount += 1;
- h->pointer_equality_needed = 1;
- }
- /* FIXME:: RR need to handle these in shared libraries
- and essentially bomb out as these being non-PIC
- relocations in shared libraries. */
- break;
-
case BFD_RELOC_AARCH64_CALL26:
case BFD_RELOC_AARCH64_JUMP26:
/* If this is a local symbol then we resolve it

25
SOURCES/binutils-2.27-aarch64-ifunc.patch

@ -0,0 +1,25 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.27/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2017-02-21 10:45:19.311956006 +0000
+++ binutils-2.27/bfd/elfnn-aarch64.c 2017-02-21 11:55:07.517922655 +0000
@@ -4947,6 +4947,7 @@ elfNN_aarch64_final_link_relocate (reloc
it here if it is defined in a non-shared object. */
if (h != NULL
&& h->type == STT_GNU_IFUNC
+ && (input_section->flags & SEC_ALLOC)
&& h->def_regular)
{
asection *plt;
Only in binutils.orig/ld/testsuite/ld-ifunc: .#pr18808b.c
Only in binutils.orig/ld/testsuite/ld-ifunc: #pr18808b.c#
diff -rup binutils.orig/ld/testsuite/ld-ifunc/pr18808b.c binutils-2.27/ld/testsuite/ld-ifunc/pr18808b.c
--- binutils.orig/ld/testsuite/ld-ifunc/pr18808b.c 2017-02-21 10:45:27.418826491 +0000
+++ binutils-2.27/ld/testsuite/ld-ifunc/pr18808b.c 2017-02-21 10:45:41.049608726 +0000
@@ -6,7 +6,7 @@ static int foo_impl(int x)
return x;
}
-int bar()
+void bar ()
{
int (*f)(int) = foo;

2317
SOURCES/binutils-2.27-cve-bugs.patch

File diff suppressed because it is too large Load Diff

84
SOURCES/binutils-2.27-filename-in-error-messages.patch

@ -0,0 +1,84 @@
--- binutils-2.27.orig/binutils/readelf.c 2017-01-16 11:51:05.043922264 +0000
+++ binutils-2.27/binutils/readelf.c 2017-01-16 12:01:34.389053872 +0000
@@ -16733,39 +16733,49 @@ process_archive (char * file_name, FILE
static int
process_file (char * file_name)
{
+ char * name;
+ char * saved_program_name;
FILE * file;
struct stat statbuf;
char armag[SARMAG];
- int ret;
+ int ret = 1;
+
+ /* Overload program_name to include file_name. Doing this means
+ that warning/error messages will positively identify the file
+ concerned even when multiple instances of readelf are running. */
+ name = xmalloc (strlen (program_name) + strlen (file_name) + 3);
+ sprintf (name, "%s: %s", program_name, file_name);
+ saved_program_name = program_name;
+ program_name = name;
if (stat (file_name, &statbuf) < 0)
{
if (errno == ENOENT)
- error (_("'%s': No such file\n"), file_name);
+ error (_("No such file\n"));
else
- error (_("Could not locate '%s'. System error message: %s\n"),
- file_name, strerror (errno));
- return 1;
+ error (_("Could not locate file. System error message: %s\n"),
+ strerror (errno));
+ goto done;
}
if (! S_ISREG (statbuf.st_mode))
{
- error (_("'%s' is not an ordinary file\n"), file_name);
- return 1;
+ error (_("Not an ordinary file\n"));
+ goto done;
}
file = fopen (file_name, "rb");
if (file == NULL)
{
- error (_("Input file '%s' is not readable.\n"), file_name);
- return 1;
+ error (_("Not readable\n"));
+ goto done;
}
if (fread (armag, SARMAG, 1, file) != 1)
{
- error (_("%s: Failed to read file's magic number\n"), file_name);
+ error (_("Failed to read file's magic number\n"));
fclose (file);
- return 1;
+ goto done;
}
current_file_size = (bfd_size_type) statbuf.st_size;
@@ -16777,8 +16787,7 @@ process_file (char * file_name)
else
{
if (do_archive_index)
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
- file_name);
+ error (_("Not an archive so its index cannot be displayed\n"));
rewind (file);
archive_file_size = archive_file_offset = 0;
@@ -16787,7 +16796,10 @@ process_file (char * file_name)
fclose (file);
+ done:
current_file_size = 0;
+ free (program_name);
+ program_name = saved_program_name;
return ret;
}

1717
SOURCES/binutils-2.27-gold.patch

File diff suppressed because it is too large Load Diff

271
SOURCES/binutils-2.27-local-dynsym-count.patch

@ -0,0 +1,271 @@
diff -rup binutils-2.27.orig/bfd/ChangeLog binutils-2.27/bfd/ChangeLog
--- binutils-2.27.orig/bfd/ChangeLog 2016-08-12 17:14:07.621773233 +0100
+++ binutils-2.27/bfd/ChangeLog 2016-08-12 17:17:32.408119156 +0100
@@ -1,3 +1,9 @@
+2016-08-12 Alan Modra <amodra@gmail.com>
+
+ * elf-bfd.h (struct elf_link_hash_table): Add local_dynsymcount.
+ * elflink.c (_bfd_elf_link_renumber_dynsyms): Set local_dynsymcount.
+ (bfd_elf_final_link): Set .dynsym sh_info from local_dynsymcount.
+
2016-08-03 Tristan Gingold <gingold@adacore.com>
* version.m4: Bump version to 2.27
Only in binutils-2.27/bfd: ChangeLog.orig
Only in binutils-2.27/bfd: ChangeLog.rej
diff -rup binutils-2.27.orig/bfd/elf-bfd.h binutils-2.27/bfd/elf-bfd.h
--- binutils-2.27.orig/bfd/elf-bfd.h 2016-08-12 17:14:07.630773290 +0100
+++ binutils-2.27/bfd/elf-bfd.h 2016-08-12 17:16:08.519549845 +0100
@@ -524,6 +524,7 @@ struct elf_link_hash_table
/* The number of symbols found in the link which is intended for the
mandatory DT_SYMTAB tag (.dynsym section) in .dynamic section. */
bfd_size_type dynsymcount;
+ bfd_size_type local_dynsymcount;
/* The string table of dynamic symbols, which becomes the .dynstr
section. */
diff -rup binutils-2.27.orig/bfd/elflink.c binutils-2.27/bfd/elflink.c
--- binutils-2.27.orig/bfd/elflink.c 2016-08-12 17:14:07.637773334 +0100
+++ binutils-2.27/bfd/elflink.c 2016-08-12 17:16:08.521549858 +0100
@@ -903,6 +903,7 @@ _bfd_elf_link_renumber_dynsyms (bfd *out
for (p = elf_hash_table (info)->dynlocal; p ; p = p->next)
p->dynindx = ++dynsymcount;
}
+ elf_hash_table (info)->local_dynsymcount = dynsymcount;
elf_link_hash_traverse (elf_hash_table (info),
elf_link_renumber_hash_table_dynsyms,
@@ -11678,7 +11679,10 @@ bfd_elf_final_link (bfd *abfd, struct bf
{
Elf_Internal_Sym sym;
bfd_byte *dynsym = elf_hash_table (info)->dynsym->contents;
- long last_local = 0;
+
+ o = elf_hash_table (info)->dynsym->output_section;
+ elf_section_data (o)->this_hdr.sh_info
+ = elf_hash_table (info)->local_dynsymcount + 1;
/* Write out the section symbols for the output sections. */
if (bfd_link_pic (info)
@@ -11708,8 +11712,6 @@ bfd_elf_final_link (bfd *abfd, struct bf
return FALSE;
sym.st_value = s->vma;
dest = dynsym + dynindx * bed->s->sizeof_sym;
- if (last_local < dynindx)
- last_local = dynindx;
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
}
@@ -11742,16 +11744,10 @@ bfd_elf_final_link (bfd *abfd, struct bf
+ e->isym.st_value);
}
- if (last_local < e->dynindx)
- last_local = e->dynindx;
-
dest = dynsym + e->dynindx * bed->s->sizeof_sym;
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
}
-
- elf_section_data (elf_hash_table (info)->dynsym->output_section)->this_hdr.sh_info =
- last_local + 1;
}
/* We get the global symbols from the hash table. */
Only in binutils-2.27/bfd: elflink.c.orig
diff -rup binutils-2.27.orig/ld/ChangeLog binutils-2.27/ld/ChangeLog
--- binutils-2.27.orig/ld/ChangeLog 2016-08-12 17:14:08.064776041 +0100
+++ binutils-2.27/ld/ChangeLog 2016-08-12 17:17:00.166900351 +0100
@@ -1,3 +1,19 @@
+2016-08-12 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-tic6x/shlib-1.rd: Correct expected .dynsym sh_info.
+ * testsuite/ld-tic6x/shlib-1b.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-1r.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
+ * testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
+ * testsuite/ld-tic6x/static-app-1.rd: Likewise.
+ * testsuite/ld-tic6x/static-app-1b.rd: Likewise.
+ * testsuite/ld-tic6x/static-app-1r.rd: Likewise.
+ * testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
+
2016-08-03 Tristan Gingold <gingold@adacore.com>
* configure: Regenerate.
Only in binutils-2.27/ld: ChangeLog.orig
Only in binutils-2.27/ld: ChangeLog.rej
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1b.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-1b.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1b.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-1b.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000048 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008118 001118 000025 00 A 0 0 1
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1rb.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-1rb.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1rb.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-1rb.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000048 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008118 001118 000025 00 A 0 0 1
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-1.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-1.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000048 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008118 001118 000025 00 A 0 0 1
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1r.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-1r.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-1r.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-1r.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000048 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008118 001118 000025 00 A 0 0 1
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1b.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1b.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1b.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1b.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000044 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008044 001044 0000c0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008044 001044 0000c0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008104 001104 000036 00 A 0 0 1
\[ 4\] \.rela\.got RELA 0000813c 00113c 000018 0c AI 2 11 4
\[ 5\] \.rela\.neardata RELA 00008154 001154 000018 0c AI 2 12 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1rb.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1rb.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1rb.rd 2016-08-12 17:14:08.201776909 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1rb.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 00003c 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 000080dc 0010dc 000031 00 A 0 0 1
\[ 4\] \.rela\.got RELA 00008110 001110 000018 0c AI 2 10 4
\[ 5\] \.rela\.bss RELA 00008128 001128 00000c 0c AI 2 12 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000044 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008044 001044 0000c0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008044 001044 0000c0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008104 001104 000035 00 A 0 0 1
\[ 4\] \.rela\.got RELA 0000813c 00113c 000018 0c AI 2 11 4
\[ 5\] \.rela\.neardata RELA 00008154 001154 000018 0c AI 2 12 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1r.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1r.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-app-1r.rd 2016-08-12 17:14:08.200776903 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-app-1r.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 00003c 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 000080dc 0010dc 000030 00 A 0 0 1
\[ 4\] \.rela\.got RELA 0000810c 00110c 000018 0c AI 2 10 4
\[ 5\] \.rela\.bss RELA 00008124 001124 00000c 0c AI 2 12 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-noindex.rd binutils-2.27/ld/testsuite/ld-tic6x/shlib-noindex.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/shlib-noindex.rd 2016-08-12 17:14:08.201776909 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/shlib-noindex.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 000048 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 6 4
+ \[ 2\] \.dynsym DYNSYM 00008048 001048 0000d0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 00008118 001118 000025 00 A 0 0 1
\[ 4\] \.rela\.text RELA 00008140 001140 00000c 0c AI 2 10 4
\[ 5\] \.rela\.got RELA 0000814c 00114c 000024 0c AI 2 11 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1b.rd binutils-2.27/ld/testsuite/ld-tic6x/static-app-1b.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1b.rd 2016-08-12 17:14:08.201776909 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/static-app-1b.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 00003c 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 5 4
+ \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 000080dc 0010dc 00001d 00 A 0 0 1
\[ 4\] \.rela\.got RELA 000080fc 0010fc 000024 0c AI 2 8 4
\[ 5\] \.rela\.neardata RELA 00008120 001120 000030 0c AI 2 9 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1rb.rd binutils-2.27/ld/testsuite/ld-tic6x/static-app-1rb.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1rb.rd 2016-08-12 17:14:08.201776909 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/static-app-1rb.rd 2016-08-12 17:16:08.523549872 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 00003c 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 5 4
+ \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 000080dc 0010dc 00001d 00 A 0 0 1
\[ 4\] \.rela\.got RELA 000080fc 0010fc 000024 0c AI 2 8 4
\[ 5\] \.rela\.neardata RELA 00008120 001120 000018 0c AI 2 9 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1.rd binutils-2.27/ld/testsuite/ld-tic6x/static-app-1.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1.rd 2016-08-12 17:14:08.201776909 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/static-app-1.rd 2016-08-12 17:16:08.522549865 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 00003c 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 5 4
+ \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 000080dc 0010dc 00001d 00 A 0 0 1
\[ 4\] \.rela\.got RELA 000080fc 0010fc 000024 0c AI 2 8 4
\[ 5\] \.rela\.neardata RELA 00008120 001120 000030 0c AI 2 9 4
diff -rup binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1r.rd binutils-2.27/ld/testsuite/ld-tic6x/static-app-1r.rd
--- binutils-2.27.orig/ld/testsuite/ld-tic6x/static-app-1r.rd 2016-08-12 17:14:08.201776909 +0100
+++ binutils-2.27/ld/testsuite/ld-tic6x/static-app-1r.rd 2016-08-12 17:16:08.523549872 +0100
@@ -4,7 +4,7 @@ Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] \.hash HASH 00008000 001000 00003c 04 A 2 0 4
- \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 5 4
+ \[ 2\] \.dynsym DYNSYM 0000803c 00103c 0000a0 10 A 3 7 4
\[ 3\] \.dynstr STRTAB 000080dc 0010dc 00001d 00 A 0 0 1
\[ 4\] \.rela\.got RELA 000080fc 0010fc 000024 0c AI 2 8 4
\[ 5\] \.rela\.neardata RELA 00008120 001120 000018 0c AI 2 9 4
--- binutils-2.27.orig/binutils/readelf.c 2016-08-12 17:14:07.717773841 +0100
+++ binutils-2.27/binutils/readelf.c 2016-08-12 17:24:25.007897415 +0100
@@ -11110,6 +11110,11 @@ process_symbol_table (FILE * file)
}
putchar ('\n');
+
+ if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
+ && si >= section->sh_info)
+ warn (_("local symbol %u found at index >= %s's sh_info value of %u\n"),
+ si, printable_section_name (section), section->sh_info);
}
free (symtab);

2097
SOURCES/binutils-2.27-monotonic-section-offsets.patch

File diff suppressed because it is too large Load Diff

4350
SOURCES/binutils-2.27-objdump-improvements.patch

File diff suppressed because it is too large Load Diff

606
SOURCES/binutils-2.27-power9.2.patch

@ -0,0 +1,606 @@
diff -rup binutils.orig/gas/config/tc-ppc.c binutils-2.27/gas/config/tc-ppc.c
--- binutils.orig/gas/config/tc-ppc.c 2017-01-17 10:34:39.694867665 +0000
+++ binutils-2.27/gas/config/tc-ppc.c 2017-01-17 10:49:40.367225030 +0000
@@ -2671,7 +2671,8 @@ md_assemble (char *str)
const struct powerpc_operand *operand;
operand = &powerpc_operands[*opindex_ptr];
- if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0)
+ if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
+ && !((operand->flags & PPC_OPERAND_OPTIONAL32) != 0 && ppc_obj64))
{
unsigned int opcount;
unsigned int num_operands_expected;
@@ -2741,6 +2742,7 @@ md_assemble (char *str)
/* If this is an optional operand, and we are skipping it, just
insert a zero. */
if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
+ && !((operand->flags & PPC_OPERAND_OPTIONAL32) != 0 && ppc_obj64)
&& skip_optional)
{
long val = ppc_optional_operand_value (operand);
@@ -2942,7 +2944,7 @@ md_assemble (char *str)
}
break;
}
- /* Fall thru */
+ /* Fallthru */
case BFD_RELOC_PPC64_ADDR16_HIGH:
ex.X_add_number = PPC_HI (ex.X_add_number);
@@ -2964,7 +2966,7 @@ md_assemble (char *str)
}
break;
}
- /* Fall thru */
+ /* Fallthru */
case BFD_RELOC_PPC64_ADDR16_HIGHA:
ex.X_add_number = PPC_HA (ex.X_add_number);
@@ -3087,14 +3089,14 @@ md_assemble (char *str)
{
int tmp_insn = insn & opcode->mask;
- int use_d_reloc = (tmp_insn == E_OR2I_INSN
+ int use_a_reloc = (tmp_insn == E_OR2I_INSN
|| tmp_insn == E_AND2I_DOT_INSN
|| tmp_insn == E_OR2IS_INSN
|| tmp_insn == E_LIS_INSN
|| tmp_insn == E_AND2IS_DOT_INSN);
- int use_a_reloc = (tmp_insn == E_ADD2I_DOT_INSN
+ int use_d_reloc = (tmp_insn == E_ADD2I_DOT_INSN
|| tmp_insn == E_ADD2IS_INSN
|| tmp_insn == E_CMP16I_INSN
|| tmp_insn == E_MULL2I_INSN
@@ -3377,13 +3379,17 @@ md_assemble (char *str)
however it'll remain clear for dual-mode instructions on
dual-mode and, more importantly, standard-mode processors. */
if ((ppc_cpu & opcode->flags) == PPC_OPCODE_VLE)
- ppc_apuinfo_section_add (PPC_APUINFO_VLE, 1);
+ {
+ ppc_apuinfo_section_add (PPC_APUINFO_VLE, 1);
+ if (elf_section_data (now_seg) != NULL)
+ elf_section_data (now_seg)->this_hdr.sh_flags |= SHF_PPC_VLE;
+ }
}
#endif
/* Write out the instruction. */
/* Differentiate between two and four byte insns. */
- if (ppc_mach () == bfd_mach_ppc_vle)
+ if ((ppc_cpu & PPC_OPCODE_VLE) != 0)
{
if (PPC_OP_SE_VLE (insn))
insn_length = 2;
@@ -3400,7 +3406,7 @@ md_assemble (char *str)
f = frag_more (insn_length);
if (frag_now->has_code && frag_now->insn_addr != addr_mod)
{
- if (ppc_mach() == bfd_mach_ppc_vle)
+ if ((ppc_cpu & PPC_OPCODE_VLE) != 0)
as_bad (_("instruction address is not a multiple of 2"));
else
as_bad (_("instruction address is not a multiple of 4"));
@@ -6346,7 +6352,7 @@ ppc_frag_check (struct frag *fragP)
if (!fragP->has_code)
return;
- if (ppc_mach() == bfd_mach_ppc_vle)
+ if ((ppc_cpu & PPC_OPCODE_VLE) != 0)
{
if (((fragP->fr_address + fragP->insn_addr) & 1) != 0)
as_bad (_("instruction address is not a multiple of 2"));
@@ -6367,7 +6373,7 @@ ppc_handle_align (struct frag *fragP)
valueT count = (fragP->fr_next->fr_address
- (fragP->fr_address + fragP->fr_fix));
- if (ppc_mach() == bfd_mach_ppc_vle && count != 0 && (count & 1) == 0)
+ if ((ppc_cpu & PPC_OPCODE_VLE) != 0 && count != 0 && (count & 1) == 0)
{
char *dest = fragP->fr_literal + fragP->fr_fix;
@@ -6565,7 +6571,7 @@ md_apply_fix (fixS *fixP, valueT *valP,
}
break;
}
- /* Fall thru */
+ /* Fallthru */
case BFD_RELOC_PPC_VLE_HI16A:
case BFD_RELOC_PPC_VLE_HI16D:
@@ -6588,7 +6594,7 @@ md_apply_fix (fixS *fixP, valueT *valP,
}
break;
}
- /* Fall thru */
+ /* Fallthru */
case BFD_RELOC_PPC_VLE_HA16A:
case BFD_RELOC_PPC_VLE_HA16D:
@@ -6730,7 +6736,7 @@ md_apply_fix (fixS *fixP, valueT *valP,
case BFD_RELOC_PPC_VLE_SDAREL_HA16A:
case BFD_RELOC_PPC_VLE_SDAREL_HA16D:
gas_assert (fixP->fx_addsy != NULL);
- /* Fall thru */
+ /* Fallthru */
case BFD_RELOC_PPC_TLS:
case BFD_RELOC_PPC_TLSGD:
@@ -6854,7 +6860,7 @@ md_apply_fix (fixS *fixP, valueT *valP,
&& !S_IS_DEFINED (fixP->fx_addsy)
&& !S_IS_WEAK (fixP->fx_addsy))
S_SET_WEAK (fixP->fx_addsy);
- /* Fall thru */
+ /* Fallthru */
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
diff -rup binutils.orig/gas/testsuite/gas/ppc/power9.d binutils-2.27/gas/testsuite/gas/ppc/power9.d
--- binutils.orig/gas/testsuite/gas/ppc/power9.d 2017-01-17 10:34:39.823866144 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/power9.d 2017-01-17 10:55:45.214908333 +0000
@@ -274,8 +274,8 @@ Disassembly of section \.text:
.*: (f3 89 ef 6f|6f ef 89 f3) xvxsigsp vs60,vs61
.*: (7c 06 39 c0|c0 39 06 7c) cmpeqb cr0,r6,r7
.*: (7f 86 39 c0|c0 39 86 7f) cmpeqb cr7,r6,r7
-.*: (7c 08 49 80|80 49 08 7c) cmprb cr0,r8,r9
-.*: (7f 88 49 80|80 49 88 7f) cmprb cr7,r8,r9
+.*: (7c 08 49 80|80 49 08 7c) cmprb cr0,0,r8,r9
+.*: (7f 88 49 80|80 49 88 7f) cmprb cr7,0,r8,r9
.*: (7c 28 49 80|80 49 28 7c) cmprb cr0,1,r8,r9
.*: (7f a8 49 80|80 49 a8 7f) cmprb cr7,1,r8,r9
.*: (7d e0 01 00|00 01 e0 7d) setb r15,cr0
diff -rup binutils.orig/gas/testsuite/gas/ppc/vle-reloc.d binutils-2.27/gas/testsuite/gas/ppc/vle-reloc.d
--- binutils.orig/gas/testsuite/gas/ppc/vle-reloc.d 2017-01-17 10:34:39.822866157 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/vle-reloc.d 2017-01-17 10:53:43.744345513 +0000
@@ -25,148 +25,148 @@ Disassembly of section \.text:
14: R_PPC_VLE_REL15 sub5
18: 70 20 c0 00 e_or2i r1,0
- 18: R_PPC_VLE_LO16D low
+ 18: R_PPC_VLE_LO16A low
1c: 70 40 c0 00 e_or2i r2,0
- 1c: R_PPC_VLE_HI16D high
+ 1c: R_PPC_VLE_HI16A high
20: 70 60 c0 00 e_or2i r3,0
- 20: R_PPC_VLE_HA16D high_adjust
+ 20: R_PPC_VLE_HA16A high_adjust
24: 70 80 c0 00 e_or2i r4,0
- 24: R_PPC_VLE_SDAREL_LO16D low_sdarel
+ 24: R_PPC_VLE_SDAREL_LO16A low_sdarel
28: 70 a0 c0 00 e_or2i r5,0
- 28: R_PPC_VLE_SDAREL_HI16D high_sdarel
+ 28: R_PPC_VLE_SDAREL_HI16A high_sdarel
2c: 70 40 c0 00 e_or2i r2,0
- 2c: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
+ 2c: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
30: 70 20 c8 00 e_and2i. r1,0
- 30: R_PPC_VLE_LO16D low
+ 30: R_PPC_VLE_LO16A low
34: 70 40 c8 00 e_and2i. r2,0
- 34: R_PPC_VLE_HI16D high
+ 34: R_PPC_VLE_HI16A high
38: 70 60 c8 00 e_and2i. r3,0
- 38: R_PPC_VLE_HA16D high_adjust
+ 38: R_PPC_VLE_HA16A high_adjust
3c: 70 80 c8 00 e_and2i. r4,0
- 3c: R_PPC_VLE_SDAREL_LO16D low_sdarel
+ 3c: R_PPC_VLE_SDAREL_LO16A low_sdarel
40: 70 a0 c8 00 e_and2i. r5,0
- 40: R_PPC_VLE_SDAREL_HI16D high_sdarel
+ 40: R_PPC_VLE_SDAREL_HI16A high_sdarel
44: 70 40 c8 00 e_and2i. r2,0
- 44: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
+ 44: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
48: 70 40 c8 00 e_and2i. r2,0
- 48: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
+ 48: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
4c: 70 20 d0 00 e_or2is r1,0
- 4c: R_PPC_VLE_LO16D low
+ 4c: R_PPC_VLE_LO16A low
50: 70 40 d0 00 e_or2is r2,0
- 50: R_PPC_VLE_HI16D high
+ 50: R_PPC_VLE_HI16A high
54: 70 60 d0 00 e_or2is r3,0
- 54: R_PPC_VLE_HA16D high_adjust
+ 54: R_PPC_VLE_HA16A high_adjust
58: 70 80 d0 00 e_or2is r4,0
- 58: R_PPC_VLE_SDAREL_LO16D low_sdarel
+ 58: R_PPC_VLE_SDAREL_LO16A low_sdarel
5c: 70 a0 d0 00 e_or2is r5,0
- 5c: R_PPC_VLE_SDAREL_HI16D high_sdarel
+ 5c: R_PPC_VLE_SDAREL_HI16A high_sdarel
60: 70 40 d0 00 e_or2is r2,0
- 60: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
+ 60: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
64: 70 20 e0 00 e_lis r1,0
- 64: R_PPC_VLE_LO16D low
+ 64: R_PPC_VLE_LO16A low
68: 70 40 e0 00 e_lis r2,0
- 68: R_PPC_VLE_HI16D high
+ 68: R_PPC_VLE_HI16A high
6c: 70 60 e0 00 e_lis r3,0
- 6c: R_PPC_VLE_HA16D high_adjust
+ 6c: R_PPC_VLE_HA16A high_adjust
70: 70 80 e0 00 e_lis r4,0
- 70: R_PPC_VLE_SDAREL_LO16D low_sdarel
+ 70: R_PPC_VLE_SDAREL_LO16A low_sdarel
74: 70 a0 e0 00 e_lis r5,0
- 74: R_PPC_VLE_SDAREL_HI16D high_sdarel
+ 74: R_PPC_VLE_SDAREL_HI16A high_sdarel
78: 70 40 e0 00 e_lis r2,0
- 78: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
+ 78: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
7c: 70 20 e8 00 e_and2is. r1,0
- 7c: R_PPC_VLE_LO16D low
+ 7c: R_PPC_VLE_LO16A low
80: 70 40 e8 00 e_and2is. r2,0
- 80: R_PPC_VLE_HI16D high
+ 80: R_PPC_VLE_HI16A high
84: 70 60 e8 00 e_and2is. r3,0
- 84: R_PPC_VLE_HA16D high_adjust
+ 84: R_PPC_VLE_HA16A high_adjust
88: 70 80 e8 00 e_and2is. r4,0
- 88: R_PPC_VLE_SDAREL_LO16D low_sdarel
+ 88: R_PPC_VLE_SDAREL_LO16A low_sdarel
8c: 70 a0 e8 00 e_and2is. r5,0
- 8c: R_PPC_VLE_SDAREL_HI16D high_sdarel
+ 8c: R_PPC_VLE_SDAREL_HI16A high_sdarel
90: 70 40 e8 00 e_and2is. r2,0
- 90: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
+ 90: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
94: 70 01 98 00 e_cmp16i r1,0
- 94: R_PPC_VLE_LO16A low
+ 94: R_PPC_VLE_LO16D low
98: 70 02 98 00 e_cmp16i r2,0
- 98: R_PPC_VLE_HI16A high
+ 98: R_PPC_VLE_HI16D high
9c: 70 03 98 00 e_cmp16i r3,0
- 9c: R_PPC_VLE_HA16A high_adjust
+ 9c: R_PPC_VLE_HA16D high_adjust
a0: 70 04 98 00 e_cmp16i r4,0
- a0: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ a0: R_PPC_VLE_SDAREL_LO16D low_sdarel
a4: 70 05 98 00 e_cmp16i r5,0
- a4: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ a4: R_PPC_VLE_SDAREL_HI16D high_sdarel
a8: 70 02 98 00 e_cmp16i r2,0
- a8: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ a8: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
ac: 70 01 a8 00 e_cmpl16i r1,0
- ac: R_PPC_VLE_LO16A low
+ ac: R_PPC_VLE_LO16D low
b0: 70 02 a8 00 e_cmpl16i r2,0
- b0: R_PPC_VLE_HI16A high
+ b0: R_PPC_VLE_HI16D high
b4: 70 03 a8 00 e_cmpl16i r3,0
- b4: R_PPC_VLE_HA16A high_adjust
+ b4: R_PPC_VLE_HA16D high_adjust
b8: 70 04 a8 00 e_cmpl16i r4,0
- b8: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ b8: R_PPC_VLE_SDAREL_LO16D low_sdarel
bc: 70 05 a8 00 e_cmpl16i r5,0
- bc: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ bc: R_PPC_VLE_SDAREL_HI16D high_sdarel
c0: 70 02 a8 00 e_cmpl16i r2,0
- c0: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ c0: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
c4: 70 01 b0 00 e_cmph16i r1,0
- c4: R_PPC_VLE_LO16A low
+ c4: R_PPC_VLE_LO16D low
c8: 70 02 b0 00 e_cmph16i r2,0
- c8: R_PPC_VLE_HI16A high
+ c8: R_PPC_VLE_HI16D high
cc: 70 03 b0 00 e_cmph16i r3,0
- cc: R_PPC_VLE_HA16A high_adjust
+ cc: R_PPC_VLE_HA16D high_adjust
d0: 70 04 b0 00 e_cmph16i r4,0
- d0: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ d0: R_PPC_VLE_SDAREL_LO16D low_sdarel
d4: 70 05 b0 00 e_cmph16i r5,0
- d4: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ d4: R_PPC_VLE_SDAREL_HI16D high_sdarel
d8: 70 02 b0 00 e_cmph16i r2,0
- d8: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ d8: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
dc: 70 01 b8 00 e_cmphl16i r1,0
- dc: R_PPC_VLE_LO16A low
+ dc: R_PPC_VLE_LO16D low
e0: 70 02 b8 00 e_cmphl16i r2,0
- e0: R_PPC_VLE_HI16A high
+ e0: R_PPC_VLE_HI16D high
e4: 70 03 b8 00 e_cmphl16i r3,0
- e4: R_PPC_VLE_HA16A high_adjust
+ e4: R_PPC_VLE_HA16D high_adjust
e8: 70 04 b8 00 e_cmphl16i r4,0
- e8: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ e8: R_PPC_VLE_SDAREL_LO16D low_sdarel
ec: 70 05 b8 00 e_cmphl16i r5,0
- ec: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ ec: R_PPC_VLE_SDAREL_HI16D high_sdarel
f0: 70 02 b8 00 e_cmphl16i r2,0
- f0: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ f0: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
f4: 70 01 88 00 e_add2i. r1,0
- f4: R_PPC_VLE_LO16A low
+ f4: R_PPC_VLE_LO16D low
f8: 70 02 88 00 e_add2i. r2,0
- f8: R_PPC_VLE_HI16A high
+ f8: R_PPC_VLE_HI16D high
fc: 70 03 88 00 e_add2i. r3,0
- fc: R_PPC_VLE_HA16A high_adjust
+ fc: R_PPC_VLE_HA16D high_adjust
100: 70 04 88 00 e_add2i. r4,0
- 100: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ 100: R_PPC_VLE_SDAREL_LO16D low_sdarel
104: 70 05 88 00 e_add2i. r5,0
- 104: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ 104: R_PPC_VLE_SDAREL_HI16D high_sdarel
108: 70 02 88 00 e_add2i. r2,0
- 108: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ 108: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
10c: 70 01 90 00 e_add2is r1,0
- 10c: R_PPC_VLE_LO16A low
+ 10c: R_PPC_VLE_LO16D low
110: 70 02 90 00 e_add2is r2,0
- 110: R_PPC_VLE_HI16A high
+ 110: R_PPC_VLE_HI16D high
114: 70 03 90 00 e_add2is r3,0
- 114: R_PPC_VLE_HA16A high_adjust
+ 114: R_PPC_VLE_HA16D high_adjust
118: 70 04 90 00 e_add2is r4,0
- 118: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ 118: R_PPC_VLE_SDAREL_LO16D low_sdarel
11c: 70 05 90 00 e_add2is r5,0
- 11c: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ 11c: R_PPC_VLE_SDAREL_HI16D high_sdarel
120: 70 02 90 00 e_add2is r2,0
- 120: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ 120: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
124: 70 01 a0 00 e_mull2i r1,0
- 124: R_PPC_VLE_LO16A low
+ 124: R_PPC_VLE_LO16D low
128: 70 02 a0 00 e_mull2i r2,0
- 128: R_PPC_VLE_HI16A high
+ 128: R_PPC_VLE_HI16D high
12c: 70 03 a0 00 e_mull2i r3,0
- 12c: R_PPC_VLE_HA16A high_adjust
+ 12c: R_PPC_VLE_HA16D high_adjust
130: 70 04 a0 00 e_mull2i r4,0
- 130: R_PPC_VLE_SDAREL_LO16A low_sdarel
+ 130: R_PPC_VLE_SDAREL_LO16D low_sdarel
134: 70 05 a0 00 e_mull2i r5,0
- 134: R_PPC_VLE_SDAREL_HI16A high_sdarel
+ 134: R_PPC_VLE_SDAREL_HI16D high_sdarel
138: 70 02 a0 00 e_mull2i r2,0
- 138: R_PPC_VLE_SDAREL_HA16A high_adjust_sdarel
+ 138: R_PPC_VLE_SDAREL_HA16D high_adjust_sdarel
diff -rup binutils.orig/include/opcode/ppc.h binutils-2.27/include/opcode/ppc.h
--- binutils.orig/include/opcode/ppc.h 2017-01-17 10:34:39.864865661 +0000
+++ binutils-2.27/include/opcode/ppc.h 2017-01-17 10:49:40.367225030 +0000
@@ -407,6 +407,10 @@ extern const unsigned int num_powerpc_op
is omitted, then the value it should use for the operand is stored
in the SHIFT field of the immediatly following operand field. */
#define PPC_OPERAND_OPTIONAL_VALUE (0x400000)
+
+/* This flag is only used with PPC_OPERAND_OPTIONAL. The operand is
+ only optional when generating 32-bit code. */
+#define PPC_OPERAND_OPTIONAL32 (0x800000)
/* The POWER and PowerPC assemblers use a few macros. We keep them
with the operands table for simplicity. The macro table is an
@@ -444,6 +448,23 @@ ppc_optional_operand_value (const struct
return 0;
}
+/* PowerPC VLE insns. */
+/* Form I16L, uses 16A relocs. */
+#define E_OR2I_INSN 0x7000C000
+#define E_AND2I_DOT_INSN 0x7000C800
+#define E_OR2IS_INSN 0x7000D000
+#define E_LIS_INSN 0x7000E000
+#define E_AND2IS_DOT_INSN 0x7000E800
+
+/* Form I16A, uses 16D relocs. */
+#define E_ADD2I_DOT_INSN 0x70008800
+#define E_ADD2IS_INSN 0x70009000
+#define E_CMP16I_INSN 0x70009800
+#define E_MULL2I_INSN 0x7000A000
+#define E_CMPL16I_INSN 0x7000A800
+#define E_CMPH16I_INSN 0x7000B000
+#define E_CMPHL16I_INSN 0x7000B800
+
#ifdef __cplusplus
}
#endif
diff -rup binutils.orig/opcodes/ppc-dis.c binutils-2.27/opcodes/ppc-dis.c
--- binutils.orig/opcodes/ppc-dis.c 2017-01-17 10:34:40.064863304 +0000
+++ binutils-2.27/opcodes/ppc-dis.c 2017-01-17 10:49:40.391224746 +0000
@@ -236,7 +236,7 @@ get_powerpc_dialect (struct disassemble_
/* Disassemble according to the section headers flags for VLE-mode. */
if (dialect & PPC_OPCODE_VLE
- && info->section->owner != NULL
+ && info->section != NULL && info->section->owner != NULL
&& bfd_get_flavour (info->section->owner) == bfd_target_elf_flavour
&& elf_object_id (info->section->owner) == PPC32_ELF_DATA
&& (elf_section_flags (info->section) & SHF_PPC_VLE) != 0)
diff -rup binutils.orig/opcodes/ppc-opc.c binutils-2.27/opcodes/ppc-opc.c
--- binutils.orig/opcodes/ppc-opc.c 2017-01-17 10:34:40.064863304 +0000
+++ binutils-2.27/opcodes/ppc-opc.c 2017-01-17 10:49:40.393224722 +0000
@@ -62,10 +62,6 @@ static unsigned long insert_dxdn (unsign
static long extract_dxdn (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_fxm (unsigned long, long, ppc_cpu_t, const char **);
static long extract_fxm (unsigned long, ppc_cpu_t, int *);
-static unsigned long insert_l0 (unsigned long, long, ppc_cpu_t, const char **);
-static long extract_l0 (unsigned long, ppc_cpu_t, int *);
-static unsigned long insert_l1 (unsigned long, long, ppc_cpu_t, const char **);
-static long extract_l1 (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_li20 (unsigned long, long, ppc_cpu_t, const char **);
static long extract_li20 (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_ls (unsigned long, long, ppc_cpu_t, const char **);
@@ -429,20 +425,24 @@ const struct powerpc_operand powerpc_ope
/* The L field in a D or X form instruction. */
#define L IMM20 + 1
+ { 0x1, 21, NULL, NULL, 0 },
+
+ /* The optional L field in tlbie and tlbiel instructions. */
+#define LOPT L + 1
/* The R field in a HTM X form instruction. */
-#define HTM_R L
+#define HTM_R LOPT
{ 0x1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
- /* The L field in an X form instruction which must be zero. */
-#define L0 L + 1
- { 0x1, 21, insert_l0, extract_l0, PPC_OPERAND_OPTIONAL },
-
- /* The L field in an X form instruction which must be one. */
-#define L1 L0 + 1
- { 0x1, 21, insert_l1, extract_l1, 0 },
+ /* The optional (for 32-bit) L field in cmp[l][i] instructions. */
+#define L32OPT LOPT + 1
+ { 0x1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL | PPC_OPERAND_OPTIONAL32 },
+
+ /* The L field in dcbf instruction. */
+#define L2OPT L32OPT + 1
+ { 0x3, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
/* The LEV field in a POWER SVC form instruction. */
-#define SVC_LEV L1 + 1
+#define SVC_LEV L2OPT + 1
{ 0x7f, 5, NULL, NULL, 0 },
/* The LEV field in an SC form instruction. */
@@ -688,6 +688,8 @@ const struct powerpc_operand powerpc_ope
#define STRM SR + 1
/* The T field in a tlbilx form instruction. */
#define T STRM
+ /* The L field in wclr instructions. */
+#define L2 STRM
{ 0x3, 21, NULL, NULL, 0 },
/* The ESYNC field in an X (sync) form instruction. */
@@ -1483,58 +1485,6 @@ extract_fxm (unsigned long insn,
return mask;
}
-/* The L field in an X form instruction which must have the value zero. */
-
-static unsigned long
-insert_l0 (unsigned long insn,
- long value,
- ppc_cpu_t dialect ATTRIBUTE_UNUSED,
- const char **errmsg)
-{
- if (value != 0)
- *errmsg = _("invalid operand constant");
- return insn & ~(0x1 << 21);
-}
-
-static long
-extract_l0 (unsigned long insn,
- ppc_cpu_t dialect ATTRIBUTE_UNUSED,
- int *invalid)
-{
- long value;
-
- value = (insn >> 21) & 0x1;
- if (value != 0)
- *invalid = 1;
- return value;
-}
-
-/* The L field in an X form instruction which must have the value one. */
-
-static unsigned long
-insert_l1 (unsigned long insn,
- long value,
- ppc_cpu_t dialect ATTRIBUTE_UNUSED,
- const char **errmsg)
-{
- if (value != 1)
- *errmsg = _("invalid operand constant");
- return insn | (0x1 << 21);
-}
-
-static long
-extract_l1 (unsigned long insn,
- ppc_cpu_t dialect ATTRIBUTE_UNUSED,
- int *invalid)
-{
- long value;
-
- value = (insn >> 21) & 0x1;
- if (value != 1)
- *invalid = 1;
- return value;
-}
-
static unsigned long
insert_li20 (unsigned long insn,
long value,
@@ -3890,12 +3840,12 @@ const struct powerpc_opcode powerpc_opco
{"cmplwi", OPL(10,0), OPL_MASK, PPCCOM, PPCVLE, {OBF, RA, UISIGNOPT}},
{"cmpldi", OPL(10,1), OPL_MASK, PPC64, PPCVLE, {OBF, RA, UISIGNOPT}},
-{"cmpli", OP(10), OP_MASK, PPC, PPCVLE, {BF, L, RA, UISIGNOPT}},
+{"cmpli", OP(10), OP_MASK, PPC, PPCVLE, {BF, L32OPT, RA, UISIGNOPT}},
{"cmpli", OP(10), OP_MASK, PWRCOM, PPC|PPCVLE, {BF, RA, UISIGNOPT}},
{"cmpwi", OPL(11,0), OPL_MASK, PPCCOM, PPCVLE, {OBF, RA, SI}},
{"cmpdi", OPL(11,1), OPL_MASK, PPC64, PPCVLE, {OBF, RA, SI}},
-{"cmpi", OP(11), OP_MASK, PPC, PPCVLE, {BF, L, RA, SI}},
+{"cmpi", OP(11), OP_MASK, PPC, PPCVLE, {BF, L32OPT, RA, SI}},
{"cmpi", OP(11), OP_MASK, PWRCOM, PPC|PPCVLE, {BF, RA, SI}},
{"addic", OP(12), OP_MASK, PPCCOM, PPCVLE, {RT, RA, SI}},
@@ -4713,7 +4663,7 @@ const struct powerpc_opcode powerpc_opco
{"cmpw", XOPL(31,0,0), XCMPL_MASK, PPCCOM, 0, {OBF, RA, RB}},
{"cmpd", XOPL(31,0,1), XCMPL_MASK, PPC64, 0, {OBF, RA, RB}},
-{"cmp", X(31,0), XCMP_MASK, PPC, 0, {BF, L, RA, RB}},
+{"cmp", X(31,0), XCMP_MASK, PPC, 0, {BF, L32OPT, RA, RB}},
{"cmp", X(31,0), XCMPL_MASK, PWRCOM, PPC, {BF, RA, RB}},
{"twlgt", XTO(31,4,TOLGT), XTO_MASK, PPCCOM, 0, {RA, RB}},
@@ -4821,7 +4771,7 @@ const struct powerpc_opcode powerpc_opco
{"cmplw", XOPL(31,32,0), XCMPL_MASK, PPCCOM, 0, {OBF, RA, RB}},
{"cmpld", XOPL(31,32,1), XCMPL_MASK, PPC64, 0, {OBF, RA, RB}},
-{"cmpl", X(31,32), XCMP_MASK, PPC, 0, {BF, L, RA, RB}},
+{"cmpl", X(31,32), XCMP_MASK, PPC, 0, {BF, L32OPT, RA, RB}},
{"cmpl", X(31,32), XCMPL_MASK, PWRCOM, PPC, {BF, RA, RB}},
{"lvsr", X(31,38), X_MASK, PPCVEC, 0, {VD, RA0, RB}},
@@ -4907,7 +4857,7 @@ const struct powerpc_opcode powerpc_opco
{"ldarx", X(31,84), XEH_MASK, PPC64, 0, {RT, RA0, RB, EH}},
{"dcbfl", XOPL(31,86,1), XRT_MASK, POWER5, PPC476, {RA0, RB}},
-{"dcbf", X(31,86), XLRT_MASK, PPC, 0, {RA0, RB, L}},
+{"dcbf", X(31,86), XLRT_MASK, PPC, 0, {RA0, RB, L2OPT}},
{"lbzx", X(31,87), X_MASK, COM, 0, {RT, RA0, RB}},
@@ -5149,7 +5099,7 @@ const struct powerpc_opcode powerpc_opco
{"ehpriv", X(31,270), 0xffffffff, E500MC|PPCA2, 0, {0}},
{"tlbiel", X(31,274), X_MASK|1<<20,POWER9, PPC476, {RB, RSO, RIC, PRS, X_R}},
-{"tlbiel", X(31,274), XRTLRA_MASK, POWER4, POWER9|PPC476, {RB, L}},
+{"tlbiel", X(31,274), XRTLRA_MASK, POWER4, POWER9|PPC476, {RB, LOPT}},
{"mfapidi", X(31,275), X_MASK, BOOKE, E500|TITAN, {RT, RA}},
@@ -6233,8 +6183,8 @@ const struct powerpc_opcode powerpc_opco
{"stvfrxl", X(31,933), X_MASK, PPCVEC2, 0, {VS, RA0, RB}},
{"wclrone", XOPL2(31,934,2),XRT_MASK, PPCA2, 0, {RA0, RB}},
-{"wclrall", X(31,934), XRARB_MASK, PPCA2, 0, {L}},
-{"wclr", X(31,934), X_MASK, PPCA2, 0, {L, RA0, RB}},
+{"wclrall", X(31,934), XRARB_MASK, PPCA2, 0, {L2}},
+{"wclr", X(31,934), X_MASK, PPCA2, 0, {L2, RA0, RB}},
{"stvrxl", X(31,935), X_MASK, CELL, 0, {VS, RA0, RB}},

87
SOURCES/binutils-2.27-power9.3.patch

@ -0,0 +1,87 @@
diff -rup binutils.orig/gas/testsuite/gas/ppc/power9.d binutils-2.27/gas/testsuite/gas/ppc/power9.d
--- binutils.orig/gas/testsuite/gas/ppc/power9.d 2017-09-13 09:46:21.695333611 +0100
+++ binutils-2.27/gas/testsuite/gas/ppc/power9.d 2017-09-13 09:53:46.594277167 +0100
@@ -312,8 +312,9 @@ Disassembly of section \.text:
.*: (f1 31 9d 6f|6f 9d 31 f1) xscvdphp vs41,vs51
.*: (f1 58 a7 6f|6f a7 58 f1) xvcvhpsp vs42,vs52
.*: (f1 79 af 6f|6f af 79 f1) xvcvsphp vs43,vs53
-.*: (4c 60 00 04|04 00 60 4c) addpcis r3,0
-.*: (4c 60 00 04|04 00 60 4c) addpcis r3,0
+.*: (4c 60 00 04|04 00 60 4c) lnia r3
+.*: (4c 60 00 04|04 00 60 4c) lnia r3
+.*: (4c 60 00 04|04 00 60 4c) lnia r3
.*: (4c 80 00 05|05 00 80 4c) addpcis r4,1
.*: (4c 80 00 05|05 00 80 4c) addpcis r4,1
.*: (4c bf ff c4|c4 ff bf 4c) addpcis r5,-2
@@ -391,4 +392,7 @@ Disassembly of section \.text:
.*: (ff d7 04 8e|8e 04 d7 ff) mffscrni f30,0
.*: (ff d7 1c 8e|8e 1c d7 ff) mffscrni f30,3
.*: (ff f8 04 8e|8e 04 f8 ff) mffsl f31
+.*: (01 00 00 44|44 00 00 01) scv 0
+.*: (e1 0f 00 44|44 00 0f e1) scv 127
+.*: (a4 00 00 4c|4c 00 00 a4) rfscv
#pass
diff -rup binutils.orig/gas/testsuite/gas/ppc/power9.s binutils-2.27/gas/testsuite/gas/ppc/power9.s
--- binutils.orig/gas/testsuite/gas/ppc/power9.s 2017-09-13 09:46:21.694333623 +0100
+++ binutils-2.27/gas/testsuite/gas/ppc/power9.s 2017-09-13 09:54:01.747104949 +0100
@@ -303,6 +303,7 @@ power9:
xscvdphp 41,51
xvcvhpsp 42,52
xvcvsphp 43,53
+ lnia 3
addpcis 3,0
subpcis 3,0
addpcis 4,1
@@ -382,3 +383,6 @@ power9:
mffscrni 30,0
mffscrni 30,3
mffsl 31
+ scv 0
+ scv 127
+ rfscv
diff -rup binutils.orig/opcodes/ppc-opc.c binutils-2.27/opcodes/ppc-opc.c
--- binutils.orig/opcodes/ppc-opc.c 2017-09-13 09:46:21.874331577 +0100
+++ binutils-2.27/opcodes/ppc-opc.c 2017-09-13 09:55:18.745229836 +0100
@@ -441,7 +441,7 @@ const struct powerpc_operand powerpc_ope
#define L2OPT L32OPT + 1
{ 0x3, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
- /* The LEV field in a POWER SVC form instruction. */
+ /* The LEV field in a POWER SVC / POWER9 SCV form instruction. */
#define SVC_LEV L2OPT + 1
{ 0x7f, 5, NULL, NULL, 0 },
@@ -2447,6 +2447,9 @@ extract_vleil (unsigned long insn,
#define DX(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1))
#define DX_MASK DX (0x3f, 0x1f)
+/* An DX form instruction with the D bits specified. */
+#define NODX_MASK (DX_MASK | 0x1fffc1)
+
/* An EVSEL form instruction. */
#define EVSEL(op, xop) (OP (op) | (((unsigned long)(xop)) & 0xff) << 3)
#define EVSEL_MASK EVSEL(0x3f, 0xff)
@@ -4145,6 +4148,7 @@ const struct powerpc_opcode powerpc_opco
{"bcla", B(16,1,1), B_MASK, COM, PPCVLE, {BO, BI, BDA}},
{"svc", SC(17,0,0), SC_MASK, POWER, PPCVLE, {SVC_LEV, FL1, FL2}},
+{"scv", SC(17,0,1), SC_MASK, POWER9, PPCVLE, {SVC_LEV}},
{"svcl", SC(17,0,1), SC_MASK, POWER, PPCVLE, {SVC_LEV, FL1, FL2}},
{"sc", SC(17,1,0), SC_MASK, PPC, PPCVLE, {LEV}},
{"svca", SC(17,1,0), SC_MASK, PWRCOM, PPCVLE, {SV}},
@@ -4157,6 +4161,7 @@ const struct powerpc_opcode powerpc_opco
{"mcrf", XL(19,0), XLBB_MASK|(3<<21)|(3<<16), COM, PPCVLE, {BF, BFA}},
+{"lnia", DX(19,2), NODX_MASK, POWER9, PPCVLE, {RT}},
{"addpcis", DX(19,2), DX_MASK, POWER9, PPCVLE, {RT, DXD}},
{"subpcis", DX(19,2), DX_MASK, POWER9, PPCVLE, {RT, NDXD}},
@@ -4394,6 +4399,7 @@ const struct powerpc_opcode powerpc_opco
{"rfi", XL(19,50), 0xffffffff, COM, PPCVLE, {0}},
{"rfci", XL(19,51), 0xffffffff, PPC403|BOOKE|PPCE300|PPCA2|PPC476, PPCVLE, {0}},
+{"rfscv", XL(19,82), 0xffffffff, POWER9, PPCVLE, {0}},
{"rfsvc", XL(19,82), 0xffffffff, POWER, PPCVLE, {0}},
{"rfgi", XL(19,102), 0xffffffff, E500MC|PPCA2, PPCVLE, {0}},

452
SOURCES/binutils-2.27-power9.patch

@ -0,0 +1,452 @@
diff -rup binutils-2.27.orig/bfd/elf32-ppc.c binutils-2.27/bfd/elf32-ppc.c
--- binutils-2.27.orig/bfd/elf32-ppc.c 2016-09-28 08:49:28.280430815 +0100
+++ binutils-2.27/bfd/elf32-ppc.c 2016-09-28 08:53:48.133843615 +0100
@@ -3946,7 +3946,8 @@ is_branch_reloc (enum elf_ppc_reloc_type
|| r_type == R_PPC_ADDR24
|| r_type == R_PPC_ADDR14
|| r_type == R_PPC_ADDR14_BRTAKEN
- || r_type == R_PPC_ADDR14_BRNTAKEN);
+ || r_type == R_PPC_ADDR14_BRNTAKEN
+ || r_type == R_PPC_VLE_REL24);
}
static void
@@ -4897,6 +4898,7 @@ ppc_elf_vle_split16 (bfd *output_bfd, bf
insn = bfd_get_32 (output_bfd, loc);
top5 = value & 0xf800;
top5 = top5 << (split16_format == split16a_type ? 9 : 5);
+ insn &= (split16_format == split16a_type ? ~0x1f007ff : ~0x1f07ff);
insn |= top5;
insn |= value & 0x7ff;
bfd_put_32 (output_bfd, insn, loc);
diff -rup binutils-2.27.orig/gas/testsuite/gas/ppc/power9.d binutils-2.27/gas/testsuite/gas/ppc/power9.d
--- binutils-2.27.orig/gas/testsuite/gas/ppc/power9.d 2016-09-28 08:49:28.783433550 +0100
+++ binutils-2.27/gas/testsuite/gas/ppc/power9.d 2016-09-28 08:53:47.423839755 +0100
@@ -280,14 +280,6 @@ Disassembly of section \.text:
.*: (7f a8 49 80|80 49 a8 7f) cmprb cr7,1,r8,r9
.*: (7d e0 01 00|00 01 e0 7d) setb r15,cr0
.*: (7d fc 01 00|00 01 fc 7d) setb r15,cr7
-.*: (7e 00 01 01|01 01 00 7e) setbool r16,lt
-.*: (7e 01 01 01|01 01 01 7e) setbool r16,gt
-.*: (7e 02 01 01|01 01 02 7e) setbool r16,eq
-.*: (7e 03 01 01|01 01 03 7e) setbool r16,so
-.*: (7e 1c 01 01|01 01 1c 7e) setbool r16,4\*cr7\+lt
-.*: (7e 1d 01 01|01 01 1d 7e) setbool r16,4\*cr7\+gt
-.*: (7e 1e 01 01|01 01 1e 7e) setbool r16,4\*cr7\+eq
-.*: (7e 1f 01 01|01 01 1f 7e) setbool r16,4\*cr7\+so
.*: (7f 40 52 1a|1a 52 40 7f) lxvl vs26,0,r10
.*: (7f 14 52 1b|1b 52 14 7f) lxvl vs56,r20,r10
.*: (7f 60 5b 1a|1a 5b 60 7f) stxvl vs27,0,r11
@@ -331,6 +323,7 @@ Disassembly of section \.text:
.*: (4c e0 80 04|04 80 e0 4c) addpcis r7,-32768
.*: (4c e0 80 04|04 80 e0 4c) addpcis r7,-32768
.*: (7c 00 02 a4|a4 02 00 7c) slbsync
+.*: (7d 40 06 a4|a4 06 40 7d) slbiag r10
.*: (7d 40 5b a4|a4 5b 40 7d) slbieg r10,r11
.*: (7c 60 27 26|26 27 60 7c) slbmfee r3,r4
.*: (7c 60 27 26|26 27 60 7c) slbmfee r3,r4
@@ -344,14 +337,9 @@ Disassembly of section \.text:
.*: (7c 00 1a 24|24 1a 00 7c) tlbiel r3
.*: (7c 00 1a 24|24 1a 00 7c) tlbiel r3
.*: (7c 8f 1a 24|24 1a 8f 7c) tlbiel r3,r4,3,1,1
-.*: (7c 0c 6e 0c|0c 6e 0c 7c) copy r12,r13
-.*: (7c 2c 6e 0c|0c 6e 2c 7c) copy_first r12,r13
-.*: (7c 2c 6e 0c|0c 6e 2c 7c) copy_first r12,r13
-.*: (7c 0a 5f 0c|0c 5f 0a 7c) paste r10,r11
-.*: (7c 0a 5f 0c|0c 5f 0a 7c) paste r10,r11
-.*: (7c 2a 5f 0d|0d 5f 2a 7c) paste_last r10,r11
-.*: (7c 2a 5f 0d|0d 5f 2a 7c) paste_last r10,r11
-.*: (7c 00 06 8c|8c 06 00 7c) cp_abort
+.*: (7c 2c 6e 0c|0c 6e 2c 7c) copy r12,r13
+.*: (7c 2a 5f 0d|0d 5f 2a 7c) paste\. r10,r11
+.*: (7c 00 06 8c|8c 06 00 7c) cpabort
.*: (7c 00 04 ac|ac 04 00 7c) hwsync
.*: (7c 00 04 ac|ac 04 00 7c) hwsync
.*: (7c 00 04 ac|ac 04 00 7c) hwsync
@@ -359,8 +347,6 @@ Disassembly of section \.text:
.*: (7c 20 04 ac|ac 04 20 7c) lwsync
.*: (7c 40 04 ac|ac 04 40 7c) ptesync
.*: (7c 40 04 ac|ac 04 40 7c) ptesync
-.*: (7c 07 04 ac|ac 04 07 7c) sync 0,7
-.*: (7c 28 04 ac|ac 04 28 7c) sync 1,8
.*: (7e 80 04 cc|cc 04 80 7e) ldat r20,0,0
.*: (7e 8a e4 cc|cc e4 8a 7e) ldat r20,r10,28
.*: (7e a0 04 8c|8c 04 a0 7e) lwat r21,0,0
@@ -373,8 +359,6 @@ Disassembly of section \.text:
.*: (7c 00 f6 e4|e4 f6 00 7c) rmieg r30
.*: (7d 40 7a 6a|6a 7a 40 7d) ldmx r10,0,r15
.*: (7d 43 7a 6a|6a 7a 43 7d) ldmx r10,r3,r15
-.*: (7d 60 83 6a|6a 83 60 7d) lwzmx r11,0,r16
-.*: (7d 63 83 6a|6a 83 63 7d) lwzmx r11,r3,r16
.*: (4c 00 02 e4|e4 02 00 4c) stop
.*: (7c 00 00 3c|3c 00 00 7c) wait
.*: (7c 00 00 3c|3c 00 00 7c) wait
@@ -397,9 +381,6 @@ Disassembly of section \.text:
.*: (7d 6c 69 54|54 69 6c 7d) addex r11,r12,r13,0
.*: (7d 6c 6b 54|54 6b 6c 7d) addex r11,r12,r13,1
.*: (7d 6c 6d 54|54 6d 6c 7d) addex r11,r12,r13,2
-.*: (7e b6 b9 55|55 b9 b6 7e) addex\. r21,r22,r23,0
-.*: (7e b6 bb 55|55 bb b6 7e) addex\. r21,r22,r23,1
-.*: (7e b6 bd 55|55 bd b6 7e) addex\. r21,r22,r23,2
.*: (ff 20 04 8e|8e 04 20 ff) mffs f25
.*: (ff 20 04 8f|8f 04 20 ff) mffs\. f25
.*: (ff 41 04 8e|8e 04 41 ff) mffsce f26
@@ -410,12 +391,4 @@ Disassembly of section \.text:
.*: (ff d7 04 8e|8e 04 d7 ff) mffscrni f30,0
.*: (ff d7 1c 8e|8e 1c d7 ff) mffscrni f30,3
.*: (ff f8 04 8e|8e 04 f8 ff) mffsl f31
-.*: (7e 8a 01 76|76 01 8a 7e) brd r10,r20
-.*: (7e ab 01 b6|b6 01 ab 7e) brh r11,r21
-.*: (7e cc 01 36|36 01 cc 7e) brw r12,r22
-.*: (11 6a 63 77|77 63 6a 11) nandxor r10,r11,r12,r13
-.*: (12 b4 b5 f6|f6 b5 b4 12) xor3 r20,r21,r22,r23
-.*: (11 6a 60 34|34 60 6a 11) rldixor r10,r11,0,r12
-.*: (11 6a 66 f4|f4 66 6a 11) rldixor r10,r11,27,r12
-.*: (11 6a 67 f5|f5 67 6a 11) rldixor r10,r11,63,r12
#pass
diff -rup binutils-2.27.orig/gas/testsuite/gas/ppc/power9.s binutils-2.27/gas/testsuite/gas/ppc/power9.s
--- binutils-2.27.orig/gas/testsuite/gas/ppc/power9.s 2016-09-28 08:49:28.783433550 +0100
+++ binutils-2.27/gas/testsuite/gas/ppc/power9.s 2016-09-28 08:53:47.424839761 +0100
@@ -271,14 +271,6 @@ power9:
cmprb 7,1,8,9
setb 15,0
setb 15,7
- setbool 16,0
- setbool 16,1
- setbool 16,2
- setbool 16,3
- setbool 16,28
- setbool 16,29
- setbool 16,30
- setbool 16,31
lxvl 26,0,10
lxvl 56,20,10
stxvl 27,0,11
@@ -322,6 +314,7 @@ power9:
addpcis 7,-0x8000
subpcis 7,0x8000
slbsync
+ slbiag 10
slbieg 10,11
slbmfee 3,4
slbmfee 3,4,0
@@ -335,23 +328,16 @@ power9:
tlbiel 3
tlbiel 3,0,0,0,0
tlbiel 3,4,3,1,1
- copy 12,13,0
- copy_first 12,13
- copy 12,13,1
- paste 10,11,0
- paste 10,11
- paste. 10,11,1
- paste_last 10,11
- cp_abort
+ copy 12,13
+ paste. 10,11
+ cpabort
hwsync
sync
- sync 0,0x0
+ sync 0
lwsync
- sync 1,0x0
+ sync 1
ptesync
- sync 2,0x0
- sync 0,0x7
- sync 1,0x8
+ sync 2
ldat 20,0,0x0
ldat 20,10,0x1c
lwat 21,0,0x0
@@ -364,8 +350,6 @@ power9:
rmieg 30
ldmx 10,0,15
ldmx 10,3,15
- lwzmx 11,0,16
- lwzmx 11,3,16
stop
wait
wait 0
@@ -388,9 +372,6 @@ power9:
addex 11,12,13,0
addex 11,12,13,1
addex 11,12,13,2
- addex. 21,22,23,0
- addex. 21,22,23,1
- addex. 21,22,23,2
mffs 25
mffs. 25
mffsce 26
@@ -401,11 +382,3 @@ power9:
mffscrni 30,0
mffscrni 30,3
mffsl 31
- brd 10,20
- brh 11,21
- brw 12,22
- nandxor 10,11,12,13
- xor3 20,21,22,23
- rldixor 10,11,0,12
- rldixor 10,11,27,12
- rldixor 10,11,63,12
diff -rup binutils-2.27.orig/include/opcode/ppc.h binutils-2.27/include/opcode/ppc.h
--- binutils-2.27.orig/include/opcode/ppc.h 2016-09-28 08:49:28.845433887 +0100
+++ binutils-2.27/include/opcode/ppc.h 2016-09-28 08:53:48.132843610 +0100
@@ -214,6 +214,9 @@ extern const int vle_num_opcodes;
/* Opcode is supported by Vector-Scalar (VSX) Unit from ISA 2.08. */
#define PPC_OPCODE_VSX3 0x40000000000ull
+/* Opcode is supported by e200z4. */
+#define PPC_OPCODE_E200Z4 0x80000000000ull
+
/* A macro to extract the major opcode from an instruction. */
#define PPC_OP(i) (((i) >> 26) & 0x3f)
diff -rup binutils-2.27.orig/opcodes/ppc-dis.c binutils-2.27/opcodes/ppc-dis.c
--- binutils-2.27.orig/opcodes/ppc-dis.c 2016-09-28 08:49:29.236436013 +0100
+++ binutils-2.27/opcodes/ppc-dis.c 2016-09-28 08:58:35.525406139 +0100
@@ -105,6 +105,11 @@ struct ppc_mopt ppc_opts[] = {
0 },
{ "com", PPC_OPCODE_COMMON,
0 },
+ { "e200z4", (PPC_OPCODE_PPC | PPC_OPCODE_BOOKE| PPC_OPCODE_SPE
+ | PPC_OPCODE_ISEL | PPC_OPCODE_EFS | PPC_OPCODE_BRLOCK
+ | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK | PPC_OPCODE_RFMCI
+ | PPC_OPCODE_E500 | PPC_OPCODE_E200Z4),
+ PPC_OPCODE_VLE },
{ "e300", PPC_OPCODE_PPC | PPC_OPCODE_E300,
0 },
{ "e500", (PPC_OPCODE_PPC | PPC_OPCODE_BOOKE | PPC_OPCODE_SPE
diff -rup binutils-2.27.orig/opcodes/ppc-opc.c binutils-2.27/opcodes/ppc-opc.c
--- binutils-2.27.orig/opcodes/ppc-opc.c 2016-09-28 08:49:29.236436013 +0100
+++ binutils-2.27/opcodes/ppc-opc.c 2016-09-28 08:58:16.374302016 +0100
@@ -2374,6 +2374,12 @@ extract_vleil (unsigned long insn,
#define OPVUP(x,vup) (OP (x) | ((((unsigned long)(vup)) & 0xff) << 8))
#define OPVUP_MASK OPVUP (0x3f, 0xff)
+/* The main opcode combined with an update code and the RT fields specified in
+ D form instruction. Used for VLE volatile context save/restore
+ instructions. */
+#define OPVUPRT(x,vup,rt) (OPVUP (x, vup) | ((((unsigned long)(rt)) & 0x1f) << 21))
+#define OPVUPRT_MASK OPVUPRT (0x3f, 0xff, 0x1f)
+
/* An A form instruction. */
#define A(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1) | (((unsigned long)(rc)) & 1))
#define A_MASK A (0x3f, 0x1f, 1)
@@ -3055,6 +3061,7 @@ extract_vleil (unsigned long insn,
#define E6500 PPC_OPCODE_E6500
#define PPCVLE PPC_OPCODE_VLE
#define PPCHTM PPC_OPCODE_HTM
+#define E200Z4 PPC_OPCODE_E200Z4
/* The list of embedded processors that use the embedded operand ordering
for the 3 operand dcbt and dcbtst instructions. */
#define DCBT_EO (PPC_OPCODE_E500 | PPC_OPCODE_E500MC | PPC_OPCODE_476 \
@@ -3161,7 +3168,6 @@ const struct powerpc_opcode powerpc_opco
{"machhwu.", XO (4, 12,0,1), XO_MASK, MULHW, 0, {RT, RA, RB}},
{"ps_muls1", A (4, 13,0), AFRB_MASK, PPCPS, 0, {FRT, FRA, FRC}},
{"ps_muls1.", A (4, 13,1), AFRB_MASK, PPCPS, 0, {FRT, FRA, FRC}},
-{"rldixor", VXASH(4,26), VXASH_MASK, POWER9, 0, {RA, RS, SH6, RB}},
{"ps_madds0", A (4, 14,0), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
{"ps_madds0.", A (4, 14,1), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
{"ps_madds1", A (4, 15,0), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
@@ -3203,8 +3209,6 @@ const struct powerpc_opcode powerpc_opco
{"ps_msub.", A (4, 28,1), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
{"ps_madd", A (4, 29,0), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
{"ps_madd.", A (4, 29,1), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
-{"xor3", VXA(4, 54), VXA_MASK, POWER9, 0, {RA, RS, RB, RC}},
-{"nandxor", VXA(4, 55), VXA_MASK, POWER9, 0, {RA, RS, RB, RC}},
{"vpermr", VXA(4, 59), VXA_MASK, PPCVEC3, 0, {VD, VA, VB, VC}},
{"ps_nmsub", A (4, 30,0), A_MASK, PPCPS, 0, {FRT, FRA, FRC, FRB}},
{"vaddeuqm", VXA(4, 60), VXA_MASK, PPCVEC2, 0, {VD, VA, VB, VC}},
@@ -4943,8 +4947,7 @@ const struct powerpc_opcode powerpc_opco
{"dcbfep", XRT(31,127,0), XRT_MASK, E500MC|PPCA2, 0, {RA0, RB}},
-{"setb", VX(31,256), VXVB_MASK|(3<<16), POWER9, 0, {RT, BFA}},
-{"setbool", VX(31,257), VXVB_MASK, POWER9, 0, {RT, BA}},
+{"setb", X(31,128), XRB_MASK|(3<<16), POWER9, 0, {RT, BFA}},
{"wrtee", X(31,131), XRARB_MASK, PPC403|BOOKE|PPCA2|PPC476, 0, {RS}},
@@ -4994,8 +4997,6 @@ const struct powerpc_opcode powerpc_opco
{"prtyw", X(31,154), XRB_MASK, POWER6|PPCA2|PPC476, 0, {RA, RS}},
-{"brw", X(31,155), XRB_MASK, POWER9, 0, {RA, RS}},
-
{"stdepx", X(31,157), X_MASK, E500MC|PPCA2, 0, {RS, RA0, RB}},
{"stwepx", X(31,159), X_MASK, E500MC|PPCA2, 0, {RS, RA0, RB}},
@@ -5008,7 +5009,6 @@ const struct powerpc_opcode powerpc_opco
{"sthfcmx", APU(31,167,0), APU_MASK, PPC405, 0, {FCRT, RA, RB}},
{"addex", ZRC(31,170,0), Z2_MASK, POWER9, 0, {RT, RA, RB, CY}},
-{"addex.", ZRC(31,170,1), Z2_MASK, POWER9, 0, {RT, RA, RB, CY}},
{"msgclrp", XRTRA(31,174,0,0), XRTRA_MASK, POWER8, 0, {RB}},
{"dcbtlse", X(31,174), X_MASK, PPCCHLK, E500MC, {CT, RA0, RB}},
@@ -5033,8 +5033,6 @@ const struct powerpc_opcode powerpc_opco
{"prtyd", X(31,186), XRB_MASK, POWER6|PPCA2, 0, {RA, RS}},
-{"brd", X(31,187), XRB_MASK, POWER9, 0, {RA, RS}},
-
{"cmprb", X(31,192), XCMP_MASK, POWER9, 0, {BF, L, RA, RB}},
{"icblq.", XRC(31,198,1), X_MASK, E6500, 0, {CT, RA0, RB}},
@@ -5073,8 +5071,6 @@ const struct powerpc_opcode powerpc_opco
{"sleq", XRC(31,217,0), X_MASK, M601, 0, {RA, RS, RB}},
{"sleq.", XRC(31,217,1), X_MASK, M601, 0, {RA, RS, RB}},
-{"brh", X(31,219), XRB_MASK, POWER9, 0, {RA, RS}},
-
{"stbepx", X(31,223), X_MASK, E500MC|PPCA2, 0, {RS, RA0, RB}},
{"cmpeqb", X(31,224), XCMPL_MASK, POWER9, 0, {BF, RA, RB}},
@@ -5541,8 +5537,6 @@ const struct powerpc_opcode powerpc_opco
{"mtvsrdd", X(31,435), XX1_MASK, PPCVSX3, 0, {XT6, RA0, RB}},
-{"lwzmx", X(31,437), X_MASK, POWER9, 0, {RT, RA0, RB}},
-
{"ecowx", X(31,438), X_MASK, PPC, E500|TITAN, {RT, RA0, RB}},
{"sthux", X(31,439), X_MASK, COM, 0, {RS, RAS, RB}},
@@ -5815,6 +5809,7 @@ const struct powerpc_opcode powerpc_opco
{"mcrxr", X(31,512), XBFRARB_MASK, COM, POWER7, {BF}},
+{"lbdcbx", X(31,514), X_MASK, E200Z4, 0, {RT, RA, RB}},
{"lbdx", X(31,515), X_MASK, E500MC, 0, {RT, RA, RB}},
{"bblels", X(31,518), X_MASK, PPCBRLK, 0, {0}},
@@ -5865,6 +5860,7 @@ const struct powerpc_opcode powerpc_opco
{"maskir", XRC(31,541,0), X_MASK, M601, 0, {RA, RS, RB}},
{"maskir.", XRC(31,541,1), X_MASK, M601, 0, {RA, RS, RB}},
+{"lhdcbx", X(31,546), X_MASK, E200Z4, 0, {RT, RA, RB}},
{"lhdx", X(31,547), X_MASK, E500MC, 0, {RT, RA, RB}},
{"lvtrx", X(31,549), X_MASK, PPCVEC2, 0, {VD, RA0, RB}},
@@ -5888,6 +5884,7 @@ const struct powerpc_opcode powerpc_opco
{"mcrxrx", X(31,576), XBFRARB_MASK, POWER9, 0, {BF}},
+{"lwdcbx", X(31,578), X_MASK, E200Z4, 0, {RT, RA, RB}},
{"lwdx", X(31,579), X_MASK, E500MC, 0, {RT, RA, RB}},
{"lvtlx", X(31,581), X_MASK, PPCVEC2, 0, {VD, RA0, RB}},
@@ -5906,8 +5903,8 @@ const struct powerpc_opcode powerpc_opco
{"hwsync", XSYNC(31,598,0), 0xffffffff, POWER4, BOOKE|PPC476, {0}},
{"lwsync", XSYNC(31,598,1), 0xffffffff, PPC, E500, {0}},
{"ptesync", XSYNC(31,598,2), 0xffffffff, PPC64, 0, {0}},
-{"sync", X(31,598), XSYNCLE_MASK, POWER9|E6500, 0, {LS, ESYNC}},
-{"sync", X(31,598), XSYNC_MASK, PPCCOM, BOOKE|PPC476|POWER9, {LS}},
+{"sync", X(31,598), XSYNCLE_MASK, E6500, 0, {LS, ESYNC}},
+{"sync", X(31,598), XSYNC_MASK, PPCCOM, BOOKE|PPC476, {LS}},
{"msync", X(31,598), 0xffffffff, BOOKE|PPCA2|PPC476, 0, {0}},
{"sync", X(31,598), 0xffffffff, BOOKE|PPC476, E6500, {0}},
{"lwsync", X(31,598), 0xffffffff, E500, 0, {0}},
@@ -5938,6 +5935,7 @@ const struct powerpc_opcode powerpc_opco
{"lfdux", X(31,631), X_MASK, COM, PPCEFS, {FRT, RAS, RB}},
+{"stbdcbx", X(31,642), X_MASK, E200Z4, 0, {RS, RA, RB}},
{"stbdx", X(31,643), X_MASK, E500MC, 0, {RS, RA, RB}},
{"stvlx", X(31,647), X_MASK, CELL, 0, {VS, RA0, RB}},
@@ -5975,6 +5973,7 @@ const struct powerpc_opcode powerpc_opco
{"sre", XRC(31,665,0), X_MASK, M601, 0, {RA, RS, RB}},
{"sre.", XRC(31,665,1), X_MASK, M601, 0, {RA, RS, RB}},
+{"sthdcbx", X(31,674), X_MASK, E200Z4, 0, {RS, RA, RB}},
{"sthdx", X(31,675), X_MASK, E500MC, 0, {RS, RA, RB}},
{"stvfrx", X(31,677), X_MASK, PPCVEC2, 0, {VS, RA0, RB}},
@@ -5992,6 +5991,7 @@ const struct powerpc_opcode powerpc_opco
{"sriq", XRC(31,696,0), X_MASK, M601, 0, {RA, RS, SH}},
{"sriq.", XRC(31,696,1), X_MASK, M601, 0, {RA, RS, SH}},
+{"stwdcbx", X(31,706), X_MASK, E200Z4, 0, {RS, RA, RB}},
{"stwdx", X(31,707), X_MASK, E500MC, 0, {RS, RA, RB}},
{"stvflx", X(31,709), X_MASK, PPCVEC2, 0, {VS, RA0, RB}},
@@ -6072,8 +6072,7 @@ const struct powerpc_opcode powerpc_opco
{"lvsm", X(31,773), X_MASK, PPCVEC2, 0, {VD, RA0, RB}},
-{"copy_first", XOPL(31,774,1), XRT_MASK, POWER9, 0, {RA0, RB}},
-{"copy", X(31,774), XLRT_MASK, POWER9, 0, {RA0, RB, L}},
+{"copy", XOPL(31,774,1), XRT_MASK, POWER9, 0, {RA0, RB}},
{"stvepxl", X(31,775), X_MASK, PPCVEC2, 0, {VS, RA0, RB}},
{"lvlxl", X(31,775), X_MASK, CELL, 0, {VD, RA0, RB}},
@@ -6143,7 +6142,7 @@ const struct powerpc_opcode powerpc_opco
{"lvtlxl", X(31,837), X_MASK, PPCVEC2, 0, {VD, RA0, RB}},
-{"cp_abort", X(31,838), XRTRARB_MASK,POWER9, 0, {0}},
+{"cpabort", X(31,838), XRTRARB_MASK,POWER9, 0, {0}},
{"divo", XO(31,331,1,0), XO_MASK, M601, 0, {RT, RA, RB}},
{"divo.", XO(31,331,1,1), XO_MASK, M601, 0, {RT, RA, RB}},
@@ -6155,6 +6154,7 @@ const struct powerpc_opcode powerpc_opco
{"tlbsrx.", XRC(31,850,1), XRT_MASK, PPCA2, 0, {RA0, RB}},
+{"slbiag", X(31,850), XRARB_MASK, POWER9, 0, {RS}},
{"slbmfev", X(31,851), XRLA_MASK, POWER9, 0, {RT, RB, A_L}},
{"slbmfev", X(31,851), XRA_MASK, PPC64, POWER9, {RT, RB}},
@@ -6190,9 +6190,7 @@ const struct powerpc_opcode powerpc_opco
{"extswsli", XS(31,445,0), XS_MASK, POWER9, 0, {RA, RS, SH6}},
{"extswsli.", XS(31,445,1), XS_MASK, POWER9, 0, {RA, RS, SH6}},
-{"paste", XRC(31,902,0), XLRT_MASK, POWER9, 0, {RA0, RB, L0}},
-{"paste_last", XRCL(31,902,1,1),XRT_MASK, POWER9, 0, {RA0, RB}},
-{"paste.", XRC(31,902,1), XLRT_MASK, POWER9, 0, {RA0, RB, L1}},
+{"paste.", XRCL(31,902,1,1),XRT_MASK, POWER9, 0, {RA0, RB}},
{"stvlxl", X(31,903), X_MASK, CELL, 0, {VS, RA0, RB}},
{"stdfcmux", APU(31,903,0), APU_MASK, PPC405, 0, {FCRT, RA, RB}},
@@ -7070,7 +7068,9 @@ const struct powerpc_opcode vle_opcodes[
{"se_cmphl", SE_RR(3,3), SE_RR_MASK, PPCVLE, 0, {RX, RY}},
{"e_cmpi", SCI8BF(6,0,21), SCI8BF_MASK, PPCVLE, 0, {CRD32, RA, SCLSCI8}},
+{"e_cmpwi", SCI8BF(6,0,21), SCI8BF_MASK, PPCVLE, 0, {CRD32, RA, SCLSCI8}},
{"e_cmpli", SCI8BF(6,1,21), SCI8BF_MASK, PPCVLE, 0, {CRD32, RA, SCLSCI8}},
+{"e_cmplwi", SCI8BF(6,1,21), SCI8BF_MASK, PPCVLE, 0, {CRD32, RA, SCLSCI8}},
{"e_addi", SCI8(6,16), SCI8_MASK, PPCVLE, 0, {RT, RA, SCLSCI8}},
{"e_subi", SCI8(6,16), SCI8_MASK, PPCVLE, 0, {RT, RA, SCLSCI8N}},
{"e_addi.", SCI8(6,17), SCI8_MASK, PPCVLE, 0, {RT, RA, SCLSCI8}},
@@ -7097,6 +7097,16 @@ const struct powerpc_opcode vle_opcodes[
{"e_sthu", OPVUP(6,5), OPVUP_MASK, PPCVLE, 0, {RT, D8, RA0}},
{"e_stwu", OPVUP(6,6), OPVUP_MASK, PPCVLE, 0, {RT, D8, RA0}},
{"e_stmw", OPVUP(6,9), OPVUP_MASK, PPCVLE, 0, {RT, D8, RA0}},
+{"e_ldmvgprw", OPVUPRT(6,16,0),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_stmvgprw", OPVUPRT(6,17,0),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_ldmvsprw", OPVUPRT(6,16,1),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_stmvsprw", OPVUPRT(6,17,1),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_ldmvsrrw", OPVUPRT(6,16,4),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_stmvsrrw", OPVUPRT(6,17,4),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_ldmvcsrrw", OPVUPRT(6,16,5),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_stmvcsrrw", OPVUPRT(6,17,5),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_ldmvdsrrw", OPVUPRT(6,16,6),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
+{"e_stmvdsrrw", OPVUPRT(6,17,6),OPVUPRT_MASK, PPCVLE, 0, {D8, RA0}},
{"e_add16i", OP(7), OP_MASK, PPCVLE, 0, {RT, RA, SI}},
{"e_la", OP(7), OP_MASK, PPCVLE, 0, {RT, D, RA0}},
{"e_sub16i", OP(7), OP_MASK, PPCVLE, 0, {RT, RA, NSI}},
@@ -7144,10 +7154,8 @@ const struct powerpc_opcode vle_opcodes[
{"e_cmphl16i", IA16(28,23), IA16_MASK, PPCVLE, 0, {RA, VLEUIMM}},
{"e_cmph16i", IA16(28,22), IA16_MASK, PPCVLE, 0, {RA, VLESIMM}},
{"e_cmpl16i", I16A(28,21), I16A_MASK, PPCVLE, 0, {RA, VLEUIMM}},
-{"e_cmplwi", I16A(28,21), I16A_MASK, PPCVLE, 0, {RA, VLESIMM}},
{"e_mull2i", I16A(28,20), I16A_MASK, PPCVLE, 0, {RA, VLESIMM}},
{"e_cmp16i", IA16(28,19), IA16_MASK, PPCVLE, 0, {RA, VLESIMM}},
-{"e_cmpwi", IA16(28,19), IA16_MASK, PPCVLE, 0, {RA, VLESIMM}},
{"e_sub2is", I16A(28,18), I16A_MASK, PPCVLE, 0, {RA, VLENSIMM}},
{"e_add2is", I16A(28,18), I16A_MASK, PPCVLE, 0, {RA, VLESIMM}},
{"e_sub2i.", I16A(28,17), I16A_MASK, PPCVLE, 0, {RA, VLENSIMM}},

14
SOURCES/binutils-2.27-ppc-stubs.patch

@ -0,0 +1,14 @@
--- binutils.orig/bfd/elf64-ppc.c 2017-03-08 13:43:51.185482217 +0000
+++ binutils-2.27/bfd/elf64-ppc.c 2017-03-08 13:44:28.403034088 +0000
@@ -12514,7 +12514,10 @@ ppc64_elf_size_stubs (struct bfd_link_in
stub_sec = stub_sec->next)
if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
{
- stub_sec->rawsize = stub_sec->size;
+ if (htab->stub_iteration <= STUB_SHRINK_ITER
+ || stub_sec->rawsize < stub_sec->size)
+ /* Past STUB_SHRINK_ITER, rawsize is the max size seen. */
+ stub_sec->rawsize = stub_sec->size;
stub_sec->size = 0;
stub_sec->reloc_count = 0;
stub_sec->flags &= ~SEC_RELOC;

79
SOURCES/binutils-2.27-ppc64-discarded-plt-sections.patch

@ -0,0 +1,79 @@
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.27/bfd/elf64-ppc.c
--- binutils.orig/bfd/elf64-ppc.c 2017-11-16 10:35:34.873666405 +0000
+++ binutils-2.27/bfd/elf64-ppc.c 2017-11-16 10:39:54.037530964 +0000
@@ -10105,6 +10105,10 @@ ppc64_elf_size_dynamic_sections (bfd *ou
continue;
}
+ if (bfd_is_abs_section (s->output_section))
+ _bfd_error_handler (_("warning: discarding dynamic section %s"),
+ s->name);
+
if ((s->flags & SEC_HAS_CONTENTS) == 0)
continue;
@@ -10875,7 +10879,7 @@ ppc_build_one_stub (struct bfd_hash_entr
+ htab->brlt->output_section->vma);
off = (dest
- - elf_gp (htab->brlt->output_section->owner)
+ - elf_gp (info->output_bfd)
- htab->sec_info[stub_entry->group->link_sec->id].toc_off);
if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
@@ -11025,7 +11029,7 @@ ppc_build_one_stub (struct bfd_hash_entr
}
off = (dest
- - elf_gp (plt->output_section->owner)
+ - elf_gp (info->output_bfd)
- htab->sec_info[stub_entry->group->link_sec->id].toc_off);
if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
@@ -11172,7 +11176,7 @@ ppc_size_one_stub (struct bfd_hash_entry
plt = htab->elf.iplt;
off += (plt->output_offset
+ plt->output_section->vma
- - elf_gp (plt->output_section->owner)
+ - elf_gp (info->output_bfd)
- htab->sec_info[stub_entry->group->link_sec->id].toc_off);
size = plt_stub_size (htab, stub_entry, off);
@@ -11266,7 +11270,7 @@ ppc_size_one_stub (struct bfd_hash_entry
off = (br_entry->offset
+ htab->brlt->output_offset
+ htab->brlt->output_section->vma
- - elf_gp (htab->brlt->output_section->owner)
+ - elf_gp (info->output_bfd)
- htab->sec_info[stub_entry->group->link_sec->id].toc_off);
if (info->emitrelocations)
@@ -11386,7 +11390,7 @@ ppc64_elf_next_toc_section (struct bfd_l
output toc base plus 0x8000. Making the input elf_gp an
offset allows us to move the toc as a whole without
recalculating input elf_gp. */
- off = htab->toc_curr - elf_gp (isec->output_section->owner);
+ off = htab->toc_curr - elf_gp (info->output_bfd);
off += TOC_BASE_OFF;
/* Die if someone uses a linker script that doesn't keep input
@@ -11415,7 +11419,7 @@ ppc64_elf_next_toc_section (struct bfd_l
}
addr = (htab->toc_first_sec->output_offset
+ htab->toc_first_sec->output_section->vma);
- off = addr - elf_gp (isec->output_section->owner) + TOC_BASE_OFF;
+ off = addr - elf_gp (info->output_bfd) + TOC_BASE_OFF;
elf_gp (isec->owner) = off;
return TRUE;
diff -rup binutils.orig/ld/testsuite/ld-elf/note-3.t binutils-2.27/ld/testsuite/ld-elf/note-3.t
--- binutils.orig/ld/testsuite/ld-elf/note-3.t 2017-11-16 10:35:35.670656893 +0000
+++ binutils-2.27/ld/testsuite/ld-elf/note-3.t 2017-11-16 10:59:06.352286215 +0000
@@ -17,6 +17,7 @@ SECTIONS
.dynstr : { *(.dynstr) }
.dynsym : { *(.dynsym) }
+ .got : { *(.got .toc) *(.igot) }
.got.plt : { *(.got.plt) *(.igot.plt) }
/DISCARD/ : { *(*) }
}

41
SOURCES/binutils-2.27-remove-dwarf2-minmax.patch

@ -0,0 +1,41 @@
--- binutils.orig/bfd/dwarf2.c 2017-08-08 17:40:39.084385407 +0100
+++ binutils-2.27/bfd/dwarf2.c 2017-08-08 17:41:34.237754733 +0100
@@ -215,9 +215,6 @@ struct comp_unit
/* Linked list of the low and high address ranges contained in this
compilation unit as specified in the compilation unit header. */
struct arange arange;
- /* A single arange containing the lowest and highest
- addresses covered by the compilation unit. */
- struct arange minmax;
/* The DW_AT_name attribute (for error messages). */
char *name;
@@ -1540,16 +1537,11 @@ arange_add (struct comp_unit *unit, stru
/* If the first arange is empty, use it. */
if (first_arange->high == 0)
{
- unit->minmax.low = first_arange->low = low_pc;
- unit->minmax.high = first_arange->high = high_pc;
+ first_arange->low = low_pc;
+ first_arange->high = high_pc;
return TRUE;
}
- if (unit->minmax.low > low_pc)
- unit->minmax.low = low_pc;
- if (unit->minmax.high < high_pc)
- unit->minmax.high = high_pc;
-
/* Next see if we can cheaply extend an existing range. */
arange = first_arange;
do
@@ -3151,9 +3143,6 @@ comp_unit_contains_address (struct comp_
if (unit->error)
return FALSE;
- if (unit->minmax.high < addr || unit->minmax.low > addr)
- return FALSE;
-
/* We know that the address *might* be contained within this comp
unit, but we cannot be sure until we check the specific ranges. */
arange = &unit->arange;

24
SOURCES/binutils-2.27-remove-pr19784-test.patch

@ -0,0 +1,24 @@
diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.27/ld/testsuite/ld-ifunc/ifunc.exp
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2017-02-21 16:23:38.051305028 +0000
+++ binutils-2.27/ld/testsuite/ld-ifunc/ifunc.exp 2017-02-21 16:59:09.769220809 +0000
@@ -563,20 +563,4 @@ run_ld_link_exec_tests [] [list \
"pr18841c" \
"pr18841.out" \
] \
- [list \
- "Run pr19784a" \
- "tmpdir/pr19784a.o tmpdir/libpr19784a.so" \
- "" \
- { dummy.c } \
- "pr19784a" \
- "pass.out" \
- ] \
- [list \
- "Run pr19784b" \
- "--as-needed tmpdir/pr19784a.o tmpdir/libpr19784b.so" \
- "" \
- { dummy.c } \
- "pr19784b" \
- "pass.out" \
- ] \
]

76
SOURCES/binutils-2.27-revert-PLT-elision.patch

@ -0,0 +1,76 @@
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.27/bfd/elf32-i386.c
--- binutils.orig/bfd/elf32-i386.c 2017-05-17 11:22:32.393303573 +0100
+++ binutils-2.27/bfd/elf32-i386.c 2017-05-17 11:25:33.097138811 +0100
@@ -2322,8 +2322,7 @@ do_size:
if (use_plt_got
&& h != NULL
&& h->plt.refcount > 0
- && (((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
- || h->got.refcount > 0)
+ && h->got.refcount > 0
&& htab->plt_got == NULL)
{
/* Create the GOT procedure linkage table. */
@@ -2672,16 +2671,6 @@ elf_i386_allocate_dynrelocs (struct elf_
if PLT is used. */
eh->func_pointer_refcount = 0;
- if ((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
- {
- /* Don't use the regular PLT for DF_BIND_NOW. */
- h->plt.offset = (bfd_vma) -1;
-
- /* Use the GOT PLT. */
- h->got.refcount = 1;
- eh->plt_got.refcount = 1;
- }
-
use_plt_got = eh->plt_got.refcount > 0;
/* Make sure this symbol is output as a dynamic symbol.
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.27/bfd/elf64-x86-64.c
--- binutils.orig/bfd/elf64-x86-64.c 2017-05-17 11:22:32.396303537 +0100
+++ binutils-2.27/bfd/elf64-x86-64.c 2017-05-17 11:26:00.250813521 +0100
@@ -2722,8 +2722,7 @@ do_size:
if (use_plt_got
&& h != NULL
&& h->plt.refcount > 0
- && (((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
- || h->got.refcount > 0)
+ && h->got.refcount > 0
&& htab->plt_got == NULL)
{
/* Create the GOT procedure linkage table. */
@@ -3094,16 +3093,6 @@ elf_x86_64_allocate_dynrelocs (struct el
if PLT is used. */
eh->func_pointer_refcount = 0;
- if ((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
- {
- /* Don't use the regular PLT for DF_BIND_NOW. */
- h->plt.offset = (bfd_vma) -1;
-
- /* Use the GOT PLT. */
- h->got.refcount = 1;
- eh->plt_got.refcount = 1;
- }
-
use_plt_got = eh->plt_got.refcount > 0;
/* Make sure this symbol is output as a dynamic symbol.
diff -rup binutils.orig/ld/testsuite/ld-i386/pr17689now.rd binutils-2.27/ld/testsuite/ld-i386/pr17689now.rd
--- binutils.orig/ld/testsuite/ld-i386/pr17689now.rd 2017-05-17 11:22:32.677300171 +0100
+++ binutils-2.27/ld/testsuite/ld-i386/pr17689now.rd 2017-05-17 11:39:36.097021963 +0100
@@ -1,4 +1,3 @@
-#failif
#...
[0-9a-f ]+R_386_JUMP_SLOT +0+.*
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr17689now.rd binutils-2.27/ld/testsuite/ld-x86-64/pr17689now.rd
--- binutils.orig/ld/testsuite/ld-x86-64/pr17689now.rd 2017-05-17 11:22:32.734299489 +0100
+++ binutils-2.27/ld/testsuite/ld-x86-64/pr17689now.rd 2017-05-17 11:39:53.071818174 +0100
@@ -1,4 +1,3 @@
-#failif
#...
[0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +.*
#...

354
SOURCES/binutils-2.27-s390-pgste-marker.patch

@ -0,0 +1,354 @@
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.27/bfd/elf64-s390.c
--- binutils.orig/bfd/elf64-s390.c 2017-08-29 13:09:44.135143399 +0100
+++ binutils-2.27/bfd/elf64-s390.c 2017-08-29 13:10:37.272554164 +0100
@@ -25,6 +25,7 @@
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/s390.h"
+#include "elf-s390.h"
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
@@ -660,6 +661,9 @@ struct elf_s390_link_hash_table
/* Small local sym cache. */
struct sym_cache sym_cache;
+
+ /* Options passed from the linker. */
+ struct s390_elf_params *params;
};
/* Get the s390 ELF linker hash table from a link_info structure. */
@@ -3883,6 +3887,70 @@ elf64_s390_merge_private_bfd_data (bfd *
return TRUE;
}
+/* We may add a PT_S390_PGSTE program header. */
+
+static int
+elf_s390_additional_program_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab;
+
+ htab = elf_s390_hash_table (info);
+ return htab->params->pgste;
+}
+
+
+/* Add the PT_S390_PGSTE program header. */
+
+static bfd_boolean
+elf_s390_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab;
+ struct elf_segment_map *m, *pm = NULL;
+
+ htab = elf_s390_hash_table (info);
+ if (!htab->params->pgste)
+ return TRUE;
+
+ /* If there is already a PT_S390_PGSTE header, avoid adding
+ another. */
+ m = elf_seg_map (abfd);
+ while (m && m->p_type != PT_S390_PGSTE)
+ {
+ pm = m;
+ m = m->next;
+ }
+
+ if (m)
+ return TRUE;
+
+ m = (struct elf_segment_map *)
+ bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+ if (m == NULL)
+ return FALSE;
+ m->p_type = PT_S390_PGSTE;
+ m->count = 0;
+ m->next = NULL;
+ if (pm)
+ pm->next = m;
+
+ return TRUE;
+}
+
+bfd_boolean
+bfd_elf_s390_set_options (struct bfd_link_info *info,
+ struct s390_elf_params *params)
+{
+ struct elf_s390_link_hash_table *htab;
+
+ htab = elf_s390_hash_table (info);
+ htab->params = params;
+
+ return TRUE;
+}
+
+
/* Why was the hash table entry size definition changed from
ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
this is the only reason for the s390_elf64_size_info structure. */
@@ -3959,6 +4027,8 @@ const struct elf_size_info s390_elf64_si
#define elf_backend_plt_sym_val elf_s390_plt_sym_val
#define elf_backend_add_symbol_hook elf_s390_add_symbol_hook
#define elf_backend_sort_relocs_p elf_s390_elf_sort_relocs_p
+#define elf_backend_additional_program_headers elf_s390_additional_program_headers
+#define elf_backend_modify_segment_map elf_s390_modify_segment_map
#define bfd_elf64_mkobject elf_s390_mkobject
#define elf_backend_object_p elf_s390_object_p
diff -rup binutils.orig/binutils/readelf.c binutils-2.27/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-08-29 13:09:44.138143366 +0100
+++ binutils-2.27/binutils/readelf.c 2017-08-29 13:09:53.384040839 +0100
@@ -3610,6 +3610,16 @@ get_arm_segment_type (unsigned long type
}
static const char *
+get_s390_segment_type (unsigned long type)
+{
+ switch (type)
+ {
+ case PT_S390_PGSTE: return "S390_PGSTE";
+ default: return NULL;
+ }
+}
+
+static const char *
get_mips_segment_type (unsigned long type)
{
switch (type)
@@ -3755,6 +3765,10 @@ get_segment_type (unsigned long p_type)
case EM_TI_C6000:
result = get_tic6x_segment_type (p_type);
break;
+ case EM_S390:
+ case EM_S390_OLD:
+ result = get_s390_segment_type (p_type);
+ break;
default:
result = NULL;
break;
diff -rup binutils.orig/elfcpp/elfcpp.h binutils-2.27/elfcpp/elfcpp.h
--- binutils.orig/elfcpp/elfcpp.h 2017-08-29 13:09:44.182142878 +0100
+++ binutils-2.27/elfcpp/elfcpp.h 2017-08-29 13:09:53.385040828 +0100
@@ -514,7 +514,9 @@ enum PT
// Platform architecture compatibility information
PT_AARCH64_ARCHEXT = 0x70000000,
// Exception unwind tables
- PT_AARCH64_UNWIND = 0x70000001
+ PT_AARCH64_UNWIND = 0x70000001,
+ // 4k page table size
+ PT_S390_PGSTE = 0x70000000,
};
// The valid bit flags found in the Phdr p_flags field.
diff -rup binutils.orig/include/elf/s390.h binutils-2.27/include/elf/s390.h
--- binutils.orig/include/elf/s390.h 2017-08-29 13:09:44.434140083 +0100
+++ binutils-2.27/include/elf/s390.h 2017-08-29 13:09:53.385040828 +0100
@@ -37,6 +37,9 @@
#define EF_S390_HIGH_GPRS 0x00000001
+/* Request 4k page table size. */
+#define PT_S390_PGSTE (PT_LOPROC + 0)
+
/* Relocation types. */
START_RELOC_NUMBERS (elf_s390_reloc_type)
diff -rup binutils.orig/ld/emulparams/elf64_s390.sh binutils-2.27/ld/emulparams/elf64_s390.sh
--- binutils.orig/ld/emulparams/elf64_s390.sh 2017-08-29 13:09:44.441140006 +0100
+++ binutils-2.27/ld/emulparams/elf64_s390.sh 2017-08-29 13:09:53.385040828 +0100
@@ -12,6 +12,7 @@ TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
+EXTRA_EM_FILE=s390
IREL_IN_PLT=
# Treat a host that matches the target with the possible exception of "x"
diff -rup binutils.orig/ld/gen-doc.texi binutils-2.27/ld/gen-doc.texi
--- binutils.orig/ld/gen-doc.texi 2017-08-29 13:09:44.445139961 +0100
+++ binutils-2.27/ld/gen-doc.texi 2017-08-29 13:09:53.385040828 +0100
@@ -21,6 +21,7 @@
@set POWERPC
@set POWERPC64
@set Renesas
+@set S/390
@set SPU
@set TICOFF
@set WIN32
diff -rup binutils.orig/ld/ld.texinfo binutils-2.27/ld/ld.texinfo
--- binutils.orig/ld/ld.texinfo 2017-08-29 13:09:44.445139961 +0100
+++ binutils-2.27/ld/ld.texinfo 2017-08-29 13:09:53.385040828 +0100
@@ -34,6 +34,7 @@
@set POWERPC
@set POWERPC64
@set Renesas
+@set S/390
@set SPU
@set TICOFF
@set WIN32
@@ -158,6 +159,9 @@ in the section entitled ``GNU Free Docum
@ifset POWERPC64
* PowerPC64 ELF64:: ld and PowerPC64 64-bit ELF Support
@end ifset
+@ifset S/390
+* S/390 ELF:: ld and S/390 ELF Support
+@end ifset
@ifset SPU
* SPU ELF:: ld and SPU ELF Support
@end ifset
@@ -6380,6 +6384,9 @@ functionality are not listed.
@ifset POWERPC64
* PowerPC64 ELF64:: @command{ld} and PowerPC64 64-bit ELF Support
@end ifset
+@ifset S/390
+* S/390 ELF:: @command{ld} and S/390 ELF Support
+@end ifset
@ifset SPU
* SPU ELF:: @command{ld} and SPU ELF Support
@end ifset
@@ -7373,6 +7380,30 @@ default behaviour.
@end table
@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset S/390
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node S/390 ELF
+@section @command{ld} and S/390 ELF Support
+
+@cindex S/390 ELF options
+@table @option
+
+@cindex S/390
+@kindex --s390-pgste
+@item --s390-pgste
+This option marks the result file with a @code{PT_S390_PGSTE}
+segment. The Linux kernel is supposed to allocate 4k page tables for
+binaries marked that way.
+@end table
+
+@ifclear GENERIC
@lowersections
@end ifclear
@end ifset
diff -rup binutils.orig/ld/Makefile.in binutils-2.27/ld/Makefile.in
--- binutils.orig/ld/Makefile.in 2017-08-29 13:09:44.446139950 +0100
+++ binutils-2.27/ld/Makefile.in 2017-08-29 13:09:53.385040828 +0100
@@ -3490,6 +3490,7 @@ eelf64_ia64_vms.c: $(srcdir)/emulparams/
$(srcdir)/scripttempl/ia64vms.sc ${GEN_DEPENDS}
eelf64_s390.c: $(srcdir)/emulparams/elf64_s390.sh \
+ $(srcdir)/emultempl/s390.em \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \

--- /dev/null 2017-08-29 08:03:33.387685165 +0100
+++ binutils-2.27/bfd/elf-s390.h 2017-08-29 13:19:31.705627899 +0100
@@ -0,0 +1,29 @@
+/* S/390-specific support for ELF.
+ Copyright (C) 2017 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. */
+
+/* Used to pass info between ld and bfd. */
+struct s390_elf_params
+{
+ /* Tell the kernel to allocate 4k page tables. */
+ int pgste;
+};
+
+bfd_boolean bfd_elf_s390_set_options (struct bfd_link_info *info,
+ struct s390_elf_params *params);
--- /dev/null 2017-08-29 08:03:33.387685165 +0100
+++ binutils-2.27/ld/emultempl/s390.em 2017-08-29 13:26:01.797302217 +0100
@@ -0,0 +1,64 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2017 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# 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; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf-generic.em, and defines S/390
+# specific routines.
+#
+fragment <<EOF
+
+#include "ldctor.h"
+#include "elf-s390.h"
+
+static struct s390_elf_params params = { 0 };
+
+/* This is a convenient point to tell BFD about target specific flags.
+ After the output has been created, but before inputs are read. */
+static void
+s390_elf_create_output_section_statements (void)
+{
+ if (!bfd_elf_s390_set_options (&link_info, &params))
+ einfo ("%F%P: can not init BFD: %E\n");
+}
+
+EOF
+
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+PARSE_AND_LIST_PROLOGUE='
+#define OPTION_PGSTE 301
+'
+
+PARSE_AND_LIST_LONGOPTS='
+ { "s390-pgste", no_argument, NULL, OPTION_PGSTE},
+'
+
+PARSE_AND_LIST_OPTIONS='
+ fprintf (file, _(" --s390-pgste Tell the kernel to "
+ "allocate 4k page tables\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES='
+ case OPTION_PGSTE:
+ params.pgste = 1;
+ break;
+'
+
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=s390_elf_create_output_section_statements

44
SOURCES/binutils-2.27-s390-plt.patch

@ -0,0 +1,44 @@
diff -rup binutils.orig/bfd/elf32-s390.c binutils-2.27/bfd/elf32-s390.c
--- binutils.orig/bfd/elf32-s390.c 2017-05-12 13:00:01.697650210 +0100
+++ binutils-2.27/bfd/elf32-s390.c 2017-05-12 13:01:05.223988744 +0100
@@ -2809,7 +2809,7 @@ elf_s390_relocate_section (bfd *output_b
&& s390_is_ifunc_symbol_p (h)
&& h->def_regular)
{
- if (!bfd_link_pic (info) || !h->non_got_ref)
+ if (!bfd_link_pic (info))
{
/* For a non-shared object STT_GNU_IFUNC symbol must
go through PLT. */
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.27/bfd/elf64-s390.c
--- binutils.orig/bfd/elf64-s390.c 2017-05-12 13:00:01.699650190 +0100
+++ binutils-2.27/bfd/elf64-s390.c 2017-05-12 13:01:31.017720167 +0100
@@ -2768,10 +2768,11 @@ elf_s390_relocate_section (bfd *output_b
&& s390_is_ifunc_symbol_p (h)
&& h->def_regular)
{
- if (!bfd_link_pic (info) || !h->non_got_ref)
+ if (!bfd_link_pic (info))
{
- /* For a non-shared object STT_GNU_IFUNC symbol must
- go through PLT. */
+ /* For a non-shared object the symbol will not
+ change. Hence we can write the address of the
+ target IPLT slot now. */
relocation = (htab->elf.iplt->output_section->vma
+ htab->elf.iplt->output_offset
+ h ->plt.offset);
diff -rup binutils.orig/bfd/elf-s390-common.c binutils-2.27/bfd/elf-s390-common.c
--- binutils.orig/bfd/elf-s390-common.c 2017-05-12 13:00:01.695650231 +0100
+++ binutils-2.27/bfd/elf-s390-common.c 2017-05-12 13:01:54.347477247 +0100
@@ -161,9 +161,7 @@ keep:
h->type = STT_FUNC;
}
- /* We need dynamic relocation for STT_GNU_IFUNC symbol only when
- there is a non-GOT reference in a shared object. */
- if (!bfd_link_pic (info) || !h->non_got_ref)
+ if (!bfd_link_pic (info))
*head = NULL;
/* Finally, allocate space. */

10
SOURCES/binutils-2.27-s390-pr19719.patch

@ -0,0 +1,10 @@
diff -rup binutils.orig/ld/testsuite/ld-elf/shared.exp binutils-2.27/ld/testsuite/ld-elf/shared.exp
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2017-02-21 15:00:21.788036974 +0000
+++ binutils-2.27/ld/testsuite/ld-elf/shared.exp 2017-02-21 16:18:12.497641235 +0000
@@ -665,5 +665,5 @@ proc mix_pic_and_non_pic {xfails cflags
}
}
-mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719"
+mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*" "s390*-*-*"] "" "" "pr19719"
mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"

1064
SOURCES/binutils-2.27-s390x-arch12.patch

File diff suppressed because it is too large Load Diff

43
SOURCES/binutils-2.27-s390x-check-for-NULL-pointers.patch

@ -0,0 +1,43 @@
--- binutils.orig/bfd/elf64-s390.c 2017-09-06 09:03:23.142216202 +0100
+++ binutils-2.27/bfd/elf64-s390.c 2017-09-06 09:11:05.209080947 +0100
@@ -3895,8 +3895,13 @@ elf_s390_additional_program_headers (bfd
{
struct elf_s390_link_hash_table *htab;
- htab = elf_s390_hash_table (info);
- return htab->params->pgste;
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ return htab->params->pgste;
+ }
+ return 0;
}
@@ -3909,6 +3914,9 @@ elf_s390_modify_segment_map (bfd *abfd A
struct elf_s390_link_hash_table *htab;
struct elf_segment_map *m, *pm = NULL;
+ if (!abfd || !info)
+ return TRUE;
+
htab = elf_s390_hash_table (info);
if (!htab->params->pgste)
return TRUE;
@@ -3944,8 +3952,12 @@ bfd_elf_s390_set_options (struct bfd_lin
{
struct elf_s390_link_hash_table *htab;
- htab = elf_s390_hash_table (info);
- htab->params = params;
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ htab->params = params;
+ }
return TRUE;
}

22
SOURCES/binutils-2.27-s390x-complain-missing-fPIC.patch

@ -0,0 +1,22 @@
--- binutils.orig/bfd/elf64-s390.c 2017-08-11 11:09:23.264667227 +0000
+++ binutils-2.27/bfd/elf64-s390.c 2017-08-11 11:15:07.510029088 +0000
@@ -2745,6 +2745,19 @@ elf_s390_relocate_section (bfd *output_b
case R_390_PC32:
case R_390_PC32DBL:
case R_390_PC64:
+ if (h != NULL
+ && bfd_link_pie (info)
+ && !h->def_regular)
+ {
+ _bfd_error_handler (_("%B: `%s' non-PLT reloc for symbol defined "
+ "in shared library and accessed "
+ "from executable "
+ "(rebuild file with -fPIC ?)"),
+ input_bfd, h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
/* The target of these relocs are instruction operands
residing in read-only sections. We cannot emit a runtime
reloc for it. */

18
SOURCES/binutils-2.27-skip-ld-aarch64-ifunc-exec-tests.patch

@ -0,0 +1,18 @@
Only in binutils.orig/ld/testsuite/ld-ifunc: .#ifunc.exp
diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.27/ld/testsuite/ld-ifunc/ifunc.exp
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2017-02-21 15:00:21.802036746 +0000
+++ binutils-2.27/ld/testsuite/ld-ifunc/ifunc.exp 2017-02-21 15:06:32.730980432 +0000
@@ -531,6 +531,13 @@ run_cc_link_tests [list \
] \
]
+# IFUNC support for AArch64 is still experimental, and in particular
+# function resolution is not yet stable. So skip these tests for now.
+# NC Feb 2017.
+if {[istarget "aarch64-*-*"]} {
+ return
+}
+
run_ld_link_exec_tests [] [list \
[list \
"Run pr18808" \

26
SOURCES/binutils-2.27-skip-rp14918-test-for-arm.patch

@ -0,0 +1,26 @@
--- binutils-2.27.orig/ld/testsuite/ld-plugin/lto.exp 2016-09-20 14:11:51.866711051 +0100
+++ binutils-2.27/ld/testsuite/ld-plugin/lto.exp 2016-09-20 14:18:28.528223979 +0100
@@ -287,11 +287,21 @@ set lto_link_elf_tests [list \
{dummy.c} {} "pr16746a.exe"] \
[list "PR ld/16746 (2)" \
"-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
- {dummy.c} {} "pr16746b.exe"] \
+ {dummy.c} {} "pr16746b.exe"] \
+]
+
+# PR 14918 checks that libgcc is not spuriously included in a shared link of
+# an empty program. The ARM crt1.o startup code however calls __libc_csu_init
+# in /usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs
+# __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the
+# test fails. Hence this code to skip the test.
+if { ! [istarget "arm*-*-*"] } {
+ set lto_link_elf_tests [concat $lto_link_elf_tests [list \
[list "PR ld/14918" \
"-flto" "-flto" \
{pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \
-]
+ ]]
+}
# Check final symbols in executables.
set lto_link_symbol_tests [list \

1515
SOURCES/binutils-2.27-suppress-R_X86_64_GOTPCRELX.patch

File diff suppressed because it is too large Load Diff

141
SOURCES/binutils-SUPPRESS-PPC-TLBIE-CHECK.patch

@ -0,0 +1,141 @@
--- binutils-2.25.1/gas/testsuite/gas/ppc/power7.s 2015-07-21 09:20:58.000000000 +0100
+++ binutils-2.25.1.new/gas/testsuite/gas/ppc/power7.s 2016-03-01 14:08:17.020136029 +0000
@@ -98,4 +98,4 @@ power7:
mfppr32 11
mtppr 12
mtppr32 13
- tlbie 10,11
+ tlbie 10
--- binutils-2.25.1/gas/testsuite/gas/ppc/power7.d 2015-07-21 09:20:58.000000000 +0100
+++ binutils-2.25.1.new/gas/testsuite/gas/ppc/power7.d 2016-03-01 14:08:17.020136029 +0000
@@ -107,5 +107,5 @@ Disassembly of section \.text:
.*: (7d 62 e2 a6|a6 e2 62 7d) mfppr32 r11
.*: (7d 80 e3 a6|a6 e3 80 7d) mtppr r12
.*: (7d a2 e3 a6|a6 e3 a2 7d) mtppr32 r13
-.*: (7d 60 52 64|64 52 60 7d) tlbie r10,r11
+.*: (7c 00 52 64|64 52 00 7c) tlbie r10
#pass
--- binutils.orig/opcodes/ppc-opc.c 2017-01-17 09:44:23.341397357 +0000
+++ binutils-2.27/opcodes/ppc-opc.c 2017-01-17 09:45:24.000684653 +0000
@@ -5182,8 +5182,7 @@ const struct powerpc_opcode powerpc_opco
{"mfbhrbe", X(31,302), X_MASK, POWER8, 0, {RT, BHRBE}},
{"tlbie", X(31,306), X_MASK|1<<20,POWER9, TITAN, {RB, RS, RIC, PRS, X_R}},
-{"tlbie", X(31,306), XRA_MASK, POWER7, POWER9|TITAN, {RB, RS}},
-{"tlbie", X(31,306), XRTLRA_MASK, PPC, E500|POWER7|TITAN, {RB, L}},
+{"tlbie", X(31,306), XRTLRA_MASK, PPC, POWER9|TITAN, {RB, L}},
{"tlbi", X(31,306), XRT_MASK, POWER, 0, {RA0, RB}},
{"mfvsrld", X(31,307), XX1RB_MASK, PPCVSX3, 0, {RA, XS6}},
--- binutils.orig/gas/testsuite/gas/ppc/e500-ill.s 2017-01-17 10:34:39.821866168 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/e500-ill.s 2017-01-17 10:56:56.766061777 +0000
@@ -7,4 +7,4 @@ start:
mfdcr 5, 234
mtdcr 432, 8
tlbia
- tlbie 3
+
--- binutils.orig/gas/testsuite/gas/ppc/e500-ill.l 2017-01-17 10:34:39.821866168 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/e500-ill.l 2017-01-17 10:57:09.021915557 +0000
@@ -5,4 +5,3 @@
.*: Error: unrecognized opcode: `mfdcr'
.*: Error: unrecognized opcode: `mtdcr'
.*: Error: unrecognized opcode: `tlbia'
-.*: Error: unrecognized opcode: `tlbie'
--- binutils.orig/gas/testsuite/gas/ppc/power6.s 2017-01-17 10:34:39.822866157 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/power6.s 2017-01-17 10:58:38.316849143 +0000
@@ -69,6 +69,5 @@ start:
slbia
slbia 0
slbia 7
- tlbie 10
tlbie 10,0
tlbie 10,1
--- binutils.orig/gas/testsuite/gas/ppc/power6.d 2017-01-17 10:34:39.822866157 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/power6.d 2017-01-17 10:59:24.780294250 +0000
@@ -74,7 +74,6 @@ Disassembly of section \.text:
.*: (7c 00 03 e4|e4 03 00 7c) slbia
.*: (7c 00 03 e4|e4 03 00 7c) slbia
.*: (7c e0 03 e4|e4 03 e0 7c) slbia 7
-.*: (7c 00 52 64|64 52 00 7c) tlbie r10
-.*: (7c 00 52 64|64 52 00 7c) tlbie r10
+.*: (7c 00 52 64|64 52 00 7c) tlbie r10,0
.*: (7c 20 52 64|64 52 20 7c) tlbie r10,1
#pass
--- binutils.orig/gas/testsuite/gas/ppc/power7.s 2017-01-17 10:34:39.823866144 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/power7.s 2017-01-17 11:00:19.835636746 +0000
@@ -98,4 +98,4 @@ power7:
mfppr32 11
mtppr 12
mtppr32 13
- tlbie 10
+
--- binutils.orig/gas/testsuite/gas/ppc/power7.d 2017-01-17 10:34:39.822866157 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/power7.d 2017-01-17 11:00:27.995539295 +0000
@@ -107,5 +107,4 @@ Disassembly of section \.text:
.*: (7d 62 e2 a6|a6 e2 62 7d) mfppr32 r11
.*: (7d 80 e3 a6|a6 e3 80 7d) mtppr r12
.*: (7d a2 e3 a6|a6 e3 a2 7d) mtppr32 r13
-.*: (7c 00 52 64|64 52 00 7c) tlbie r10
#pass
diff -rup binutils.orig/gas/config/tc-ppc.c binutils-2.27/gas/config/tc-ppc.c
--- binutils.orig/gas/config/tc-ppc.c 2017-02-02 12:21:55.246930313 +0000
+++ binutils-2.27/gas/config/tc-ppc.c 2017-02-02 12:29:13.568862941 +0000
@@ -2672,7 +2672,7 @@ md_assemble (char *str)
operand = &powerpc_operands[*opindex_ptr];
if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
- && !((operand->flags & PPC_OPERAND_OPTIONAL32) != 0 && ppc_obj64))
+ || (operand->flags & PPC_OPERAND_OPTIONAL32))
{
unsigned int opcount;
unsigned int num_operands_expected;
@@ -2741,8 +2741,8 @@ md_assemble (char *str)
/* If this is an optional operand, and we are skipping it, just
insert a zero. */
- if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
- && !((operand->flags & PPC_OPERAND_OPTIONAL32) != 0 && ppc_obj64)
+ if (((operand->flags & PPC_OPERAND_OPTIONAL) != 0
+ || (operand->flags & PPC_OPERAND_OPTIONAL32) != 0)
&& skip_optional)
{
long val = ppc_optional_operand_value (operand);
diff -rup binutils-2.27.orig/gas/testsuite/gas/ppc/power6.d binutils-2.27/gas/testsuite/gas/ppc/power6.d
--- binutils-2.27.orig/gas/testsuite/gas/ppc/power6.d 2017-02-14 10:17:21.352033787 +0000
+++ binutils-2.27/gas/testsuite/gas/ppc/power6.d 2017-02-14 11:54:36.643091777 +0000
@@ -74,6 +74,6 @@ Disassembly of section \.text:
.*: (7c 00 03 e4|e4 03 00 7c) slbia
.*: (7c 00 03 e4|e4 03 00 7c) slbia
.*: (7c e0 03 e4|e4 03 e0 7c) slbia 7
-.*: (7c 00 52 64|64 52 00 7c) tlbie r10,0
+.*: (7c 00 52 64|64 52 00 7c) tlbie r10
.*: (7c 20 52 64|64 52 20 7c) tlbie r10,1
#pass
diff -rup binutils-2.27.orig/opcodes/ppc-opc.c binutils-2.27/opcodes/ppc-opc.c
--- binutils-2.27.orig/opcodes/ppc-opc.c 2017-02-14 10:17:22.281021961 +0000
+++ binutils-2.27/opcodes/ppc-opc.c 2017-02-14 11:58:50.035840144 +0000
@@ -576,9 +576,12 @@ const struct powerpc_operand powerpc_ope
#define RD RS
{ 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR },
+#define RSLL RS + 1
+ { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL32 },
+
/* The RS and RT fields of the DS form stq and DQ form lq instructions,
which have special value restrictions. */
-#define RSQ RS + 1
+#define RSQ RSLL + 1
#define RTQ RSQ
{ 0x1e, 21, NULL, NULL, PPC_OPERAND_GPR },
@@ -5132,7 +5135,8 @@ const struct powerpc_opcode powerpc_opco
{"mfbhrbe", X(31,302), X_MASK, POWER8, 0, {RT, BHRBE}},
{"tlbie", X(31,306), X_MASK|1<<20,POWER9, TITAN, {RB, RS, RIC, PRS, X_R}},
-{"tlbie", X(31,306), XRTLRA_MASK, PPC, POWER9|TITAN, {RB, L}},
+{"tlbie", X(31,306), XRA_MASK, POWER7, POWER9|TITAN, {RB, RSLL}},
+{"tlbie", X(31,306), XRTLRA_MASK, PPC, E500|POWER7|TITAN, {RB, LOPT}},
{"tlbi", X(31,306), XRT_MASK, POWER, 0, {RA0, RB}},
{"mfvsrld", X(31,307), XX1RB_MASK, PPCVSX3, 0, {RA, XS6}},

104
SOURCES/binutils-coverty-fixes.patch

@ -0,0 +1,104 @@
--- binutils.orig/gold/aarch64.cc 2017-01-18 16:05:12.747684566 +0000
+++ binutils-2.27/gold/aarch64.cc 2017-01-18 16:05:23.128501011 +0000
@@ -784,8 +784,14 @@ Stub_template_repertoire<big_endian>::St
0x14000000, /* b <label> */
};
- // ST_E_835769 has the same stub template as ST_E_843419.
- const static Insntype* ST_E_835769_INSNS = ST_E_843419_INSNS;
+ // ST_E_835769 has the same stub template as ST_E_843419
+ // but we reproduce the array here so that the sizeof
+ // expressions in install_insn_template will work.
+ const static Insntype ST_E_835769_INSNS[] =
+ {
+ 0x00000000, /* Placeholder for erratum insn. */
+ 0x14000000, /* b <label> */
+ };
#define install_insn_template(T) \
const static Stub_template<big_endian> template_##T = { \
--- binutils.orig/gas/config/tc-i386.c 2017-01-18 16:05:12.533688350 +0000
+++ binutils-2.27/gas/config/tc-i386.c 2017-01-18 16:11:29.828016979 +0000
@@ -4120,13 +4120,13 @@ parse_operands (char *l, const char *mne
{ /* Yes, we've read in another operand. */
unsigned int operand_ok;
this_operand = i.operands++;
- i.types[this_operand].bitfield.unspecified = 1;
if (i.operands > MAX_OPERANDS)
{
as_bad (_("spurious operands; (%d operands/instruction max)"),
MAX_OPERANDS);
return NULL;
}
+ i.types[this_operand].bitfield.unspecified = 1;
/* Now parse operand adding info to 'i' as we go along. */
END_STRING_AND_SAVE (l);
diff -rup binutils.orig/ld/testplug2.c binutils-2.27/ld/testplug2.c
--- binutils.orig/ld/testplug2.c 2017-01-18 16:05:12.777684035 +0000
+++ binutils-2.27/ld/testplug2.c 2017-01-18 16:18:39.437420563 +0000
@@ -242,10 +242,11 @@ parse_symdefstr (const char *str, struct
sym->version = NULL;
if (colon5 && colon5[1])
{
- sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
+ ++colon5;
+ sym->comdat_key = malloc (strlen (colon5) + 1);
if (!sym->comdat_key)
return LDPS_ERR;
- strcpy (sym->comdat_key, colon5 + 1);
+ strcpy (sym->comdat_key, colon5);
}
else
sym->comdat_key = 0;
diff -rup binutils.orig/ld/testplug3.c binutils-2.27/ld/testplug3.c
--- binutils.orig/ld/testplug3.c 2017-01-18 16:05:12.777684035 +0000
+++ binutils-2.27/ld/testplug3.c 2017-01-18 16:17:48.878314557 +0000
@@ -241,10 +241,11 @@ parse_symdefstr (const char *str, struct
sym->version = NULL;
if (colon5 && colon5[1])
{
- sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
+ ++colon5;
+ sym->comdat_key = malloc (strlen (colon5) + 1);
if (!sym->comdat_key)
return LDPS_ERR;
- strcpy (sym->comdat_key, colon5 + 1);
+ strcpy (sym->comdat_key, colon5);
}
else
sym->comdat_key = 0;
diff -rup binutils.orig/ld/testplug4.c binutils-2.27/ld/testplug4.c
--- binutils.orig/ld/testplug4.c 2017-01-18 16:05:12.777684035 +0000
+++ binutils-2.27/ld/testplug4.c 2017-01-18 16:16:34.751625275 +0000
@@ -242,10 +242,11 @@ parse_symdefstr (const char *str, struct
sym->version = NULL;
if (colon5 && colon5[1])
{
- sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
+ ++colon5;
+ sym->comdat_key = malloc (strlen (colon5) + 1);
if (!sym->comdat_key)
return LDPS_ERR;
- strcpy (sym->comdat_key, colon5 + 1);
+ strcpy (sym->comdat_key, colon5);
}
else
sym->comdat_key = 0;
diff -rup binutils.orig/ld/testplug.c binutils-2.27/ld/testplug.c
--- binutils.orig/ld/testplug.c 2017-01-18 16:05:12.777684035 +0000
+++ binutils-2.27/ld/testplug.c 2017-01-18 16:19:22.460659820 +0000
@@ -238,10 +238,11 @@ parse_symdefstr (const char *str, struct
sym->version = NULL;
if (colon5 && colon5[1])
{
- sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
+ ++colon5;
+ sym->comdat_key = malloc (strlen (colon5) + 1);
if (!sym->comdat_key)
return LDPS_ERR;
- strcpy (sym->comdat_key, colon5 + 1);
+ strcpy (sym->comdat_key, colon5);
}
else
sym->comdat_key = 0;

20
SOURCES/binutils-rh1203449.patch

@ -0,0 +1,20 @@
--- ld/emultempl/armelf.em~ 2015-03-18 17:32:36.436208938 -0400
+++ ld/emultempl/armelf.em 2015-03-18 17:32:54.455591126 -0400
@@ -53,6 +53,7 @@
input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
+ link_info.relro = TRUE;
}
static void
--- ld/emultempl/aarch64elf.em~ 2015-03-18 17:32:08.347172011 -0400
+++ ld/emultempl/aarch64elf.em 2015-03-18 17:32:30.866399906 -0400
@@ -40,6 +40,7 @@
input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
+ link_info.relro = TRUE;
}
static void

20
SOURCES/binutils-rh1300603.patch

@ -0,0 +1,20 @@
diff -rup binutils-2.27.orig/bfd/elf-eh-frame.c binutils-2.27/bfd/elf-eh-frame.c
--- binutils-2.27.orig/bfd/elf-eh-frame.c 2017-01-16 17:27:46.411632857 +0000
+++ binutils-2.27/bfd/elf-eh-frame.c 2017-01-16 17:30:03.663437755 +0000
@@ -2296,7 +2296,15 @@ write_dwarf_eh_frame_hdr (bfd *abfd, str
!= sec->output_section->vma + val))
overflow = TRUE;
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
- if (i != 0
+ if (i > 0
+ && hdr_info->u.dwarf.array[i].initial_loc
+ == hdr_info->u.dwarf.array[i - 1].initial_loc
+ && hdr_info->u.dwarf.array[i].range
+ == hdr_info->u.dwarf.array[i - 1].range)
+ /* Duplicate FDE entry. We should probably discard it
+ but for now just ignore it. */
+ ;
+ else if (i != 0
&& (hdr_info->u.dwarf.array[i].initial_loc
< (hdr_info->u.dwarf.array[i - 1].initial_loc
+ hdr_info->u.dwarf.array[i - 1].range)))

139
SOURCES/binutils-rh1312876.patch

@ -0,0 +1,139 @@
--- binutils-2.25.1.new/ld/testsuite/ld-powerpc/tlsso32.r 2016-03-01 14:08:17.249137110 +0000
+++ binutils-2.25.1/ld/testsuite/ld-powerpc/tlsso32.r 2016-03-01 15:10:02.847812018 +0000
@@ -20,6 +20,7 @@ Section Headers:
+\[[ 0-9]+\] \.dynamic +DYNAMIC .* 08 +WA +3 +0 +4
+\[[ 0-9]+\] \.got +PROGBITS .* 0+30 04 +WA +0 +0 +4
+\[[ 0-9]+\] \.plt +PROGBITS .* 0+4 00 +WA +0 +0 +4
+#...
+\[[ 0-9]+\] \.shstrtab +.*
+\[[ 0-9]+\] \.symtab +.*
+\[[ 0-9]+\] \.strtab +.*
@@ -80,12 +81,12 @@ Symbol table '\.dynsym' contains [0-9]+
.* TLS +GLOBAL +DEFAULT +8 le1
.* TLS +GLOBAL +DEFAULT +UND ld
.* NOTYPE +GLOBAL +DEFAULT +6 _start
-.* NOTYPE +GLOBAL +DEFAULT +11 __end
+.* NOTYPE +GLOBAL +DEFAULT +.. __end
.* TLS +GLOBAL +DEFAULT +8 ld2
.* TLS +GLOBAL +DEFAULT +8 ld1
-.* NOTYPE +GLOBAL +DEFAULT +11 __bss_start
-.* NOTYPE +GLOBAL +DEFAULT +11 _edata
-.* NOTYPE +GLOBAL +DEFAULT +11 _end
+.* NOTYPE +GLOBAL +DEFAULT +.. __bss_start
+.* NOTYPE +GLOBAL +DEFAULT +.. _edata
+.* NOTYPE +GLOBAL +DEFAULT +.. _end
.* TLS +GLOBAL +DEFAULT +8 gd0
.* TLS +GLOBAL +DEFAULT +8 ie0
@@ -103,32 +104,4 @@ Symbol table '\.symtab' contains [0-9]+
.* SECTION +LOCAL +DEFAULT +9
.* SECTION +LOCAL +DEFAULT +10
.* SECTION +LOCAL +DEFAULT +11
-.* FILE +LOCAL +DEFAULT +ABS .*
-.* TLS +LOCAL +DEFAULT +7 gd4
-.* TLS +LOCAL +DEFAULT +7 ld4
-.* TLS +LOCAL +DEFAULT +7 ld5
-.* TLS +LOCAL +DEFAULT +7 ld6
-.* TLS +LOCAL +DEFAULT +7 ie4
-.* TLS +LOCAL +DEFAULT +7 le4
-.* TLS +LOCAL +DEFAULT +7 le5
-.* FILE +LOCAL +DEFAULT +ABS .*
-.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
-.* NOTYPE +LOCAL +DEFAULT +6 0+8000\.got2\.plt_pic32\.__tls_get_addr
-.* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve
-.* NOTYPE +LOCAL +DEFAULT +6 __glink
-.* OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
-.* TLS +GLOBAL +DEFAULT +UND gd
-.* TLS +GLOBAL +DEFAULT +8 le0
-.* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
-.* TLS +GLOBAL +DEFAULT +8 ld0
-.* TLS +GLOBAL +DEFAULT +8 le1
-.* TLS +GLOBAL +DEFAULT +UND ld
-.* NOTYPE +GLOBAL +DEFAULT +6 _start
-.* NOTYPE +GLOBAL +DEFAULT +11 __end
-.* TLS +GLOBAL +DEFAULT +8 ld2
-.* TLS +GLOBAL +DEFAULT +8 ld1
-.* NOTYPE +GLOBAL +DEFAULT +11 __bss_start
-.* NOTYPE +GLOBAL +DEFAULT +11 _edata
-.* NOTYPE +GLOBAL +DEFAULT +11 _end
-.* TLS +GLOBAL +DEFAULT +8 gd0
-.* TLS +GLOBAL +DEFAULT +8 ie0
+#pass
--- binutils-2.25.1.new/ld/testsuite/ld-powerpc/tlsexe32.r 2016-03-01 14:08:17.248137105 +0000
+++ binutils-2.25.1/ld/testsuite/ld-powerpc/tlsexe32.r 2016-03-01 15:08:57.693493230 +0000
@@ -22,6 +22,7 @@ Section Headers:
+\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4
+\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000018 04 +WA +0 +0 +4
+\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4
+#...
+\[[ 0-9]+\] \.shstrtab +STRTAB +.*
+\[[ 0-9]+\] \.symtab +SYMTAB +.*
+\[[ 0-9]+\] \.strtab +STRTAB +.*
@@ -64,11 +65,11 @@ Symbol table '\.dynsym' contains [0-9]+
.* NOTYPE +LOCAL +DEFAULT +UND
.* TLS +GLOBAL +DEFAULT +UND gd
.* TLS +GLOBAL +DEFAULT +UND ld
-.* NOTYPE +GLOBAL +DEFAULT +12 __end
-.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
+.* NOTYPE +GLOBAL +DEFAULT +.. __end
+.* NOTYPE +GLOBAL +DEFAULT +.. __bss_start
.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
-.* NOTYPE +GLOBAL +DEFAULT +12 _edata
-.* NOTYPE +GLOBAL +DEFAULT +12 _end
+.* NOTYPE +GLOBAL +DEFAULT +.. _edata
+.* NOTYPE +GLOBAL +DEFAULT +.. _end
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
@@ -85,29 +86,5 @@ Symbol table '\.symtab' contains [0-9]+
.* SECTION +LOCAL +DEFAULT +10
.* SECTION +LOCAL +DEFAULT +11
.* SECTION +LOCAL +DEFAULT +12
-.* FILE +LOCAL +DEFAULT +ABS .*
-.* TLS +LOCAL +DEFAULT +8 gd4
-.* TLS +LOCAL +DEFAULT +8 ld4
-.* TLS +LOCAL +DEFAULT +8 ld5
-.* TLS +LOCAL +DEFAULT +8 ld6
-.* TLS +LOCAL +DEFAULT +8 ie4
-.* TLS +LOCAL +DEFAULT +8 le4
-.* TLS +LOCAL +DEFAULT +8 le5
-.* FILE +LOCAL +DEFAULT +ABS .*
-.* OBJECT +LOCAL +DEFAULT +10 _DYNAMIC
-.* OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_
-.* TLS +GLOBAL +DEFAULT +UND gd
-.* TLS +GLOBAL +DEFAULT +9 le0
-.* TLS +GLOBAL +DEFAULT +9 ld0
-.* TLS +GLOBAL +DEFAULT +9 le1
-.* TLS +GLOBAL +DEFAULT +UND ld
-.* NOTYPE +GLOBAL +DEFAULT +7 _start
-.* NOTYPE +GLOBAL +DEFAULT +12 __end
-.* TLS +GLOBAL +DEFAULT +9 ld2
-.* TLS +GLOBAL +DEFAULT +9 ld1
-.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
-.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
-.* NOTYPE +GLOBAL +DEFAULT +12 _edata
-.* NOTYPE +GLOBAL +DEFAULT +12 _end
-.* TLS +GLOBAL +DEFAULT +9 gd0
-.* TLS +GLOBAL +DEFAULT +9 ie0
+#pass
+
diff -rup binutils-2.27.orig/ld/testsuite/ld-powerpc/powerpc.exp binutils-2.27/ld/testsuite/ld-powerpc/powerpc.exp
--- binutils-2.27.orig/ld/testsuite/ld-powerpc/powerpc.exp 2017-01-16 17:27:46.697628285 +0000
+++ binutils-2.27/ld/testsuite/ld-powerpc/powerpc.exp 2017-01-16 17:34:34.684104074 +0000
@@ -102,13 +102,13 @@ set ppcelftests {
{{objdump -hw reloc.d}} "reloc.so"}
{"APUinfo section processing" "-melf32ppc" ""
"-a32 -me500" {apuinfo1.s apuinfo-nul.s apuinfo2.s}
- {{readelf -x2 apuinfo.rd}} "apuinfo"}
+ {{readelf -x.PPC.EMB.apuinfo apuinfo.rd}} "apuinfo"}
{"APUinfo VLE section processing" "-melf32ppc" ""
"-a32 -me500 -mvle" {apuinfo1.s apuinfo-vle.s apuinfo-vle2.s}
- {{readelf -x2 apuinfo-vle.rd}} "apuinfo-vle"}
+ {{readelf -x.PPC.EMB.apuinfo apuinfo-vle.rd}} "apuinfo-vle"}
{"APUinfo NULL section processing" "-melf32ppc" ""
"-a32 -me500" {apuinfo-nul1.s apuinfo-nul.s}
- {{readelf -x2 apuinfo-nul.rd}} "apuinfo"}
+ {{readelf -x.PPC.EMB.apuinfo apuinfo-nul.rd}} "apuinfo"}
{"TLS32 static exec" "-melf32ppc" "" "-a32" {tls32.s tlslib32.s}
{{objdump -dr tls32.d} {objdump -sj.got tls32.g}
{objdump -sj.tdata tls32.t}}

BIN
SOURCES/standards.info.gz

Binary file not shown.

2786
SPECS/binutils.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save