--- binutils-2.25.orig/debian/README.cross +++ binutils-2.25/debian/README.cross @@ -0,0 +1,26 @@ +Cross-binutils debian packages can be built directly from the binutils +source package. + +To build a cross-binutils package: + + o Download and unpack the binutils source package: + + apt-get source binutils + + o Ensure you have the binutils build-dependencies installed: + + apt-get build-dep binutils + + o Then build the cross-binutils package: + + TARGET= dpkg-buildpackage -b -uc -us + or + echo arm >debian/target; dpkg-buildpackage -b -uc -us + + (substitute your target name, e.g. "arm" or "m68k", instead of + "") + +--- +Nikita Youshchenko +Hector Oron +Marcin Juszkiewicz --- binutils-2.25.orig/debian/README.source +++ binutils-2.25/debian/README.source @@ -0,0 +1,2 @@ +The package uses dpatch to apply patches on top of the upstream source. +See /usr/share/doc/dpatch/README.source.gz. --- binutils-2.25.orig/debian/binutils-hppa64.overrides +++ binutils-2.25/debian/binutils-hppa64.overrides @@ -0,0 +1,8 @@ +# don't warn about missing man pages for diverted binaries +binutils-hppa64 binary: binary-without-manpage + +# the API of the shared libs is not public, don't care about the name +binutils-hppa64 binary: package-name-doesnt-match-sonames + +# it's a cross toolchain +binutils-hppa64 binary: binary-or-shlib-defines-rpath --- binutils-2.25.orig/debian/binutils-hppa64.postinst +++ binutils-2.25/debian/binutils-hppa64.postinst @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "configure" ]; then + ldconfig +fi --- binutils-2.25.orig/debian/binutils-hppa64.postrm +++ binutils-2.25/debian/binutils-hppa64.postrm @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + ldconfig +fi --- binutils-2.25.orig/debian/binutils-hppa64.shlibs.in +++ binutils-2.25/debian/binutils-hppa64.shlibs.in @@ -0,0 +1,2 @@ +libbfd @VER@-hppa64@DATE_EXT@ binutils-hppa64 +libopcodes @VER@-hppa64@DATE_EXT@ binutils-hppa64 --- binutils-2.25.orig/debian/binutils-multiarch-dev.overrides +++ binutils-2.25/debian/binutils-multiarch-dev.overrides @@ -0,0 +1,2 @@ +# package only has symlinks +binutils-multiarch-dev binary: control-file-is-empty md5sums --- binutils-2.25.orig/debian/binutils-multiarch.overrides +++ binutils-2.25/debian/binutils-multiarch.overrides @@ -0,0 +1,13 @@ +# don't warn about missing man pages for diverted binaries +binutils-multiarch binary: binary-without-manpage + +# the API of the shared libs is not public, don't care about the name +binutils-multiarch binary: package-name-doesnt-match-sonames + +# the upstream name, we don't care +binutils-multiarch binary: dev-pkg-without-shlib-symlink + +# not in binutils-multiarch, just move these away +binutils-multiarch: diversion-for-unknown-file usr/lib/libopcodes.a preinst:19 +binutils-multiarch: diversion-for-unknown-file usr/lib/libbfd.a preinst:16 + --- binutils-2.25.orig/debian/binutils-multiarch.postinst +++ binutils-2.25/debian/binutils-multiarch.postinst @@ -0,0 +1,52 @@ +#! /bin/sh +# Update .so symlinks and remove obsolete diversions. +# +# Removing a diversion requires a guarantee that the conflicting +# file is not present any more, and we cannot guarantee that if +# some other version of binutils-multiarch is installed. +# So we remove the diversions in postinst, not preinst. +set -e +old_diversion() { + local divertto file + file=$1 + divertto=${2-$file.single} + if + dpkg-divert --package binutils-multiarch --list | + grep -q -F "$divertto" + then + dpkg-divert --package binutils-multiarch \ + --remove --rename \ + --divert "$divertto" "$file" + fi +} + +# remove obsolete diversions +old_diversion /usr/bin/ld.bfd +old_diversion /usr/bin/c++filt +old_diversion /usr/lib/libbfd.a /usr/lib/libbfd-single.a +old_diversion /usr/lib/libopcodes.a /usr/lib/libopcodes-single.a +old_diversion /usr/bin/ld +old_diversion /usr/bin/elfedit +for f in elf32_sparc elf32ppc elf64alpha elf_i386 m68kelf \ + alpha i386linux m68klinux sparclinux sun4 +do + for ext in x xbn xn xr xs xu + do + old_diversion /usr/lib/ldscripts/$f.$ext + done +done +old_diversion /usr/lib/libbfd-2.9.1.0.15.so.0.0.0 \ + /usr/lib/libbfd-single-2.9.1.0.15.so.0.0.0 +old_diversion /usr/lib/libopcodes-2.9.1.0.15.so.0.0.0 \ + /usr/lib/libopcodes-single-2.9.1.0.15.so.0.0.0 +old_diversion /usr/lib/libbfd.la /usr/lib/libbfd-single.la +old_diversion /usr/lib/libopcodes.la /usr/lib/libopcodes-single.la +old_diversion /usr/include/bfd.h /usr/include/bfd.single.h +old_diversion /usr/lib/ldscripts + +rm -f /usr/lib/libbfd-*-multiarch.so.0 +rm -f /usr/lib/libopcodes-*-multiarch.so.0 + +if [ "$1" = "configure" ]; then + ldconfig +fi --- binutils-2.25.orig/debian/binutils-multiarch.postrm.in +++ binutils-2.25/debian/binutils-multiarch.postrm.in @@ -0,0 +1,49 @@ +#! /bin/sh +set -e +this_ver=@DEB_VER@; # this version +# action: upgrade, abort-upgrade, remove, abort-install, disappear, +# purge, or failed-upgrade. +context=$1 +if + test "$context" = failed-upgrade && + dpkg --compare-versions "$this_ver" lt "$2" +then + # postrm of the future failed. + # Who knows what it was supposed to do? Abort. + exit 1 +fi +new_ver=; # version replacing this one, if any. +case "$context" in +failed-upgrade) + new_ver=$this_ver ;; +abort-install|disappear) + new_ver= ;; +*) + new_ver=$2 ;; +esac + +diversion() { + local added_ver divertto file + added_ver=$1 + file=$2 + divertto=${3-$file.single} + + if + test "$context" != purge && + dpkg --compare-versions "$new_ver" lt "$added_ver" + then + dpkg-divert --package binutils-multiarch \ + --remove --rename --divert "$divertto" "$file" + fi +} + + +for prog in nm objdump objcopy strings strip size \ + ar ranlib addr2line gprof readelf +do + diversion 2.9.5.0.16-1 "/usr/bin/$prog" +done + +if [ "$1" = "remove" ]; then + ldconfig +fi --- binutils-2.25.orig/debian/binutils-multiarch.preinst.in +++ binutils-2.25/debian/binutils-multiarch.preinst.in @@ -0,0 +1,27 @@ +#! /bin/sh +set -e +new_ver=@DEB_VER@; # this version +context=$1; # why to install (install, upgrade, or abort-upgrade) +old_ver=$2; # version being replaced, if any + +diversion() { + local added_ver divertto file + added_ver=$1 + file=$2 + divertto=${3-$file.single} + + if + test "$context" = install || + dpkg --compare-versions "$old_ver" lt "$added_ver" || + dpkg --compare-versions "$new_ver" le "$old_ver" + then + dpkg-divert --package binutils-multiarch \ + --add --rename --divert "$divertto" "$file" + fi +} + +for prog in nm objdump objcopy strings strip size \ + ar ranlib addr2line gprof readelf +do + diversion 2.9.5.0.16-1 "/usr/bin/$prog" +done --- binutils-2.25.orig/debian/binutils-multiarch.prerm.in +++ binutils-2.25/debian/binutils-multiarch.prerm.in @@ -0,0 +1,66 @@ +#! /bin/sh +# Remove obsolete diversions. +# +# They are already removed in postinst, but if configuration fails, +# they will still be around. Removing the package without +# configuring would then allow the diversions to leak. +# +# So we catch them here. This cannot wait for postrm because that +# would break error recovery during upgrades: after the old, working +# version re-adds the diversion in preinst, the diversion would be removed +# again in postrm. More generally, removing a diversion requires +# a guarantee that the conflicting file is not present any more, +# and we cannot guarantee that if some other version of +# binutils-multiarch is installed. +set -e +this_ver=@DEB_VER@; # this version +context=$1; # action: upgrade, remove, deconfigure, or failed-upgrade. +if + test "$context" = failed-upgrade && + dpkg --compare-versions "$this_ver" lt "$2" +then + # prerm of the future failed. + # Who knows what it was supposed to do? Abort. + exit 1 +fi + +old_diversion() { + local divertto file + file=$1 + divertto=${2-$file.single} + if + dpkg-divert --package binutils-multiarch --list | + grep -q -F "$divertto" + then + dpkg-divert --package binutils-multiarch \ + --remove --rename \ + --divert "$divertto" "$file" + fi +} + +# remove obsolete diversions +old_diversion /usr/bin/ld.bfd +old_diversion /usr/bin/c++filt +old_diversion /usr/lib/libbfd.a /usr/lib/libbfd-single.a +old_diversion /usr/lib/libopcodes.a /usr/lib/libopcodes-single.a +old_diversion /usr/bin/ld +old_diversion /usr/bin/elfedit +for f in elf32_sparc elf32ppc elf64alpha elf_i386 m68kelf \ + alpha i386linux m68klinux sparclinux sun4 +do + for ext in x xbn xn xr xs xu + do + old_diversion /usr/lib/ldscripts/$f.$ext + done +done +old_diversion /usr/lib/libbfd-2.9.1.0.15.so.0.0.0 \ + /usr/lib/libbfd-single-2.9.1.0.15.so.0.0.0 +old_diversion /usr/lib/libopcodes-2.9.1.0.15.so.0.0.0 \ + /usr/lib/libopcodes-single-2.9.1.0.15.so.0.0.0 +old_diversion /usr/lib/libbfd.la /usr/lib/libbfd-single.la +old_diversion /usr/lib/libopcodes.la /usr/lib/libopcodes-single.la +old_diversion /usr/include/bfd.h /usr/include/bfd.single.h +old_diversion /usr/lib/ldscripts + +rm -f /usr/lib/libbfd-*-multiarch.so.0 +rm -f /usr/lib/libopcodes-*-multiarch.so.0 --- binutils-2.25.orig/debian/binutils-multiarch.shlibs.in +++ binutils-2.25/debian/binutils-multiarch.shlibs.in @@ -0,0 +1,2 @@ +libbfd @VER@-multiarch@DATE_EXT@ binutils-multiarch (>= @DEB_UVER@), binutils-multiarch (<< @DEB_NVER@) +libopcodes @VER@-multiarch@DATE_EXT@ binutils-multiarch (>= @DEB_UVER@), binutils-multiarch (<< @DEB_NVER@) --- binutils-2.25.orig/debian/binutils-static-udeb.overrides +++ binutils-2.25/debian/binutils-static-udeb.overrides @@ -0,0 +1,2 @@ +# yes, it's embedded +binutils-static-udeb udeb: embedded-zlib --- binutils-2.25.orig/debian/binutils-static.overrides +++ binutils-2.25/debian/binutils-static.overrides @@ -0,0 +1,5 @@ +# yes, it's embedded +binutils-static binary: embedded-zlib + +# not needed +binutils-static binary: binary-without-manpage --- binutils-2.25.orig/debian/binutils-static.preinst +++ binutils-2.25/debian/binutils-static.preinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +if [ -L /usr/share/doc/binutils-static ]; then + # We must be upgrading from a version that depended on binutils + rm -f /usr/share/doc/binutils-static +fi + +exit 0 --- binutils-2.25.orig/debian/binutils.overrides +++ binutils-2.25/debian/binutils.overrides @@ -0,0 +1,11 @@ +# the API of the shared libs is not public, don't care about the name +binutils binary: package-name-doesnt-match-sonames + +# the upstream name, we don't care +binutils binary: dev-pkg-without-shlib-symlink + +# big tables +binutils binary: manpage-has-errors-from-man + +# silence lintian stupidity +binutils binary: spelling-error-in-binary usr/bin/as mmnemonic mnemonic --- binutils-2.25.orig/debian/binutils.postinst +++ binutils-2.25/debian/binutils.postinst @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "configure" ]; then + ldconfig +fi --- binutils-2.25.orig/debian/binutils.postrm +++ binutils-2.25/debian/binutils.postrm @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + ldconfig +fi --- binutils-2.25.orig/debian/binutils.presubj +++ binutils-2.25/debian/binutils.presubj @@ -0,0 +1,25 @@ +When reporting binutils errors, please provide the actual input files +and options given to the tool (gas, objcopy, ld, etc.) at run time. +This can mean the difference between a pleasant debugging experience +and a heisenbug that becomes unreproducible when gcc's code generation +changes. + +For example, to create a testcase for an "ld" problem, first find the +"gcc" command line that triggers the error: + + $ make + ... output ending in an error ... + $ make V=1 VERBOSE=1 2>&1 | head -1 + +Add "-v" after gcc and run it again. One of the early output lines +will be an invocation of collect2. Replace collect2 with "ld" and +it should reproduce the same error. If you collect all the objects +(including system libraries) mentioned on the "ld" command line in a +tarball and send it along with the ld command line then that is a +testcase. + +A possible step after that is to try omitting some objects from the +ld command line and see if it still triggers the same error, but +that's just icing on the cake. + +Happy debugging! --- binutils-2.25.orig/debian/binutils.shlibs.in +++ binutils-2.25/debian/binutils.shlibs.in @@ -0,0 +1,2 @@ +libbfd @VER@-system@DATE_EXT@ binutils (>= @DEB_UVER@), binutils (<< @DEB_NVER@) +libopcodes @VER@-system@DATE_EXT@ binutils (>= @DEB_UVER@), binutils (<< @DEB_NVER@) --- binutils-2.25.orig/debian/changelog +++ binutils-2.25/debian/changelog @@ -0,0 +1,5649 @@ +binutils (2.25-9ubuntu1) wily; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + - Build binutils-static and binutils-static-udeb packages. + + -- Matthias Klose Mon, 22 Jun 2015 16:27:13 +0200 + +binutils (2.25-9) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20150622. + - ARM32, AArch64, POWERPC fixes. + * Fix PR gas/18427, gas slow on hppa, taken from the trunk. Closes: #787192. + + -- Matthias Klose Mon, 22 Jun 2015 11:45:36 +0200 + +binutils (2.25-8ubuntu1) wily; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + - Build binutils-static and binutils-static-udeb packages. + + -- Matthias Klose Thu, 28 May 2015 17:26:13 +0200 + +binutils (2.25-8) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20150523. + - PPC and AArch64 backports from the trunk. + + -- Matthias Klose Sat, 23 May 2015 09:44:54 +0200 + +binutils (2.25-7) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20150411. + * More adjustments for reproducible builds. Closes: #774429. + + -- Matthias Klose Fri, 24 Apr 2015 13:18:01 +0200 + +binutils (2.25-6) unstable; urgency=medium + + * Apply patches from the 2.25 branch to address PR binutils/17512, + PR binutils/17531. + * Removal partial backports for PR binutils/17531. + * Configure with --enable-deterministic-archives. Closes: #774429. + + -- Matthias Klose Thu, 26 Mar 2015 16:40:36 +0100 + +binutils (2.25-5ubuntu7) vivid; urgency=medium + + * Fix PR ld/18222, downgrade linker error on protected symbols in + .dynbss to a warning. Fixes libunwind build error. + + -- Matthias Klose Fri, 10 Apr 2015 17:42:44 +0200 + +binutils (2.25-5ubuntu6) vivid; urgency=medium + + * Fix PR ld/18167, taken from the trunk. + + -- Matthias Klose Fri, 27 Mar 2015 13:25:26 +0100 + +binutils (2.25-5ubuntu5) vivid; urgency=medium + + * Revert the fixes for PR ld/15228, PR ld/17709, causing PR ld/18167. + + -- Matthias Klose Thu, 26 Mar 2015 16:28:49 +0100 + +binutils (2.25-5ubuntu4) vivid; urgency=medium + + * Update to the binutils 2.25 branch 20150325. + - Backport patches to address PR binutils/17512, PR binutils/17531. + * Removal partial backports for PR binutils/17531. + + -- Matthias Klose Wed, 25 Mar 2015 22:08:50 +0100 + +binutils (2.25-5ubuntu3) vivid; urgency=medium + + * Fix the AArch64 build. + + -- Matthias Klose Fri, 20 Mar 2015 18:09:16 +0100 + +binutils (2.25-5ubuntu2) vivid; urgency=medium + + * Update to the binutils 2.25 branch 20150320. + - x86 gas: Limit multi-byte nop instructions to 10 bytes. + - Fix ppc32 synthetic symbols when __tls_get_addr_opt stub is generated. + - Tweak ppc32 tls_get_addr optimisation. + - PowerPC64 thread-safe stubs not needed for iplt. + - Use dynamic text relocs for protected vars (ppc32, ppc64). + - Fix PR gold/18010, PR gold/17954 PowerPC64 gold issues. + - Backport support for Cortex-A72. + - Fix PR ld/15228, PR ld/17709, add extern_protected_data and set it + for x86. + * Really install the texi files. LP: #1410780. + + -- Matthias Klose Fri, 20 Mar 2015 17:39:01 +0100 + +binutils (2.25-5ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + - Build binutils-static and binutils-static-udeb packages. + - Use 64k for COMMONPAGESIZE on powerpc, ppc64 and ppc64el. LP: #1412553. + * Update to the binutils 2.25 branch 20150225. + + -- Matthias Klose Wed, 25 Feb 2015 09:35:24 +0100 + +binutils (2.25-5) unstable; urgency=medium + + * Remove '*.rej' files in the source package. Closes: #775679. + * Make the package build reproducibly (addresses: #774429): + - Fix mtimes before building binary packages. + - Stop recording the current time when creating gzip files. + - Sort file list in md5sums. + - Fix mtimes before building source tarball. + - Sort file list in binutils source tarball. + - If available, call strip-nondeterminism on static libraries. + * Fix PR ld/17827 - PIE copy relocations are broken with pointers. + Closes: #772958. + + -- Matthias Klose Wed, 25 Feb 2015 09:00:51 +0100 + +binutils (2.25-4) unstable; urgency=medium + + * Backport fixes for PR binutils/17531 up to 2014-12-22. + + -- Matthias Klose Thu, 15 Jan 2015 08:00:07 +0100 + +binutils (2.25-3) unstable; urgency=medium + + * Don't build as a release candidate, fixing the upper shlibs dependency. + * Refresh patches. + + -- Matthias Klose Thu, 25 Dec 2014 13:45:39 +0100 + +binutils (2.25-2ubuntu2) vivid; urgency=medium + + * Use 64k for COMMONPAGESIZE on powerpc, ppc64 and ppc64el. LP: #1412553. + + -- Matthias Klose Fri, 23 Jan 2015 14:13:08 +0100 + +binutils (2.25-2ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + - Build binutils-static and binutils-static-udeb packages. + + -- Matthias Klose Thu, 25 Dec 2014 07:53:40 +0100 + +binutils (2.25-2) unstable; urgency=medium + + * Apply proposed patch for PR ld/17742 (don't create .eh_frame_hdr + on shared lib bfd). + + -- Matthias Klose Thu, 25 Dec 2014 06:55:02 +0100 + +binutils (2.25-1) unstable; urgency=medium + + * binutils 2.25 release. + - MIPS specific gas update. + + -- Matthias Klose Thu, 25 Dec 2014 05:49:55 +0100 + +binutils (2.24.90.20141219-1ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Sat, 20 Dec 2014 18:29:24 +0100 + +binutils (2.24.90.20141219-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141219. + - Fix PR ld/17713 (segfault), PR ld/17689 (link error), PR ld/15228. + * Apply proposed patch for PR gold/17729 (fixing ~600 GCC test failures). + + -- Matthias Klose Fri, 19 Dec 2014 18:59:30 +0100 + +binutils (2.24.90.20141209-1ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Tue, 09 Dec 2014 10:07:28 +0100 + +binutils (2.24.90.20141209-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141209. + - Fix PR binutils/17677, PR gold/17670 (powerpc), + PR gold/17566 (powerpc). + + -- Matthias Klose Tue, 09 Dec 2014 09:31:53 +0100 + +binutils (2.24.90.20141201-1ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Wed, 03 Dec 2014 14:43:28 +0100 + +binutils (2.24.90.20141201-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141201. + - Fix PR ld/16452, PR/ld/16457: Don't output symbol version + requirement for non-DT_NEEDED libs. Closes: #728529. + + -- Matthias Klose Mon, 01 Dec 2014 21:53:10 +0100 + +binutils (2.24.90.20141128-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141128. + - gold: Fix corrupted .eh_frame section with LTO and --gc-sections. + - gold: Fix PowerPC relaxation corner case. + * Relax upper shlibs version dependency to the next release candidate. + + -- Matthias Klose Fri, 28 Nov 2014 14:20:09 +0100 + +binutils (2.24.90.20141124-1ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Mon, 24 Nov 2014 18:30:06 +0100 + +binutils (2.24.90.20141124-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141124. + - ppc alignment fixes, Go fixes + - PR binutils/17597, PR binutils/17512, PR binutils/17521, PR binutils/17533, + trunk backports for fixing the recent CVE issues. + - One more fix for Cortex-A53 Erratum 835769 (AArch64). + + -- Matthias Klose Mon, 24 Nov 2014 17:29:27 +0100 + +binutils (2.24.90.20141111-2ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Tue, 11 Nov 2014 10:22:29 +0100 + +binutils (2.24.90.20141111-2) unstable; urgency=medium + + * Fix ld -r abort in _bfd_elf_write_section_eh_frame, taken from the trunk. + Closes: #769067. + + -- Matthias Klose Tue, 11 Nov 2014 11:10:27 +0100 + +binutils (2.24.90.20141111-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141111. + - Update .MIPS.abiflags to support MIPS R6. + * gold: Misc updates for the AArch64 backend, taken from the trunk. + * Mention some CVE issues, fixed in the 20141104 snapshot: + - CVE-2014-8484 (PR binutils/17509). + - CVE-2014-8485, CVE-2014-8504 (PR binutils/17510). + - CVE-2014-8501, CVE-2014-8502, CVE-2014-8503 (PR binutils/17512). + * Fix some lintian warnings. + + -- Matthias Klose Tue, 11 Nov 2014 07:55:51 +0100 + +binutils (2.24.90.20141104-1ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Tue, 04 Nov 2014 16:01:06 +0100 + +binutils (2.24.90.20141104-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141023. + - Fix PR bfd/17481. + - Fix PR17488, powerpc64-linux-ld segfault. LP: #1381580. + - Fix PR ld/17492. LP: #882353. + - Fix PR gas/17493. LP: #1051156. + - Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7. + - PowerPC64 ELFv1 function symbol definition vs LTO and discarded sections. + - ppc: enable msgclr and msgsnd on Power8. + - Relax ppc64_elf_tls_optimize assertion. + * Pick patch from the trunk: + - Support relexation for the gold aarch64 backend. + - AArch64: move bogus assertion. + - Fix build configured with --enable-targets=aarch64-linux. + - Fix running ld-unique tests on ARM. + - gas: Recognize: AAarch64 ThunderX processor. + + -- Matthias Klose Tue, 04 Nov 2014 02:14:45 +0100 + +binutils (2.24.90.20141023-1ubuntu1) vivid; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Thu, 23 Oct 2014 23:59:57 +0200 + +binutils (2.24.90.20141023-1) unstable; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141023. + * Pick patch from the trunk: + - Fix PR17488, powerpc64-linux-ld segfault. LP: #1381580. + - Support relexation for the gold aarch64 backend. + - Fix PR bfd/17481. + - Fix PR ld/17492. LP: #882353. + - Fix PR gas/17493. LP: #1051156. + - Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7. + - PowerPC64 ELFv1 function symbol definition vs LTO and discarded sections. + - AArch64: move bogus assertion. + - Fix build configured with --enable-targets=aarch64-linux. + - ppc: enable msgclr and msgsnd on Power8. + - Fix running ld-unique tests on ARM. + - gas: Recognize: AAarch64 ThunderX processor. + - Relax ppc64_elf_tls_optimize assertion. + + -- Matthias Klose Thu, 23 Oct 2014 22:52:07 +0200 + +binutils (2.24.90.20141014-0ubuntu3) utopic; urgency=medium + + * Pick patches from the trunk: + - Fix PR ld/17492. LP: #882353. + - Fix PR gas/17493. LP: #1051156. + + -- Matthias Klose Thu, 16 Oct 2014 15:32:59 +0200 + +binutils (2.24.90.20141014-0ubuntu2) utopic; urgency=medium + + * Pick patches from the trunk: + - Fix PR17488, powerpc64-linux-ld segfault. LP: #1381580. + - Support relexation for the gold aarch64 backend. + - Fix PR bfd/17481. + + -- Matthias Klose Thu, 16 Oct 2014 09:11:28 +0200 + +binutils (2.24.90.20141014-0ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the 2.25 branch 20141014. + * Remove patches picked from upstream. + * Build gold on AArch64. + + -- Matthias Klose Tue, 14 Oct 2014 11:39:04 +0200 + +binutils (2.24.51.20141001-1ubuntu4) utopic; urgency=medium + + * Fix PR ld/17647, taken from upstream. Closes: #764573. + + -- Matthias Klose Mon, 13 Oct 2014 20:20:11 +0200 + +binutils (2.24.51.20141001-1ubuntu2) utopic; urgency=medium + + * Fix ld/17447, taken from upstream. LP: #1371636. + + -- Matthias Klose Sun, 05 Oct 2014 07:54:23 +0200 + +binutils (2.24.51.20141001-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Wed, 01 Oct 2014 02:55:12 +0200 + +binutils (2.24.51.20141001-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20141001. + - On ppc64el, move the section headers to the end of the object file + for ld.bfd. LP: #1365664. + + -- Matthias Klose Wed, 01 Oct 2014 02:32:06 +0200 + +binutils (2.24.51.20140918-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Thu, 18 Sep 2014 23:49:38 +0200 + +binutils (2.24.51.20140918-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140918. + + -- Matthias Klose Thu, 18 Sep 2014 19:28:16 +0200 + +binutils (2.24.51.20140903-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Thu, 04 Sep 2014 00:37:05 +0200 + +binutils (2.24.51.20140903-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140903. + * Try to work around binutils-multiarch build failure on sh4 by disabling + hppa targets for the binutils-multiarch build. Addresses: #758830. + * Enable powerpc targets for ppc64el. Closes: #760395. + + -- Matthias Klose Wed, 03 Sep 2014 23:02:26 +0200 + +binutils (2.24.51.20140818-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Mon, 18 Aug 2014 14:41:00 +0200 + +binutils (2.24.51.20140818-1) unstable; urgency=high + + * Snapshot, taken from the trunk 20140818. + - Fix GLIBC ifunc breakage on PowerPC64 ELFv2. LP: #1355962. + + -- Matthias Klose Mon, 18 Aug 2014 13:49:01 +0200 + +binutils (2.24.51.20140814-2) unstable; urgency=medium + + * Still provide i486-* symlinks. + + -- Matthias Klose Sun, 17 Aug 2014 17:06:36 +0200 + +binutils (2.24.51.20140814-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Thu, 14 Aug 2014 13:39:18 +0200 + +binutils (2.24.51.20140814-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140814. + - Add ld options --push-state and --pop-state. + * binutils-hppa64: Set architecture to hppa. + * Add aarch64_ilp32-linux-gnu multiarch directories to the search path. + + -- Matthias Klose Thu, 14 Aug 2014 13:28:40 +0200 + +binutils (2.24.51.20140807-1ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the trunk 20140807. + + -- Matthias Klose Thu, 07 Aug 2014 11:54:19 +0200 + +binutils (2.24.51.20140727-1ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the trunk 20140727. + + -- Matthias Klose Sun, 27 Jul 2014 15:50:56 +0200 + +binutils (2.24.51.20140709-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Wed, 09 Jul 2014 20:00:32 +0200 + +binutils (2.24.51.20140709-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140709. + - Fix PR gold/15639, -flto and ld.gold on ARM. + Closes: #712189. LP: #1191909. + + -- Matthias Klose Wed, 09 Jul 2014 19:44:18 +0200 + +binutils (2.24.51.20140704-1ubuntu1) utopic; urgency=medium + + * Merge with Debian, remaining changes: + - Build from upstream sources. + + -- Matthias Klose Fri, 04 Jul 2014 13:26:06 +0200 + +binutils (2.24.51.20140704-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140704. + * Build gold for mips* targets. + * Update the patch for the mips64el support. Closes: #750566, #753052. + * Update patches for the current trunk. + + -- Matthias Klose Fri, 04 Jul 2014 12:00:05 +0200 + +binutils (2.24.51.20140617-1ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the trunk 20140617. + + -- Matthias Klose Tue, 17 Jun 2014 10:41:22 +0200 + +binutils (2.24.51.20140617-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140617. + + -- Matthias Klose Tue, 17 Jun 2014 10:29:20 +0200 + +binutils (2.24.51.20140612-0ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the trunk 20140612. + * Re-enable the ld_system_root patch. + + -- Matthias Klose Thu, 12 Jun 2014 14:02:24 +0200 + +binutils (2.24.51.20140604-1ubuntu2) utopic; urgency=medium + + * Re-apply 2.24.51.20140425-0ubuntu2 changes, lost in previous upload. + + -- Matthias Klose Thu, 05 Jun 2014 11:25:35 +0200 + +binutils (2.24.51.20140604-1ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the trunk 20140604. + + -- Matthias Klose Wed, 04 Jun 2014 14:19:01 +0200 + +binutils (2.24.51.20140604-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140604. + * Refactor rules for consistent usage of the PF macro (Helmut Grohne). + + -- Matthias Klose Wed, 04 Jun 2014 13:48:21 +0200 + +binutils (2.24.51.20140425-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140425. + * Refactor rules for consistent usage of the PF macro (Helmut Grohne). + * On x86 targets provide gnu-type prefixed binaries with the cpu that GCC + is configured for. + * 129_multiarch_libpath.patch: Fix to search multiarch dirs, only needed + for a minority of packages still using ld directly for linking instead + of the recommended use of gcc. + + -- Matthias Klose Sun, 27 Apr 2014 21:52:56 +0200 + +binutils (2.24.51.20140425-0ubuntu2) utopic; urgency=medium + + * 129_multiarch_libpath.patch: Fix to search multiarch dirs again. + + -- Adam Conrad Fri, 25 Apr 2014 16:17:34 -0600 + +binutils (2.24.51.20140425-0ubuntu1) utopic; urgency=medium + + * Snapshot, taken from the trunk 20140425. + + -- Matthias Klose Fri, 25 Apr 2014 14:33:56 +0200 + +binutils (2.24.51.20140417-0ubuntu1) trusty; urgency=medium + + * Snapshot, taken from the trunk 20140417. + + -- Matthias Klose Thu, 17 Apr 2014 21:17:28 +0200 + +binutils (2.24.51.20140411-1) unstable; urgency=medium + + * Snapshot, taken from the trunk 20140411. + * Provide $(DEB_HOST_GNU_TYPE)- prefixed binaries and man pages. + * Don't enable the spu targets on powerpc targets anymore. + * Build the gold linker on hurd-i386 (Svante Signell). Closes: #744020. + + -- Matthias Klose Fri, 11 Apr 2014 18:49:22 +0200 + +binutils (2.24-5ubuntu3) trusty; urgency=medium + + * [AArch64] Fix off by one error in instruction relaxation mask. + See https://sourceware.org/ml/binutils/2014-04/msg00151.html. + + -- Matthias Klose Tue, 15 Apr 2014 19:55:23 +0200 + +binutils (2.24-5ubuntu2) trusty; urgency=medium + + * Provide $(DEB_HOST_GNU_TYPE)- prefixed binaries and man pages. + + -- Matthias Klose Thu, 10 Apr 2014 16:38:11 +0100 + +binutils (2.24-5ubuntu1) trusty; urgency=medium + + * Merge with Debian; remaining changes: + - Build from upstream sources. + + -- Matthias Klose Fri, 21 Mar 2014 13:54:09 +0100 + +binutils (2.24-5) unstable; urgency=medium + + * Update from the 2.24 branch, 20140321. + * Stop building the binutils-spu package. + * Add a binutils-multiarch-dev package. Closes: #583160 + + -- Matthias Klose Fri, 21 Mar 2014 11:23:40 +0100 + +binutils (2.24-4ubuntu1) trusty; urgency=medium + + * Merge with Debian; remaining changes: + - Build from upstream sources. + + -- Matthias Klose Tue, 04 Mar 2014 02:41:22 +0100 + +binutils (2.24-4) unstable; urgency=medium + + * Update from the 2.24 branch, 20140304. + * Update Aarch64 ilp32 linker and libdir names. + * Fix relocations for thread local variables on AArch64. Updated patch + taken from the trunk. + * Enable AArch64 big endian targets for AArch64 builds and for + binutils-multiarch. + * gas: Add entry for "xgene1" (AArch64). + * gas: Remove the alignment limit on AArch64. + * Add a Built-Using attribute for for the binutils-cross-* packages. + Closes: #738311. + + -- Matthias Klose Tue, 04 Mar 2014 02:21:00 +0100 + +binutils (2.24-3) unstable; urgency=medium + + * Update from the 2.24 branch, 20140124. + * Display the reference causing a shared library to be needed (taken from + the trunk). + + -- Matthias Klose Fri, 24 Jan 2014 14:39:48 +0100 + +binutils (2.24-2ubuntu3) trusty; urgency=medium + + * Fix relocations for thread local variables on AArch64. Updated patch + taken from the trunk. + + -- Matthias Klose Fri, 24 Jan 2014 16:46:21 +0100 + +binutils (2.24-2ubuntu2) trusty; urgency=low + + * Fix relocations for thread local variables on AArch64 (Michael + Hudson). + * Don't ship the embedspu binary in binutils-multiarch. + + -- Matthias Klose Tue, 17 Dec 2013 16:37:35 +0100 + +binutils (2.24-2ubuntu1) trusty; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Mon, 09 Dec 2013 14:22:33 +0100 + +binutils (2.24-2) unstable; urgency=medium + + * Update from the 2.24 branch, 20131209. + * Remove versioned build dependencies which are not needed anymore + since 2005. + * Drop the ld_system_root patch. + * Fix PowerPC64 linking of --just-symbols objects (Alan Modra). + + -- Matthias Klose Mon, 09 Dec 2013 13:57:43 +0100 + +binutils (2.24-1ubuntu2) trusty; urgency=low + + * Remove versioned build dependencies which are not needed anymore + since 2005. + * Fix PowerPC64 linking of --just-symbols objects (Alan Modra). + + -- Matthias Klose Tue, 03 Dec 2013 11:07:14 +0100 + +binutils (2.24-1ubuntu1) trusty; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Mon, 02 Dec 2013 12:34:33 +0100 + +binutils (2.24-1) unstable; urgency=low + + * Final upstream release. + * ifunc updates for AArch64, taken from the trunk. + + -- Matthias Klose Mon, 02 Dec 2013 11:21:16 +0200 + +binutils (2.23.91.20131123-1ubuntu1) trusty; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Sat, 23 Nov 2013 08:41:59 +0100 + +binutils (2.23.91.20131123-1) unstable; urgency=low + + * New upstream snapshot, taken from the 2.24 branch. + * Stop shipping libiberty, now available in libiberty-dev. + + -- Matthias Klose Sat, 23 Nov 2013 08:27:51 +0100 + +binutils (2.23.90.20131116-1ubuntu2) trusty; urgency=low + + * On AArch64, don't set LIBPATH_SUFFIX to 64. + + -- Matthias Klose Tue, 19 Nov 2013 13:31:11 +0200 + +binutils (2.23.90.20131116-1ubuntu1) trusty; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Sat, 16 Nov 2013 13:54:31 +0100 + +binutils (2.23.90.20131116-1) unstable; urgency=low + + * New upstream snapshot, taken from the 2.24 branch. + + -- Matthias Klose Sat, 16 Nov 2013 12:40:28 +0100 + +binutils (2.23.90.20131017-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Thu, 17 Oct 2013 14:27:21 +0200 + +binutils (2.23.90.20131017-1) unstable; urgency=low + + * New upstream snapshot, taken from the 2.24 branch. + + -- Matthias Klose Thu, 17 Oct 2013 14:22:05 +0200 + +binutils (2.23.90.20130927-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Fri, 27 Sep 2013 16:22:51 +0200 + +binutils (2.23.90.20130927-1) unstable; urgency=low + + * New upstream snapshot, taken from the 2.24 branch. + * Add ifunc support for AArch64. + + -- Matthias Klose Fri, 27 Sep 2013 14:05:44 +0200 + +binutils (2.23.52.20130913-0ubuntu1) saucy; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Fri, 13 Sep 2013 13:52:59 +0200 + +binutils (2.23.52.20130828-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Wed, 28 Aug 2013 15:25:50 +0200 + +binutils (2.23.52.20130828-1) unstable; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Wed, 28 Aug 2013 15:22:51 +0200 + +binutils (2.23.52.20130727-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Sat, 27 Jul 2013 11:29:57 +0200 + +binutils (2.23.52.20130727-1) unstable; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Sat, 27 Jul 2013 10:37:11 +0200 + +binutils (2.23.52.20130722-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Mon, 22 Jul 2013 22:37:02 +0200 + +binutils (2.23.52.20130722-1) unstable; urgency=low + + * New upstream snapshot. + - Fix PR ld/15762, glibc being built without warning sections. + * Set the libdir for arm64 to lib, not lib64. + * Stop building the binutils-gold package, let binutils provide + binutils-gold. Packages requiring gold should explicity pass + -fuse-ld=gold to the compiler, packages requiring the bfd linker + should pass -fuse-ld=bfd to the compiler. + * Refresh patches. + + -- Matthias Klose Mon, 22 Jul 2013 21:13:32 +0200 + +binutils (2.23.52.20130620-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Thu, 20 Jun 2013 12:31:29 +0200 + +binutils (2.23.52.20130620-1) unstable; urgency=low + + * New upstream snapshot. + * Add conflicts with mingw binutils. Closes: #712057, #712063. + * Always compare the test results with the ones from the installed binutils. + + -- Matthias Klose Thu, 20 Jun 2013 12:27:31 +0200 + +binutils (2.23.52.20130612-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Wed, 12 Jun 2013 12:26:59 +0200 + +binutils (2.23.52.20130612-1) unstable; urgency=low + + * New upstream snapshot. + - Fix issue #15323, redefining weak functions in -flto incrementally-linked + executable. Closes: #710936. + * Install libiberty.a again in binutils-dev, not installed anymore upstream + by default. + * Import the autopkg tests from Ubuntu. + * Enable i386pep emulation for the x86 builds. Closes: #703463. + * Fix typo in ld(1). Closes: #704867. + * Add mips64(el) support (YunQiang Su). Closes: #710214. + + -- Matthias Klose Wed, 12 Jun 2013 11:35:05 +0200 + +binutils (2.23.52.20130611-1ubuntu2) saucy; urgency=low + + * Restore lost changes from 2.23.2-2ubuntu2 and 2.23.2-2ubuntu3. + * Install libiberty.a alongside libiberty_pic.a in binutils-dev. + + -- Adam Conrad Tue, 11 Jun 2013 20:45:00 -0600 + +binutils (2.23.52.20130611-1ubuntu1) saucy; urgency=low + + * Merge with Debian; remaining changes: + - Build from the upstream source. + + -- Matthias Klose Tue, 11 Jun 2013 15:00:49 +0200 + +binutils (2.23.52.20130611-1) unstable; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Tue, 11 Jun 2013 14:53:06 +0200 + +binutils (2.23.52.20130522-1) experimental; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Wed, 22 May 2013 16:22:04 +0200 + +binutils (2.23.2-2ubuntu3) saucy; urgency=low + + * debian/tests/control: Add a Depends: field as "@" does not work for this + package (binutils-hppa64 cannot be installed on other architectures). + + -- Martin Pitt Wed, 05 Jun 2013 07:12:42 +0200 + +binutils (2.23.2-2ubuntu2) saucy; urgency=low + + * Fix wrong syntax in debian/tests/control that's causing autopkgtest + failures. + + -- Steve Langasek Tue, 04 Jun 2013 07:50:53 -0700 + +binutils (2.23.2-2ubuntu1) raring; urgency=low + + * Merge with Debian; remaining changes: + - Build from upstream sources. + - Build binutils-static and binutils-static-udeb packages. + - Add simple rebuild autopkgtest. + + -- Matthias Klose Tue, 16 Apr 2013 02:57:24 +0200 + +binutils (2.23.2-2) experimental; urgency=low + + * Add support for Cortex-A53 / Cortex-A57. + * Fix PR gas/14887 and PR gas/14987, gas syntax errors on ARM. + LP: #1166628. + + -- Matthias Klose Tue, 16 Apr 2013 02:21:44 +0200 + +binutils (2.23.2-1ubuntu2) raring; urgency=low + + * Add support for Cortex-A53 / Cortex-A57. + + -- Matthias Klose Sat, 30 Mar 2013 09:50:08 +0100 + +binutils (2.23.2-1ubuntu1) raring; urgency=low + + * Merge with Debian; remaining changes: + - Build from upstream sources. + - Build binutils-static and binutils-static-udeb packages. + - Add simple rebuild autopkgtest. + + -- Matthias Klose Tue, 26 Mar 2013 20:25:43 +0100 + +binutils (2.23.2-1) experimental; urgency=low + + * binutils 2.23.2 release. + + -- Matthias Klose Tue, 26 Mar 2013 19:58:59 +0100 + +binutils (2.23.1-0ubuntu11) raring; urgency=low + + * Update from the 2.23 branch (20130222). + * For cross builds, add the tool libdir to the library search path. + + -- Matthias Klose Fri, 22 Feb 2013 15:28:19 +0100 + +binutils (2.23.1-0ubuntu10) raring; urgency=low + + * Revert, broken for cross builds: + - Recognize DEB_TARGET_ARCH for cross builds. + + -- Matthias Klose Thu, 14 Feb 2013 23:32:59 +0100 + +binutils (2.23.1-0ubuntu9) raring; urgency=low + + * AArch64: Fix the support for PRFM instructions with preload + instruction hints (proposed for the 2.23 branch). + + -- Matthias Klose Thu, 14 Feb 2013 19:52:08 +0100 + +binutils (2.23.1-0ubuntu8) raring; urgency=low + + * Update from the 2.23 branch (20130213). + - AArch64 and PPC updates. + * Recognize DEB_TARGET_ARCH for cross builds. Closes: #695595. + * Fix srec_scan null dereference (Sang Kil Cha). Closes: #684903. + + -- Matthias Klose Wed, 13 Feb 2013 12:45:29 +0100 + +binutils (2.23.1-0ubuntu6) raring; urgency=low + + * Fix PR ld/14918: linking with -flto always links in libgcc_s.so. + Closes: #650145. + * Fix build failure with texinfo 4.14. Closes: #697353. + + -- Matthias Klose Sat, 05 Jan 2013 14:20:15 +0100 + +binutils (2.23.1-0ubuntu5) raring; urgency=low + + * Drop build dependency on g++. + + -- Matthias Klose Wed, 12 Dec 2012 08:55:12 +0100 + +binutils (2.23.1-0ubuntu4) raring; urgency=low + + * Update from the 2.23 branch (20121204). + * Add -fuse-ld= for GCC linker option compatibility in ld and gold. + * gold cross builds: Search the multiarch directories too. + * Revert the gettext:any build dependency hack. + + -- Matthias Klose Wed, 05 Dec 2012 08:45:10 +0100 + +binutils (2.23.1-0ubuntu3) raring; urgency=low + + * debian/control.in: Drop Vcs-*, that branch hasn't been updated since + natty. + * Add simple rebuild autopkgtest. (LP: #1081500) + * Add a simple test to compile, link, and run a program against libc6 and + build/use a shared library with the system-installed binutils, to ensure + basic binutils functionality. + + -- Martin Pitt Thu, 22 Nov 2012 07:49:25 +0100 + +binutils (2.23.1-0ubuntu2) raring; urgency=low + + * Update from the 2.23 branch (20121121). + - arm, aarch64 and x32 updates. + - Fix build error with -Werror. LP: #1079676. + + -- Matthias Klose Wed, 21 Nov 2012 14:14:55 +0100 + +binutils (2.23.1-0ubuntu1) raring; urgency=low + + * binutils 2.23.1 release. + + -- Matthias Klose Thu, 15 Nov 2012 14:07:23 +0100 + +binutils (2.23-2ubuntu1) raring; urgency=low + + * Merge with Debian; remaining changes: + - Build from upstream tarball. + + -- Matthias Klose Tue, 06 Nov 2012 19:40:21 +0100 + +binutils (2.23-2) experimental; urgency=low + + * Update multi-arch paths for x32 (x86_64-linux-gnux32) (Daniel Schepler). + Closes: #692138. + * Add new ARM hard-float/soft-float ABI flags for EABI_VER5 (Steve McIntyre). + * Silence lintian stupidity about interpreting every string in binaries + as text (Emmanuel Fleury). Closes: #661639. + * In ld.texi, remove cross reference to BFD internals documentation. + + -- Matthias Klose Tue, 06 Nov 2012 10:42:37 +0100 + +binutils (2.23-1) experimental; urgency=low + + * binutils 2.23 release. + * Don't include the documents licensed under GFDL with cover texts. + Closes: #650504. + + -- Matthias Klose Wed, 24 Oct 2012 10:29:50 +0200 + +binutils (2.22.90.20120924-1) experimental; urgency=low + + * New upstream snapshot (taken from the 2.23 branch). + * Fix bfd.h, removing the safety inclusion guard. + * Fix multilib conflicts of generated values by __WORDSIZE-based expressions. + + -- Matthias Klose Mon, 24 Sep 2012 18:39:51 +0200 + +binutils (2.22.90.20120924-0ubuntu2) quantal; urgency=low + + * Fix inclusion of bfd.h, removing the safety inclusion guard. + * Fix multilib conflicts of generated values by __WORDSIZE-based expressions. + + -- Matthias Klose Tue, 25 Sep 2012 18:40:36 +0200 + +binutils (2.22.90.20120924-0ubuntu1) quantal; urgency=low + + * Update from the 2.23 branch: + - Fix PR ld/14591 (wrong symbol type with common symbol and weak function). + * d/p/211-hjl-binutils-weakdef.patch, d/p/213-hjl-binutils-sec64k.patch: + Remove, not found anymore in the hjl releases. + * Remove all other (not applied) patches from the hjl releases. + + -- Matthias Klose Mon, 24 Sep 2012 22:16:17 +0200 + +binutils (2.22.90.20120919-0ubuntu1) quantal; urgency=low + + * Update from the 2.23 branch: + - armv8 fixes. + + -- Matthias Klose Wed, 19 Sep 2012 16:49:35 +0200 + +binutils (2.22.90.20120913-2ubuntu1) quantal; urgency=low + + * Merge with Debian. + + -- Matthias Klose Sat, 15 Sep 2012 11:29:42 +0200 + +binutils (2.22.90.20120913-2) experimental; urgency=low + + * Undo the reversion of the mips patches, unrelated issue. + * Build again with -marm on armhf. Testsuite still not ready for thumb mode. + + -- Matthias Klose Sat, 15 Sep 2012 03:00:10 +0200 + +binutils (2.22.90.20120913-1ubuntu1) quantal; urgency=low + + * Merge with Debian. + + -- Matthias Klose Thu, 13 Sep 2012 21:06:18 +0200 + +binutils (2.22.90.20120913-1) experimental; urgency=low + + * New upstream snapshot (taken from the 2.23 branch). + * Add R_AARCH64_GOT_LD_PREL19 reloc implementation, taken from the trunk. + * Revert mips updates. + See http://sourceware.org/ml/binutils/2012-09/msg00158.html + + -- Matthias Klose Thu, 13 Sep 2012 20:35:08 +0200 + +binutils (2.22.90.20120907-1ubuntu1) quantal; urgency=low + + * Build-depend on gettext:any to fix the cross build. LP: #1043442. + Work around until libgettext is split out of gettext (see #683751). + + -- Matthias Klose Sat, 08 Sep 2012 13:43:51 +0200 + +binutils (2.22.90.20120907-1) experimental; urgency=low + + * New upstream snapshot (taken from the 2.23 branch). + * Don't build anymore with -marm on armhf. + * Work around `install' limitation not able to pass parameters + to the strip command. Closes: #686183. + * Generate md5sums file. Closes: #684079. + + -- Matthias Klose Sat, 08 Sep 2012 13:40:39 +0200 + +binutils (2.22.90.20120816-2ubuntu1) quantal; urgency=low + + * Merge with Debian. + + -- Matthias Klose Wed, 22 Aug 2012 13:54:26 +0200 + +binutils (2.22.90.20120816-2) experimental; urgency=low + + * Some refactoring of debian/rules based on patches from Marcin: + * Introduce DEB_TARGET_* macros to unify native and cross builds. + * Build the control file as the first step for cross builds. + * Try again building without --disable-werror. + * Refactor stripping of binaries into a `strip_package' macro. + + -- Matthias Klose Tue, 21 Aug 2012 15:31:05 +0200 + +binutils (2.22.90.20120816-1ubuntu1) quantal; urgency=low + + * New upstream snapshot (taken from the 2.23 branch). + * Configure for aarch64 and x32 targets. + + -- Matthias Klose Thu, 16 Aug 2012 16:35:48 +0200 + +binutils (2.22.90.20120731-0ubuntu1) quantal; urgency=low + + * New upstream snapshot (taken from the 2.23 branch). + + -- Matthias Klose Wed, 01 Aug 2012 16:31:30 +0200 + +binutils (2.22.52.20120713-0ubuntu1) quantal; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Sat, 14 Jul 2012 00:56:30 +0200 + +binutils (2.22.52.20120704-1) experimental; urgency=low + + * New upstream snapshot. + + -- Matthias Klose Wed, 04 Jul 2012 14:40:01 +0200 + +binutils (2.22-7) unstable; urgency=low + + * Update from the binutils-2_22-branch 20120704. + - Fix PR ld/13991 and a gold issue on ARM. + * Fix warning building libiberty/md5.c. Closes: #674831. + * Enable x86_64-pep in binutils-multiarch. Closes: #675364. + + -- Matthias Klose Wed, 04 Jul 2012 11:00:14 +0200 + +binutils (2.22-6ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Thu, 08 Mar 2012 19:21:22 +0100 + +binutils (2.22-6) unstable; urgency=low + + * Update from the binutils-2_22-branch 20120307. + - Fix PR ld/12161 (avr), PR binutils/13622 (readelf crash), + PR binutils/13476 (hppa), PR ld/13387 (hppa), + * Fix typo in elf64-x86-64.c, follow-up patch to PR ld/13302. + + -- Matthias Klose Thu, 08 Mar 2012 18:52:20 +0100 + +binutils (2.22-5ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Wed, 25 Jan 2012 11:47:53 +0100 + +binutils (2.22-5) unstable; urgency=low + + * Update from the binutils-2_22-branch 20120124. + - Fix PR ld/13581 (x32). + * Fix PR gas/13449 (ARM), taken from the trunk. + + -- Matthias Klose Tue, 24 Jan 2012 21:26:43 +0100 + +binutils (2.22-4ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Sat, 07 Jan 2012 10:27:24 +0100 + +binutils (2.22-4) unstable; urgency=low + + * Don't bump the soversion (revert the change in 2.22-3). + * Apply proposed patch for PR binutils/13534, allowing ar to handle + files bigger than 2GB (Francois Gouget). Closes: #652887). + * Recognize DW_LANG_Go in readelf (backport from trunk). + + -- Matthias Klose Sat, 07 Jan 2012 09:07:25 +0100 + +binutils (2.22-3ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Tue, 03 Jan 2012 07:28:18 +0100 + +binutils (2.22-3) unstable; urgency=low + + * Update from the binutils-2_22-branch 20120102. + - gold updates. + - mips updates. + + -- Matthias Klose Tue, 03 Jan 2012 06:06:20 +0100 + +binutils (2.22-2ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Sun, 11 Dec 2011 17:37:30 +0100 + +binutils (2.22-2) unstable; urgency=low + + * Update from the binutils-2_22-branch 20111211. + * Fix build failure with make 3.82 (Daniel Schepler). Closes: #650064. + + -- Matthias Klose Sun, 11 Dec 2011 16:30:14 +0000 + +binutils (2.22-1ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Mon, 21 Nov 2011 17:47:56 +0100 + +binutils (2.22-1) unstable; urgency=low + + * Binutils 2.22 release. + + -- Matthias Klose Mon, 21 Nov 2011 16:50:53 +0100 + +binutils (2.21.90.20111025-1ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Tue, 25 Oct 2011 15:46:41 +0200 + +binutils (2.21.90.20111025-1) unstable; urgency=low + + * Snapshot, taken from the binutils-2_22-branch 20111025. + * Fix lintian warnings. + + -- Matthias Klose Tue, 25 Oct 2011 15:06:46 +0200 + +binutils (2.21.90.20111019-3ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Sun, 23 Oct 2011 13:41:58 +0200 + +binutils (2.21.90.20111019-3) unstable; urgency=low + + * Fix PR ld/13302, taken from the trunk. + + -- Matthias Klose Sun, 23 Oct 2011 13:15:07 +0200 + +binutils (2.21.90.20111019-2ubuntu1) precise; urgency=low + + * Merge with Debian. + + -- Matthias Klose Thu, 20 Oct 2011 13:12:50 +0200 + +binutils (2.21.90.20111019-2) unstable; urgency=low + + * Fix PR ld/13287, taken from the trunk. LP: #872687. + + -- Matthias Klose Thu, 20 Oct 2011 12:29:18 +0200 + +binutils (2.21.90.20111019-1) unstable; urgency=low + + * Snapshot, taken from the binutils-2_22-branch 20111019. + + -- Matthias Klose Wed, 19 Oct 2011 22:25:05 +0200 + +binutils (2.21.90.20111004-2ubuntu1) oneiric; urgency=low + + * Merge with Debian. + + -- Matthias Klose Tue, 11 Oct 2011 12:36:33 +0200 + +binutils (2.21.90.20111004-2) unstable; urgency=low + + * Fix PR ld/13250, preserve the maximum alignment and size for common + symbols (H.J. Lu). Closes: #608901. LP: #697229. + + -- Matthias Klose Thu, 06 Oct 2011 08:06:04 +0200 + +binutils (2.21.90.20111004-1) unstable; urgency=medium + + * Snapshot, taken from the binutils-2_22-branch 20111004. + * Fix PR ld/13195, taken from the trunk. Closes: #643858, #644183. + + -- Matthias Klose Tue, 04 Oct 2011 12:12:16 +0200 + +binutils (2.21.53.20110922-1) unstable; urgency=low + + * Snapshot, taken from the binutils-2_22-branch 20110924. + + -- Matthias Klose Sat, 24 Sep 2011 09:55:38 +0200 + +binutils (2.21.53.20110910-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110910. + - Fix PR gas/13024. Closes: #635592. + * Build with proposed patch for PR ld/12965. + * Don't ship .la files in the cross binutils packages. + * For native builds, add the multiarch directories to the default + search path. + + -- Matthias Klose Sat, 10 Sep 2011 13:06:01 +0200 + +binutils (2.21.53.20110823-3) unstable; urgency=low + + * Revert the last change: + - Default to --hash-style=both in ld.bfd and ld.gold. + + -- Matthias Klose Thu, 25 Aug 2011 10:48:28 +0200 + +binutils (2.21.53.20110823-2) unstable; urgency=low + + * Default to --hash-style=both in ld.bfd and ld.gold. + * Fix s390x build (Aurelian Jarno). Closes: #635167. + + -- Matthias Klose Wed, 24 Aug 2011 13:06:48 +0200 + +binutils (2.21.53.20110823-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110823. + - ld --no-copy-dt-needed-entries/--no-add-needed is now the default. + + -- Matthias Klose Tue, 23 Aug 2011 21:23:38 +0200 + +binutils (2.21.53.20110810-0ubuntu4) oneiric-proposed; urgency=low + + * Fix PR ld/13250, preserve the maximum alignment and size for common + symbols (H.J. Lu). Closes: #608901. LP: #697229. + + -- Matthias Klose Thu, 06 Oct 2011 09:22:34 +0200 + +binutils (2.21.53.20110810-0ubuntu3) oneiric; urgency=low + + * Fix PR ld/13201, link error with --as-needed and -flto. LP: #778292. + LP: #690194. + + -- Matthias Klose Tue, 20 Sep 2011 11:34:33 +0200 + +binutils (2.21.53.20110810-0ubuntu2) oneiric; urgency=low + + * Build with proposed patch for PR ld/12965. LP: #641126. + * Don't ship .la files in the cross binutils packages. LP: #760420. + * For native builds, add the multiarch directories to the default + search path. LP: #780455. + + -- Matthias Klose Wed, 07 Sep 2011 15:36:22 +0200 + +binutils (2.21.53.20110810-0ubuntu1) oneiric; urgency=low + + * Snapshot, taken from the trunk 20110810. + + -- Matthias Klose Thu, 11 Aug 2011 22:51:48 +0200 + +binutils (2.21.53.20110805-1ubuntu1) oneiric; urgency=low + + * Merge with Debian. + + -- Matthias Klose Fri, 05 Aug 2011 12:34:26 +0200 + +binutils (2.21.53.20110805-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110805. + + -- Matthias Klose Fri, 05 Aug 2011 12:25:49 +0200 + +binutils (2.21.53.20110729-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110729. + * Fix s390x build (Aurelian Jarno). Closes: #635167. + + -- Matthias Klose Fri, 29 Jul 2011 19:04:46 +0200 + +binutils (2.21.53.20110720-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110720. + - Fix PR ld/12978. Closes: #632681. + + -- Matthias Klose Wed, 20 Jul 2011 20:54:51 +0200 + +binutils (2.21.52.20110707-1ubuntu1) oneiric; urgency=low + + * Merge with Debian. + + -- Matthias Klose Thu, 07 Jul 2011 07:28:51 +0200 + +binutils (2.21.52.20110707-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110707. + - Fix build failure on mips/mipsel. Closes: #632690. + - Fix issues on kfreebsd-amd64. Closes: #632671. + + -- Matthias Klose Thu, 07 Jul 2011 06:48:33 +0200 + +binutils (2.21.52.20110703-1ubuntu1) oneiric; urgency=low + + * Merge with Debian. + + -- Matthias Klose Mon, 04 Jul 2011 10:31:01 +0200 + +binutils (2.21.52.20110703-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110703. + + -- Matthias Klose Sun, 03 Jul 2011 21:56:44 +0200 + +binutils (2.21.52.20110606-2) unstable; urgency=low + + * Fix PR ld/12845, taken from the trunk. Closes: #628685. + + -- Matthias Klose Thu, 09 Jun 2011 12:45:15 +0200 + +binutils (2.21.52.20110606-1ubuntu1) oneiric; urgency=low + + * Merge with Debian. + + -- Matthias Klose Tue, 07 Jun 2011 11:56:41 +0200 + +binutils (2.21.52.20110606-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110606. + - Fix PR ld/12833. Closes: #628770. + - Fix spelling errors. Closes: #604696. + * Let gold accept a dummy -z buildd- option. + * Add a /usr/share/bug/binutils/presubj file for reportbug (and symlinks + from the other /usr/share/bug/binutils-foo directories) explaining how + to make a self-contained testcase (Jonathan Nieder). Closes: #629147. + * Fix ld crash cause of invalid pointer in munmap_chunk. Closes: #628916. + + -- Matthias Klose Tue, 07 Jun 2011 00:03:47 +0200 + +binutils (2.21.51.20110523-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110523. + + -- Matthias Klose Mon, 23 May 2011 23:38:52 +0200 + +binutils (2.21.51.20110421-6ubuntu1) oneiric; urgency=low + + * Merge with Debian. + + -- Matthias Klose Thu, 19 May 2011 16:02:39 +0200 + +binutils (2.21.51.20110421-6) unstable; urgency=low + + [ Marcin Juszkiewicz ] + * Use pregenerated ld.gold.1 for cross builds. + + [ Matthias Klose ] + * Redefine STRIP and install_binary for cross builds (Ken Werner). + * Apply fix for PR ld/12726, taken from the trunk. + + -- Matthias Klose Thu, 19 May 2011 15:51:22 +0200 + +binutils (2.21.51.20110421-5) unstable; urgency=medium + + * Use a symlink for /usr/bin/ld, even if gold is not built. Closes: #615262. + + -- Matthias Klose Tue, 17 May 2011 17:58:17 +0200 + +binutils (2.21.51.20110421-4) unstable; urgency=low + + * Fix PR ld/12730, taken from the trunk. Closes: #625616. + * Cortex A8 workarounds for PLT tail calls (Richard Sandiford). + + -- Matthias Klose Sun, 08 May 2011 02:06:22 +0200 + +binutils (2.21.51.20110421-3) unstable; urgency=low + + * Fix segfault in ar, delete_members. + + -- Matthias Klose Sun, 01 May 2011 17:30:42 +0200 + +binutils (2.21.51.20110421-2) unstable; urgency=low + + * Fix typo in the patch for PR gas/12698. + + -- Matthias Klose Wed, 27 Apr 2011 21:33:47 +0200 + +binutils (2.21.51.20110421-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110421. + * Install a man page for ld.gold, generated by help2man. Closes: #619823. + * Apply proposed patch for PR gas/12698. Closes: #623964. + + -- Matthias Klose Wed, 27 Apr 2011 18:14:39 +0200 + +binutils (2.21.51.20110421-0ubuntu6) oneiric; urgency=low + + * Fix PR ld/12730, taken from the trunk. Closes: #625616. + + -- Matthias Klose Sun, 08 May 2011 02:17:37 +0200 + +binutils (2.21.51.20110421-0ubuntu5) oneiric; urgency=low + + * Cortex A8 workarounds for PLT tail calls (Richard Sandiford). + + -- Matthias Klose Fri, 06 May 2011 11:55:11 +0200 + +binutils (2.21.51.20110421-0ubuntu4) oneiric; urgency=low + + * Fix segfault in ar, delete_members. + + -- Matthias Klose Sun, 01 May 2011 17:30:42 +0200 + +binutils (2.21.51.20110421-0ubuntu3) oneiric; urgency=low + + * Install a man page for ld.gold, generated by help2man. Closes: #619823. + * Apply proposed patch for PR gas/12698. Closes: #623964. + + -- Matthias Klose Wed, 27 Apr 2011 20:26:20 +0200 + +binutils (2.21.51.20110421-0ubuntu1) oneiric; urgency=low + + * Snapshot, taken from the trunk 20110421. + + -- Matthias Klose Thu, 21 Apr 2011 14:24:45 +0200 + +binutils (2.21.51.20110419-2) unstable; urgency=low + + * Fix powerpcspe and sparc builds. + + -- Matthias Klose Tue, 19 Apr 2011 13:47:56 +0200 + +binutils (2.21.51.20110419-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20110419. + + -- Matthias Klose Tue, 19 Apr 2011 10:18:14 +0200 + +binutils (2.21.0.20110327-2ubuntu2) natty; urgency=low + + * Fix architecture field for binutils-gold (powerpcspe). + * Add support for arm-*-gnueabihf targets. Closes: #621029. + * Fix PR ld/12654: Pproperly handle R_386_TLS_LDO_32 for PIE. LP: #663294. + + -- Matthias Klose Sat, 09 Apr 2011 13:35:11 +0200 + +binutils (2.21.0.20110327-2ubuntu1) natty; urgency=low + + [ Marcin Juszkiewicz ] + * Build -dbgsym package for cross builds. LP: #711523. + + -- Matthias Klose Thu, 31 Mar 2011 16:24:10 +0200 + +binutils (2.21.0.20110327-2) unstable; urgency=low + + * Fix architecture field for binutils-gold. + * Configure with --disable-werror on armhf. + + -- Matthias Klose Tue, 29 Mar 2011 19:38:55 +0200 + +binutils (2.21.0.20110327-1) unstable; urgency=low + + * Update from the 2.21 branch 20110327. + * Add multiarch directories to linker search path. Closes: #369064. + LP: #738098. + + -- Matthias Klose Sun, 27 Mar 2011 22:32:57 +0100 + +binutils (2.21.0.20110322-1ubuntu2) natty; urgency=low + + * Add multiarch directories to linker search path. Closes: #369064. + LP: #738098. + + -- Matthias Klose Sat, 26 Mar 2011 11:27:54 +0100 + +binutils (2.21.0.20110322-1ubuntu1) natty; urgency=low + + * Merge with Debian. + + -- Matthias Klose Tue, 22 Mar 2011 23:36:26 +0100 + +binutils (2.21.0.20110322-1) unstable; urgency=low + + * Update from the 2.21 branch 20110322. + * S/390: Make as to accept all instructions if no -march option given. + taken from the trunk (Aurelian Jarno). Closes: #618751. + * Extend support for armhf (Loic Minier). + - debian/control.in, debian/control, debian/rules: Enable gold for armhf. + - debian/rules: Introduce $(CROSS) (set to $(DEB_HOST_GNU_TYPE)- when + cross-building) and call $(CROSS)cpp to check whether -marm is needed or + not instead of testing for armel; an alternative would be to + unconditionally set -marm if DEB_HOST_ARCH_CPU is arm. + - debian/rules: commented out -fno-section-anchors CFLAGS handling would + also be enabled for armhf. + - debian/rules: ignore regressions on armhf as well; note that + ignore_regressions is set three times. + + -- Matthias Klose Tue, 22 Mar 2011 23:12:39 +0100 + +binutils (2.21.0.20110302-2ubuntu1) natty; urgency=low + + * Merge with Debian. + + -- Matthias Klose Fri, 11 Mar 2011 00:14:22 +0100 + +binutils (2.21.0.20110302-2) unstable; urgency=low + + [ Carlos O'Donell ] + * Fix binutils-hppa64 build. + + [ Matthias Klose ] + * Fix PR ld/12376 (John David Anglin), taken from the trunk. + * Update to the 2.21 branch, 20110310. + + -- Matthias Klose Thu, 10 Mar 2011 21:35:07 +0100 + +binutils (2.21.0.20110302-1ubuntu1) natty; urgency=low + + * Merge with Debian. + + -- Matthias Klose Fri, 04 Mar 2011 01:37:26 +0100 + +binutils (2.21.0.20110302-1) unstable; urgency=low + + * Update from the 2.21 branch. + + [ Thorsten Glaser ] + * patches/640_m68k_fix-TLS_GD-relocation: new, temp. Closes: #611768. + + [ Matthias Klose ] + * On ppc64, look for 32 bit target libraries in /lib32, /usr/lib32 etc., + first. + + -- Matthias Klose Wed, 02 Mar 2011 02:41:17 +0100 + +binutils (2.21.0.20110216-2) unstable; urgency=low + + * Upload to unstable. + + -- Matthias Klose Tue, 22 Feb 2011 20:35:16 +0100 + +binutils (2.21.0.20110216-1ubuntu3) natty; urgency=low + + * Read multiarch targets from the first column of /usr/share/dpkg/archtable; + it's not the ideal list, but it's better than a hardcoded list and + enabling all targets was breaking too many tools; LP: #726428. + + -- Loïc Minier Wed, 02 Mar 2011 18:57:13 +0100 + +binutils (2.21.0.20110216-1ubuntu2) natty; urgency=low + + * Remove leftover bfd/elflink.c.rej. + * Pass --enable-targets=all to configure in the multiarch pass; + Debian #610745. + + -- Loïc Minier Thu, 24 Feb 2011 11:46:06 +0100 + +binutils (2.21.0.20110216-1ubuntu1) natty; urgency=low + + * Upload to natty. + + -- Matthias Klose Wed, 16 Feb 2011 19:43:02 +0100 + +binutils (2.21.0.20110216-1) experimental; urgency=low + + * Update from the 2.21 branch. + + -- Matthias Klose Wed, 16 Feb 2011 15:54:15 +0100 + +binutils (2.21-5ubuntu1) natty; urgency=low + + * Upload to natty. + + -- Matthias Klose Tue, 25 Jan 2011 05:46:53 +0100 + +binutils (2.21-5) experimental; urgency=low + + * Update gold to 1.11, taken from the 2.21 branch. + * Add the arm-linux-gnueabi target to binutils-multiarch (Loic Minier). + + -- Matthias Klose Tue, 25 Jan 2011 00:51:38 +0100 + +binutils (2.21-4ubuntu1) natty; urgency=low + + * Revert the soname change. + + -- Matthias Klose Wed, 12 Jan 2011 22:09:24 +0100 + +binutils (2.21-4ubuntu0) natty; urgency=low + + * Intermediate upload to natty to change the soversion on amd64. + + -- Matthias Klose Wed, 12 Jan 2011 21:51:03 +0100 + +binutils (2.21-4) experimental; urgency=low + + * Fix handling of writable .eh_frame section in gold, taken from the + 2.21 branch. + + -- Matthias Klose Wed, 12 Jan 2011 00:42:15 +0100 + +binutils (2.21-3ubuntu1) natty; urgency=low + + * Upload to natty. + + -- Matthias Klose Fri, 31 Dec 2010 16:31:48 +0100 + +binutils (2.21-3) experimental; urgency=low + + [ Matthias Klose ] + * Don't include `-system' in the bfd version identifier. + + [ Sedat Dilek ] + * 160_pr12327.patch: Fix PR ld/12327, taken from the trunk. + + -- Matthias Klose Thu, 29 Dec 2010 23:51:35 +0100 + +binutils (2.21-2) experimental; urgency=low + + * Don't install ld.bfd in binutils-multiarch. + * Fix assembler bug blocking Thumb-2 kernel builds (CS issue #8775). + + -- Matthias Klose Fri, 10 Dec 2010 13:45:00 +0100 + +binutils (2.21-1ubuntu4) natty; urgency=low + + * Don't install ld.bfd in binutils-multiarch. LP: #688497. + * Fix assembler bug blocking Thumb-2 kernel builds (CS issue #8775). + + -- Matthias Klose Fri, 10 Dec 2010 15:35:54 +0100 + +binutils (2.21-1ubuntu2) natty; urgency=low + + * Fix build dependencies. + + -- Matthias Klose Fri, 10 Dec 2010 00:57:01 +0100 + +binutils (2.21-1ubuntu1) natty; urgency=low + + * Upload to natty. + + -- Matthias Klose Fri, 10 Dec 2010 00:17:07 +0100 + +binutils (2.21-1) experimental; urgency=low + + * binutils 2.21 release. + + [ Marcin Juszkiewicz ] + + * Enable building gold in cross builds. LP: #686530. + * Allow to build only the -source package, and include the version + in the package name. LP: #682646. + + -- Matthias Klose Thu, 09 Dec 2010 23:24:49 +0100 + +binutils (2.20.90.20101121-0ubuntu1) natty; urgency=low + + * Update from the binutils 2.21 release branch. + + -- Matthias Klose Sun, 21 Nov 2010 13:53:59 +0100 + +binutils (2.20.90.20101105-0ubuntu1) natty; urgency=low + + * binutils 2.21 prerelease 1. + + -- Matthias Klose Wed, 10 Nov 2010 01:47:38 +0200 + +binutils (2.20.51.20101028-0ubuntu1) natty; urgency=low + + * Snapshot, taken from the trunk 20100928. + + -- Matthias Klose Thu, 28 Oct 2010 17:55:49 +0200 + +binutils (2.20.51.20101014-0ubuntu1) natty; urgency=low + + * Snapshot, taken from the trunk 20100914. + * ld: Accept --sysroot again. LP: #660257. + + -- Matthias Klose Thu, 14 Oct 2010 11:10:06 +0200 + +binutils (2.20.51.20101009-0ubuntu1) natty; urgency=low + + * Snapshot, taken from the trunk 20100909. + * For cross builds, build without sysroot support. Closes LP: #598389. + + -- Matthias Klose Sat, 09 Oct 2010 15:08:04 +0200 + +binutils (2.20.51.20100908-0ubuntu2) maverick; urgency=low + + * debian/patches/216-tilde-in-ar-filenames: Allow ar scripts to contain ~ + in the filename, fixes u-boot-linaro rc build failures that ended up + using pathnames with ~ in them. LP: #641488 + + -- Zygmunt Krynicki Fri, 17 Sep 2010 19:20:28 +0200 + +binutils (2.20.51.20100908-0ubuntu1) maverick; urgency=low + + * Snapshot, taken from the trunk 20100908. + * Build binutils-hppa64 in cross builds (Al Viro). Closes: #595319. + * Don't build the binutils-hppa64 package for Ubuntu. + * Fix some lintian warnings. + + -- Matthias Klose Wed, 08 Sep 2010 15:26:18 +0200 + +binutils (2.20.51.20100813-1ubuntu3) maverick; urgency=low + + * Add missing patch file. + + -- Matthias Klose Fri, 03 Sep 2010 10:32:25 +0200 + +binutils (2.20.51.20100813-1ubuntu2) maverick; urgency=low + + * Link executables statically when `static' is passed in DEB_BUILD_OPTIONS + (Jim Heck). Closes: #590101. + * Apply proposed patch for PR ld/10340 (ld doesn't honor sysroot prefix + for ldscripts). LP: #625320. + + -- Matthias Klose Fri, 27 Aug 2010 16:52:19 +0200 + +binutils (2.20.51.20100813-1ubuntu1) maverick; urgency=low + + * Merge with Debian. + + -- Matthias Klose Fri, 13 Aug 2010 13:26:32 +0200 + +binutils (2.20.51.20100813-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100813. + + [ Jonathan Nieder ] + * Remove ld.bfd from binutils-multiarch (not that useful without an + multiarch assembler). + + [ Marcin Juszkiewicz ] + * Revert sysroot to / for cross builds. LP: #598389. + * Generate debian/control for native and cross builds. LP: #612629. + * Provide packaging rules in -source package. LP: #608745. + + [ Matthias Klose ] + * Don't apply patches, when PATCHED_SOURCES is set to `yes'. + * Proposed patch for PR11889, readelf crashes for malformed binaries + (Dan Rosenberg). LP: #614206. + + -- Matthias Klose Fri, 13 Aug 2010 11:10:14 +0200 + +binutils (2.20.51.20100710-1ubuntu2) maverick; urgency=low + + * Don't use configury for cross builds for native builds. LP: #604134. + + -- Matthias Klose Sun, 11 Jul 2010 10:15:01 +0200 + +binutils (2.20.51.20100710-1ubuntu1) maverick; urgency=low + + * Update HJ patches from binutils 2.20.51.0.10. + + -- Matthias Klose Sat, 10 Jul 2010 11:42:27 +0200 + +binutils (2.20.51.20100710-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100710. + - Fix PR gas/10531. LP: #599485. + * debian/rules: Introduce PF macros (Jim Heck). Closes: #588357. + + [ Marcin Juszkiewicz ] + * Don't install documentation files in -cross packages. Closes: #586636. + * Set sysroot to /usr/$(TARGET) for cross builds. LP: #598389. + + -- Matthias Klose Sat, 10 Jul 2010 10:42:55 +0200 + +binutils (2.20.51.20100617-0ubuntu1) maverick; urgency=low + + * Snapshot, taken from the trunk 20100617. + + -- Matthias Klose Thu, 17 Jun 2010 15:30:31 +0200 + +binutils (2.20.51.20100608-0ubuntu1) maverick; urgency=low + + * Snapshot, taken from the trunk 20100608. + * Merge 'binary-cross' target into 'binary' one (Marcin Juszkiewicz). + LP: #587851. + * debian/copyright: Update to GFDL 1.3. + + -- Matthias Klose Tue, 08 Jun 2010 13:26:49 +0200 + +binutils (2.20.51.20100527-1ubuntu1) maverick; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Thu, 27 May 2010 12:32:39 +0200 + +binutils (2.20.51.20100527-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100527. + + [ Jonathan Nieder ] + * debian/binutils-multiarch.preinst.in: Re-add diversions on reinstall. + Closes: #581156. + * Remove c++filt from binutils-multiarch. + * Rename /usr/bin/ld from multiarch build to ld.bfd. Closes: #582490. + LP: #586227. + + -- Matthias Klose Thu, 27 May 2010 10:40:48 +0200 + +binutils (2.20.51.20100518-1ubuntu1) maverick; urgency=low + + * Snapshot, taken from the trunk 20100518. + * Merge with Debian; remaining changes: + - Build binutils-static. + * Update hjl patches from 2.20.51.0.8. + + -- Matthias Klose Tue, 18 May 2010 14:04:04 +0200 + +binutils (2.20.51.20100518-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100518. + + -- Matthias Klose Tue, 18 May 2010 13:29:45 +0200 + +binutils (2.20.51.20100428-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100428. + + -- Matthias Klose Wed, 28 Apr 2010 10:07:28 +0200 + +binutils (2.20.51.20100418-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100418. + * debian/*.shlibs.in: Automate upstream version changes. + * Configure native build --with-sysroot=/. Closes: #556126. + * Move the ld.gold binary into the binutils package, just keep the + diversion (ld) in the binutils-gold package. + * Linker selection: ld is used by default, to use the gold linker, + pass -fuse-linker-plugin (no other side effects if -flto/-fwhopr + is not passed). To force ld.bfd or ld.gold, pass -B/usr/lib/compat-ld + for ld.bfd or /usr/lib/gold-ld for ld.gold. + * Apply proposed patch for ARM: Add option to disable merging of adjacent + exidx unwinder entries. + + [ Jonathan Nieder ] + * Clean up diversion handling in binutils-multiarch: + - remove diversion of libbfd.a and libopcodes.a. Closes: #545067. + - wait for the new version to be unpacked before removing old diversions + - avoid messages from re-adding diversions when upgrading from a version + that already has them + - remove diversions when downgrading to a version that does not have + them (for example, when recovering from an upgrade failure) + * Add diversion for ld.bfd in binutils-multiarch. + * Update comment in debian/rules to acknowledge that binutils-multiarch + includes a linker now. + * Add c++filt to binutils-multiarch. + * Remove elfedit from binutils-multiarch. + Its functionality does not depend on the list of supported targets. + * Fixup to version changes handling. + + -- Matthias Klose Sun, 18 Apr 2010 14:18:59 +0200 + +binutils (2.20.51.20100407-0ubuntu1) lucid; urgency=low + + * Snapshot, taken from the trunk 20100407. + * debian/*.shlibs: Update to the version from the trunk. + * Configure native build --with-sysroot=/. Closes: #556126. + + -- Matthias Klose Thu, 08 Apr 2010 01:31:49 +0200 + +binutils (2.20.51.20100405-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100405. + * debian/*.shlibs: Update to the version from the trunk. + * Mangle the soname of the binutils libraries to be different than + the default name. Closes: #557620. + Packaged cross builds should do the same. + * Add diversion for elfedit in binutils-multiarch (Jonathan Nieder). + Closes: #576126. + * Convert to quilt (Sedat Dilek). + * Update to proposed patch to enable both gold and ld in a single toolchain. + The gold binary is now installed as `gold'. Keep the name `ld.gold'. + + -- Matthias Klose Mon, 05 Apr 2010 14:49:46 +0200 + +binutils (2.20.51.20100227-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100227. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Sat, 27 Feb 2010 08:55:05 +0100 + +binutils (2.20.51.20100222-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100222. + * debian/*.shlibs: Update to the version from the trunk. + * binutils-dev: Install plugin-api.h. + * Ignore testsuite regressions on armel. + + -- Matthias Klose Tue, 23 Feb 2010 02:27:28 +0100 + +binutils (2.20.51.20100216-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100216. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Tue, 16 Feb 2010 17:49:47 +0100 + +binutils (2.20.51.20100112-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100112. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Tue, 12 Jan 2010 09:06:51 +0100 + +binutils (2.20.51.20100109-2) experimental; urgency=low + + * Regenerate ld/configure (includes ld in the binutils package). + + -- Matthias Klose Mon, 11 Jan 2010 01:48:09 +0100 + +binutils (2.20.51.20100109-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100109. + - PR gold/10980: Support more options available by current GNU ld. + Closes: #555886. + - Fix PR gold/11072: Discard .gnu_debuglink sections, taken from the trunk. + Closes: #563366. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Sat, 09 Jan 2010 14:32:33 +0100 + +binutils (2.20.51.20100101-1) experimental; urgency=low + + * Snapshot, taken from the trunk 20100101. + * debian/*.shlibs: Update to the version from the trunk. + * Remove patches available on the trunk. + + -- Matthias Klose Fri, 01 Jan 2010 18:49:42 +0100 + +binutils (2.20.1-9ubuntu1) maverick; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Thu, 06 May 2010 16:56:40 +0200 + +binutils (2.20.1-9) unstable; urgency=high + + * [arm] branches to weak symbols, update patch from the trunk. + + -- Matthias Klose Thu, 06 May 2010 15:42:22 +0200 + +binutils (2.20.1-8ubuntu2) maverick; urgency=low + + * Build gold for powerpc as well. + + -- Matthias Klose Sat, 01 May 2010 14:22:35 +0200 + +binutils (2.20.1-8ubuntu1) maverick; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Thu, 29 Apr 2010 21:40:16 +0200 + +binutils (2.20.1-8) unstable; urgency=low + + * [arm] branches to weak symbols, patch taken from the trunk. + + -- Matthias Klose Thu, 29 Apr 2010 20:36:07 +0200 + +binutils (2.20.1-7) unstable; urgency=low + + * Apply proposed patch for ARM: Add option to disable merging of adjacent + exidx unwinder entries. Addresses PR libgcj/40860. + + -- Matthias Klose Tue, 20 Apr 2010 22:51:35 +0000 + +binutils (2.20.1-6) unstable; urgency=low + + * Move the ld.gold binary into the binutils package, just keep the + diversion (ld) in the binutils-gold package. + * Linker selection: ld is used by default, to use the gold linker, + pass -fuse-linker-plugin (no other side effects if -flto/-fwhopr + is not passed). To force ld.bfd or ld.gold, pass -B/usr/lib/compat-ld + for ld.bfd or /usr/lib/gold-ld for ld.gold. + * Disable building gold on arm. Use gold from the trunk, if needed. + * Backport fixups of Loongson2F from the trunk. + + -- Matthias Klose Sat, 17 Apr 2010 18:27:45 +0200 + +binutils (2.20.1-5) unstable; urgency=medium + + * Apply patch for PR gas/11456: Use memcpy to copy overlap memory. + + -- Matthias Klose Fri, 02 Apr 2010 01:36:07 +0200 + +binutils (2.20.1-4) unstable; urgency=low + + * Mangle the soname of the binutils libraries to be different than + the default name. Closes: #557620. + Packaged cross builds should do the same. + * Reduce ARM linking time (backport from the trunk). + * Apply fix for PR ld/11426, taken from the trunk. + + -- Matthias Klose Tue, 30 Mar 2010 22:32:12 +0200 + +binutils (2.20.1-3ubuntu5) lucid; urgency=low + + * Rebuild statically linked ld.static binary against recent libc. + + -- Matthias Klose Sun, 18 Apr 2010 23:50:53 +0200 + +binutils (2.20.1-3ubuntu4) lucid; urgency=low + + * Apply patch for PR gas/11456: Use memcpy to copy overlap memory. + + -- Matthias Klose Wed, 31 Mar 2010 19:10:39 +0200 + +binutils (2.20.1-3ubuntu3) lucid; urgency=low + + * Fix versioned dependency in binutils shlibs file. + + -- Matthias Klose Wed, 31 Mar 2010 04:02:51 +0200 + +binutils (2.20.1-3ubuntu2) lucid; urgency=low + + * Mangle the soname of the binutils libraries to be different than + the default name. Closes: #557620. LP: #548451. + Packaged cross builds should do the same. + * Apply fix for PR ld/11426, taken from the trunk. + + -- Matthias Klose Tue, 30 Mar 2010 23:46:50 +0200 + +binutils (2.20.1-3ubuntu1) lucid; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Sun, 21 Mar 2010 13:42:52 +0100 + +binutils (2.20.1-3) unstable; urgency=low + + * binutils-gold: Install the gold binary as `gold' as well, as proposed + by a patch to enable both gold and ld in a single toolchain. + + -- Matthias Klose Sun, 21 Mar 2010 06:43:48 +0100 + +binutils (2.20.1-2ubuntu1) lucid; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Mon, 08 Mar 2010 18:25:25 +0100 + +binutils (2.20.1-2) unstable; urgency=low + + * Fix version in debian/*shlibs to match the release version; + the 2.20.1 upstream release identifies as 2.20.1.20100303. + + -- Matthias Klose Mon, 08 Mar 2010 18:01:22 +0100 + +binutils (2.20.1-1ubuntu1) lucid; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Mon, 08 Mar 2010 13:11:53 +0100 + +binutils (2.20.1-1) unstable; urgency=low + + * New upstream release. + * Don't set has_ifunc_symbols if the symbol comes from a shared library + (backport from the trunk). + * Don't include documentation files in the -cross packages. + Closes: #571522. LP: #514509. + * Fix typo in ld documentation. LP: #497923. + * Add readelf --unwind support for ARM. + + -- Matthias Klose Mon, 08 Mar 2010 04:47:46 +0100 + +binutils (2.20-6ubuntu3) lucid; urgency=low + + * Apply updates from the 2.20 branch up to 20100216 + - Apply patch to fix R_ARM_THM_JUMP24 relocation truncated bug. + * Don't set has_ifunc_symbols if the symbol comes from a shared library + (backport from the trunk). + + -- Matthias Klose Fri, 19 Feb 2010 17:19:09 +0100 + +binutils (2.20-6ubuntu2) lucid; urgency=low + + * Apply updates from the 2.20 branch up to 20100216 + - Fix broken global Thumb to ARM branches. + + -- Matthias Klose Tue, 16 Feb 2010 18:32:35 +0100 + +binutils (2.20-6ubuntu1) lucid; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Fri, 05 Feb 2010 20:30:59 +0100 + +binutils (2.20-6) unstable; urgency=low + + * Apply updates from the 2.20 branch up to 20100205 + - 135_arm_dis_thumb2.dpatch: Remove, applied upstream. + - 136_gold_gnu_debuglink.dpatch: Remove, applied upstream. + * armel: Fix ld-shared/shared.exp and ld-elfvsb/elfvsb.exp failures + (proposed patch, Matthew Gretton-Dann). Closes: #564685. LP: #446478. + * Fix PR other/42602: demangling a global constructors symbol. + Closes: #561150. + + -- Matthias Klose Fri, 05 Feb 2010 20:01:20 +0100 + +binutils (2.20-5ubuntu1) lucid; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Sat, 09 Jan 2010 12:13:43 +0100 + +binutils (2.20-5) unstable; urgency=low + + * Apply updates from the 2.20 branch up to 20100109 + * Apply patches from the trunk: + - [arm] Prevent disassembler from aborting on an invalid Thumb2 instruction. + - Fix PR gold/11072: Discard .gnu_debuglink sections. Closes: #563366. + - Fix PR ld/11138: internal error when DSO is before object files. + Closes: #562822. + - Fix PR gold/11042: COPY relocs need for the dynamic object. + Closes: #559183. + - Fix PR gold/10916: Fix --exclude-libs with undefined symbol. + Closes: #555012. + - Fix PR gold/10979: gold linker crashes. Closes: #553916. + - Fix PR gas/10740: Intel syntax far jumps broken. Closes: #541535. + + -- Matthias Klose Sat, 09 Jan 2010 10:43:04 +0100 + +binutils (2.20-4ubuntu4) lucid; urgency=low + + * ARM - Fix b / bl ranges for Thumb2 (Ramana Radhakrishnan). + + -- Matthias Klose Mon, 21 Dec 2009 13:38:09 +0100 + +binutils (2.20-4ubuntu3) lucid; urgency=low + + * [arm] Prevent disassembler from aborting on an invalid Thumb2 instruction, + taken from the trunk. + + -- Matthias Klose Thu, 19 Nov 2009 18:48:28 +0100 + +binutils (2.20-4ubuntu1) lucid; urgency=low + + * On armel build with -marm; the testsuite is not ready to be run with + -mthumb. + + -- Matthias Klose Thu, 12 Nov 2009 01:10:33 +0100 + +binutils (2.20-4) unstable; urgency=low + + * Fix binutils-gold update. Closes: #555734. + * Don't configure gold for spu on powerpc. + + -- Matthias Klose Wed, 11 Nov 2009 23:33:20 +0100 + +binutils (2.20-3ubuntu1) lucid; urgency=low + + * Merge with Debian; remaining changes: + - Build binutils-static. + + -- Matthias Klose Tue, 10 Nov 2009 11:14:38 +0100 + +binutils (2.20-3) unstable; urgency=low + + * Apply updates from the 2.20 branch up to 20091108: + - Fix PR gold/10876 (closes: #553435), PR gold/10910, PR gold/10860, + PR gold/10880 (closes: #553512, #553436), PR gold/10887, + PR gold/10893, PR gold/10895 (thanks to Peter Fritzsche for tracking + the gold reports). + * Fix libiberty build failure on sh4 (Nobuhiro Iwamatsu). Closes: #550810. + * PR ld/10858: Fix pie on mips/mipsel. Closes: #526961. + * Ignore regressions on sparc; the proper fix is to fix the testcases + for v9. + * Remove the conflict between binutils-multiarch and binutils-gold. + Closes: #521106. + + -- Matthias Klose Tue, 10 Nov 2009 02:15:41 +0100 + +binutils (2.20-2) unstable; urgency=high + + * Apply updates from the 2.20 branch up to 20091028: + - Fix PR binutils/10802, PR binutils/10793, PR binutils/10792, + PR gas/10856. + - Remove local patches now in the branch. + * Ignore regressions on armel when building with gcc-4.4; the proper fix + is to build the testcases using -fno-section-anchors. + + -- Matthias Klose Thu, 29 Oct 2009 22:17:42 +0100 + +binutils (2.20-1ubuntu3) lucid; urgency=low + + * Work around build failure on powerpc, disable the gold build; re-enable + it later with a proper fix. + * Ignore regressions on sparc; the proper fix is to fix the testcases + for v9. + + -- Matthias Klose Sat, 31 Oct 2009 12:21:59 +0100 + +binutils (2.20-1ubuntu2) lucid; urgency=low + + * Don't build just on armel and i386. + + -- Matthias Klose Fri, 30 Oct 2009 14:51:13 +0100 + +binutils (2.20-1ubuntu1) lucid; urgency=low + + * Apply updates from the 2.20 branch up to 20091028: + - Fix PR binutils/10802, PR binutils/10793, PR binutils/10792, + PR gas/10856. + - Remove local patches now in the branch. + * Ignore regressions on armel; the proper fix is to build the + testcases using -fno-section-anchors. + + -- Matthias Klose Fri, 30 Oct 2009 01:27:43 +0100 + +binutils (2.20-1) unstable; urgency=low + + * binutils 2.20 final release. + - Fix PR binutils/10785, memory corruptions. + - PR ld/10749, ia64 linker failure. + - PR gas/2117, ia64 assembler fix. + - gold updates. + * Configure with --enable-plugins. Closes: #550088. + * debian/test-suite-compare.py: Don't count untested test cases as + regressions. + * binutils-gold: Install /usr/lib/compat-ld/ld to point to the + old linker. To use the old linker when gold is installed, use + gcc -B/usr/lib/compat-ld/ (including the trailing slash). + + -- Matthias Klose Sat, 17 Oct 2009 12:22:30 +0200 + +binutils (2.20-0ubuntu2) karmic-proposed; urgency=low + + * Fix PR gas/10856, wrong code with assembler files in intel syntax. + Patch taken from the 2.20 branch. LP: #461303. + + -- Matthias Klose Wed, 28 Oct 2009 09:46:50 +0100 + +binutils (2.20-0ubuntu1) karmic; urgency=low + + * binutils 2.20 final release. + - Fix PR binutils/10785, memory corruptions. + - gold updates. LP: #453278. + * debian/*.shlibs: Update to the release version. LP: #452526. + * Fix build failure on arm, building from the release tarball. + + -- Matthias Klose Sat, 17 Oct 2009 11:14:00 +0200 + +binutils (2.19.91.20091014-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20091014. + - PR ld/10749, ia64 linker failure. + - PR gas/2117, ia64 assembler fix. + * debian/*.shlibs: Update to the version from the branch. + * Fix build failures for cross build. + + -- Matthias Klose Wed, 14 Oct 2009 14:55:40 +0200 + +binutils (2.19.91.20091006-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20091006. + - cfi_sections changes applied, remove 129_cfi_sections.dpatch. + * debian/*.shlibs: Update to the version from the branch. + * binutils-gold: Build the testsuite as part of the check target + instead of the build target to avoid build failures when the + installed binutils soname is the same as the one which is built + (gas is segfaulting). Just a workaround, not a solution. + + -- Matthias Klose Tue, 06 Oct 2009 18:14:37 +0200 + +binutils (2.19.91.20091005-0ubuntu2) karmic; urgency=low + + * Really re-enable the binutils-gold build on powerpc. + + -- Matthias Klose Tue, 06 Oct 2009 13:53:22 +0200 + +binutils (2.19.91.20091005-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20091005. + - no changes, bump the soname only. + * debian/*.shlibs: Update to the version from the branch. + * Re-enable the binutils-gold build on powerpc. + * Add 129_cfi_sections.dpatch, support for .cfi_sections, taken + from the trunk. LP: #440172. + * Add 150_gold_copyrelocs.dpatch, add -z copyrelocs option for gold. + + -- Matthias Klose Tue, 06 Oct 2009 10:31:58 +0200 + +binutils (2.19.91.20091003-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20091003. + - powerpc fixes. + * debian/*.shlibs: Update to the version from the branch. + * Reenable binutils-gold build on armel (build failures on just + one buildd). + * Disable binutils-gold build on powerpc, fails to build with the + version in the archive. + * binutils-source: Depend on texinfo, zlib1g-dev. + + -- Matthias Klose Tue, 06 Oct 2009 10:16:47 +0200 + +binutils (2.19.91.20091001-0ubuntu2) karmic; urgency=low + + * Don't build binutils-gold for armel, currently ftbfs. + + -- Matthias Klose Thu, 01 Oct 2009 23:54:41 +0200 + +binutils (2.19.91.20091001-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20091001. + - Fix PR ld/9863, regression in testsuite on armel. + - Fix regressions seen in the GCC/libjava testsuite. + * debian/*.shlibs: Update to the version from the branch. + * No need to build libiberty_pic.a twice. + + -- Matthias Klose Thu, 01 Oct 2009 16:53:04 +0200 + +binutils (2.19.91.20090923-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20090923 (last upload + was taken from the trunk).. + * debian/*.shlibs: Update to the version from the branch. + + -- Matthias Klose Wed, 23 Sep 2009 09:44:40 +0200 + +binutils (2.19.91.20090922-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20090922. + * debian/*.shlibs: Update to the version from the branch. + + -- Matthias Klose Tue, 22 Sep 2009 22:01:19 +0200 + +binutils (2.19.91.20090910-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20090910, corresponding + to the 2.19.90 upstream snapshot. + * Fix Thumb-2 shared libraries (Daniel Jacobowitz), patch taken + from the trunk. + * Update binutils-sec64k patch (H.J. Lu). + + -- Matthias Klose Thu, 10 Sep 2009 17:21:56 +0200 + +binutils (2.19.90.20090909-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the 2.20 release branch 20090909. + * debian/*.shlibs: Update to the version from the branch. + + -- Matthias Klose Wed, 09 Sep 2009 10:01:29 +0200 + +binutils (2.19.51.20090827-1ubuntu1) karmic; urgency=low + + * Merge with Debian unstable; remaining changes: + - Build binutils-static and binutils-static-udeb packages. + - Apply patches derived from the binutils HJL release. + + -- Matthias Klose Fri, 28 Aug 2009 13:49:57 +0200 + +binutils (2.19.51.20090827-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20090827. + - Fix PR ld/10518: In linker scripts override a "*" match by any other + wildcard match. Closes: #540751. + * debian/*.shlibs: Update to the version from the trunk. Closes: #540800. + * Add sysroot support for cross builds (Hector Oron). Closes: #522480. + * Update long description of binutils-doc. Closes: #428764. + * Update build-dependency on autoconf. + * Fix some lintian warnings. + + -- Matthias Klose Thu, 27 Aug 2009 17:09:28 +0200 + +binutils (2.19.51.20090805-1ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090805. + * debian/*.shlibs: Update to the version from the trunk. + - Fix PR binutils/10364, strip not failing on unwritable files. + Closes: #276428. + - Fix PR binutils/10363, objdump -T crashing on corrupted file. + Closes: #487963. + * 129_cortex_a8.dpatch: Fix a couple of cortex-a8 erratum bugs. + + -- Matthias Klose Wed, 05 Aug 2009 10:29:44 +0200 + +binutils (2.19.51.20090723-1ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090723. + * debian/*.shlibs: Update to the version from the trunk. + * Apply build-id patch to avoid memory corruption (taken from Fedora). + + -- Matthias Klose Thu, 23 Jul 2009 13:47:19 +0200 + +binutils (2.19.51.20090714-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090714. + - Fix PR gas/10387 (branch instruction with no operand causes gas + to segfault on armel). LP: #396049. + - 128_arm_eabi_align64.dpatch: Remove, integrated upstream. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Tue, 14 Jul 2009 12:48:09 -0400 + +binutils (2.19.51.20090713-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090713. + * debian/*.shlibs: Update to the version from the trunk. + * 128_arm_eabi_align64.dpatch: Adjust expected output to changed objdump + output. LP: #398732. + + -- Matthias Klose Mon, 13 Jul 2009 13:21:56 -0400 + +binutils (2.19.51.20090704-1ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090704. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Sat, 04 Jul 2009 11:46:03 +0200 + +binutils (2.19.51.20090704-1) unstable; urgency=low + + * Snapshot, taken from the trunk 20090704. + - debian/patches/128_arm_eabi_auto_it.dpatch: Remove, applied upstream. + * debian/*.shlibs: Update to the version from the trunk. + * Bump standards version. + + -- Matthias Klose Sat, 04 Jul 2009 10:37:18 +0200 + +binutils (2.19.51.20090622-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090622. + - debian/patches/128_arm_eabi_auto_it.dpatch: Remove, applied upstream. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Tue, 23 Jun 2009 01:36:34 +0200 + +binutils (2.19.51.20090620-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090620. + * debian/*.shlibs: Update to the version from the trunk. + * Build the binutils-gold package on armel. + * Update hjl patches from the binutils-2.19.51.0.10 release. + + -- Matthias Klose Sat, 20 Jun 2009 22:56:32 +0200 + +binutils (2.19.51.20090616reallz0515-0ubuntu1) karmic; urgency=low + + * Reupload snapshot from trunk 20090515. + * Apply proposed patch to augment maximum alignment size to 64 (ARM gas). + * Apply proposed patch for new option for automatically generating IT blocks. + + -- Matthias Klose Wed, 17 Jun 2009 23:02:25 +0000 + +binutils (2.19.51.20090515-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090515. + - Fix PR ld/10152. LP: #375991. + * Revert work-around from last upload. + * debian/*.shlibs: Update to the version from the trunk. + * Build the binutils-gold package again. + + -- Matthias Klose Fri, 15 May 2009 16:34:56 +0200 + +binutils (2.19.51.20090508-0ubuntu2) karmic; urgency=low + + * Revert change for ARM unwind table linker processing. Addresses #375991. + + -- Matthias Klose Wed, 13 May 2009 17:46:20 +0200 + +binutils (2.19.51.20090508-0ubuntu1) karmic; urgency=low + + * Snapshot, taken from the trunk 20090508. + * debian/*.shlibs: Update to the version from the trunk. + + -- Matthias Klose Fri, 08 May 2009 11:22:40 +0200 + +binutils (2.19.51.20090423-0ubuntu2) karmic; urgency=low + + * Snapshot, taken from the trunk 20090423. + * debian/*.shlibs: Update to the version from the trunk. + * Fix build failure when building with -Os. + * debian/patches/013_bash_in_ld_testsuite.dpatch: Update. + + -- Matthias Klose Fri, 24 Apr 2009 12:29:23 +0200 + +binutils (2.19.1-0ubuntu3) jaunty; urgency=low + + * Re-add -a to dpkg-architecture call; the addition of -f is all what's + needed to ignore the dpkg-architecture env set by dpkg-buildpackage (since + we don't care about the DEB_BUILD_* or DEB_HOST_* arches but only about + the TARGET arch). + + -- Loic Minier Tue, 10 Feb 2009 16:42:28 +0100 + +binutils (2.19.1-0ubuntu2) jaunty; urgency=low + + * binutils-source: Make .dpatch files executable. + * Use dpkg-architecture -f instead of -a for cross builds. + * Call pkg_create_dbgsym explicitly to build debug symbols packages. + LP: #322243. + + -- Matthias Klose Tue, 10 Feb 2009 12:05:51 +0100 + +binutils (2.19.1-0ubuntu1) jaunty; urgency=low + + * Binutils 2.19.1 release. + - 128_arm_relocs_against_weak.dpatch 129_scale-DW_CFA_advance_loc.dpatch: + Remove, applied upstream. + * debian/*.shlibs: Update to the release version. + + -- Matthias Klose Wed, 04 Feb 2009 10:14:33 +0100 + +binutils (2.19.0.20090110-0ubuntu1) jaunty; urgency=low + + * Update to the binutils-2_19-branch 20090110. + - Fix PR binutils/7011. LP: #254790. + * debian/*.shlibs: Update to the version from the branch. + + -- Matthias Klose Sat, 10 Jan 2009 13:47:35 +0100 + +binutils (2.19-0ubuntu3) jaunty; urgency=low + + * debian/patches/129_scale-DW_CFA_advance_loc.dpatch: Scale + DW_CFA_advance_loc[124] output values. + * debian/patches/128_arm_relocs_against_weak.dpatch: Fix R_ARM_THM_CALL + relocations against undefined weak symbols in shared libraries. + + -- Matthias Klose Sat, 29 Nov 2008 11:25:22 +0100 + +binutils (2.19-0ubuntu2) jaunty; urgency=low + + * No-change rebuild to remove translations from the binary package, + accidentally included due to a misbuild. + + -- Steve Langasek Fri, 21 Nov 2008 04:35:45 +0000 + +binutils (2.19-0ubuntu1) jaunty; urgency=low + + * Binutils 2.19 release. + * debian/*.shlibs: Update to the release version. + * debian/control: Update to GPL3, reference the GFDL. + * Make lintian more happy. + + -- Matthias Klose Thu, 30 Oct 2008 15:37:05 +0100 + +binutils (2.18.93.20081009-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the 2.19 branch 20081009 (corresponding to the + 2.18.93 upstream snapshot. + * debian/*.shlibs: Update to the version from the branch. + * In gprof(1), remove references to monitor(3) and profil(2). + + -- Matthias Klose Wed, 08 Oct 2008 15:27:50 +0200 + +binutils (2.18.92.20081003-0ubuntu2) intrepid; urgency=low + + * Add build dependency on zlib1g-dev. + + -- Matthias Klose Tue, 07 Oct 2008 12:52:33 +0200 + +binutils (2.18.92.20081003-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the 2.19 branch 20081003 (corresponding to the + 2.18.92 upstream snapshot. + * Stop building binutils-gold for the intrepid release (still + experimental). + * debian/*.shlibs: Update to the version from the branch. + + -- Matthias Klose Fri, 03 Oct 2008 11:16:43 +0000 + +binutils (2.18.91.20080923-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the 2.19 branch 20080923 (corresponding to the + 2.18.91 upstream snapshot. + * debian/*.shlibs: Update to the version from the branch. + * debian/patches/201-hjl-bfd-ref_addr.dpatch: Remove, integrated upstream. + * Fail the build if the testsuite shows regressions compared to the + last (installed) build. + + -- Matthias Klose Tue, 23 Sep 2008 13:22:34 +0200 + +binutils (2.18.90.20080910-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the 2.19 branch 20080910. + - No testsuite regressions on amd64, i386, lpia, sparc. + * debian/*.shlibs: Update to the version from the branch. + * debian/patches/201-hjl-bfd-ref_addr.dpatch: Update. + + -- Matthias Klose Sat, 13 Sep 2008 19:40:31 +0200 + +binutils (2.18.50.20080814-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080814. + * debian/*.shlibs: Update to the version from the trunk. + * debian/patches/201-hjl-bfd-ref_addr.dpatch: Update. + * debian/patches/209-hjl-binutils-error.dpatch: Likewise. + + -- Matthias Klose Thu, 14 Aug 2008 16:37:01 +0000 + +binutils (2.18.50.20080806-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080806. + - Fix PR ld/6656, disable gas generated debug info if compiler generated + debug info is seen. LP: #240884. Closes: #481592. + * debian/*.shlibs: Update to the version from the trunk. + * Build binutils-gold for powerpc. + + -- Matthias Klose Wed, 06 Aug 2008 08:39:52 +0200 + +binutils (2.18.50.20080707-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080707. + * debian/*.shlibs: Update to the version from the trunk. + * include/safe-ctype.h: Add #include of ctype.h before redefining + the ctype.h macros (proposed for the trunk). + + -- Matthias Klose Mon, 07 Jul 2008 10:21:30 +0000 + +binutils (2.18.50.20080610-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080610. + * debian/*.shlibs: Update to the version from the trunk. LP: #237461. + + -- Matthias Klose Tue, 10 Jun 2008 17:18:50 +0200 + +binutils (2.18.50.20080530-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080530. + - gold recognizes -z relro and -z norelro. + * debian/rules: Explicitely set SHELL to /bin/bash, build-depend on bash. + * debian/rules: Fix setting of TARGET for cross builds. + * binutils-static: Remove dependency on libc6. LP: #184582. + + -- Matthias Klose Fri, 30 May 2008 23:55:07 +0200 + +binutils (2.18.50.20080509-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080509. + * Add -Wno-format-security to CFLAGS, CXXFLAGS, due to picky default + hardening options. + * Let gold ignore -z relro and -z norelro for now. + * Build gold with -Wno-error. + + -- Matthias Klose Fri, 09 May 2008 11:09:24 +0200 + +binutils (2.18.50.20080507-0ubuntu1) intrepid; urgency=low + + * Snapshot, taken from the trunk 20080507. + * Remove patches applied upstream: 304_pr4476.dpatch, 305_arm-dis.dpatch, + 306_pr4453.dpatch, 307_ld-pic.dpatch, 308_mips-pic.dpatch, + 311_pr5006.dpatch, 312_pr5011.dpatch, 313_pr5025.dpatch. + * Update patches from the hjl releases: 200-hjl-ld-env (not applied), + 206-hjl-binutils-shr.dpatch (not applied), + * Remove patches from the hjl release: 204-hjl-binutils-tls-relro.dpatch, + 208-hjl-libtool-relink.dpatch, 209-hjl-binutils-error.dpatch, + 210-hjl-binutils-signed.dpatch, + * New patches from the hjl release: 212-hjl-bfd-64k.dpatch. + * debian/*.shlibs: Update to the version from the trunk. + * On amd64, i386, lpia and sparc, build a binutils-gold package, + diverting /usr/bin/ld. + + -- Matthias Klose Wed, 07 May 2008 17:41:05 +0200 + +binutils (2.18.1~cvs20080103-4ubuntu1) hardy; urgency=low + + * Merge with Debian unstable; remaining changes: + - Build binutils-static and binutils-static-udeb packages. + + -- Matthias Klose Tue, 22 Apr 2008 12:02:51 +0200 + +binutils (2.18.1~cvs20080103-4) unstable; urgency=medium + + * debian-rules: Remove libiberty in /usr/lib64; workaround for + `gcc -print-multi-os-directory' printing the symlink. + Closes: #473665, #473591. + * Don't include development fiiles in binutils-spu. + * Fix binutils-spu build on ppc64 (Andreas Jochens). Closes: #474116. + * Build libiberty with -fPIC on mips/mipsel (Aurelian Jarno). + + -- Matthias Klose Sat, 05 Apr 2008 11:21:08 +0200 + +binutils (2.18.1~cvs20080103-3) unstable; urgency=low + + [ Arthur Loiret ] + * Build a binutils for spu-elf target on powerpc and ppc64. + - debian/control: Add a binutils-spu package. + - debian/binutils-spu.{postinst,postrm,shlibs}: Add. + * Add sh64-linux-gnu to multiarch targets. + * Fix cross-compilation support. + * Make lintian happier: + - Use ${source:Version}, ${binary:Version} variables. + - Remove -1 from Build-Depends revisions. + - Bump Standards-Version to 3.7.3. + + [ Matthias Klose ] + * Keep the spu elfscripts in bintutils, remove them from binutils-spu. + * debian/patches/307_ld-pic.dpatch: Fix failing ld-shared tests when built + with gcc-4.3. + + -- Matthias Klose Sat, 29 Mar 2008 20:32:35 +0100 + +binutils (2.18.1~cvs20080103-2) unstable; urgency=low + + * debian/patches/306_pr4453.dpatch: Fix PR binutils/4453, taken from + the trunk (Aurelian Jarno). Closes: #363423. + + -- Matthias Klose Fri, 21 Mar 2008 20:49:17 +0100 + +binutils (2.18.1~cvs20080103-0ubuntu1) hardy; urgency=low + + * Update to 20080103 from the binutils-2_18-branch. + - Set version number to 2.18.0 (smaller than the one from the trunk). + * debian/*.shlibs: Update to version from the branch. + * debian/patches/305_arm-dis.dpatch: Fix segfault when disassembling ARM + code. Closes: #438956. + + -- Matthias Klose Thu, 03 Jan 2008 21:26:56 +0000 + +binutils (2.18.1~cvs20071027-1ubuntu2) hardy; urgency=low + + * Do not include static libraries in the multiarch package. + * Install a libiberty compiled with -fPIC as libiberty_pic.a. + LP: #50512. + * Don't include /usr/lib64 for cross packages. Closes: #450429. + + -- Matthias Klose Fri, 23 Nov 2007 12:14:31 +0000 + +binutils (2.18.1~cvs20071027-1ubuntu1) hardy; urgency=low + + * Update to 20071027 from the binutils-2_18-branch. + - Fix PR ld/4988, assertion failures in ld. Closes: #440015. + * debian/*.shlibs: Update to version from the branch. + * Drop the build dependency on expect-tcl8.3, don't run the + testsuite on hppa. + + -- Matthias Klose Sat, 27 Oct 2007 17:33:13 +0000 + +binutils (2.18-1ubuntu1) hardy; urgency=low + + * Rebuild using gcc-4.2. + + -- Matthias Klose Sun, 21 Oct 2007 08:31:26 +0000 + +binutils (2.18-1) unstable; urgency=low + + [ Matthias Klose ] + * New upstream release. + - Remove patches applied upstream: 100_warning_arm, 400_gcc42_fix, + 401_builddoc. + * debian/*.shlibs: Update to release version. + + -- Matthias Klose Wed, 29 Aug 2007 01:07:31 +0200 + +binutils (2.18-0ubuntu3) gutsy; urgency=low + + * Apply patches for: + - PR binutils/5011, readelf reads past end of buffer. + - PR ld/5025, downgrade error to a warning if .note.gnu.build-id + has been discarded. + + -- Matthias Klose Wed, 19 Sep 2007 00:31:23 +0200 + +binutils (2.18-0ubuntu2) gutsy; urgency=low + + * Apply fix for PR ld/5008, taken from the trunk. + + -- Matthias Klose Sun, 09 Sep 2007 22:08:19 +0200 + +binutils (2.18-0ubuntu1) gutsy; urgency=low + + * Final 2.18 release. + * debian/*.shlibs: Update to release version. + + -- Matthias Klose Wed, 29 Aug 2007 13:22:09 +0200 + +binutils (2.18~cvs20070827-0ubuntu1) gutsy; urgency=low + + * New upstream CVS snapshot, taken from the binutils-2_18-branch. + - Remove patches applied upstream: 311_sse4_intel_mode, 400_gcc42_fix, + 401_builddoc. + * debian/*.shlibs: Update to snapshot version. + + -- Matthias Klose Mon, 27 Aug 2007 19:30:21 +0200 + +binutils (2.18~cvs20070812-0ubuntu1) gutsy; urgency=low + + * New upstream CVS snapshot, taken from the binutils-2_18-branch. + * debian/rules: Support parallel= with comma separated keywords + in DEB_BUILD_OPTIONS. + * debian/rules (clean): Remove stamp files. + * debian/*.shlibs: Update to snapshot version. + * debian/patches/401_builddoc.dpatch: Fix doc build failure on the branch. + * debian/patches/311_sse4_intel_mode.dpatch: Fix SSE4 for Intel mode. + * Update patches: 200-hjl-ld-env (not applied), 203-hjl-binutils-indirect, + 204-hjl-binutils-tls-relro, 209-hjl-binutils-error, + * Remove patches: 201-hjl-bfd-dwarf-dup.dpatch, 201-hjl-bfd-dwarf-dup, + 205-hjl-bfd-kept, 208-hjl-libtool-relink. + * New patches: 210-hjl-binutils-signed, 211-hjl-binutils-weakdef. + + -- Matthias Klose Sun, 12 Aug 2007 12:42:57 +0200 + +binutils (2.17.20070804cvs-0ubuntu1) gutsy; urgency=low + + * New upstream CVS snapshot. + - PR binutils/4888, fixes objcopy --only-keep-debug. Closes: #435444. + * debian/rules: Support parallel= in DEB_BUILD_OPTIONS (see #209008). + * debian/*.shlibs: Update to snapshot version. + * Build using the default compiler on all architectures. + + -- Matthias Klose Sat, 04 Aug 2007 11:29:10 +0000 + +binutils (2.17.20070801cvs-0ubuntu2) gutsy; urgency=low + + * Build-depend on gcc-4.1 on lpia, since we're calling it explicitly. + + -- Adam Conrad Fri, 3 Aug 2007 13:24:26 +1000 + +binutils (2.17.20070801cvs-0ubuntu1) gutsy; urgency=low + + * CVS snapshot 20070801, taken from the trunk. + - Fixes objcopy --only-keep-debug on amd64. + + -- Matthias Klose Wed, 01 Aug 2007 18:46:10 +0200 + +binutils (2.17.20070718cvs-0ubuntu2) gutsy; urgency=low + + * debian/patches/305_ungetc.dpatch: Allow UNGETC to work with empty buffer, + taken from CVS HEAD. + + -- Matthias Klose Fri, 20 Jul 2007 12:47:44 +0200 + +binutils (2.17.20070718cvs-0ubuntu1) gutsy; urgency=low + + * CVS snapshot 20070718, taken from the trunk. + * Fix cross build failure while stripping binaries. Closes: #432907. + + -- Matthias Klose Wed, 18 Jul 2007 15:19:15 +0000 + +binutils (2.17.20070713cvs-0ubuntu2) gutsy; urgency=low + + * Fix build failure with gcc-4.2. + + -- Matthias Klose Tue, 17 Jul 2007 11:09:25 +0000 + +binutils (2.17.20070713cvs-0ubuntu1) gutsy; urgency=low + + * CVS snapshot 20070713, taken from the trunk. + - Remove patches applied upstream: 301_pr4436.dpatch, 302_pr4448.dpatch, + 303_pr4454.dpatch, 305_pr4497.dpatch, 306_ld_demangler_segfault.dpatch, + 307_pr4558.dpatch. + * Update hjl patches: + - Remove 207-hjl-libtool-archive.dpatch. + - Add 201-hjl-bfd-dwarf-dup.dpatch, 209-hjl-binutils-error.dpatch. + - Update 200-hjl-ld-env.dpatch, 201-hjl-bfd-ref_addr.dpatch, + 204-hjl-binutils-tls-relro.dpatch, hjl-binutils-shr.dpatch. + * debian/copyright: Include GPL-3. + * debian/rules: Fix version extraction. + * debian/rules: Honor `noopt' in DEB_BUILD_OPTIONS. Closes LP: #65607. + * debian/patches/013_bash_in_ld_testsuite.dpatch: Use bash in the ld + testsuite. Closes LP: #124435. + + -- Matthias Klose Fri, 13 Jul 2007 15:43:07 +0200 + +binutils (2.17.20070426cvs-7ubuntu2) gutsy; urgency=low + + * Fix PR gas/4558. + + -- Matthias Klose Mon, 28 May 2007 08:48:33 +0000 + +binutils (2.17.20070426cvs-7ubuntu1) gutsy; urgency=low + + * Merge with Debian. + + -- Matthias Klose Fri, 25 May 2007 08:24:08 +0200 + +binutils (2.17cvs20070426-7) unstable; urgency=low + + * 306_ld_demangler_segfault.dpatch: new CVS patch from Alan Modra to fix + segfaults in ld seen when building, e.g. openipmi. + + * debian/copyright: update source location and copyright years. + * debian/rules: idem. + + -- James Troup Wed, 23 May 2007 02:19:09 +0100 + +binutils (2.17cvs20070426-6) unstable; urgency=low + + * Fix PR ld/4497, regression introduced with the fix for PR ld/4454. + Closes: #423496. + * Fix binutils/4476, readelf support for --hash-style=gnu. Closes: #421790. + + -- Matthias Klose Mon, 14 May 2007 10:51:40 +0200 + +binutils (2.17cvs20070426-5) unstable; urgency=low + + * Fix PR ld/4454. + + -- Matthias Klose Sun, 06 May 2007 09:50:29 +0200 + +binutils (2.17cvs20070426-4) unstable; urgency=low + + * Fix PR gas/4448, overstrict check for powerpc lswi. Closes: #421799. + + -- Matthias Klose Wed, 2 May 2007 18:26:03 +0200 + +binutils (2.17cvs20070426-3) unstable; urgency=low + + * Update debian/*.shlibs files. Closes: #421454. + * Fix PR gas/4436, wrong reject in powerpc opcode table checks. + Closes: #421455. + * Fix build failure on arm (Aurelian Jarno). Closes: #421365. + * Compare testsuite results of the installed binutils with the built one. + + -- Matthias Klose Mon, 30 Apr 2007 07:47:09 +0200 + +binutils (2.17.20070426cvs-2ubuntu7) gutsy; urgency=low + + * Fix PR ld/4497, regression introduced with the fix for PR ld/4454. + + -- Matthias Klose Mon, 14 May 2007 08:13:50 +0000 + +binutils (2.17.20070426cvs-2ubuntu6) gutsy; urgency=low + + * Fix binutils/4476, readelf support for --hash-style=gnu. + + -- Matthias Klose Thu, 10 May 2007 07:32:28 +0000 + +binutils (2.17.20070426cvs-2ubuntu5) gutsy; urgency=low + + * Fix PR ld/4454. + + -- Matthias Klose Sun, 06 May 2007 13:02:11 +0000 + +binutils (2.17.20070426cvs-2ubuntu4) gutsy; urgency=low + + * Fix PR gas/4448, overstrict check for powerpc lswi. + + -- Matthias Klose Wed, 2 May 2007 13:42:10 +0200 + +binutils (2.17.20070426cvs-2ubuntu3) gutsy; urgency=low + + * Update debian/*.shlibs files. + * Fix PR gas/4436, wrong reject in powerpc opcode table checks. + + -- Matthias Klose Mon, 30 Apr 2007 08:02:30 +0200 + +binutils (2.17.20070426cvs-2ubuntu2) gutsy; urgency=low + + * Add binutils-udeb as a dist file with priority optional. + + -- Matthias Klose Fri, 27 Apr 2007 17:27:23 +0200 + +binutils (2.17.20070426cvs-2ubuntu1) gutsy; urgency=low + + * Merge with Debian. + + -- Matthias Klose Fri, 27 Apr 2007 10:16:54 +0200 + +binutils (2.17cvs20070426-2) unstable; urgency=low + + * Fix typo preparing the binutils-hppa64 package. Closes: #421199. + * Compare testsuite results of the installed binutils with the built one. + + -- Matthias Klose Fri, 27 Apr 2007 08:06:49 +0200 + +binutils (2.17cvs20070426-1) unstable; urgency=low + + [ James Troup ] + * New upstream CVS snapshot. + * debian/test-suite-compare.py: simplistic comparator for binutils test + suite runs. + + [ Matthias Klose ] + * Merge changes from the experimental uploads: + * debian/patches/121_i386_x86_64_biarch.dpatch: Remove, applied upstream. + * Build a binutils-source package (containing the patched sources). + * Check for a working expect before building the package. + * Configure the multiarch build for x86_64-linux-gnu instead of + x86_64-linux. + * debian/rules: Don't strip binaries if nostrip is in DEB_BUILD_OPTIONS. + * debian/rules: Don't try to strip shell scripts. + * Configure --with-pkgversion to include the distribution name. + * debian/patches/000_print_debian_version.dpatch: Remove. + * debian/control: Build-depend on lsb-release. + * Enable spu target in powerpc and binutils-multiarch build. + * Don't include embedspu in binutils-multiarch on powerpc. + * debian/control: Set priority for source package to optional. + + -- James Troup Fri, 27 Apr 2007 01:29:57 +0100 + +binutils (2.17.20070420cvs-0ubuntu1) gutsy; urgency=low + + * CVS snapshot 20070420, taken from the trunk. + - debian/patches/007_binutils_soversion.dpatch: Remove, applied upstream. + + -- Matthias Klose Fri, 20 Apr 2007 13:46:05 +0200 + +binutils (2.17.20070406cvs-0ubuntu1) toolchain-test; urgency=low + + * CVS snapshot 20070406, taken from the trunk. + * Do not apply: 200-hjl-ld-env. + * Enable spu target in powerpc, ppc64 builds and in the + binutils-multiarch build. + * Don't include embedspu in binutils-multiarch on powerpc, ppc64. + Closes: #411486. + + -- Matthias Klose Fri, 6 Apr 2007 06:57:41 +0200 + +binutils (2.17.20070329cvs-0ubuntu1) toolchain-test; urgency=low + + * CVS snapshot 20070329, taken from the trunk. + * Patches from the hjl 2.17.50.0.13 release: + - 202-hjl-binutils-check-phdr: Remove, applied upstream. + - 205-hjl-bfd-kept.dpatch: Address the link speed issue by caching + the result of _bfd_elf_check_kept_section. + - 206-hjl-binutils-shr.dpatch: Implementation of ELF sharable section + proposal (not applied by default). + - 208-hjl-libtool-relink.dpatch: Avoid unnecessary linker messages + when running "make check". + + -- Matthias Klose Thu, 29 Mar 2007 07:16:28 +0200 + +binutils (2.17.20070321cvs-0ubuntu2) toolchain-test; urgency=low + + * Configure --with-pkgversion, not including the package version, + which may break ld version detection in configure scripts. + * debian/patches/000_cvs_version_string.dpatch: Remove. + * debian/patches/007_binutils_soversion.dpatch: Use date for non-release + builds in soversion. + + -- Matthias Klose Thu, 22 Mar 2007 07:01:14 +0100 + +binutils (2.17.20070321cvs-0ubuntu1) toolchain-test; urgency=low + + * CVS snapshot 20070321, taken from the trunk. + * debian/patches/000_print_{debian,ubuntu}_version.dpatch: Remove. + * debian/control: Build-depend on lsb-release. + * Configure --with-pkgversion to include the distribution name. + * Apply patches from the hjl 2.17.50.0.13 release: + - 200-hjl-ld-env.dpatch: Handle LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS + env vars. + - 201-hjl-bfd-ref_addr.dpatch: Support DW_FORM_ref_addr in Dwarf 2 reader + in linker. + - 202-hjl-binutils-check-phdr.dpatch: Fix PR ld/4007: Linker failed + to issue an error on bad section in segment. + - 203-hjl-binutils-indirect.dpatch: PR ld/3351; avoid linker crash on ia64. + - 204-hjl-binutils-tls-relro.dpatch: PR binutils/3281; objcopy changes + PT_GNU_RELRO when there is PT_TLS. + - 207-hjl-libtool-archive.dpatch: Allow linking against an archive when + building a shared library. + * Set Ubuntu maintainer address. + + -- Matthias Klose Wed, 21 Mar 2007 09:17:21 +0100 + +binutils (2.17.20070210cvs-1ubuntu1) toolchain-test; urgency=low + + * Merge with Debian experimental; remaining changes: + - Build binutils-static and binutils-static-udeb packages. + + -- Matthias Klose Mon, 12 Feb 2007 16:03:23 +0100 + +binutils (2.17.20070210cvs-1) experimental; urgency=low + + * CVS snapshot 20070210, taken from the trunk. + * debian/rules: Don't try to strip shell scripts. + + -- Matthias Klose Sat, 10 Feb 2007 15:59:45 +0100 + +binutils (2.17.20070103cvs-2) experimental; urgency=low + + * Overwrite the VERSION string (date) from the snapshot with + a parsable version string (2.17.50), as found on the trunk. + + -- Matthias Klose Fri, 5 Jan 2007 10:06:09 +0100 + +binutils (2.17.20070103cvs-1) experimental; urgency=low + + * binutils snapshot 20070103, taken from + ftp://sourceware.org/pub/binutils/snapshots/ + * Build a binutils-source package (containing the patched sources). + * Check for a working expect before building the package. + * Configure binutils-multiarch for i486-gnu as well. + * Configure the multiarch build for x86_64-linux-gnu instead of + x86_64-linux. + * debian/rules: Don't strip binaries if nostrip is in DEB_BUILD_OPTIONS. + + -- Matthias Klose Thu, 4 Jan 2007 22:13:54 +0100 + +binutils (2.17.20070103cvs-0ubuntu1) feisty; urgency=low + + * binutils snapshot 20070103, taken from + ftp://sourceware.org/pub/binutils/snapshots/ + * Merge with Debian experimental; remaining changes: + - Build binutils-static and binutils-static-udeb packages. + - Build a binutils-source package (containing the patched + sources). + - Check for a working expect before building the package. + - Configure binutils-multiarch for i486-gnu as well. + * Configure the multiarch build for x86_64-linux-gnu instead of + x86_64-linux. + * debian/rules: Don't strip binaries if nostrip is in DEB_BUILD_OPTIONS. + * Strip binaries in binutils-static and in the binutils udeb. + + -- Matthias Klose Thu, 4 Jan 2007 15:17:45 +0100 + +binutils (2.17.20061210cvs-1) experimental; urgency=low + + * CVS snapshot 20061210, taken from the trunk. + * debian/patches/121_i386_x86_64_biarch.dpatch: Remove, applied upstream. + + -- Matthias Klose Sun, 10 Dec 2006 20:43:41 +0100 + +binutils (2.17.20070103cvs-0ubuntu2) feisty; urgency=low + + * Overwrite the VERSION string (date) from the snapshot with + a parsable version string (2.17.50), as found on the trunk. + + -- Matthias Klose Fri, 5 Jan 2007 09:02:06 +0000 + +binutils (2.17.50.0.6-0ubuntu1) feisty; urgency=low + + [Fabio M. Di Nitto] + + * we are supposed to upload to feisty, aren't we? ;) + + [Jeff Bailey] + + * New upstream snapshot from HJ Lu. + * debian/patches/121_i386_x86_64_biarch: Drop, merged upstream. + + -- Fabio M. Di Nitto Tue, 31 Oct 2006 15:43:58 +0100 + +binutils (2.17-3) unstable; urgency=low + + * debian/rules (configure-multi-stamp): drop i486-kfreebsd-gnu again as + it breaks objdump for i386 on amd64. Closes: #380539 + + -- James Troup Tue, 3 Oct 2006 00:53:17 +0100 + +binutils (2.17-2) unstable; urgency=low + + * The "Laisse le Wookie gagner" release. + + * 127_x86_64_i386_biarch.dpatch: new patch from Aurelien Jarno + to add (/usr)/lib32 to the search paths on + amd64. Closes: #369052 + + * debian/rules (configure-multi-stamp): add i486-kfreebsd-gnu at request + of Aurelien Jarno. Closes: #315306 + + -- James Troup Wed, 26 Jul 2006 20:33:13 +0100 + +binutils (2.17-1ubuntu1) edgy; urgency=low + + * New upstream release. + - ld checks for libs in the same order as ld.so does. Ubuntu #40214. + * Synchronise with Debian unstable. + * Remove patch 122_sparc64_UA2005_instruction_set.dpatch, integrated + upstream. + * Remove patch 130_tekhex_buffer_overflow.dpatch, integrated upstream. + * 122_x86_64_i386_biarch.dpatch: New, search libraries in (/usr)/lib32 on + amd64. Closes: #369052. + * Build a binutils-source package; obsoletes toolchain-source package. + + -- Matthias Klose Wed, 28 Jun 2006 10:29:16 +0200 + +binutils (2.17-1) unstable; urgency=low + + * New upstream release. + * 120_mips_xgot_multigot_workaround.dpatch: removed - superseded by a + proper fix upstream. Closes: #274738 + * debian/binutils.shlibs, debian/binutils-multiarch.shlibs, + debian/binutils-hppa64.shlibs: updated SONAME to 2.17. + + -- James Troup Mon, 26 Jun 2006 13:17:36 +0100 + +binutils (2.16.1cvs20060507-1) unstable; urgency=low + + * New upstream CVS snapshot of 'binutils-2_17-branch'. + + * debian/control (Standards-Version): bump to 3.7.2.0. + + -- James Troup Sun, 7 May 2006 19:57:08 +0100 + +binutils (2.16.1cvs20060413-1) unstable; urgency=low + + * New upstream CVS snapshot. + * 120_mips_xgot_multigot_workaround.dpatch: updated to work with CVS + r1.163 of bfd/elfxx-mips.c, pass 'info' instead of 'output_bfd' to + MIPS_ELF_GOT_MAX_SIZE(). + + * Patch from NIIBE Yutaka in #280884: + * debian/rules (configure-multi-stamp): Support m32r-linux. Closes: + #340264 + * debian/rules: Run 'make check' only if build == host. + + * debian/rules: Also don't run 'make check' if nocheck is in + DEB_BUILD_OPTIONS. Based on a patch from Michael Banck + . Closes: #315290 + + * Integrate most of a patch to build arbitrary binutils-$TARGET + cross-packages from #231707. Thanks to Nikita V. Youshchenko + and Josh Triplett . + + * debian/copyright: update to include GFDL. Closes: #81950 + * debian/copyright: update FSF address. + + * debian/rules: move non-architecture specific conflicts (gas, + elf-binutils, modutils (<< 2.4.19-1)) out of a substitued variable and + into the control file. Rename variable to extraConflicts. + * debian/control: likewise. + + -- James Troup Sat, 15 Apr 2006 03:05:41 +0100 + +binutils (2.16.1cvs20060117-1ubuntu2.1) dapper-security; urgency=low + + * SECURITY UPDATE: Crash and possible arbitrary code execution in apps using + libbfd (such as 'strings'). + * Add debian/patches/130_tekhex_buffer_overflow.dpatch: + - Fix buffer overflow on hexadecimal number parsing in the Tektronix Hex + Format BFD library backend. + - Patch ported from CVS HEAD. + * CVE-2006-2362 + + -- Martin Pitt Tue, 6 Jun 2006 11:35:55 +0200 + +binutils (2.16.1cvs20060117-1ubuntu2) dapper; urgency=low + + * [SPARC64] Add support for new UA2005 instruction set: + - Add patch 122_sparc64_UA2005_instruction_set.dpatch. + (Thanks David S. Miller for providing the patch) + + NOTE: the patch is sparc specific and does NOT touch any other code. + It is a plain rebuild on all other arches. + + -- Fabio M. Di Nitto Sat, 25 Feb 2006 07:11:28 +0100 + +binutils (2.16.1cvs20060117-1ubuntu1) dapper; urgency=low + + * Synchronise with Debian untstable. + + -- Matthias Klose Thu, 19 Jan 2006 09:21:47 +0100 + +binutils (2.16.1cvs20060117-1) unstable; urgency=low + + * New upstream CVS snapshot. + + * 118_arm_pass_all.dpatch, 125_fix_tc_arm_cast.dpatch: merged upstream - + removed. + + -- James Troup Wed, 18 Jan 2006 02:25:25 +0000 + +binutils (2.16.1cvs20051214-1ubuntu1) dapper; urgency=low + + * Synchronise with Debian unstable. + + -- Matthias Klose Thu, 15 Dec 2005 00:11:16 +0000 + +binutils (2.16.1cvs20051214-1) unstable; urgency=low + + * New upstream CVS snapshot. + * Fix ld segfaults on ia64. Closes: #342777 + + * 126_fix_PROVIDE_HIDDEN.dpatch: merged upstream - removed. + + -- James Troup Wed, 14 Dec 2005 08:06:37 +0000 + +binutils (2.16.1cvs20051206-1) unstable; urgency=low + + * New upstream CVS snapshot. + * Fixes linking of qemu. Closes: #340328 + + * 126_fix_PROVIDE_HIDDEN.dpatch: new patch from Thiemo Seufer to fix + handling of hidden symbols which were provided by a linker + script. Closes: #342307 + + * debian/control (Standards-Version): updated to 3.6.2.1. + + -- James Troup Sat, 10 Dec 2005 05:23:34 +0000 + +binutils (2.16.1cvs20051117-1ubuntu1) dapper; urgency=low + + * Synchronise with Debian unstable. + + -- Matthias Klose Fri, 18 Nov 2005 14:09:29 +0100 + +binutils (2.16.1cvs20051117-1) unstable; urgency=low + + * New upstream CVS snapshot. + * Fixes c++filt's flushing of stdout which broke gcj. Closes: #339287 + + * debian/control (Build-Depends): switch from expect to expect-tcl8.3 + since tcl8.4's broken threading causes the testsuite to fail entirely + on hppa. Closes: #339509 + + -- James Troup Thu, 17 Nov 2005 13:15:15 +0000 + +binutils (2.16.1cvs20051109-1ubuntu1) dapper; urgency=low + + * Synchronise with Debian unstable. + * Reenable the testsuite on hppa and sparc. + * debian/control: + - Set standards version to 3.6.2 (no changes). + - Add alternative build dependency on expect-tcl8.3. + + -- Matthias Klose Mon, 14 Nov 2005 10:52:27 +0100 + +binutils (2.16.1cvs20051109-1) unstable; urgency=low + + * New upstream CVS snapshot. + * Fixes broken PLT handling on m68k. Closes: #327780 + * Don't compile flex files with -Werror, fixing mips builds. + Closes: #333980 + * Don't check undefined symbols introduced by "ld -u" for TLS. Closes: + #326103 + + * 117_mips_symbolic_link.dpatch: merged upstream - removed. + + * debian/rules: pass --disable-werror on ia64 as current gcc generates + too many false positives. Closes: #336939 + + * 125_fix_tc_arm_cast.dpatch: new patch from Lennert Buytenhek to fix + cast warning and arm builds. Closes: #336175 + + * 121_i386_x86_64_biarch.dpatch: imported from Ubuntu at request of + Daniel Jacobwitz to fix biarch linking on i386/amd64. Closes: + #334626, #334673 + + * debian/rules: remove any reference to pkgstriptranslations - an + Ubuntu-ism that shouldn't have been in the Debian package in the first + place but that isn't needed in Ubuntu any more in any event. + + * debian/rules: MAKEOVERRIDES is now clobbered by the top level + Makefile, so switch to overriding MAKE itself (sic) to pass the + customized VERSION variable/string down to sub-directories for + -multiarch and -hppa64 builds. Thanks to Daniel Silverstone for the + suggestion. + + -- James Troup Fri, 11 Nov 2005 20:38:22 +0000 + +binutils (2.16.1cvs20050902-1) unstable; urgency=low + + * New upstream CVS snapshot. + * Fixes --as-needed on sparc and hppa. Closes: #320697 + * Fixes buffer overflows and other crashes. Closes: #311975 + + * 124_readelf_robustify.dpatch: merged upstream - removed. + * 001_ld_makefile_patch: regenerated with help of wiggle. + + * debian/*.shlibs: update to version 2.16.91. + + * debian/copyright: use canonical GNU URL. Update copyright years. + * debian/rules: update version and copyright. + + * debian/rules (pre-build): not relevant with a CVS snapshot which + doesn't have pre-generated info files - removed. + * debian/rules (clean): don't save info files for the same reason, in + fact explicitly remove them. + * debian/rules (build_stamps): drop pre-build. + + -- James Troup Sat, 3 Sep 2005 00:30:56 +0100 + +binutils (2.16.1-3) unstable; urgency=low + + * debian/rules: remove powerpc libc header hack. + * debian/include/sys/procfs.h: remove. + + * 124_readelf_robustify.dpatch: new patch from Jakub Jelinek to + robustify readelf. Thanks to Thiemo Seufer . + Closes: #318344 + + -- James Troup Wed, 31 Aug 2005 05:03:11 +0100 + +binutils (2.16.1-2ubuntu7) dapper; urgency=low + + * debian/rules: Stop calling pkgstriptranslations, we now get it + for free with the new and improved dpkg-deb diversion hack. + + -- Adam Conrad Wed, 26 Oct 2005 10:39:15 +1000 + +binutils (2.16.1-2ubuntu6) breezy; urgency=low + + * debian/control: Create a new binutils-static-udeb udeb for d-i. + * debian/rules: Copy stuff from -static to -static-udeb for above. + * debian/rules: compress changelog in /usr/share/doc/binutils-static + + -- Adam Conrad Tue, 4 Oct 2005 16:51:06 +1000 + +binutils (2.16.1-2ubuntu5) breezy; urgency=low + + [ Jeff Bailey ] + * debian/control: binutils-static no longer depends on binutils. + * debian/rules: Install the copyright and changelog into + /usr/share/doc/binutils-static. + + [ Adam Conrad ] + * debian/binutils-static.preinst: Make sure that we lose our doc + symlink before we upgrade, or some Very Bad Things could happen. + * debian/rules: Make the above get installed to the right location. + + -- Adam Conrad Tue, 4 Oct 2005 15:45:12 +1000 + +binutils (2.16.1-2ubuntu4) breezy; urgency=low + + The " jbailey: how soon should I expect an upload?" release. + + * debian/patches/122_sparc_hppa_got.dpatch: New patch to allow + --as-needed on sparc, and to avoid issues with duplicate + GLOBAL_OFFSET_TABLES on hppa. + + * debian/patches/00list.sparc: New file, add this patch there. + + * debian/patches/00list.hppa: New file, add this patch there. + + -- Jeff Bailey Wed, 31 Aug 2005 16:46:13 -0400 + +binutils (2.16.1-2ubuntu3) breezy; urgency=low + + * debian/patches/121_i386_x86_64_biarch: New patch to allow + ld to work in an i386/x86_64 biarch configuration. + + -- Jeff Bailey Fri, 5 Aug 2005 16:24:23 +0000 + +binutils (2.16.1-2ubuntu2) breezy; urgency=low + + * debian/rules: Call it /bin/ld_static, not /bin/ld to avoid + confusion. + + -- Jeff Bailey Tue, 26 Jul 2005 01:34:43 +0000 + +binutils (2.16.1-2ubuntu1) breezy; urgency=low + + * debian/rules: Add binutils-static pass. This provides /bin/ld + for use in linking objects that might be needed at boot time + for mounting /usr or /. + Also remove stamps when cleaning. + + -- Jeff Bailey Tue, 26 Jul 2005 00:12:07 +0000 + +binutils (2.16.1-2) unstable; urgency=low + + * debian/include/sys/procfs.h: Include fixed powerpc libc header, to fix + FTBFS on powerpc. Temporary fix, to be removed with glibc-2.3.5. + + -- Matthias Klose Sun, 10 Jul 2005 16:35:17 +0200 + +binutils (2.16.1-1) unstable; urgency=medium + + * New upstream version. + * debian/patches/117_mips_symbolic_link.dpatch: Updated, apply it again. + (Thiemo Seufer). + * debian/patches/130_bfd_doc_makefile.dpatch: Remove, applied upstream. + * debian/control: Build depend on dpkg-dev (>= 1.13.9), needed to determine + the GNU architecture type. + * The symlinks for the tools change to the the new output of + dpkg-architecture -qDEB_HOST_GNU_TYPE (i.e. i386-linux-ld becomes + i486-linux-gnu-ld). + * Change the values for --enable-targets according to the dpkg-architecture + update. + * Configure the hppa64 cross compiler for hppa64-linux-gnu. Adjust + the hppa64 install target. + * debian/*shlibs: Update to version 2.16.1. + * Make restoring of saved pregenerated info files more robust. + + -- Matthias Klose Sat, 9 Jul 2005 14:58:49 +0200 + +binutils (2.16-1) unstable; urgency=low + + * Update to CVS 2.16 branch 20050612. + * debian/patches/130_bfd_doc_makefile.dpatch: New patch to fix + build failure in bfd/doc. + * debian/watch: New file. + + -- Matthias Klose Sun, 12 Jun 2005 12:29:12 +0200 + +binutils (2.16-0) experimental; urgency=low + + * New upstream release. + - Fixes build failure using gcc-4.0 (closes: #299671). + * debian/patches: + - 000_print_debian_version.dpatch: Updated. + - 001_ld_makefile_patch.dpatch, 002_gprof_profile_arcs.dpatch, + 002_gprof_profile_arcs.dpatch: Regenerated. + - 012_check_ldrunpath_length.dpatch: Updated. + - 112_fix_reloc_sizing.dpatch, 113_elf_backend_hide_symbol.dpatch, + 114_mips_delay_slots_in_branch.dpatch, 115_fix_sparc_fmov.dpatch, + 116_ar_nonexistent_files.dpatch: Removed, applied upstream. + - 117_mips_symbolic_link.dpatch: Disabled. Needs an update. + - 118_arm_pass_all.dpatch: Regenerated. + - 119_fix_gas_double_negative.dpatch: Removed, applied upstream. + - 120_mips_xgot_multigot_workaround.dpatch: Updated. + - 121_ia64_unwind_fixes.dpatch, 122_m68k_undefweak_symbols.dpatch: + Removed, applied upstream. + * Merge Ubuntu changes: + - debian/patches: + - 123_dont_add_to_undefs_twice.dpatch: Removed, applied upstream. + - debian/rules: Call pkgstriptranslations if present. + * debian/rules: + - Fix VERSION extraction. + - Save info files before build and restore them in clean target. + * debian/control: + - Add me as an uploader. + + -- Matthias Klose Fri, 6 May 2005 18:43:09 +0200 + +binutils (2.15-6) unstable; urgency=low + + * 123_bfd_overflow_fix.dpatch: new patch from Alan Modra to fix BFD + overflows. Closes: #308625 + + -- James Troup Sat, 21 May 2005 20:20:01 +0100 + +binutils (2.15-5ubuntu2) hoary; urgency=low + + * debian/rules: Call pkgstriptranslations if present (the package does not + use debhelper, thus it does not happen automatically). + + -- Martin Pitt Fri, 18 Mar 2005 13:07:52 +0000 + +binutils (2.15-5ubuntu1) hoary; urgency=low + + * 123_dont_add_to_undefs_twice.dpatch: new patch from Alan Modra (PR338) to + not add symbols to the undefined list twice, causing an assertion failure + in ld when building the kernel on amd64. + + -- Daniel Stone Tue, 7 Dec 2004 09:29:31 +0100 + +binutils (2.15-5) unstable; urgency=low + + * 121_ia64_unwind_fixes.dpatch: new patch from David Mosberger to fix + unwind related bugs. Closes: #278836 + * 122_m68k_undefweak_symbols: new patch from Andreas Schwab to fix undef + weak symbols with non-default visibilty on m68k. Closes: #278388 + + -- James Troup Thu, 25 Nov 2004 00:13:28 +0000 + +binutils (2.15-4) unstable; urgency=low + + * 120_mips_xgot_multigot_workaround.dpatch: new patch from Thiemo Seufer + to make multigot/xgot handling exclusive and fix mozilla builds on + mipsen. Closes: #272149 + + -- James Troup Thu, 23 Sep 2004 22:44:03 +0100 + +binutils (2.15-3) unstable; urgency=low + + * 112_fix_reloc_sizing.dpatch: update patch based on revised change from + Alan Modra. + + * 116_ar_nonexistent_files.dpatch: new patch from Nick Clifton to fix + ar's handling of non-existent files. Closes: #267139 + + * 117_mips_symbolic_link.dpatch: new patch from Thiemo Seufer to fix the + "final link failed: Bad value" error on mips. Closes: #270619 + + * 118_arm_pass_all.dpatch: new kludge patch to fix broken libtool pass_all + handling on arm and other arches. + + * 119_fix_gas_double_negative.dpatch: new patch from Alan Modra via + Daniel Jacobowitz to fix gas' handling of -- and ++. Closes: #266772 + + -- James Troup Thu, 9 Sep 2004 22:24:08 +0100 + +binutils (2.15-2) unstable; urgency=low + + * 112_fix_reloc_sizing.dpatch: new patch from Daniel Jacobowitz to fix + objcopy relocation sections. Closes: #252719 + + * 113_elf_backend_hide_symbol.dpatch: new patch from Alan Modra to fix + ld internal error on hppa. Closes: #254549 + + * 114_mips_delay_slots_in_branch.dpatch: new patch from Thiemo Seufer to + handle delay slots in branch correctly on mips. Closes: #266660 + + * 115_fix_sparc_fmov.dpatch: new patch from Jakub Jelinek via Dave + Miller to fix bogus fmov* SPARC opcodes. Closes: #267824 + + -- James Troup Tue, 31 Aug 2004 22:45:13 +0100 + +binutils (2.15-1) unstable; urgency=low + + * New upstream release. Closes: #248990, #259458 + * Fixes -Wl,-z,defs to correctly abort builds with unresolved + symbols. Closes: #256481 + * Better error message for truncation of bignums in as. + Closes: #219933 + * strip(1) no longer corrupts binaries for architectures it doesn't + recognise. Closes: #211052 + * nm -C /usr/lib/libcrypto++.a no longer segfaults. Closes: #247917 + + * 105_alpha_rpcc_opcode_fix.dpatch, 106_arm_pic.dpatch, + 107_powerpc_ld_segfault.dpatch, 108_m68k_fmoveml_fix.dpatch, + 109_objcopy_keep_debug.dpatch, 110_hppa64_local_symbols.dpatch, + 111_objcopy_vs_unstripped.dpatch, 906_hjl_libtool_dso.dpatch: merged + upstream - removed. + * 012_check_ldrunpath_length.dpatch: resynced with wiggle(1). + + * debian/binutils.shlibs, debian/binutils-hppa64.shlibs, + debian/binutils-multiarch.shlibs: update for 2.15. + + * debian/rules (install): remove gas.info hack as no longer needed + (fixed properly upstream). + * debian/rules (clean): remove gas/doc/as.info which doesn't seem to be + in the upstream tar ball. + + * debian/rules (binary-arch): install $pkg/ChangeLog.linux only if they + exist (because they don't in GNU releases). + + -- James Troup Thu, 29 Jul 2004 22:44:04 +0100 + +binutils (2.14.90.0.7-8) unstable; urgency=low + + * debian/rules: don't use gcc-2.95 on m68k. Thanks to Adam Conrad for + pointing this out. + + -- James Troup Wed, 19 May 2004 10:35:44 +0100 + +binutils (2.14.90.0.7-7) unstable; urgency=low + + * 111_objcopy_vs_unstripped.dpatch: new patch from Alan Modra via Daniel + Jacobowitz to fix objcopy on unstripped libraries on alpha and arm. + Closes: #234021 + + * debian/control (Build-Depends): remove m68k specific build-depends on + gcc-2.95 and libc6-dev (<< 2.3). Many thanks to Michael Schmitz for + testing this. + + -- James Troup Tue, 30 Mar 2004 18:00:54 +0100 + +binutils (2.14.90.0.7-6) unstable; urgency=low + + * 110_hppa64_local_symbols.dpatch: new patch from Randolph Chung to fix + dynamic name generation of local symbols on hppa64 - needed to build + 64-bit hppa kernels. Closes: #238176 + + -- James Troup Fri, 26 Mar 2004 15:52:27 +0000 + +binutils (2.14.90.0.7-5) unstable; urgency=low + + * 109_objcopy_keep_debug.dpatch: new patch from Daniel Jacobowitz + , objcopy --only-keep-debug and readelf SHT_NOBITS + fixes. + + -- James Troup Mon, 26 Jan 2004 16:25:25 +0000 + +binutils (2.14.90.0.7-4) unstable; urgency=low + + * debian/control: add binutils-hppa64 package. + * debian/rules: add support for binutils-hppa64 package and don't enable + hppa64-linux for binutils or binutils-multiarch. + * debian/binutils-hppa64.postinst: new file. + * debian/binutils-hppa64.postrm: likewise. + * debian/binutils-hppa64.shlibs: likewise. + * Above changes largely based on a patch from Matthias Klose + . Closes: #225892 + + * debian/control (Build-Depends): drop bzip2. + + * debian/rules (install-stamp): remove empty /usr/include directory in + binutils. + * debian/rules (install-stamp): remove /usr/share/info/dir* to + workaround install-info brain damage (cf #213524). + + -- James Troup Thu, 22 Jan 2004 21:32:44 +0000 + +binutils (2.14.90.0.7-3) unstable; urgency=low + + * 108_m68k_fmoveml_fix.dpatch: new patch from H.J. Lu + to fix fmoveml disassembly and associated + testsuite regression on m68k. + + -- James Troup Tue, 18 Nov 2003 14:35:23 +0000 + +binutils (2.14.90.0.7-2) unstable; urgency=low + + * 107_powerpc_ld_segfault.dpatch: new patch from Alan Modra + to fix ld segfault on powerpc. Thanks to + Josselin Mouette for the report. Closes: #219187 + + -- James Troup Wed, 5 Nov 2003 13:32:17 +0000 + +binutils (2.14.90.0.7-1) unstable; urgency=low + + * New upstream release. + * 100_null_owner_ld_fix.dpatch, 101_ppc_as_shf_and_rel_fix.dpatch, + 102_alpha_null_got_ld_fix.dpatch, + 103_static_linking_elf_eh_frame.dpatch, + 104_elf_eh_frame_alpha_fix.dpatch: removed; merged upstream. + * debian/rules: update version number. + * debian/binutils.shlibs: likewise. + * debian/binutils-multiarch.shlibs: likewise. + + * 009_signed_char_fix.dpatch: removed; this was fixed upstream correctly + (http://sources.redhat.com/ml/binutils/2003-05/msg00304.html) and this + patch is breaking that fix. Thanks to Daniel Jacobowitz + . + + * 003_gmon_manpage_fix.dpatch -> 002_gprof_profile_arcs.dpatch. + * 014_gprof_manpage_fix.dpatch -> 003_gprof_see_also_monitor.dpatch. + + * 300_alpha_rpcc_opcode_fix.dpatch -> 105_alpha_rpcc_opcode_fix.dpatch + (committed to trunk). + + * debian/rules (configure-multi-stamp): also enable mips64{el,}-linux + for binutils-multiarch. Alphabetize target list. + + * 106_arm_pic: new patch from Phil Blundell and Daniel + Jacobowitz which implements GC for GOT and PLT relocs + in the elf32-arm backend. + + * debian/rules (install-stamp): work around upstream bug which causes + as.info and as.1 to disappear by explicitly calling "make + install-info-am install-am" in builddir-single/gas/doc. + + -- James Troup Sat, 1 Nov 2003 18:14:04 +0000 + +binutils (2.14.90.0.6-5) unstable; urgency=low + + * 104_elf_eh_frame_alpha_fix.dpatch: new patch from H.J. Lu + to fix regressions on alpha caused by + 103_static_linking_elf_eh_frame. Thanks to Thimo Neubauer + for the original report. Closes: #215636 + + -- James Troup Fri, 17 Oct 2003 00:02:09 +0100 + +binutils (2.14.90.0.6-4) unstable; urgency=low + + * 103_static_linking_elf_eh_frame.dpatch: new patch from H.J. Lu + to fix static linking of C++ binaries. + + * 200_alpha_null_got_ld_fix.dpatch: renamed... + * 102_alpha_null_got_ld_fix.dpatch: to this. + + * debian/rules: patch from Guido Guenther to enable + mips64 support. Closes: #213448 + + -- James Troup Sun, 12 Oct 2003 14:26:26 +0100 + +binutils (2.14.90.0.6-3) unstable; urgency=low + + * 100_null_owner_ld_fix.dpatch: new patch from Alan Modra + to fix an ld crash with null owner sections. + Closes: #212029 + + * debian/rules: don't compile with gcc-2.95 on arm; the only failures + are a) testsuite-only (i.e. don't appear to affect real world + applications) and b) fixed by upcoming gcc patches by Phil Blundell + in any event. + * debian/control (Build-Depends): likewise don't build-depend on + gcc-2.95 for arm. + + * 101_ppc_as_shf_and_rel_fix.dpatch: new patch from Alan Modra + to fix an as regression where it refused to + compile utils.S from Linux/PPC 2.6. Closes: #211668 + + -- James Troup Tue, 23 Sep 2003 01:32:08 +0100 + +binutils (2.14.90.0.6-2) unstable; urgency=low + + * debian/rules (CONFLICTS): remove spurious "--", left over from + debhelper based-rules. Fixes build failure on sparc. + + * 200_alpha_null_got_ld_fix.dpatch: new patch from Daniel Jacobowitz + to fix an ld crash on alpha with null .got sections. + Closes: #204615 + + * scripts/dpkg-arch.mk: remove. + * debian/rules: define DEB_BUILD_GNU_TYPE, DEB_HOST_ARCH and + DEB_HOST_GNU_TYPE here instead. + + * debian/rules (binary-indep): use ':' as a separator to chown, rather + than '.' which is a legal character for a username. + * debian/rules (binary-arch): likewise. + + * debian/rules: further trivial cleanups. + + -- James Troup Thu, 18 Sep 2003 22:13:36 +0100 + +binutils (2.14.90.0.6-1) unstable; urgency=low + + * New "upstream" release. + * Fixes core dump of nm -C on certain object files. Closes: #205616 + + * New maintainer. + * debian/control (Maintainer): adjust accordingly. + * debian/copyright: likewise. Update copyright years, URL. + * debian/control (Standards-Version): bump to 3.6.1.0. + + * 011_disable_combreloc_ARM_ONLY.diff: dropped on request of Phil + Blundell - this is obsolete, it was working around a + bug in ld since fixed by Daniel Jacobowitz upstream. + + * 890-elf64_alpha_segfault.diff: dropped as bogus + (http://sources.redhat.com/ml/binutils/2003-04/msg00399.html); rth's + correct fix is already in the upstream source. + + * debian/README.Debian: migrate nearly-obsolete debconf notes to here. + * debian/control (Depends): drop debconf. + * binutils.config, binutils.templates, binutils.templates.ca, + binutils.templates.fr, binutils.templates.ja, + binutils.templates.pt_BR, postrm.debhelper: obsolete, removed. + Closes: #189641, #198222 + + * Migrated from dbs... + * debian/README.build: obsolete; removed. + * debian/rules: remove $(BUILD_TREE)/, $(STAMP_DIR)/, $(unpacked), $(patched) and other references + to DBS. + * debian/rules (clean): remove build tree directories. + * debian/scripts/dbs-build.mk: unused, remove. + * debian/scripts/file2cat: likewise. + + * ... to dpatch. + * debian/rules: include /usr/share/dpatch/dpatch.make. + * debian/rules (configure-single-stamp): depend on patch-stamp. + * debian/rules (configure-multi-stamp): likewise. + * debian/rules (clean): depend on unpatch. Remove debian/patched. + * debian/control (Build-Depends): add dpatch. + + * binutils-doc.postinst, binutils-doc.prerm, + binutils-multiarch.postinst, binutils-multiarch.postrm, + binutils-multiarch.preinst, binutils-multiarch.shlibs, + binutils.postinst, binutils.postrm, binutils.shlibs: new files based + on .deb and packages.d/. + * scripts/dh_split: obsolete, removed. + * debian/packages.d/binutils-dev.in, debian/packages.d/binutils-doc.in, + debian/packages.d/binutils-multiarch.in, + debian/packages.d/binutils.in: likewise. + + * debian/rules: rewritten, de-debhelper-ized. + * debian/control (Build-Depends): drop debhelper and add file. + + -- James Troup Thu, 11 Sep 2003 22:08:18 +0100 + +binutils (2.14.90.0.5-0.2) unstable; urgency=low + + * NMU. + * Rebuild using fixed gcc on sparc (closes: #202924). + + -- Matthias Klose Mon, 28 Jul 2003 20:12:00 +0200 + +binutils (2.14.90.0.5-0.1) unstable; urgency=low + + * NMU. + * New upstream version. + * Remove patches applied upstream: + - debian/patches/500_s390_gas.diff + - debian/patches/905-hppa_visibility.diff + - debian/patches/906-mips_ld_fix.diff + * Updated patch: + - debian/patches/906-hjl_libtool_dso.diff + + -- Matthias Klose Wed, 23 Jul 2003 20:09:51 +0200 + +binutils (2.14.90.0.4-0.1) unstable; urgency=low + + * NMU + * New upstream version. + 1. Work around the brain dead libtool. + * New patches: + - debian/patches/500_s390_gas.diff (closes: #194929). + - debian/patches/905-hppa_visibility.diff (closes: #195203). + - debian/patches/906-mips_ld_fix.diff (closes: #195207). + - debian/patches/906-hjl_libtool_dso.diff + + -- Matthias Klose Sat, 31 May 2003 12:12:10 +0200 + +binutils (2.14.90.0.3-0.1) unstable; urgency=low + + * NMU + * New upstream version. + 1. Update from binutils 2003 0523. + 2. Fix 2 ELF visibility bugs. + 3. Fix ELF/ppc linker bugs. + * Remove patches applied upstream: + - debian/patches/903-hjl_ld-dso-test.diff + - debian/patches/904_hjl_hppa_whitespace.diff + + -- Matthias Klose Sat, 24 May 2003 09:02:54 +0200 + +binutils (2.14.90.0.2-0.1) unstable; urgency=low + + * NMU + * New upstream version. + 1. Update from binutils 2003 0515. + 2. Fix various ELF visibility bugs. + 3. Fix some ia64 linker bugs. + 4. Add more IAS compatibilities to ia64 assembler. + * New patches: + - debian/patches/903-hjl_ld-dso-test.diff (closes: #193505). + - debian/patches/904_hjl_hppa_whitespace.diff. + * Remove patches applied upstream: + - debian/patches/900_binutils-2.14.90.0.1-empty-test.diff + - debian/patches/901-hjl_weaksymfix.diff + + -- Matthias Klose Sun, 18 May 2003 10:50:00 +0200 + +binutils (2.14.90.0.1-0.1) unstable; urgency=low + + * NMU + * New upstream version. + - Fix: MIPS branch-to-global bug (closes: #189031). + - Fix: Crash on alpha with --gdwarf2 and bad file number (closes: #187211). + - Fix: objdump -R BFD ICE on prelinked binaries (closes: #180088). + * New patches: + - debian/patches/900_binutils-2.14.90.0.1-empty-test.diff + - debian/patches/901-hjl_weaksymfix.diff + * Remove patches applied upstream: + - debian/patches/002_ldlex_inflexible_transition.diff + - debian/patches/013_objdump_doc_fix.diff + - debian/patches/850_hppa_stub_fix.diff + - debian/patches/860_m68k_elf.diff + - debian/patches/861_m68k_elf.diff + - debian/patches/870-sparc64-update.diff + - debian/patches/880-alpha-update.diff + * Remove obsolete patch: + - debian/patches/patches/800_hjl_mips_fixes.diff + * Add x86_64 for the i386 binutils package and the binutils-multiarch + package (closes: #189350). + * Set CFLAGS to -g -O2 for build (closes: #181268). + + -- Matthias Klose Tue, 6 May 2003 09:58:14 +0200 + +binutils (2.13.90.0.18-1.7) unstable; urgency=high + + * NMU + * Fixed ld segv (replaced yy_current_buffer by YY_CURRENT_BUFFER) + (Closes: #188876, 188900, 188912) + + -- Julien LEMOINE Mon, 14 Apr 2003 04:45:03 +0200 + +binutils (2.13.90.0.18-1.6) unstable; urgency=high + + * NMU + * [002_ldlex_inflexible_transition.diff] New. Make ld buildable again with + sid's current flex. + + -- J.H.M. Dassen (Ray) Sun, 13 Apr 2003 16:54:46 +0200 + +binutils (2.13.90.0.18-1.5) unstable; urgency=medium + + * NMU + * [890-elf64_alpha_segfault.diff] Patch from Julien LEMOINE + to fix the segfault encountered while building + gal on alpha. (Closes: #185556) + * sid's current flex breaks the building of several packages, including this + one; see #188665. The i386 upload is built using a pbuilder sid chroot + with flex downgraded to the sarge version. + + -- J.H.M. Dassen (Ray) Sun, 13 Apr 2003 13:44:17 +0200 + +binutils (2.13.90.0.18-1.4) unstable; urgency=low + + * NMU + * ld/emulparams/elf64_sparc.sh: Set LIBPATH_SUFFIX instead of suffix + for emulation. Patch from current CVS suggested by Clint Adams, + needed for sparc64 glibc build. + * bfd/elf64-alpha.c: Patch from current CVS suggested by Falk Hueffner, + needed to build xstow, kdegames (#181623), sfs. + * Explicitely fail, when trying to build with glibc-2.3 on arm and + m68k. See #184048 for m68k ld failures. + + -- Matthias Klose Tue, 8 Apr 2003 23:27:46 +0200 + +binutils (2.13.90.0.18-1.3) unstable; urgency=low + + * NMU + * Another fix for ELF/m68k (__bb_exit_func initialization). + + -- Matthias Klose Tue, 18 Mar 2003 00:05:47 +0100 + +binutils (2.13.90.0.18-1.2) unstable; urgency=high + + * NMU + * Apply upstream fix for ELF/m68k. Closes: #182313. + * Use gcc-2.95 on m68k-linux. Built on testing (glibc-2.2). + + -- Matthias Klose Sun, 9 Mar 2003 01:02:39 +0100 + +binutils (2.13.90.0.18-1.1) unstable; urgency=low + + * NMU + * Apply upstream fix for hppa stubs. Closes: #181397 + + -- LaMont Jones Wed, 19 Feb 2003 12:34:58 -0700 + +binutils (2.13.90.0.18-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-01-21) + * Upstream: Fix an ia64 gas bug + * Upstream: Fix some TLS bugs + * Upstream: Fix ELF/ppc bugs + * Upstream: Fix an ELF/m68k bug + * Corrected ARM combreloc disabling patch + (closes: Bug#175204) + * Upstream fixes take care of TEXTREL bug + on powerpc (closes: Bug#176084) + * Fixed shellutils dependency problem + (closes: Bug#175673) + * Removed mention of the monitor manpage + from the gprof manpage (closes: Bug#160654) + + -- Christopher C. Chimelis Sun, 2 Feb 2003 23:17:29 -0500 + +binutils (2.13.90.0.16-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-11-26) + * Upstream: Include /usr/bin/c++filt + * Upstream: Fix "ld -r" with exception handling + + -- Christopher C. Chimelis Mon, 9 Dec 2002 19:14:02 -0500 + +binutils (2.13.90.0.14-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-11-14) + * Upstream: Fix ELF/alpha bugs + * Upstream: Fix an ELF/i386 assembler bug + * Updated package MIPS patch from HJ Lu + * Added s390 patches from Gerhard Tonn. + Actually, the patches to support s390x were + already included upstream, so I just enabled + it in the rules script (closes: Bug#168074, Bug#168974) + * Since powerpc64-linux support was already + added in a prior upload, I'm closing the + wishlist bug for it (closes: Bug#156955) + + -- Christopher C. Chimelis Tue, 20 Nov 2002 05:36:21 -0500 + +binutils (2.13.90.0.10-2) unstable; urgency=low + + * Added two patches from upstream to fix alpha BFD. + (closes: Bug#165633) + + -- Christopher C. Chimelis Sun, 27 Oct 2002 14:21:51 -0400 + +binutils (2.13.90.0.10-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-10-10) + * Upstream: More ELF/PPC linker bug fixes. + * Upstream: Fix an ELF/alpha linker bug. + * Upstream: Fix an ELF/sparc linker bug to support + Solaris. + * Upstream: More TLS updates. + * Updated m68k gcc 3.1 patch since it wasn't applying + cleanly. Is this still needed? + * Added patches to allow building with new bison + (closes: Bug#164436, Bug#164042) + * Should be better for prelink support, which is coming + soon (closes: Bug#161427) + * Removed windres manpage from all packages + (closes: Bug#157415) + * Fixed download location in copyright file + (closes: Bug#158028) + * Added i386-gnu to multiarch build targets + (closes: Bug#157057) + * Add alpha opcode patch from Falk Hueffner + (closes: Bug#164201) + * Remove .la files from packages + (closes: Bug#160455) + + -- Christopher C. Chimelis Mon, 15 Oct 2002 20:22:29 -0400 + +binutils (2.13.90.0.4-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-08-) + * Upstream: Update from binutils 2002 0814 + * Upstream: Fix symbol versioning bugs for gcc 3.2 + * Upstream: Fix mips gas + * Upstream: Fix an x86 TLS bfd bug + * Upstream: Fix an x86 PIC gas bug + + -- Christopher C. Chimelis Thu, 15 Aug 2002 20:13:44 -0400 + +binutils (2.12.90.0.15-2) unstable; urgency=low + + * Fix combreloc disabling patch for ARM + (closes: Bug#156315) + * Remove S390 patch since it is no longer + needed (thanks to Gerhard Tonn for checking + this out) + * Fix BFD version string escaping + (closes: Bug#154989) + * Add SH patch from Yaegashi Takeshi + (closes: Bug#156230) + * Added conflicts for older modutils + (closes: Bug#155324) + * Forgot to apply MIPS patch from HJ Lu + (apologies to MIPS folks) + + -- Christopher C. Chimelis Wed, 14 Aug 2002 13:09:12 -0400 + +binutils (2.12.90.0.15-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-07-17) + * Upstream: Fix an ia64 assembler bug + * Upstream: Fix a symbol versioning bug + * Upstream: You have to apply the modutils patch + enclosed here in order to support System.map + generated by the new nm (bug filed) + * The symbol visibility patch is included + upstream, as is the alpha PLT/GOT patch, so + both removed from my packaging. + * Included patch from upstream to fix RELA targets + (closes: Bug#153729) + + -- Christopher C. Chimelis Thu, 2 Aug 2002 02:24:29 -0400 + +binutils (2.12.90.0.14-2) unstable; urgency=low + + * The "Let's Get This Party Started Right" upload + (since I'm closing as many old bugs as possible) + * Removed sparc patch altogether + * Added a small alpha patch from upstream to fix + some obscure PLT/GOT issues. + * Manpages are now fixed finally -- no more + I (closes: Bug#108369) + * Have not gotten another report of the + debconf message being cut off, so I'm closing + the debconf-related bug. I suspect this may + have been a problem in the debconf front-end + being used, but I have not been able to reproduce + it (closes: Bug#149045) + * Closing a bug report that I had tagged moreinfo + a LONG time ago (over one year), but never got + more info on. I have not heard of this kind + of problem since, nor have I been able to + reproduce it at any time since (closes: Bug#105986). + For interested parties, it revolved around + allowing gcc to show a linker error, but the + reporter didn't know about the -v option for + gcc. There was a linker problem, but it appeared + to be either hardware failure or user error. + * Closing a demangler 'bug' that revolved around + stripping @PLT from symbol names. Since the + PLT suffix is documented, I'm going to close + this bug. Also, it doesn't help that the symbol + in the bug report uses an obsolete mangling style, + so I can't test this even if I wanted to + (closes: Bug#45889) + + -- Christopher C. Chimelis Mon, 22 Jul 2002 12:54:01 -0400 + +binutils (2.12.90.0.14-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-06-27) + * Upstream: Fix a mips assembler bug + * Upstream: Fix an ELF/mips SHF_MERGE bug + * Upstream: Fix a linker bug which leads to the + incorrect Linux 2.2 kernel. + * PE patch removed since it is included + in upstream source now + * Includes some patches which allow for + more true testsuite results from gcc-3.1 + * Fix sparc ld emulation script patches to get + rid of the lib/64 silliness (now uses lib64) + * Removed the L word from the package description + since Debian is no longer linux-only + (closes: Bug#150575) + * The strings dereferencing problem with + some Windows binaries seems to also be fixed now + (closes: Bug#121366) + * Added a patch to only generate an RPATH entry + if LD_RUN_PATH is not empty, for cases where + -rpath isn't specified (closes: Bug#151024) + * Fixed arch detection problem in the build + scripts. + * Fixed bad capitalisation of -g in the objdump + manpage (closes: Bug#152697) + * Added patch from HJ Lu to fix a symbol + visibility issue. + + -- Christopher C. Chimelis Wed, 17 Jul 2002 14:23:42 -0400 + +binutils (2.12.90.0.9-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-05-26). + * Upstream: Supports "-z muldefs" + * Updated PE bfd from CVS to fix auto-import + segfaults (closes: Bug#131407) + * Remove the PE-removing patch for i386 targets + due to the above + + -- Christopher C. Chimelis Thu, 6 Jun 2002 15:52:29 -0400 + +binutils (2.12.90.0.7-1) unstable; urgency=low + + * New upstream version (synced with CVS 2002-04-23). + * Upstream: ELF EH frame bug fix + * Upstream: MIPS ELF visibility bug fix + * Upstream: Bug fixes for ELF/sparc + * Upstream: Bug fixes for ELF/cris + * Upstream: Fix linking a.out relocatable files + with ELF + * Upstream: Fix a PPC altivec assembler bug + * Numerous upstream changes since I have + deliberately not updated in awhile so that + I could stabilise the package for woody + release + * Fixed a glaring typo in the Debian additions + to the version string. + * Upstream incorporated --oformat + documentation patch; removed. + * Added a patch from upstream involving + relative relocs on Alpha + * Removed configure.info-[1-3] from -doc + (closes: Bug#146205) + + -- Christopher C. Chimelis Sun, 5 Apr 2002 04:52:33 -0400 + +binutils (2.12.90.0.1-5) unstable; urgency=high + + * Added a patch to m68k bits for gas to allow + gcc 3.1 to build + * Added Brazilian Portuguese translation for + debconf (closes: Bug#144677) + * Removed unneeded gasp manpage since gasp + was eliminated as a distinct binary + (closes: Bug#144583) + + -- Christopher C. Chimelis Mon, 29 Apr 2002 14:40:21 -0400 + +binutils (2.12.90.0.1-4) unstable; urgency=low + + * Added patch from Gerhardt Tonn + to fix s390 merge problem (closes: Bug#143187) + * Corrected DOW of my last changelog entry :-P + + -- Christopher C. Chimelis Thu, 18 Apr 2002 13:03:49 -0400 + +binutils (2.12.90.0.1-3) unstable; urgency=low + + * Oops...I used dpkg-architecture from dpkg-dev + in the postinst and didn't add a dependency + for it. It was a bad choice anyway and I'm + going to use uname -s instead + (closes: Bug#142744, Bug#142915) + + -- Christopher C. Chimelis Mon, 15 Apr 2002 12:41:10 -0400 + +binutils (2.12.90.0.1-2) unstable; urgency=low + + * Added Catalan debconf translation + (closes: Bug#139740) + * Ensure that info entries are removed from the + texinfo dirfile when binutils-doc is removed + (closes: Bug#126557) + * Ensure that the kernel link debconf warning + only shows up on linux systems + (closes: Bug#142360) + + -- Christopher C. Chimelis Thu, 13 Mar 2002 01:30:22 -0400 + +binutils (2.12.90.0.1-1) unstable; urgency=high + + * New upstream version (synced with CVS 2002-03-07). + * Upstream: Add the .preinit_array/.init_array/.fini_array + support. + * Upstream: Fix eh_frame. + * Upstream: Turn on combreloc by default. + * Upstream: Enable gprof for Linux/mips. + * Turn combreloc off for ARM explicitely until + I can confirm that PIC is not still broken + by using it. + * Remove IA-64 unwind patch and objcopy fix + since they are included in the upstream sources + now. + * Re-enable testsuite run since Randolph did the NMU + on dejagnu (thank you!). + * Appears to fix sparc64 linking problems. I'm + still looking into exactly what was going on with + that (closes: Bug#137850) + * Enabled hppa64-linux support in main binutils + package (closes: Bug#137955) + * Added Japanese debconf template. Thanks to + Tomohiro KUBOTA for supplying that + (closes: Bug#138112) + * Added patch for ld to fix dosemu problems + (closes: Bug#126863) + + -- Christopher C. Chimelis Mon, 11 Mar 2002 14:02:45 -0500 + +binutils (2.11.93.0.2-3) unstable; urgency=high + + * Split translated debconf templates out. + I apparently misunderstood the instructions + on integrating the French translation since + this is my first real attempt at using + debconf (closes: Bug#136295) + * Disable combreloc default on ARM since it + breaks PIC, apparently (closes: Bug#134241) + Please test other ARM bugs against this + version and inform me of the results! + + -- Christopher C. Chimelis Fri, 8 Mar 2002 19:10:10 -0500 + +binutils (2.11.93.0.2-2) unstable; urgency=high + + * Include a patch from upstream to fix stripping + archives containing multiple files with the + same name (like libgcj, unfortunately). + (closes: Bug#107812) + * Include IA64 unwind fix from CVS to fix kernel + linking on IA64. (closes: Bug#135143) + * Added French translation of the debconf + bits. Thanks to Denis Barbier for the + work on that. (closes: Bug#134626) + * Disabled testsuite run until dejagnu is + fixed. I'm leaving the build-dep for dejagnu + in, though, since I know I'll forget to + reinsert it when I do re-enable the testsuite + run. + + -- Christopher C. Chimelis Fri, 22 Feb 2002 14:05:22 -0500 + +binutils (2.11.93.0.2-1) unstable; urgency=high + + * New upstream version (synced with CVS 2002-02-07). + * Upstream: Fix a weak symbol alpha linker bug for glibc. + * Upstream: More support for gcc 3.1. + * Keep on disabling efi-app-ia32 type targets + since the segfault is still unfixed in CVS and + I haven't had the time to go back and really + debug and fix this. + * Updated standards version. + * Corrected some of the lintian problems (all except + the ones involving Changelog.linux, the .comment + section, and the missing manpages for + binutils-multiarch's binaries since that package + depends on binutils, which provides those). + + -- Christopher C. Chimelis Wed, 13 Feb 2002 13:41:47 -0500 + +binutils (2.11.92.0.12.3-7) unstable; urgency=high + + * The "Remind Me To Think Next Time" upload. + * Fix the postinst to only compare versions on + upgrade rather than during configure. + (closes: Bug#133349, Bug#133514) + * Still working on the other bugs...if only + I could get a day off of work... + + -- Christopher C. Chimelis Tue, 12 Feb 2002 06:15:02 -0500 + +binutils (2.11.92.0.12.3-6) unstable; urgency=high + + * The "Make The Bad Man Stop" upload. + * Revert patch to bfd/elf32-sparc.c (already + reverted upstream) that broke UA32 relocs on sparc + and caused bus errors with C++/Java binaries + (closes: Bug#126162) + * Remove i486-mingw32 target from the enabled + in multiarch and removed efi-app-ia32 from the + BFD config for Intel linux targets until I can find + and fixthe segfaults that seem to keep coming up when + reading Windows files and viruses with objdump or + strings. This is only temporary, so I'm not closing + the bugs until the problem gets fixed, but + I am going to bump them down to wishlist, merge + them, and note the above in them. + (debian/patches/010_disable_efi_app_ia32_TEMPORARY.diff + disables the efi-app-ia32 BFD in case someone + wants to revert this change easily) + * Added debconf warning about the kernel linking + situation since it keeps coming up and people + keep initially disagreeing with me about this + being a kernel bug. Also, merged prior warning + about -oformat change into the same debconf warning + (it's two, two, two warnings in one). This makes + the DEBIAN_FRONTEND case bug moot (closes: Bug#131801) + * Added powerpc64-linux target to multiarch since + work is progressing on that target and the machines + are due to hit the shelves Very Soon(TM). + + -- Christopher C. Chimelis Fri, 1 Feb 2002 17:06:29 -0500 + +binutils (2.11.92.0.12.3-5) unstable; urgency=high + + * Fix signed char assumption in i386 disassembly bits + (closes: Bug#126993) + + -- Christopher C. Chimelis Mon, 8 Jan 2002 17:27:17 -0500 + +binutils (2.11.92.0.12.3-4) unstable; urgency=high + + * Go back to enabling archs by enumeration for + multiarch. Apparently, a few aren't enabled + with --enable-targets=all (sparc64-linux, namely). + Besides, multiarch was incredibly large, which + was probably unneeded. + + -- Christopher C. Chimelis Wed, 26 Dec 2001 13:53:49 -0500 + +binutils (2.11.92.0.12.3-3) unstable; urgency=high + + * Include patch from Alan Modra to fix more + refcount problems on hppa. + + -- Christopher C. Chimelis Fri, 7 Dec 2001 05:42:04 -0500 + +binutils (2.11.92.0.12.3-2) unstable; urgency=high + + * Include patch from Alan Modra to fix hppa linking + woes wrt undefined symbols (closes: Bug#121993) + + -- Christopher C. Chimelis Wed, 5 Dec 2001 04:14:51 -0500 + +binutils (2.11.92.0.12.3-1) unstable; urgency=high + + * New upstream version (synced with CVS 2001-11-21) + * Upstream: Fix a linker symbol version bug + for common symbols. + * Upstream: Update handling relocations against + the discarded sections. You may need to apply + the kernel patch enclosed here to your kernel + source. + * Upstream: Support "-march=xxx -mipsN" for mips + gas if they are compatible. + * Upstream: Fix a regression when linking with + non-ELF object files. + * Includes Alan Modra's patch to reduce stub sizes + on HPPA. Should help C++ on HPPA. + * Once again includes a mips patch from HJ Lu. + * My documentation changes were cleaned up and + accepted upstream, so the gas manpage fixes go + away (hurray!). + * Stopped iterating targets for binutils-multiarch + and started enabling all of them. This saves + maintenance time since new targets will be + automatically supported in future uploads + and existing targets that I didn't include + before will be supported from now on. This may + grow build time and the libbfd in the multiarch + package, but it's worth it. + * Also, started using the --enable-64-bit-bfd + flag for configuring multiarch. I don't know + why I didn't realise this wasn't there before + since I test with it all of the time. + + -- Christopher C. Chimelis Fri, 30 Nov 2001 20:11:42 -0500 + +binutils (2.11.92.0.10-4) unstable; urgency=high + + * The "Fingers crossed" upload. + * Enable combreloc by default for s390 again. + Rumour has it that it worked before, but there + was a misunderstanding in the s390 developer + community, hence the disabling in the past. + * Fix the ld texinfo file to not mention the old + oformat invocation (closes: Bug#116182) + * Next upload should include the mips updates and + some powerpc updates. I just need time to test + those out first. + + -- Christopher C. Chimelis Fri, 23 Nov 2001 23:23:22 -0500 + +binutils (2.11.92.0.10-3) unstable; urgency=high + + * Replace HPPA reloc patch with patches from Alan + Modra upstream. + * Add upstream patch to fix quoted -rpath bug + (closes: Bug#107214) + + -- Christopher C. Chimelis Sat, 10 Nov 2001 18:19:05 -0400 + +binutils (2.11.92.0.10-2) unstable; urgency=high + + * Disable -z combreloc enable patch on S/390 + since it's not supported there yet + (closes: Bug#117087) + + -- Christopher C. Chimelis Fri, 26 Oct 2001 00:07:01 -0400 + +binutils (2.11.92.0.10-1) unstable; urgency=high + + * New upstream version (synced with CVS 2001-10-21) + * Upstream: Fix the ELF/PPC linker. + * Upstream: Fix the ELF/cris linker. + * Upstream: Fix ELF strip. + * Includes beginnings of Altivec support + (closes: Bug#98617) + * Fixes use of BookE instruction format on 4xx + PowerPC (closes: Bug#116627) + * Includes patches from Alan Modra to fix hppa + relocations. + * Forgot to close the previous PPC bug with last + upload (closes: Bug#116454) + * Moved to enclosing a bzipped tarball rather than + a gzipped one to save download time for everyone + involved. Build-deps adjusted accordingly. + + -- Christopher C. Chimelis Tue, 23 Oct 2001 03:29:49 -0400 + +binutils (2.11.92.0.7-2) unstable; urgency=high + + * Include a patch from H.J Lu to fix a powerpc + issue not shown in the testsuite results. + + -- Christopher C. Chimelis Fri, 19 Oct 2001 00:49:04 -0400 + +binutils (2.11.92.0.7-1) unstable; urgency=high + + * New upstream release (synced with CVS 2001-10-16) + * Upstream: Fix all breakages introduced in 2.11.92.0.5 + * No mips/ dir patches need to be applied with this one. + Woohoo! + * Removed patches from debian/patches that are already + applied upstream. + * Patched version strings to reflect that this is a + Debian release at the request of upstream (to prevent + confusion, apparently). + * Applied patch from H.J. Lu to fix mips section + misalignment. + * Applied patch from Jakub Jelinek to fix kernel linking + on i386 and possibly other archs (closes: Bug#116041) + * Fixed postinst and prerm for binutils-doc to test that + the files exist before calling install-info. This should + fix the odd circumstance when binutils-doc is packaged on + an arch that doesn't support gprof (or any other dir for + that matter) and, therefore, the docs that are usually + made in that dir aren't made. This is particularly true + with gprof on mips. + + -- Christopher C. Chimelis Wed, 17 Oct 2001 18:56:51 -0400 + +binutils (2.11.92.0.5-3) unstable; urgency=high + + * Enable -z combreloc on all targets. This will make + prelinking possible with the prelink package. Please + test this on all archs prior to upload. If it fails, file + a bug immediately and I'll disable the patch for that + platform. + * Added patches from Alan Modra (from CVS) to fix other + archs after the refcount patch broke them. This supercedes + the powerpc patch, so I replaced that with this. + (closes: Bug#115218) + * Added patch from H.J. Lu (from CVS) to fix IA64 linker + problems as well. + * Added patch from David Kimdon to specify which filename is + causing an error if that filename is a dir (closes: Bug#45832). + * Removed workaround patch for stabs problem on Alpha since + it appears to be causing problems on mips and is no longer + needed on Alpha anyway. + * Now runs the testsuite and includes the results in the + binutils package for reference. + + -- Christopher C. Chimelis Sat, 13 Oct 2001 15:10:20 -0400 + +binutils (2.11.92.0.5-2) unstable; urgency=high + + * Applied fix from H.J. Lu to fix PowerPC target + (closes: Bug#115285). Thanks to Jack Howarth + for forcing the issue upstream. + + -- Christopher C. Chimelis Fri, 12 Oct 2001 23:14:51 -0400 + +binutils (2.11.92.0.5-1) unstable; urgency=high + + * New upstream release (synced with CVS 2001-10-05) + * Upstream: Support gcc 3.1 for IA64. + * Upstream: Support prelink for ELF/PPC. + * Upstream: Fix an ELF/x86 linker bug for Oracle + (closes: Bug#113614) + * Upstream: Fix a weak symbol bug. + * Upstream: Support locale. + + -- Christopher C. Chimelis Tue, 9 Oct 2001 19:53:49 -0400 + +binutils (2.11.90.0.31-2) unstable; urgency=high + + * Applied IA64 patch from CVS to fix gcc issues + on IA64. + + -- Christopher C. Chimelis Mon, 24 Sep 2001 12:45:29 -0400 + +binutils (2.11.90.0.31-1) unstable; urgency=high + + * New upstream source (synced with CVS 2001-08-30) + * Upstream: Fix a MIPS linker bug. + * Now applying mips diffs from H.J. Lu (upstream) + for better MIPS and MIPS64 support. + * Applied patch from Christopher Cramer to fix + gasp .REG issue (closes: Bug#110560) + + -- Christopher C. Chimelis Sat, 1 Sep 2001 23:42:22 -0400 + +binutils (2.11.90.0.29-1) unstable; urgency=high + + * New upstream source (synced with CVS 2001-08-27) + * Upstream: Fix an Alpha assembler bug. + * Upstream: Fix an IA64 linker bug. + * Upstream: Fix a MIPS linker bug. + * Upstream: Support '-z combreloc|nocombreloc' in linker. + + -- Christopher C. Chimelis Thu, 30 Aug 2001 04:48:04 -0400 + +binutils (2.11.90.0.27-4) unstable; urgency=high + + * Argh. Really remove the manpages from multiarch + this time (closes: Bug#110410) + + -- Christopher C. Chimelis Tue, 28 Aug 2001 14:32:34 -0400 + +binutils (2.11.90.0.27-3) unstable; urgency=high + + * Include hppa patch to force error + (closes: Bug#109173) + * Fix manpages - seems that I accidentally included + the multiarch manpages rather than the target + manpages (sorry). + * Partial update to as manpage to denote arch options + and added options for the rest of the targets + Still need to elaborate on them, though. More + changes are forthcoming (closes: Bug#110127) + + -- Christopher C. Chimelis Mon, 27 Aug 2001 10:13:27 -0400 + +binutils (2.11.90.0.27-2) unstable; urgency=high + + * Remove bash dependency...ash's behaviour has + already been modified, so it should be able + to build binutils now (closes: Bug#106992) + * Includes new S/390 patch (closes: Bug#109300) + * Could never reproduce objdump segfault and + never got a reply on the bug report + (closes: Bug#93884) + * Can't reproduce m68k segfault either + (closes: Bug#87714) + + -- Christopher C. Chimelis Mon, 20 Aug 2001 23:07:30 -0400 + +binutils (2.11.90.0.27-1) unstable; urgency=high + + * New upstream source (synced with 20010810 CVS) + * Upstream: Fixed x86 linker bug. + * Reverted a patch to gas to dodge a bug in STABS output + on Alpha using gcc 2.95.4, so alpha can be in sync + with the rest of the archs now. + * Fixes strip problems with busybox (closes: Bug#106593) + * Kernels should compile ok again on i386 + (closes: Bug#107190) + + -- Christopher C. Chimelis Thu, 16 Aug 2001 08:24:49 -0400 + +binutils (2.11.90.0.25-1) unstable; urgency=high + + * New upstream source (synced with 20010726 CVS) + * Upstream: fix i386 assembler bug. + * Upstream: "make check" has 2 failures in the + ld-selective test in ld on Linux/alpha. They + should be marked xfail. Fixed in the next release. + * Removed m68k patch (closes: Bug#106431) + * Man pages appear to be correctly generated now + (closes: Bug#98569, Bug# 98938) + * Added bash build dependency (closes: Bug#106992) + * Should compile ok on powerpc (the last one did + also...don't know why voltaire's build daemon failed). + I won't close this bug until I build it myself + on voltaire or hear back from the autobuilder folks + on PPC. + * Looking into the whole LD_LIBRARY_PATH issue that + keeps being brought up. I think the docs are wrong + because the templates say that it shouldn't obey that + at all. Can we please stop filing duplicate bugs for + this? I would greatly appreciate it... + + -- Christopher C. Chimelis Wed, 1 Aug 2001 07:06:52 -0400 + +binutils (2.11.90.0.24-1) unstable; urgency=high + + * New upstream source (synced with 20010714 CVS) + * DO NOT COMPILE FOR ALPHA. I need to fix gcc 2.95.4 + prior to this release working on Alpha correctly + (long story). + * Upstream: Avoid COPY relocs on i386 + * Upstream: Fix IA64 assembler (please try this and let me know) + * Upstream: Fix a static linking the PIC object files on ia32 + * Upstream: Add the version script support for --export-dynamic + * Upstream: Fix sparc/elf for linux/sparc + * Upstream: Fix alpha/elf for gcc 3.0 + * Supposedly required for gcc-3.0 usage on many platforms + * Add s390 to multiarch list (closes: Bug#98095) + * Supposedly good on mips, but please check. I emailed Ryan + to see if bug 98095 still happens, but never got a reply. + If I get around it, I'll check it myself since my mips + lives once again. + * Retake my package from Matt (next time we agree to an NMU, + please don't change the maintainer name...no wonder I didn't + get any bug reports!) + * Cross-compilation support will be added in the next upload + (I'll be uploading alpha debs with the next release as well, + the alpha problem outweighs cross-compilation support in + priority right now). + + -- Christopher C. Chimelis Thu, 19 Jul 2001 05:12:05 -0400 + +binutils (2.11.90.0.7-2) unstable; urgency=high + + * Applied patch from Alan Modra to fix m68k + assertion problems (closes: Bug#96352) + * Applied srec patch from Richard Henderson for + alpha. + + -- Christopher C. Chimelis Wed, 9 May 2001 03:11:19 -0400 + +binutils (2.11.90.0.7-1) unstable; urgency=high + + * New upstream source (synced with 20010425 CVS) + * Upstream: Fix the -Bsymbolic bug introduced in + binutils 2.11.90.0.5 (closes: Bug#95168) + + -- Christopher C. Chimelis Sun, 29 Apr 2001 20:03:22 -0400 + +binutils (2.11.90.0.5-1) unstable; urgency=high + + * New upstream source (synced with 20010414 CVS) + * Upstream: Fix in IA64 assembler + * Upstream: Change Linux/MIPS to use SVR4 MIPS ABI + rather than IRIX ABI. + * The above change may cause problems for MIPS. + If so, please file a bug and I'll revert those + changes if need be. I suspect that glibc, gcc, + and the kernel may eventually follow suit, though + to fit in with this change (it makes sense... + see the symbol ordering problems threads on the + binutils list for more info). + * Upstream: IA32 gas bug fixed...no further details + provided, unfortunately. + * Reportedly fixes core dumping when trying to link + object files from other platforms (now warns) + (closes: Bug#60502) + * Includes Philip Blundell's ARM PLT patch finally... + sorry for the delay (closes: Bug#94181) + * m68k problems should be fixed by now. Wish I had + gotten more feedback, but I didn't so I'm assuming it + works at this point (closes: Bug#74396) + * Stopped compiling cross-compiler packages until we + work out a better system for the entire toolchain. + Sorry, but it was taking far too long on even fast + machines and I've gotten more complaints about the + current arrangement than I have positive feedback. + (closes: Bug#91120, Bug#91119, Bug#91118, Bug#91117, + Bug#91116, Bug#88311, Bug#78028, Bug#90177) + * Fixed readelf manpage so that it no longer says that + it is a preprocessor for assembly programs + (closes: Bug#90798) + + -- Christopher C. Chimelis Tue, 17 Apr 2001 20:07:14 -0400 + +binutils (2.11.90.0.1-1) unstable; urgency=high + + * New upstream source (synced with 20010309 + CVS). + * Fixed misapplied m68k ld patch. + I am hoping that this almost totally fixes + m68k ELF for now. + * Fixed typo in mips patch and applied another + mips patch from Daniel Jacobowitz. + * Should no longer build same-arch cross + packages. Please let me know if this fix + worked so that I can close the bugs (I have + no access to such an arch at the moment) + * Made urgency high since m68k really needs + this if the bugs are truly fixed. Even if + not, this version is infinitely better on + at least two platforms than prior ones were. + + -- Christopher C. Chimelis Thu, 15 Mar 2001 16:29:32 -0500 + +binutils (2.10.91.0.2-4) unstable; urgency=low + + * Applied m68k ld and bfd patches from + Michael Fedrowitz to hopefully make things + better on m68k. + + -- Christopher C. Chimelis Sun, 11 Mar 2001 20:16:44 -0500 + +binutils (2.10.91.0.2-3) unstable; urgency=low + + * Adjusted the priority of binutils-doc to + optional. + * Added debhelper build-depends (closes: Bug#87690) + * Fixed postinst problem for new binutils + installations (closes: Bug#87911) + + -- Christopher C. Chimelis Thu, 1 Mar 2001 15:06:50 -0500 + +binutils (2.10.91.0.2-2) unstable; urgency=low + + * Add support for SH and IA64 to binutils-multiarch. + * Applied m68k gas patch from Michael Fedrowitz + in hopes that this will fix the grave bug that + has been such a pain to m68k folks. I'll leave + the bug open until it's verified that it works + ok. + * Applied IA-64 printf patch (closes: Bug#82702) + * Kernels appear to be building fine with this + release on all archs available to me + (closes: Bug#77610) + * Added text during postinst that informs users + to modify their i386 kernel Makefiles for the + --oformat change (closes: Bug#86995) + * Incorporated remaining mips diffs that weren't + already applied upstream (closes: Bug#81280) + * Sparc/sparc64 patch seems to be doing fine, so + closing the bug (closes: Bug#86781) + * Added non-linux cross- package support to rules + (closes: Bug#79948) + * Close misc bugs: + Missing info file in binutils-doc (closes: Bug#78754) + + -- Christopher C. Chimelis Thu, 22 Feb 2001 19:36:12 -0500 + +binutils (2.10.91.0.2-1) unstable; urgency=low + + * New upstream version. + * Added weak symbol relocation patch for sparc/sparc64. + * Included m68k ELF fix from Michael Fedrowitz. + * BIG NOTE: any i386 kernels compiled with this will need + to be patched to change the ld option '-oformat' to + '--oformat' (extra hyphen). + + -- Christopher C. Chimelis Tue, 20 Feb 2001 21:32:44 -0500 + +binutils (2.10.1.0.2-1) unstable; urgency=low + + * New upstream release (really prerel, but better than + using a CVS version). + * Should re-add Compaq demangling style to all + tools (alpha-only). + * Again, hopefully fixes m68k ELF support...still have + no idea why or how this was broken before. + + -- Christopher C. Chimelis Mon, 20 Nov 2000 16:25:44 -0500 + +binutils (2.10.0.27-0.cvs20001011.2) unstable; urgency=low + + * Applied another PowerPC patch to correct the + implementation of .protected and .hidden in the + linker. This should also aid in the glibc + transition on PowerPC. + + -- Christopher C. Chimelis Tue, 17 Oct 2000 13:23:40 -0400 + +binutils (2.10.0.27-0.cvs20001011.1) unstable; urgency=low + + * Applied PowerPC weak symbol patch from CVS to aid + in glibc transition on that platform. + + -- Christopher C. Chimelis Sun, 15 Oct 2000 19:12:22 -0400 + +binutils (2.10.0.27-0.cvs20001011) unstable; urgency=low + + * Grabbed a new CVS version since it backs out a + change that prevented current gcc snapshots from + linking properly to libstdc++v3. This may also + solve some other problems related to global + section symbols (feedback appreciated). + * Finally changed my email address in the control + file (how I overlooked this after all of this + time I'll never know). + + -- Christopher C. Chimelis Wed, 11 Oct 2000 08:59:36 -0400 + +binutils (2.10.0.27-0.cvs20001008) unstable; urgency=low + + * Removed configure.info.gz from binutils-doc since + it didn't really belong there. (closes: Bug#72746) + * Update for hppa/hppa64 targets (included testsuite + changes committed on 07-Oct-2000). (closes: Bug#71524) + * Upstream change to elflink.h to hopefully stop + segfaults on some archs when linking binaries to + shared libs. + + -- Christopher C. Chimelis Sun, 8 Oct 2000 16:14:08 -0400 + +binutils (2.10.0.27-0.cvs20000923.1) unstable; urgency=low + + * Fixed rules file so that builds don't fail when compiling the + binary-arch target (added binary-cross to binary-arch). + * Fixed harmless attempt at removing builddir-avr twice. + + -- Christopher C. Chimelis Thu, 28 Sep 2000 10:39:12 -0400 + +binutils (2.10.0.27-0.cvs20000923) unstable; urgency=low + + * CVS snapshot from 2000-09-23. + * Should fix some (most) HPPA issues. + * Adds binutils-m68k cross-assembler. + + -- Christopher C. Chimelis Sun, 24 Sep 2000 10:19:20 -0400 + +binutils (2.10.0.26-2) unstable; urgency=low + + * Added the avr target for Amtel's AVR MCU's + * Applied Frank I. Smith to generate packages for + multiple cross targets: + + Bump rev number, NOP. + + Testing out bumping up the rev number. + + Added powerpc, arm, mipsel cross binutils packages. + + -- Christopher C. Chimelis Fri, 22 Sep 2000 17:31:44 -0400 + +binutils (2.10.0.26-1) unstable; urgency=low + + * New upstream source. + * Added mips-linux, hppa-linux, and hppa64-linux to multiarch targets + + -- Christopher C. Chimelis Sun, 17 Sep 2000 01:05:49 -0400 + +binutils (2.10.0.24-1) unstable; urgency=low + + * New upstream source. + * Fixes ia32 assembler buglet. + * (Hopefully) fixes PPC visibility problems with + glibc 2.2 + + -- Christopher C. Chimelis Thu, 24 Aug 2000 16:52:44 -0400 + +binutils (2.10.0.18-3) unstable; urgency=low + + * Added build depends stuff. + + -- Christopher C. Chimelis Sat, 5 Aug 2000 21:09:04 -0400 + +binutils (2.10.0.18-2) unstable; urgency=low + + * Added proviso to control file saying that -multiarch + should not be installed by the average user. + + -- Christopher C. Chimelis Sat, 29 Jul 2000 20:07:15 -0400 + +binutils (2.10.0.18-1) unstable; urgency=low + + * New upstream source. + * Should address some needed things for glibc 2.2 + (added new DT_XXXX dynamic tags and fixes DT_NEEDED + link bug) + * Reapplied the now-infamous "ObjC patch" until + we can figure out why we still have this problem + (hint hint hint...we really need to do this). + + -- Christopher C. Chimelis Sat, 22 Jul 2000 13:18:27 -0400 + +binutils (2.10.0.9-4) unstable; urgency=low + + * Applied a patch from Ben Collins to fix sparc64 + linker scripts + + -- Christopher C. Chimelis Sat, 8 Jul 2000 07:24:10 -0400 + +binutils (2.10.0.9-3) unstable; urgency=low + + * Applied a patch from the libstdc++ mailing list to + make sure that the linker doesn't eat the eh_frame + section. + + -- Christopher C. Chimelis Fri, 7 Jul 2000 10:26:59 -0400 + +binutils (2.10.0.9-2) unstable; urgency=low + + * Wow, already a bug fix. + * binutils-dev now provides libiberty.h + + -- Christopher C. Chimelis Fri, 23 Jun 2000 19:54:39 -0400 + +binutils (2.10.0.9-1) unstable; urgency=low + + * New upstream version (more linux-specific). + + -- Christopher C. Chimelis Fri, 23 Jun 2000 14:31:04 -0400 + +binutils (2.10-1) unstable; urgency=low + + * New upstream version (finally, a real release!) + + -- Christopher C. Chimelis Wed, 21 Jun 2000 19:08:14 -0400 + +binutils (2.9.5.0.46-1) unstable; urgency=low + + * New upstream source. + * ELF visibility attribute should work correctly now. + * ia32 "jmp" instructions are now assembled differently + to use relocation for global jumps (affects PIC asm + code). + + -- Christopher C. Chimelis Thu, 8 Jun 2000 21:34:42 -0400 + +binutils (2.9.5.0.42-1) unstable; urgency=low + + * New upstream source. + * Includes a testcase for hidden symbol support. + + -- Christopher C. Chimelis Fri, 19 May 2000 20:48:52 -0400 + +binutils (2.9.5.0.41-1) unstable; urgency=high + + * New upstream source. + * Now includes patch to enable hidden symbol support + needed for gcc 3.0 testing. + + -- Christopher C. Chimelis Fri, 5 May 2000 20:38:41 -0400 + +binutils (2.9.5.0.37-1) frozen unstable; urgency=high + + * Was forced to bring the current frozen version up to + upstream 2.9.5.0.37 in order to fix a rather nasty + i386 gas bug and also since the existing ARM patch + applied in 2.9.5.0.31-3 has been superceded upstream + (closes:Bug#62119) + * Includes proper demangler support for Compaq compiler + usage on Alpha (may be superceded upstream shortly, + but is good enough for potato and for Compaq's usage) + (closes:Bug#62079) + * Added cross-compilation support for individual use. + Please note that the binary packages do not support + this. If you require this feature, you need to compile + the source package changing debian/rules. Also, if + you do this, YMMV since things on this front are changing + rapidly upstream and also because cross-compiling from + certain platforms to others may not work (i386->alpha, + for example). (closes:Bug#59246) + * Fixed replaces statement in binutils-multiarch + (closes:Bug#62496) + * Release Manager: I once again beg that this be included + in potato. I've freed up some time to deal with bug + reports quickly if needed. + + -- Christopher C. Chimelis Sat, 29 Apr 2000 04:03:39 -0400 + +binutils (2.9.5.0.31-3) frozen unstable; urgency=high + + * Applied patch to fix broken ARM code generation (closes:Bug#61977) + + -- Christopher C. Chimelis Fri, 7 Apr 2000 15:50:42 -0400 + +binutils (2.9.5.0.31-2) frozen unstable; urgency=high + + * Remove ld from binutils-multiarch since it doesn't want to + link kernels on several archs properly (fixes severity:important bug) + (closes: Bug#61719, Bug#61615, Bug#51625) + + -- Christopher C. Chimelis Mon, 3 Apr 2000 22:48:55 -0400 + +binutils (2.9.5.0.31-1) frozen unstable; urgency=high + + * Yet another patch (this time from H.J. Lu upstream) to fix + the unlink race condition bug. This is VERY important and + needs to be in potato. It also fixes the temp file creation + problem with objcopy on PPC (closes: Bug#60934) + * New upstream release. Fixes a serious Alpha bug along + with a demangler bug and several others (closes: Bug#61121) + * Should fix apt-get upgrade problem...please test + (closes: Bug#56175) + * Release manager: can we squeeze this in? I know it's a + new version, but the ELF bug on Alpha really needs to + be fixed along with the rest of the above and some others + not mentioned here. + + -- Christopher C. Chimelis Wed, 22 Mar 2000 05:05:12 -0500 + +binutils (2.9.5.0.22-5) frozen unstable; urgency=high + + * Applied fixed patch from Colin Phipps to seal the unlink + race condition in bfd/cache.c (closes: Bug#58865, Bug#57831) + * Installed a proper changelog in binutils-doc + (closes: Bug#58522) + * Closes other older bug (closes: Bug#55801) + * Included bbconv.pl in binutils main package in the doc dir + under the gprof subdir (closes: Bug#57521) + + -- Christopher C. Chimelis Tue, 14 Mar 2000 10:32:52 -0500 + +binutils (2.9.5.0.22-4) frozen unstable; urgency=high + + * Patched gprof/hertz.h to allow binutils to actually + build and work on Hurd (closes: Bug#57564) + * Patched bfd/cache.c to avoid a rare, but possible + security problem when as is creating/opening temp + files (closes: Bug#57831) + + -- Christopher C. Chimelis Thu, 17 Feb 2000 10:31:05 -0500 + +binutils (2.9.5.0.22-3) frozen unstable; urgency=high + + * Removed standards.info...do we really need seven + bugs filed for the same problem + (closes: Bug#54521, Bug#54546, Bug#54614, Bug#54682, Bug#55402, Bug#55582, Bug#55602) + * Changed binutils-multiarch extended description + to mention that a cross-assembling gas is not + included (closes: Bug#49308) + * Closing a bug because it related to lack of disk space + (closes: Bug#52714) + + -- Christopher C. Chimelis Wed, 19 Jan 2000 19:28:09 -0500 + +binutils (2.9.5.0.22-2) unstable; urgency=high + + * Added getopt.h include that was omitted in the -taso patch + (closes: Bug#52380) + * Fixed table misalignment when calling objdump --info + (closes: Bug#51517) + * Added Debian changelog to binutils-doc (closes: Bug#52574) + + -- Christopher C. Chimelis Wed, 15 Dec 1999 19:14:05 -0500 + +binutils (2.9.5.0.22-1) unstable; urgency=high + + * New upstream version. + * More MIPS fixes. + * Added support for -taso linker flag for Alpha. + * Reapplied all previous patches. + + -- Christopher C. Chimelis Wed, 7 Dec 1999 01:08:51 -0600 + +binutils (2.9.5.0.19-1) unstable; urgency=high + + * New upstream version + * Fixes some MIPS problems + * Reapplied the ObjC patch (is this ever going to be fixed upstream) + since it's badly needed right now + + -- Christopher C. Chimelis Thu, 4 Nov 1999 15:00:35 -0400 + +binutils (2.9.5.0.16-3) unstable; urgency=low + + * Added support for mipsel-linux in binutils-multiarch + + -- Christopher C. Chimelis Thu, 4 Nov 1999 15:00:35 -0400 + +binutils (2.9.5.0.16-2) unstable; urgency=low + + * Added a replaces field in the control file to fix + previous file overwrite problems (closes: Bug#47518, Bug#47938) + * Verified manpages are up to date (closes: Bug#18483) + * Added m68k-rtems to targets in -multiarch in hopes + that it will actually work as advertised (closes: Bug#47468) + + -- Christopher C. Chimelis Mon, 25 Oct 1999 15:58:55 -0400 + +binutils (2.9.5.0.16-1) unstable; urgency=low + + * New upstream version. + * Massive bugfix upload on the Debian side: + * Fixes changelog problems between all of the binutils + debs (closes: Bug#47133, Bug#47208, Bug#47211) + * Fixes other overwrite problems (closes: Bug#46991, Bug#47024, Bug#46074) + * Multiarch should now make good diversions when + upgrading (closes: Bug#47359) + * Applied patch from Kevin Buhr to fix ld segfaults with + empty archives (closes: Bug#47019) + * Should have fixed info install problems by now + (closes: Bug#35935) + + -- Christopher C. Chimelis Fri, 15 Oct 1999 03:18:55 -0400 + +binutils (2.9.5.0.14-1) unstable; urgency=low + + * New upstream version. + * Thanks to Matthias Klose for the following: + * Separate documentation to binutils-doc package. + * debian/rules: + - Remove extra /usr/share/doc/binutils/changelog.gz file. + - Move bfd docs to binutils-dev package. + - Move upstream changelogs to binutils-doc package. + - Remove standard GNU info files left in /usr/share/info. + - Call dh_installdocs for all packages. + * debian/*{dirs,files}: Remove. Mention explicitely in debian/rules. + + -- Christopher C. Chimelis Wed, 6 Oct 1999 03:18:55 -0400 + +binutils (2.9.5.0.12-2) unstable; urgency=low + + * Applied patch from Matthias Klose to fix many issues including architecture detection. + * Rules file is now much prettier and easier to manage. + * Binutils is now built for i386 rather than i486 in the rules file (oops). + * Added diversion for readelf in binutils-multiarch. + + -- Christopher C. Chimelis Tue, 21 Sep 1999 03:39:08 -0400 + +binutils (2.9.5.0.12-1) unstable; urgency=low + + * Massive bugfix release. + * New upstream source (finally) (closes: Bug#44934) + * Fixes upstream bugs on many platforms. + * Gives powerpc a working binutils again. (closes: Bug#45052) + * Now provides .code16 support on i386 (please test) + * Manpage for objdump should now be complete (closes: Bug#27039) + * Put together manpages for gasp and the new binary readelf (closes: Bug#21918) + * Fixes nm core dump problem (closes: Bug#41999) + * Applied patches from Ben Collins to add sparc64 support (closes: Bug#44426) + * Update Standards version + * FHS compliance + + -- Christopher C. Chimelis Sat, 18 Sept 1999 01:21:05 -0400 + +binutils (2.9.5.0.12-0.2) experimental; urgency=low + + * Added Sparc/Sparc64 changes from Ben Collins (I really need a Sparc one of these days). + * Again, this should be the last experimental before a new release. + + -- Christopher C. Chimelis Fri, 17 Aug 1999 16:32:05 -0400 + +binutils (2.9.5.0.12-0.1) experimental; urgency=low + + * New upstream version. + * Should be the last experimental before a new release. + + -- Christopher C. Chimelis Thu, 9 Aug 1999 23:12:52 -0400 + +binutils (2.9.5.0.10-0.1) experimental; urgency=low + + * New upstream version. + * Didn't apply PPC patches...let me know if still needed + + -- Christopher C. Chimelis Thu, 9 Aug 1999 23:12:52 -0400 + +binutils (2.9.5.0.6-0.1) experimental; urgency=low + + * New upstream version. + * Didn't apply PPC patches...let me know if still needed + + -- Christopher C. Chimelis Thu, 9 Aug 1999 23:12:52 -0400 + +binutils (2.9.4.0.8-0.1) unstable; urgency=low + + * New upstream version. + * Applied as much of the PPC patches as I could. + + -- Christopher C. Chimelis Thu, 15 Jul 1999 12:46:45 -0400 + +binutils (2.9.4.0.3-0.1) unstable; urgency=low + + * New upstream version. + * Apply patch from Richard Henderson to fix PPC's libpath. + * Apply patch from Franz Sirl to fix Richard Henderson. + + -- Daniel Jacobowitz Sun, 6 Jun 1999 01:27:10 -0400 + +binutils (2.9.4.0.2-0.1) unstable; urgency=low + + * New upstream version. 2.9.4.0.1 was hurriedly recalled. + + -- Daniel Jacobowitz Sun, 6 Jun 1999 01:27:10 -0400 + +binutils (2.9.4.0.1-0.1) unstable; urgency=low + + * New upstream version. + + -- Daniel Jacobowitz Sun, 6 Jun 1999 01:27:10 -0400 + +binutils (2.9.1.0.25-2) unstable; urgency=low + + * Added ObjC patch AGAIN...sorry about that + + -- Christopher C. Chimelis Sun, 23 May 1999 15:14:35 -0400 + +binutils (2.9.1.0.25-1) unstable; urgency=low + + * New upstream version - Fixes a PIII asm optimisation bug + + -- Christopher C. Chimelis Sun, 23 May 1999 00:36:55 -0400 + +binutils (2.9.1.0.24-2) unstable; urgency=low + + * Reapplied ObjC patch...apparently it's still needed. + + -- Christopher C. Chimelis Mon, 10 May 1999 19:53:15 -0400 + +binutils (2.9.1.0.24-1) unstable; urgency=low + + * New upstream release - fixes too many little things to mention. + + -- Christopher C. Chimelis Tue, 3 May 1999 16:35:08 -0400 + +binutils (2.9.1.0.23-1) unstable; urgency=low + + * New upstream release - incorporates sparc64 and arm patches. + * Added RPATH patch from Joel Klecker since my last upload failed. + * Removed ObjC patch. Let me know if it is still needed (doubtful, but + still might be). + + -- Christopher C. Chimelis Mon, 5 Apr 1999 13:26:55 -0500 + +binutils (2.9.1.0.22b-2) unstable; urgency=low + + * Added patch from Joel Klecker to finally (properly) fix the rpath issue + (Thanks, Joel!). + + -- Christopher C. Chimelis Fri, 2 Apr 1999 18:14:05 -0600 + +binutils (2.9.1.0.22b-1) unstable; urgency=low + + * Converted package to CVS (so bear with any delays in handling + bug fixes; I'm new to CVS ironically) + * New upstream version (sparc64 and ARM patches again added). + * Added support for mingw32 target in binutils-multiarch + + -- Christopher C. Chimelis Fri, 12 Mar 1999 03:51:44 -0600 + +binutils (2.9.1.0.19a-4) frozen unstable; urgency=high + * Added sparc64 patches from Steve Dunham to fix sparc64 targets + * Modified rules to add support for gcc/egcs by arch. + + -- Christopher C. Chimelis Mon, 1 Feb 1999 15:51:19 -0600 + +binutils (2.9.1.0.19a-3) frozen unstable; urgency=high + + * Reverted a patch to elflink.h that caused problems for + Obj-C code (symbols weren't exported with a size or + type). + + -- Christopher C. Chimelis Thu, 21 Jan 1999 19:25:17 -0600 + +binutils (2.9.1.0.19a-2) frozen unstable; urgency=low + + * Added arm-linux as multiarch target (sorry Jim). + * Uploaded to frozen to fix strange intermittant kernel + compilation problems (Fixes #31434). + * Fixed multiarch's postinst script to check for + c++filt.single before trying to remove it to prevent + warning messages if using g++ from egcs. + * Fixed typo in multiarch's postrm (addr2line) (Fixes: #31533) + * Added links to .so's for clean removal in the future (Fixes: #31536) + + -- Christopher C. Chimelis Fri, 8 Jan 1999 15:28:32 -0600 + +binutils (2.9.1.0.19a-1) unstable; urgency=low + + * New upstream version; fixes some Alpha problems and other archs + should benefit also. + * Added ARM target patch from Corel again (still not in upstream). + + -- Christopher C. Chimelis Mon, 4 Jan 1999 20:24:36 -0600 + +binutils (2.9.1.0.16-1) unstable; urgency=low + + * New upstream version; merges some ARM patches for Netwinders + * Added patch for ARM target from Corel (thanks Jim Pick) + + -- Christopher C. Chimelis Mon, 30 Nov 1998 16:59:25 -0600 + +binutils (2.9.1.0.15-5) frozen unstable; urgency=low + + * Reuploaded to frozen (why it wasn't there earlier....) + + -- Christopher C. Chimelis Mon, 30 Nov 1998 16:37:08 -0600 + +binutils (2.9.1.0.15-4) unstable frozen; urgency=low + + * Removed c++filt diversion in -multiarch to prevent conflicting + diversions when using egcs' g++ (which also wants to divert c++filt) + + -- Christopher C. Chimelis Wed, 25 Nov 1998 18:06:17 -0600 + +binutils (2.9.1.0.15-3) unstable frozen; urgency=low + + * Made Roman's changes "official" (thanks Roman). + + -- Christopher C. Chimelis Mon, 2 Nov 1998 05:46:56 -0600 + +binutils (2.9.1.0.15-2.1) unstable; urgency=low + + * Non-maintainer upload with agreement from Chris. + * Use a different soname for multi-arch libbfd and libopcodes; this + fixes the problem that the single-arch binaries (as and the diverted + ones) will all dump core because they're runtime-linked against the + multi-arch libs. (Fixes: #28656) + * Due to the above, binutils-multiarch also needs ldconfig in postinst + now. + * Fixup diversions once again: Do not even package the ldscripts for the + native architecture, so diversions for files in /usr/lib/ldscripts + aren't necessary. + * Also remove diversions on abort-install. + * Remove now obsolete diversions in preinst. + * Also symlink /usr/doc/binutils-multiarch to binutils, and do not + put /usr/doc/binutils in the package again. + * Put the symlinks libbfd.so and libopcode.so into binutils-dev, so one + can link to them. + + -- Roman Hodek Sat, 31 Oct 1998 11:31:14 +0100 + +binutils (2.9.1.0.15-2) unstable; urgency=low + + * Fixed binutils-multiarch diversions + * Reverted elf.c to .13 version to fix bug in strip + + -- Christopher C. Chimelis Tue, 27 Oct 1998 05:26:28 -0600 + +binutils (2.9.1.0.15-1) unstable; urgency=low + + * New upstream version. + * Moved over to debhelper and updated standards version to 2.4.1.4. + * Adds 3DNow instruction support for AMD processors. + * Fixes MANY Alpha bugs and a few for Sparc, PPC, and m68k reportedly. + * Added binutils-multiarch package to allow for multiple-arch support + (fixes bug #19471). + + -- Christopher C. Chimelis Thu, 14 Oct 1998 19:30:10 -0500 + +binutils (2.9.1.0.13-1) unstable; urgency=low + + * New upstream version, fixes bug #25354. + * Hopefully, all requested docs are included, fixes bug #21325. + * Fixes MANY Alpha problems. + * Reportedly may fix MIPS and Sparc problems also...see changelogs. + * Has been tested on x86's with great success. + + -- Christopher C. Chimelis Mon, 5 Oct 1998 23:02:08 -0500 + +binutils (2.9.1-0.2) frozen unstable; urgency=low + + * Fixed binutils-dev dependencies. + + -- Joel Klecker Tue, 05 May 1998 09:24:04 -0700 + +binutils (2.9.1-0.1) frozen unstable; urgency=medium + + * Non-maintainer release. + * New upstream release. + * Moved docs into subdirs where appropriate. + * Integrated the following changes from J.H.M. Dassen: + * Updated FSF address in copyright file. (lintian). + * Reported lack of "gasp" manpage (# ....), and link it to + undocumented(7). (lintian). + * Added a TODO list. + + -- Joel Klecker Thu, 30 Apr 1998 10:43:42 -0700 + +binutils (2.9-0.3) frozen unstable; urgency=medium + + * Added upstream patch which fixes a problem with strip + and netscape (#17971). + + -- Joel Klecker Tue, 28 Apr 1998 08:58:27 -0700 + +binutils (2.9-0.2) frozen unstable; urgency=low + + * Added more of the upstream docs (#21325). + * Put a changelog.gz symlink in /usr/doc/binutils + to satisfy policy. + + -- Joel Klecker Tue, 21 Apr 1998 09:02:22 -0700 + +binutils (2.9-0.1) frozen unstable; urgency=low + + * Non-maintainer release. + * New upstream release (bugfixes only). + + -- Joel Klecker Sun, 12 Apr 1998 04:11:07 -0700 + +binutils (2.8.1.0.23-1) unstable; urgency=low + + * New upstream version + * -dev replaces libc5-dev (#17840) + * No longer possible to link against shared libbbfd/opcodes (#18121) + + -- Galen Hazelwood Sat, 14 Mar 1998 18:19:10 -0700 + +binutils (2.8.1.0.19-1) unstable; urgency=low + + * New upstream version (#17296) + * Fixed typo in description (#16481) + * Fully replaces libbfd-dev (#16619) + + -- Galen Hazelwood Sun, 25 Jan 1998 15:37:03 -0700 + +binutils (2.8.1.0.17-1) unstable; urgency=low + + * New upstream version + * Rejoined libbfd and binutils packages (#15486) + * Added "SHELL=bash" to rules file (#14528) + * bfd info docs seem to be broken, don't install for now + + -- Galen Hazelwood Sat, 6 Dec 1997 14:55:26 -0700 + +binutils (2.8.1.0.15-1) unstable; urgency=low + + * New upstream version (#14250) + * Updated to Standard 2.3.0.0 + * Restored ansidecl.h to libbfd-dev (#14116) + + -- Galen Hazelwood Thu, 30 Oct 1997 20:04:24 -0700 + +binutils (2.8.1-2) unstable; urgency=low + + * Added 2.8.1.0.4 patch + + -- Galen Hazelwood Thu, 12 Jun 1997 20:49:57 -0600 + +binutils (2.8.1-1) unstable; urgency=low + + * New upstream version + * Added 2.8.1.0.1 patch + + -- Galen Hazelwood Fri, 30 May 1997 14:48:42 -0600 + +binutils (2.8-1) unstable; urgency=low + + * New upstream version + * Smarter debian build environment (automatic version handling) + * Added 2.8.0.3 patch + * Built with libc6 + + -- Galen Hazelwood Sun, 4 May 1997 11:16:12 -0600 + +binutils (2.7.0.9-3) frozen unstable; urgency=low + + * Patched for alpha support + * Distribute libiberty.a with -dev package (#8376) + * libbfd[x]-dev now has standard Provides/Conflicts behavior (#8377) + + -- Galen Hazelwood Fri, 28 Mar 1997 11:45:58 -0700 + +binutils (2.7.0.9-2) unstable; urgency=low + + * Moved 2.7.0.9 out of experimental (no longer unreleased beta) + + -- Galen Hazelwood Sun, 9 Mar 1997 23:43:19 -0700 + +binutils (2.7.0.9-1) experimental; urgency=low + + * New upstream beta version (fixes bug #7336) + * Split shared libraries (bfd) out of binutils (fixes bug #7244) + * No longer builds aout-binutils + + -- Galen Hazelwood Thu, 13 Feb 1997 00:27:18 -0700 + +binutils (2.7-6) unstable; urgency=low + + * Uses dpkg --print-gnu-build-architecture for build + * Demoted aout-binutils to priority "extra" + + -- Galen Hazelwood Mon, 27 Jan 1997 13:34:08 -0700 + +binutils (2.7-5) unstable; urgency=low (HIGH for m68k) + + * Added patch for m68k, will now compile X68 and kernel 2.1.15 + + -- Galen Hazelwood Tue, 31 Dec 1996 22:15:03 -0700 + +binutils (2.7-4) unstable; urgency=low + + * New maintainer + * Updated to new source format + * Fixed typo in script.1 (Fixes bug #4558) + * Fixed typo in as.1 (Fixes bug #5567) + * Postinst now calls ldconfig without explicit pathname (Fixes bug #6151) + + -- Galen Hazelwood Mon, 30 Dec 1996 12:10:25 -0700 + +binutils (2.7-3): + +Remove lib*.so links so the libs are not used for develpment. +gzip manpages + +Changes made by Michael Meskes in consent with David Engel. + +binutils (2.7-2): + +Include shared libraries +Strip shared libraries +Also update AOUT version +Minor changes to debian.rules + +binutils (2.7-1): + +Updated to new upstream version. + +Added a simple extended description (Bug#3574). + +Don't call ldconfig from postrm script (Bug#4246). + + LocalWords: Aurelien Jarno + --- binutils-2.25.orig/debian/control +++ binutils-2.25/debian/control @@ -0,0 +1,116 @@ +Source: binutils +Section: devel +Priority: optional +Maintainer: Ubuntu Core developers +XSBC-Original-Maintainer: Matthias Klose +Uploaders: James Troup , Daniel Jacobowitz +Standards-Version: 3.9.6 +Build-Depends: autoconf (>= 2.64), dpkg-dev (>= 1.17.11), + bison, flex, gettext, texinfo, dejagnu, quilt, + python3:any, file, xz-utils, lsb-release, zlib1g-dev +XS-Testsuite: autopkgtest + +Package: binutils +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: gas, elf-binutils, modutils (<< 2.4.19-1), ${extraConflicts}, + binutils-gold (<< 2.20.51.20100415) +Breaks: binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), + binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3) +Replaces: binutils-gold (<< 2.20.51.20100415), + binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), + binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3) +Provides: elf-binutils, ${gold:Provides} +Suggests: binutils-doc (>= ${source:Version}) +Description: GNU assembler, linker and binary utilities + The programs in this package are used to assemble, link and manipulate + binary and object files. They may be used in conjunction with a compiler + and various libraries to build programs. + +Package: binutils-dev +Architecture: any +Priority: extra +Depends: binutils (= ${binary:Version}) +Conflicts: libbfd-dev +Provides: libbfd-dev +Replaces: libbfd-dev, libc5-dev +Description: GNU binary utilities (BFD development files) + This package includes header files and static libraries necessary to build + programs which use the GNU BFD library, which is part of binutils. Note + that building Debian packages which depend on the shared libbfd is Not + Allowed. + +Package: binutils-multiarch +Architecture: any +Priority: extra +Depends: ${shlibs:Depends}, binutils (= ${binary:Version}) +Description: Binary utilities that support multi-arch targets + The programs in this package are used to manipulate binary and object + files that may have been created on other architectures. This package + is primarily for multi-architecture developers and cross-compilers and + is not needed by normal users or developers. Note that a cross-assembling + version of gas is not included in this package, just the binary utilities. + . + NORMAL USERS SHOULD NOT INSTALL THIS PACKAGE. It's meant only for those + requiring support for reading info from binaries from other architectures. + +Package: binutils-multiarch-dev +Architecture: any +Priority: extra +Depends: ${shlibs:Depends}, + binutils-dev (= ${binary:Version}), binutils-multiarch (= ${binary:Version}) +Replaces: binutils-multiarch (<< 2.24-5) +Description: GNU binary utilities that support multi-arch targets (BFD development files) + This package includes header files, static and shared libraries necessary + to build programs which use the GNU BFD library for multi-arch targets, + which is part of binutils. Note that building Debian packages which depend + on the shared libbfd is Not Allowed. + . + NORMAL USERS SHOULD NOT INSTALL THIS PACKAGE. It's meant only for those + requiring support for reading info from binaries from other architectures. + +Package: binutils-static +Architecture: any +Description: statically linked binutils tools + This package contains statically linked binutils tools used + for linking kernel modules needed to mount /usr or /. At the moment, + it only contains ld. + +Package: binutils-static-udeb +Section: debian-installer +Architecture: any +Description: statically linked binutils tools for for the Debian installer + This package contains statically linked binutils tools used + for linking kernel modules needed to mount /usr or /. At the moment, + it only contains ld. + +Package: binutils-hppa64 +Architecture: hppa +Depends: ${shlibs:Depends}, binutils (= ${binary:Version}) +Recommends: libc6-dev +Suggests: binutils-doc (>= ${source:Version}) +Description: GNU assembler, linker and binary utilities targeted for hppa64-linux + The programs in this package are used to assemble, link and manipulate + binary and object files. They may be used in conjunction with a compiler + and various libraries to build programs. + . + This package is needed to build an 64-bit kernel for 64-bit hppa machines. + +Package: binutils-doc +Section: doc +Architecture: all +Priority: optional +Depends: dpkg (>= 1.15.4) | install-info +Conflicts: binutils (<< 2.9.1.0.25-3) +Suggests: binutils (= ${binary:Version}) +Description: Documentation for the GNU assembler, linker and binary utilities + This package consists of the documentation for the GNU assembler, + linker and binary utilities in info format. + +Package: binutils-source +Architecture: all +Priority: optional +Depends: texinfo, zlib1g-dev, make, python +Description: GNU assembler, linker and binary utilities (source) + This package contains the sources and patches which are needed to + build binutils. --- binutils-2.25.orig/debian/control.cross.in +++ binutils-2.25/debian/control.cross.in @@ -0,0 +1,12 @@ +Package: binutils-__TARGET__ +Architecture: any +Depends: binutils, ${shlibs:Depends} +Suggests: binutils-doc (= ${Source-Version}) +Priority: extra +Built-Using: ${Built-Using} +Description: GNU binary utilities, for __TARGET__ target + This package provides GNU assembler, linker and binary utilities + for __TARGET__ target, for use in a cross-compilation environment. + . + You don't need this package unless you plan to cross-compile programs + for __TARGET__. --- binutils-2.25.orig/debian/control.in +++ binutils-2.25/debian/control.in @@ -0,0 +1,116 @@ +Source: binutils +Section: devel +Priority: optional +Maintainer: Ubuntu Core developers +XSBC-Original-Maintainer: Matthias Klose +Uploaders: James Troup , Daniel Jacobowitz +Standards-Version: 3.9.6 +Build-Depends: autoconf (>= 2.64), @dpkg_dev@ + bison, flex, gettext, texinfo, dejagnu, quilt, + python3:any, file, xz-utils, lsb-release, zlib1g-dev +XS-Testsuite: autopkgtest + +Package: binutils +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: gas, elf-binutils, modutils (<< 2.4.19-1), ${extraConflicts}, + binutils-gold (<< 2.20.51.20100415) +Breaks: binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), + binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3) +Replaces: binutils-gold (<< 2.20.51.20100415), + binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), + binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3) +Provides: elf-binutils, ${gold:Provides} +Suggests: binutils-doc (>= ${source:Version}) +Description: GNU assembler, linker and binary utilities + The programs in this package are used to assemble, link and manipulate + binary and object files. They may be used in conjunction with a compiler + and various libraries to build programs. + +Package: binutils-dev +Architecture: any +Priority: extra +Depends: binutils (= ${binary:Version}) +Conflicts: libbfd-dev +Provides: libbfd-dev +Replaces: libbfd-dev, libc5-dev +Description: GNU binary utilities (BFD development files) + This package includes header files and static libraries necessary to build + programs which use the GNU BFD library, which is part of binutils. Note + that building Debian packages which depend on the shared libbfd is Not + Allowed. + +Package: binutils-multiarch +Architecture: any +Priority: extra +Depends: ${shlibs:Depends}, binutils (= ${binary:Version}) +Description: Binary utilities that support multi-arch targets + The programs in this package are used to manipulate binary and object + files that may have been created on other architectures. This package + is primarily for multi-architecture developers and cross-compilers and + is not needed by normal users or developers. Note that a cross-assembling + version of gas is not included in this package, just the binary utilities. + . + NORMAL USERS SHOULD NOT INSTALL THIS PACKAGE. It's meant only for those + requiring support for reading info from binaries from other architectures. + +Package: binutils-multiarch-dev +Architecture: any +Priority: extra +Depends: ${shlibs:Depends}, + binutils-dev (= ${binary:Version}), binutils-multiarch (= ${binary:Version}) +Replaces: binutils-multiarch (<< 2.24-5) +Description: GNU binary utilities that support multi-arch targets (BFD development files) + This package includes header files, static and shared libraries necessary + to build programs which use the GNU BFD library for multi-arch targets, + which is part of binutils. Note that building Debian packages which depend + on the shared libbfd is Not Allowed. + . + NORMAL USERS SHOULD NOT INSTALL THIS PACKAGE. It's meant only for those + requiring support for reading info from binaries from other architectures. + +Package: binutils-static +Architecture: any +Description: statically linked binutils tools + This package contains statically linked binutils tools used + for linking kernel modules needed to mount /usr or /. At the moment, + it only contains ld. + +Package: binutils-static-udeb +Section: debian-installer +Architecture: any +Description: statically linked binutils tools for for the Debian installer + This package contains statically linked binutils tools used + for linking kernel modules needed to mount /usr or /. At the moment, + it only contains ld. + +Package: binutils-hppa64 +Architecture: hppa +Depends: ${shlibs:Depends}, binutils (= ${binary:Version}) +Recommends: libc6-dev +Suggests: binutils-doc (>= ${source:Version}) +Description: GNU assembler, linker and binary utilities targeted for hppa64-linux + The programs in this package are used to assemble, link and manipulate + binary and object files. They may be used in conjunction with a compiler + and various libraries to build programs. + . + This package is needed to build an 64-bit kernel for 64-bit hppa machines. + +Package: binutils-doc +Section: doc +Architecture: all +Priority: optional +Depends: dpkg (>= 1.15.4) | install-info +Conflicts: binutils (<< 2.9.1.0.25-3) +Suggests: binutils (= ${binary:Version}) +Description: Documentation for the GNU assembler, linker and binary utilities + This package consists of the documentation for the GNU assembler, + linker and binary utilities in info format. + +Package: binutils-source +Architecture: all +Priority: optional +Depends: texinfo, zlib1g-dev, make, python +Description: GNU assembler, linker and binary utilities (source) + This package contains the sources and patches which are needed to + build binutils. --- binutils-2.25.orig/debian/copyright +++ binutils-2.25/debian/copyright @@ -0,0 +1,44 @@ +This is the Debian GNU/Linux prepackaged version of the GNU assembler, +linker, and binary utilities. + +This package was put together by me, James Troup , +from sources, which I obtained from: + + ftp://ftp.gnu.org/pub/gnu/binutils/ + +and: + + cvs://:pserver:anoncvs@sources.redhat.com:/cvs/src + +It was previously maintained by Christopher C. Chimelis + +GNU Binutils is Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, +1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software +Foundation, Inc. + + 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. */ + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL' +and `/usr/share/common-licenses/LGPL'. + +The binutils manuals and associated documentation are also Copyright +(C) Free Software Foundation, Inc. They are distributed under the GNU +Free Documentation License Version 1.3 or any later version published +by the Free Software Foundation, with no Invariant Sections, with no +with no Front-Cover Texts, and with no Back-Cover Texts. +On Debian GNU/Linux systems, the complete text of the GFDL can be found +in `/usr/share/common-licenses/GFDL'. --- binutils-2.25.orig/debian/dwp.1 +++ binutils-2.25/debian/dwp.1 @@ -0,0 +1,33 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.5. +.TH DWP "1" "April 2015" "dwp (GNU Binutils for Ubuntu) 2.25" "User Commands" +.SH NAME +dwp \- The DWARF packaging utility +.SH SYNOPSIS +.B dwp +[\fI\,options\/\fR] [\fI\,file\/\fR...] +.SH DESCRIPTION +.TP +\fB\-h\fR, \fB\-\-help\fR +Print this help message +.TP +\fB\-e\fR EXE, \fB\-\-exec\fR EXE +Get list of dwo files from EXE (defaults output to EXE.dwp) +.TP +\fB\-o\fR FILE, \fB\-\-output\fR FILE +Set output dwp file name +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Verbose output +.TP +\fB\-\-verify\-only\fR +Verify output file against exec file +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version number +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2014 Free Software Foundation, Inc. +This program is free software; you may redistribute it under the terms of +the GNU General Public License version 3 or (at your option) any later version. +This program has absolutely no warranty. --- binutils-2.25.orig/debian/gfdl.texi +++ binutils-2.25/debian/gfdl.texi @@ -0,0 +1,41 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header + +@settitle BFD/ld internal documentation + +@c Create a separate index for command line options. +@defcodeindex op +@c Merge the standard indexes into a single one. +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@paragraphindent 1 + +@c %**end of header + +@copying +The current documentation is licensed under the same terms as the Debian packaging. +@end copying +@ifnottex +@dircategory Programming +@direntry +* @name@: (@name@). BFD/ld internal documentation (@name@). +@end direntry +@sp 1 +@end ifnottex + +@summarycontents +@contents +@page + +@node Top +@top Introduction +@cindex introduction +The official BFD, BFD internals and ld internals documentation is released +under the terms of the GNU Free Documentation License with cover texts. +This has been considered non free by the Debian Project. Thus you will find +it in the non-free section of the Debian archive. +@bye --- binutils-2.25.orig/debian/ld.gold.1 +++ binutils-2.25/debian/ld.gold.1 @@ -0,0 +1,747 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.5. +.TH GOLD "1" "April 2015" "gold (GNU Binutils for Ubuntu 2.25) 1.11" "User Commands" +.SH NAME +gold \- The GNU ELF linker +.SH SYNOPSIS +.B ld.gold +[\fI\,options\/\fR] \fI\,file\/\fR... +.SH OPTIONS +.TP +\fB\-\-help\fR +Report usage information +.TP +\fB\-v\fR, \fB\-\-version\fR +Report version information +.TP +\fB\-V\fR +Report version and target information +.TP +\fB\-\-add\-needed\fR +Not supported +.TP +\fB\-\-no\-add\-needed\fR +Do not copy DT_NEEDED tags from shared libraries +.HP +\fB\-\-allow\-multiple\-definition\fR Allow multiple definitions of symbols +.TP +\fB\-\-no\-allow\-multiple\-definition\fR +Do not allow multiple definitions +.TP +\fB\-\-allow\-shlib\-undefined\fR +Allow unresolved references in shared libraries +.TP +\fB\-\-no\-allow\-shlib\-undefined\fR +Do not allow unresolved references in shared libraries +.TP +\fB\-\-as\-needed\fR +Only set DT_NEEDED for shared libraries if used +.TP +\fB\-\-no\-as\-needed\fR +Always DT_NEEDED for shared libraries +.TP +\fB\-assert\fR [ignored] +Ignored +.TP +\fB\-b\fR [elf,binary], \fB\-\-format\fR [elf,binary] +Set input format +.HP +\fB\-Bdynamic\fR \fB\-l\fR searches for shared libraries +.HP +\fB\-Bstatic\fR \fB\-l\fR does not search for shared libraries +.TP +\fB\-dy\fR +alias for \fB\-Bdynamic\fR +.TP +\fB\-dn\fR +alias for \fB\-Bstatic\fR +.TP +\fB\-Bgroup\fR +Use group name lookup rules for shared library +.TP +\fB\-Bsymbolic\fR +Bind defined symbols locally +.TP +\fB\-Bsymbolic\-functions\fR +Bind defined function symbols locally +.TP +\fB\-\-build\-id\fR [=STYLE] +Generate build ID note +.TP +\fB\-\-build\-id\-chunk\-size\-for\-treehash\fR SIZE +Chunk size for '\-\-build\-id=tree' +.TP +\fB\-\-build\-id\-min\-file\-size\-for\-treehash\fR SIZE +Minimum output file size for '\-\-build\-id=tree' to work differently than '\-\-build\-id=sha1' +.TP +\fB\-\-check\-sections\fR +Check segment addresses for overlaps (default) +.TP +\fB\-\-no\-check\-sections\fR +Do not check segment addresses for overlaps +.TP +\fB\-\-compress\-debug\-sections\fR [none,zlib] +Compress .debug_* sections in the output file +.TP +\fB\-\-copy\-dt\-needed\-entries\fR +Not supported +.HP +\fB\-\-no\-copy\-dt\-needed\-entries\fR Do not copy DT_NEEDED tags from shared libraries +.TP +\fB\-\-cref\fR +Output cross reference table +.TP +\fB\-\-no\-cref\fR +Do not output cross reference table +.TP +\fB\-\-ctors\-in\-init\-array\fR +Use DT_INIT_ARRAY for all constructors (default) +.TP +\fB\-\-no\-ctors\-in\-init\-array\fR +Handle constructors as directed by compiler +.TP +\fB\-d\fR, \fB\-\-define\-common\fR +Define common symbols +.TP +\fB\-\-no\-define\-common\fR +Do not define common symbols +.TP +\fB\-dc\fR +Alias for \fB\-d\fR +.TP +\fB\-dp\fR +Alias for \fB\-d\fR +.TP +\fB\-\-debug\fR [all,files,script,task][,...] +Turn on debugging +.TP +\fB\-\-defsym\fR SYMBOL=EXPRESSION +Define a symbol +.TP +\fB\-\-demangle\fR [=STYLE] +Demangle C++ symbols in log messages +.TP +\fB\-\-no\-demangle\fR +Do not demangle C++ symbols in log messages +.TP +\fB\-\-detect\-odr\-violations\fR +Look for violations of the C++ One Definition Rule +.TP +\fB\-\-no\-detect\-odr\-violations\fR +Do not look for violations of the C++ One Definition Rule +.TP +\fB\-x\fR, \fB\-\-discard\-all\fR +Delete all local symbols +.TP +\fB\-X\fR, \fB\-\-discard\-locals\fR +Delete all temporary local symbols +.TP +\fB\-\-dynamic\-list\-data\fR +Add data symbols to dynamic symbols +.TP +\fB\-\-dynamic\-list\-cpp\-new\fR +Add C++ operator new/delete to dynamic symbols +.HP +\fB\-\-dynamic\-list\-cpp\-typeinfo\fR Add C++ typeinfo to dynamic symbols +.TP +\fB\-\-dynamic\-list\fR FILE +Read a list of dynamic symbols +.HP +\fB\-e\fR ADDRESS, \fB\-\-entry\fR ADDRESS Set program start address +.TP +\fB\-\-exclude\-libs\fR lib,lib ... +Exclude libraries from automatic export +.TP +\fB\-E\fR, \fB\-\-export\-dynamic\fR +Export all dynamic symbols +.TP +\fB\-\-no\-export\-dynamic\fR +Do not export all dynamic symbols (default) +.TP +\fB\-\-export\-dynamic\-symbol\fR SYMBOL +Export SYMBOL to dynamic symbol table +.TP +\fB\-EB\fR +Link big\-endian objects. +.TP +\fB\-EL\fR +Link little\-endian objects. +.TP +\fB\-\-eh\-frame\-hdr\fR +Create exception frame header +.TP +\fB\-\-no\-enum\-size\-warning\fR +(ARM only) Do not warn about objects with incompatible enum sizes +.HP +\fB\-f\fR SHLIB, \fB\-\-auxiliary\fR SHLIB Auxiliary filter for shared object symbol table +.TP +\fB\-F\fR SHLIB, \fB\-\-filter\fR SHLIB +Filter for shared object symbol table +.TP +\fB\-\-fatal\-warnings\fR +Treat warnings as errors +.TP +\fB\-\-no\-fatal\-warnings\fR +Do not treat warnings as errors +.TP +\fB\-fini\fR SYMBOL +Call SYMBOL at unload\-time +.TP +\fB\-\-fix\-cortex\-a8\fR +(ARM only) Fix binaries for Cortex\-A8 erratum. +.TP +\fB\-\-no\-fix\-cortex\-a8\fR +(ARM only) Do not fix binaries for Cortex\-A8 erratum. +.TP +\fB\-\-fix\-arm1176\fR +(ARM only) Fix binaries for ARM1176 erratum. +.TP +\fB\-\-no\-fix\-arm1176\fR +(ARM only) Do not fix binaries for ARM1176 erratum. +.TP +\fB\-\-merge\-exidx\-entries\fR +(ARM only) Merge exidx entries in debuginfo. +.TP +\fB\-\-no\-merge\-exidx\-entries\fR +(ARM only) Do not merge exidx entries in debuginfo. +.TP +\fB\-\-fix\-v4bx\fR +(ARM only) Rewrite BX rn as MOV pc, rn for ARMv4 +.TP +\fB\-\-fix\-v4bx\-interworking\fR +(ARM only) Rewrite BX rn branch to ARMv4 interworking veneer +.TP +\fB\-g\fR +Ignored +.TP +\fB\-\-gdb\-index\fR +Generate .gdb_index section +.TP +\fB\-\-no\-gdb\-index\fR +Do not generate .gdb_index section +.TP +\fB\-\-gnu\-unique\fR +Enable STB_GNU_UNIQUE symbol binding (default) +.TP +\fB\-\-no\-gnu\-unique\fR +Disable STB_GNU_UNIQUE symbol binding +.TP +\fB\-h\fR FILENAME, \fB\-soname\fR FILENAME +Set shared library name +.TP +\fB\-\-hash\-bucket\-empty\-fraction\fR FRACTION +Min fraction of empty buckets in dynamic hash +.TP +\fB\-\-hash\-style\fR [sysv,gnu,both] +Dynamic hash style +.TP +\fB\-I\fR PROGRAM, \fB\-\-dynamic\-linker\fR PROGRAM +Set dynamic linker path +.TP +\fB\-\-incremental\fR +Do an incremental link if possible; otherwise, do a full link and prepare output for incremental linking +.TP +\fB\-\-no\-incremental\fR +Do a full link (default) +.TP +\fB\-\-incremental\-full\fR +Do a full link and prepare output for incremental linking +.TP +\fB\-\-incremental\-update\fR +Do an incremental link; exit if not possible +.TP +\fB\-\-incremental\-base\fR FILE +Set base file for incremental linking (default is output file) +.TP +\fB\-\-incremental\-changed\fR +Assume files changed +.TP +\fB\-\-incremental\-unchanged\fR +Assume files didn't change +.TP +\fB\-\-incremental\-unknown\fR +Use timestamps to check files (default) +.TP +\fB\-\-incremental\-startup\-unchanged\fR +Assume startup files unchanged (files preceding this option) +.HP +\fB\-\-incremental\-patch\fR PERCENT Amount of extra space to allocate for patches +.TP +\fB\-init\fR SYMBOL +Call SYMBOL at load\-time +.TP +\fB\-\-just\-symbols\fR FILE +Read only symbol values from FILE +.TP +\fB\-\-map\-whole\-files\fR +Map whole files to memory (default on 64\-bit hosts) +.TP +\fB\-\-no\-map\-whole\-files\fR +Map relevant file parts to memory (default on 32\-bit hosts) +.TP +\fB\-\-keep\-files\-mapped\fR +Keep files mapped across passes (default) +.TP +\fB\-\-no\-keep\-files\-mapped\fR +Release mapped files after each pass +.TP +\fB\-\-ld\-generated\-unwind\-info\fR +Generate unwind information for PLT (default) +.TP +\fB\-\-no\-ld\-generated\-unwind\-info\fR +Do not generate unwind information for PLT +.TP +\fB\-l\fR LIBNAME, \fB\-\-library\fR LIBNAME +Search for library LIBNAME +.TP +\fB\-L\fR DIR, \fB\-\-library\-path\fR DIR +Add directory to search path +.TP +\fB\-\-text\-reorder\fR +Enable text section reordering for GCC section names (default) +.TP +\fB\-\-no\-text\-reorder\fR +Disable text section reordering for GCC section names +.TP +\fB\-nostdlib\fR +Only search directories specified on the command line. +.TP +\fB\-\-rosegment\fR +Put read\-only non\-executable sections in their own segment +.TP +\fB\-\-rosegment\-gap\fR OFFSET +Set offset between executable and read\-only segments +.TP +\fB\-m\fR EMULATION +Set GNU linker emulation; obsolete +.TP +\fB\-\-mmap\-output\-file\fR +Map the output file for writing (default). +.TP +\fB\-\-no\-mmap\-output\-file\fR +Do not map the output file for writing. +.TP +\fB\-M\fR, \fB\-\-print\-map\fR +Write map file on standard output +.TP +\fB\-Map\fR MAPFILENAME +Write map file +.TP +\fB\-n\fR, \fB\-\-nmagic\fR +Do not page align data +.TP +\fB\-N\fR, \fB\-\-omagic\fR +Do not page align data, do not make text readonly +.TP +\fB\-\-no\-omagic\fR +Page align data, make text readonly +.TP +\fB\-\-enable\-new\-dtags\fR +Enable use of DT_RUNPATH and DT_FLAGS +.TP +\fB\-\-disable\-new\-dtags\fR +Disable use of DT_RUNPATH and DT_FLAGS +.TP +\fB\-\-noinhibit\-exec\fR +Create an output file even if errors occur +.TP +\fB\-\-no\-undefined\fR +Report undefined symbols (even with \fB\-\-shared\fR) +.TP +\fB\-o\fR FILE, \fB\-\-output\fR FILE +Set output file name +.TP +\fB\-O\fR LEVEL, \fB\-optimize\fR LEVEL +Optimize output file size +.TP +\fB\-\-oformat\fR [binary] +Set output format +.TP +\fB\-p\fR +(ARM only) Ignore for backward compatibility +.TP +\fB\-pie\fR +Create a position independent executable +.TP +\fB\-no\-pie\fR +Do not create a position independent executable +.TP +\fB\-\-pic\-executable\fR +Create a position independent executable +.TP +\fB\-\-no\-pic\-executable\fR +Do not create a position independent executable +.TP +\fB\-no\-pipeline\-knowledge\fR +(ARM only) Ignore for backward compatibility +.TP +\fB\-\-plt\-align\fR [=P2ALIGN] +(PowerPC64 only) Align PLT call stubs to fit cache lines +.TP +\fB\-\-plt\-static\-chain\fR +(PowerPC64 only) PLT call stubs should load r11 +.TP +\fB\-\-no\-plt\-static\-chain\fR +(PowerPC64 only) PLT call stubs should not load r11 +.TP +\fB\-\-plt\-thread\-safe\fR +(PowerPC64 only) PLT call stubs with load\-load barrier +.TP +\fB\-\-no\-plt\-thread\-safe\fR +(PowerPC64 only) PLT call stubs without barrier +.TP +\fB\-\-plugin\fR PLUGIN +Load a plugin library +.TP +\fB\-\-plugin\-opt\fR OPTION +Pass an option to the plugin +.TP +\fB\-\-posix\-fallocate\fR +Use posix_fallocate to reserve space in the output file (default). +.TP +\fB\-\-no\-posix\-fallocate\fR +Use fallocate or ftruncate to reserve space. +.TP +\fB\-\-preread\-archive\-symbols\fR +Preread archive symbols when multi\-threaded +.TP +\fB\-\-print\-output\-format\fR +Print default output format +.TP +\fB\-\-print\-symbol\-counts\fR FILENAME +Print symbols defined and used for each input +.TP +\fB\-Qy\fR +Ignored for SVR4 compatibility +.TP +\fB\-q\fR, \fB\-\-emit\-relocs\fR +Generate relocations in output +.TP +\fB\-r\fR, \fB\-relocatable\fR +Generate relocatable output +.TP +\fB\-i\fR +Synonym for \fB\-r\fR +.TP +\fB\-\-relax\fR +Relax branches on certain targets +.TP +\fB\-\-retain\-symbols\-file\fR FILE +keep only symbols listed in this file +.TP +\fB\-R\fR DIR +Add DIR to runtime search path +.TP +\fB\-rpath\fR DIR +Add DIR to runtime search path +.TP +\fB\-\-rpath\-link\fR DIR +Add DIR to link time shared library search path +.TP +\fB\-\-section\-ordering\-file\fR FILENAME +Layout sections in the order specified. +.TP +\fB\-\-section\-start\fR SECTION=ADDRESS +Set address of section +.TP +\fB\-\-sort\-common\fR [={ascending,descending}] +Sort common symbols by alignment +.TP +\fB\-\-sort\-section\fR [none,name] +Sort sections by name. '\-\-no\-text\-reorder' will override '\-\-sort\-section=name' for .text +.TP +\fB\-\-spare\-dynamic\-tags\fR COUNT +Dynamic tag slots to reserve (default 5) +.TP +\fB\-s\fR, \fB\-\-strip\-all\fR +Strip all symbols +.TP +\fB\-S\fR, \fB\-\-strip\-debug\fR +Strip debugging information +.TP +\fB\-\-strip\-debug\-non\-line\fR +Emit only debug line number information +.TP +\fB\-\-strip\-debug\-gdb\fR +Strip debug symbols that are unused by gdb (at least versions <= 7.4) +.TP +\fB\-\-strip\-lto\-sections\fR +Strip LTO intermediate code sections +.TP +\fB\-\-stub\-group\-size\fR SIZE +(ARM, PowerPC only) The maximum distance from instructions in a group of sections to their stubs. Negative values mean stubs are always after (PowerPC before) the group. 1 means use default size. +.TP +\fB\-\-no\-keep\-memory\fR +Use less memory and more disk I/O (included only for compatibility with GNU ld) +.TP +\fB\-G\fR, \fB\-shared\fR +Generate shared library +.TP +\fB\-Bshareable\fR +Generate shared library +.TP +\fB\-\-split\-stack\-adjust\-size\fR SIZE +Stack size when \fB\-fsplit\-stack\fR function calls non\-split +.TP +\fB\-static\fR +Do not link against shared libraries +.TP +\fB\-\-icf\fR [none,all,safe] +Identical Code Folding. '\-\-icf=safe' Folds ctors, dtors and functions whose pointers are definitely not taken. +.TP +\fB\-\-icf\-iterations\fR COUNT +Number of iterations of ICF (default 2) +.TP +\fB\-\-print\-icf\-sections\fR +List folded identical sections on stderr +.TP +\fB\-\-no\-print\-icf\-sections\fR +Do not list folded identical sections +.TP +\fB\-\-keep\-unique\fR SYMBOL +Do not fold this symbol during ICF +.TP +\fB\-\-gc\-sections\fR +Remove unused sections +.TP +\fB\-\-no\-gc\-sections\fR +Don't remove unused sections (default) +.TP +\fB\-\-print\-gc\-sections\fR +List removed unused sections on stderr +.TP +\fB\-\-no\-print\-gc\-sections\fR +Do not list removed unused sections +.TP +\fB\-\-stats\fR +Print resource usage statistics +.TP +\fB\-\-sysroot\fR DIR +Set target system root directory +.TP +\fB\-t\fR, \fB\-\-trace\fR +Print the name of each input file +.TP +\fB\-T\fR FILE, \fB\-\-script\fR FILE +Read linker script +.TP +\fB\-\-threads\fR +Run the linker multi\-threaded +.TP +\fB\-\-no\-threads\fR +Do not run the linker multi\-threaded +.TP +\fB\-\-thread\-count\fR COUNT +Number of threads to use +.TP +\fB\-\-thread\-count\-initial\fR COUNT +Number of threads to use in initial pass +.HP +\fB\-\-thread\-count\-middle\fR COUNT Number of threads to use in middle pass +.TP +\fB\-\-thread\-count\-final\fR COUNT +Number of threads to use in final pass +.TP +\fB\-Tbss\fR ADDRESS +Set the address of the bss segment +.TP +\fB\-Tdata\fR ADDRESS +Set the address of the data segment +.TP +\fB\-Ttext\fR ADDRESS +Set the address of the text segment +.TP +\fB\-Ttext\-segment\fR ADDRESS +Set the address of the text segment +.TP +\fB\-Trodata\-segment\fR ADDRESS +Set the address of the rodata segment +.TP +\fB\-\-toc\-optimize\fR +(PowerPC64 only) Optimize TOC code sequences +.TP +\fB\-\-no\-toc\-optimize\fR +(PowerPC64 only) Don't optimize TOC code sequences +.TP +\fB\-\-toc\-sort\fR +(PowerPC64 only) Sort TOC and GOT sections +.TP +\fB\-\-no\-toc\-sort\fR +(PowerPC64 only) Don't sort TOC and GOT sections +.TP +\fB\-u\fR SYMBOL, \fB\-\-undefined\fR SYMBOL +Create undefined reference to SYMBOL +.TP +\fB\-\-unresolved\-symbols\fR ignore\-all,report\-all,ignore\-in\-object\-files,ignore\-in\-shared\-libs +How to handle unresolved symbols +.TP +\fB\-\-verbose\fR +Synonym for \fB\-\-debug\fR=\fI\,files\/\fR +.TP +\fB\-\-version\-script\fR FILE +Read version script +.TP +\fB\-\-warn\-common\fR +Warn about duplicate common symbols +.TP +\fB\-\-no\-warn\-common\fR +Do not warn about duplicate common symbols (default) +.TP +\fB\-\-warn\-constructors\fR +Ignored +.TP +\fB\-\-no\-warn\-constructors\fR +Ignored +.TP +\fB\-\-warn\-execstack\fR +Warn if the stack is executable +.TP +\fB\-\-no\-warn\-execstack\fR +Do not warn if the stack is executable (default) +.TP +\fB\-\-no\-warn\-mismatch\fR +Don't warn about mismatched input files +.TP +\fB\-\-warn\-multiple\-gp\fR +Ignored +.TP +\fB\-\-warn\-search\-mismatch\fR +Warn when skipping an incompatible library +.TP +\fB\-\-no\-warn\-search\-mismatch\fR +Don't warn when skipping an incompatible library +.TP +\fB\-\-warn\-shared\-textrel\fR +Warn if text segment is not shareable +.TP +\fB\-\-no\-warn\-shared\-textrel\fR +Do not warn if text segment is not shareable (default) +.TP +\fB\-\-warn\-unresolved\-symbols\fR +Report unresolved symbols as warnings +.TP +\fB\-\-error\-unresolved\-symbols\fR +Report unresolved symbols as errors +.TP +\fB\-\-no\-wchar\-size\-warning\fR +(ARM only) Do not warn about objects with incompatible wchar_t sizes +.TP +\fB\-\-whole\-archive\fR +Include all archive contents +.TP +\fB\-\-no\-whole\-archive\fR +Include only needed archive contents +.TP +\fB\-\-wrap\fR SYMBOL +Use wrapper functions for SYMBOL +.TP +\fB\-y\fR SYMBOL, \fB\-\-trace\-symbol\fR SYMBOL +Trace references to symbol +.TP +\fB\-\-undefined\-version\fR +Allow unused version in script (default) +.TP +\fB\-\-no\-undefined\-version\fR +Do not allow unused version in script +.TP +\fB\-Y\fR PATH +Default search path for Solaris compatibility +.TP +\-(, \fB\-\-start\-group\fR +Start a library search group +.TP +\-), \fB\-\-end\-group\fR +End a library search group +.TP +\fB\-\-start\-lib\fR +Start a library +.TP +\fB\-\-end\-lib\fR +End a library +.TP +\fB\-fuse\-ld\fR +Ignored for GCC linker option compatibility +.TP +\fB\-z\fR combreloc +Sort dynamic relocs +.TP +\fB\-z\fR nocombreloc +Do not sort dynamic relocs +.TP +\fB\-z\fR common\-page\-size=SIZE +Set common page size to SIZE +.TP +\fB\-z\fR defs +Report undefined symbols (even with \fB\-\-shared\fR) +.TP +\fB\-z\fR execstack +Mark output as requiring executable stack +.TP +\fB\-z\fR initfirst +Mark DSO to be initialized first at runtime +.TP +\fB\-z\fR interpose +Mark object to interpose all DSOs but executable +.TP +\fB\-z\fR lazy +Mark object for lazy runtime binding (default) +.TP +\fB\-z\fR loadfltr +Mark object requiring immediate process +.TP +\fB\-z\fR max\-page\-size=SIZE +Set maximum page size to SIZE +.TP +\fB\-z\fR muldefs +Allow multiple definitions of symbols +.TP +\fB\-z\fR nocopyreloc +Do not create copy relocs +.TP +\fB\-z\fR nodefaultlib +Mark object not to use default search paths +.TP +\fB\-z\fR nodelete +Mark DSO non\-deletable at runtime +.TP +\fB\-z\fR nodlopen +Mark DSO not available to dlopen +.TP +\fB\-z\fR nodump +Mark DSO not available to dldump +.TP +\fB\-z\fR noexecstack +Mark output as not requiring executable stack +.TP +\fB\-z\fR now +Mark object for immediate function binding +.TP +\fB\-z\fR origin +Mark DSO to indicate that needs immediate $ORIGIN processing at runtime +.TP +\fB\-z\fR relro +Where possible mark variables read\-only after relocation +.TP +\fB\-z\fR norelro +Don't mark variables read\-only after relocation +.TP +\fB\-z\fR text +Do not permit relocations in read\-only segments +.TP +\fB\-z\fR notext +Permit relocations in read\-only segments (default) +.TP +\fB\-z\fR textoff +Permit relocations in read\-only segments (default) +.TP +\fB\-z\fR buildd +Dummy z option +.PP +ld.gold: supported targets: elf32\-i386 elf32\-i386\-freebsd elf32\-i386\-nacl elf32\-x86\-64 elf32\-x86\-64\-freebsd elf32\-x86\-64\-nacl elf64\-x86\-64 elf64\-x86\-64\-freebsd elf64\-x86\-64\-nacl +ld.gold: supported emulations: elf_i386 elf_i386_nacl elf32_x86_64 elf32_x86_64_nacl elf_x86_64 elf_x86_64_nacl +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright \(co 2014 Free Software Foundation, Inc. +This program is free software; you may redistribute it under the terms of +the GNU General Public License version 3 or (at your option) a later version. +This program has absolutely no warranty. --- binutils-2.25.orig/debian/patches/001_ld_makefile_patch.patch +++ binutils-2.25/debian/patches/001_ld_makefile_patch.patch @@ -0,0 +1,31 @@ +Author: +Description: Description: correct where ld scripts are installed +Author: Chris Chimelis +Upstream status: N/A +Date: ?? +Index: b/ld/Makefile.am +=================================================================== +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -54,7 +54,7 @@ endif + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +Index: b/ld/Makefile.in +=================================================================== +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -388,7 +388,7 @@ AM_CFLAGS = $(WARN_CFLAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include --- binutils-2.25.orig/debian/patches/002_gprof_profile_arcs.patch +++ binutils-2.25/debian/patches/002_gprof_profile_arcs.patch @@ -0,0 +1,29 @@ +Author: Chris Chimelis +Description: Add more documentation about profiling and -fprofile-arcs. +Index: b/gprof/gprof.texi +=================================================================== +--- a/gprof/gprof.texi ++++ b/gprof/gprof.texi +@@ -145,6 +145,10 @@ + If more than one profile file is specified, the @code{gprof} + output shows the sum of the profile information in the given profile files. + ++If you use gcc 2.95.x or 3.0 to compile your binaries, you may need ++to add the @samp{-fprofile-arcs} to the compile command line in order ++for the call graphs to be properly stored in gmon.out. ++ + @code{Gprof} calculates the amount of time spent in each routine. + Next, these times are propagated along the edges of the call graph. + Cycles are discovered, and calls into a cycle are made to share the time +@@ -276,6 +280,11 @@ + options. The same option, @samp{-pg}, alters either compilation or linking + to do what is necessary for profiling. Here are examples: + ++If you use gcc 2.95.x or 3.0.x, you may need to add the ++@samp{-fprofile-arcs} option to the compile line along with @samp{-pg} ++in order to allow the call-graphs to be properly included in the gmon.out ++file. ++ + @example + cc -g -c myprog.c utils.c -pg + cc -o myprog myprog.o utils.o -pg --- binutils-2.25.orig/debian/patches/003_gprof_see_also_monitor.patch +++ binutils-2.25/debian/patches/003_gprof_see_also_monitor.patch @@ -0,0 +1,15 @@ +Author: Chris Chimelis +Description: Don't mention monitor(3) which doesn't exist in Debian. (#160654) +Index: b/gprof/gprof.texi +=================================================================== +--- a/gprof/gprof.texi ++++ b/gprof/gprof.texi +@@ -193,7 +193,7 @@ + @c man end + + @c man begin SEEALSO +-monitor(3), profil(2), cc(1), prof(1), and the Info entry for @file{gprof}. ++cc(1), prof(1), and the Info entry for @file{gprof}. + + ``An Execution Profiler for Modular Programs'', + by S. Graham, P. Kessler, M. McKusick; --- binutils-2.25.orig/debian/patches/006_better_file_error.patch +++ binutils-2.25/debian/patches/006_better_file_error.patch @@ -0,0 +1,21 @@ +Author: David Kimdon +Description: Specify which filename is causing an error if the filename is a +directory. (#45832) +Index: b/bfd/opncls.c +=================================================================== +--- a/bfd/opncls.c ++++ b/bfd/opncls.c +@@ -193,6 +193,13 @@ + { + bfd *nbfd; + const bfd_target *target_vec; ++ struct stat s; ++ ++ if (stat (filename, &s) == 0) ++ if (S_ISDIR(s.st_mode)) { ++ bfd_set_error (bfd_error_file_not_recognized); ++ return NULL; ++ } + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) --- binutils-2.25.orig/debian/patches/012_check_ldrunpath_length.patch +++ binutils-2.25/debian/patches/012_check_ldrunpath_length.patch @@ -0,0 +1,25 @@ +Author: Chris Chimelis +Description: Only generate an RPATH entry if LD_RUN_PATH is not empty, for +cases where -rpath isn't specified. (#151024) +Index: b/ld/emultempl/elf32.em +=================================================================== +--- a/ld/emultempl/elf32.em ++++ b/ld/emultempl/elf32.em +@@ -1195,6 +1195,8 @@ fragment <link.next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) --- binutils-2.25.orig/debian/patches/013_bash_in_ld_testsuite.patch +++ binutils-2.25/debian/patches/013_bash_in_ld_testsuite.patch @@ -0,0 +1,28 @@ +Author: Matthias Klose +Description: Explicitely use bash for the ld testsuite. +Index: b/ld/testsuite/config/default.exp +=================================================================== +--- a/ld/testsuite/config/default.exp ++++ b/ld/testsuite/config/default.exp +@@ -117,10 +117,10 @@ proc get_link_files {varname} { + #makefile rules, with embedded shell variable expansions. + #make wants $$shell_var, we want $shell_var ... + set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' < +Upstream status: Debian specific +--- a/ld/emulparams/elf_i386.sh ++++ b/ld/emulparams/elf_i386.sh +@@ -13,3 +13,13 @@ + NO_SMALL_DATA=yes + SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 12 ? 12 : 0" + IREL_IN_PLT= ++ ++# Linux modify the default library search path to first include ++# a 32-bit specific directory. ++case "$target" in ++ x86_64*-linux* | i[3-7]86*-linux* | x86_64*-kfreebsd*-gnu | i[3-7]86*-kfreebsd*-gnu) ++ case "$EMULATION_NAME" in ++ *i386*) LIBPATH_SUFFIX=32 ;; ++ esac ++ ;; ++esac --- binutils-2.25.orig/debian/patches/128_build_id.patch +++ binutils-2.25/debian/patches/128_build_id.patch @@ -0,0 +1,42 @@ +Author: +Description: Description: Fix ld corrupt build ID generation +Author: Nick Clifton +Upstream status: Taken from Fedora (BZ 501582) +--- a/bfd/compress.c ++++ b/bfd/compress.c +@@ -174,7 +174,7 @@ + case COMPRESS_SECTION_NONE: + if (p == NULL) + { +- p = (bfd_byte *) bfd_malloc (sz); ++ p = (bfd_byte *) bfd_zmalloc (sz); + if (p == NULL) + return FALSE; + need_free = TRUE; +--- a/bfd/elfcode.h ++++ b/bfd/elfcode.h +@@ -1158,6 +1158,24 @@ + + if (i_shdr.contents) + (*process) (i_shdr.contents, i_shdr.sh_size, arg); ++ else ++ { ++ asection *sec; ++ ++ sec = bfd_section_from_elf_index (abfd, count); ++ if (sec != NULL) ++ { ++ if (sec->contents == NULL) ++ { ++ /* Force rereading from file. */ ++ sec->flags &= ~SEC_IN_MEMORY; ++ if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents)) ++ continue; ++ } ++ if (sec->contents != NULL) ++ (*process) (sec->contents, i_shdr.sh_size, arg); ++ } ++ } + } + + return TRUE; --- binutils-2.25.orig/debian/patches/128_ppc64_powerpc_biarch.patch +++ binutils-2.25/debian/patches/128_ppc64_powerpc_biarch.patch @@ -0,0 +1,17 @@ +Index: b/ld/emulparams/elf32ppccommon.sh +=================================================================== +--- a/ld/emulparams/elf32ppccommon.sh ++++ b/ld/emulparams/elf32ppccommon.sh +@@ -54,3 +54,12 @@ case "$host":"$EMULATION_NAME" in + *:*64*) LIBPATH_SUFFIX=64 ;; + *:*32*) LIBPATH_SUFFIX=32 ;; + esac ++ ++# On 64bit, look for 32 bit target libraries in /lib32, /usr/lib32 etc., first. ++case "$target" in ++ powerpc64-*-linux* | ppc64-*-linux*) ++ case "$EMULATION_NAME" in ++ *32*) LIBPATH_SUFFIX=32 ;; ++ esac ++ ;; ++esac --- binutils-2.25.orig/debian/patches/129_multiarch_libpath.patch +++ binutils-2.25/debian/patches/129_multiarch_libpath.patch @@ -0,0 +1,212 @@ +# DP: Add multiarch directories to linker search path for ld and gold. + +Index: b/ld/genscripts.sh +=================================================================== +--- a/ld/genscripts.sh ++++ b/ld/genscripts.sh +@@ -228,7 +228,115 @@ + *) LIB_PATH=${lib_path1}:${lib_path2} ;; + esac + ++# We use the $tool_lib variable in our multiarch mangling: ++if [ "x${TOOL_LIB}" = "x" ] ; then ++ tool_lib=${exec_prefix}/${target_alias}/lib ++else ++ tool_lib=${exec_prefix}/${TOOL_LIB}/lib ++fi ++ ++if [ "x${APPEND_TOOLLIBDIR}" = "xyes" ] ; then ++ LIB_PATH=${LIB_PATH}:${tool_lib} ++ # For multilib targets, search both $tool_lib dirs ++ if [ "x${LIBPATH_SUFFIX}" != "x" ] ; then ++ LIB_PATH=${LIB_PATH}:${tool_lib}${LIBPATH_SUFFIX} ++ fi ++fi ++ + LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'` ++if [ -n "$DEB_TARGET_MULTIARCH" ]; then ++ temp_dirs=' ' ++ for dir in `echo ${LIB_PATH} | sed -e 's/:/ /g'`; do ++ case "$dir" in ++ *${tool_lib}*|*/${target_alias}/*) ++ ;; ++ */lib) ++ if [ -n "$DEB_TARGET_MULTIARCH32" ]; then ++ case $EMULATION_NAME in ++ elf_i386|elf32*) ++ temp_dirs="${temp_dirs}${dir}/$DEB_TARGET_MULTIARCH32 ";; ++ *) ++ temp_dirs="${temp_dirs}${dir}/$DEB_TARGET_MULTIARCH " ++ esac ++ elif [ -n "$DEB_TARGET_MULTIARCH64" ]; then ++ case $EMULATION_NAME in ++ elf*_64|elf64*) ++ temp_dirs="${temp_dirs}${dir}/$DEB_TARGET_MULTIARCH64 ";; ++ *) ++ temp_dirs="${temp_dirs}${dir}/$DEB_TARGET_MULTIARCH " ++ esac ++ else ++ temp_dirs="${temp_dirs}${dir}/$DEB_TARGET_MULTIARCH " ++ fi ++ ;; ++ */lib32) ++ if [ -n "$DEB_TARGET_MULTIARCH32" ]; then ++ dir2=$(echo $dir | sed "s,32$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_TARGET_MULTIARCH32 " ++ fi ++ ;; ++ */lib64) ++ case "${target}" in ++ aarch64*-*-*|powerpc64-*-*|s390x-*-*|sparc64-*-*|x86_64-*-linux-gnu|mips64-*-gnuabi64) ++ #dir=$(echo $dir | sed "s,64$,,") ++ dir2=$(echo $dir | sed "s,64$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_TARGET_MULTIARCH " ++ ;; ++ *) ++ if [ -n "$DEB_TARGET_MULTIARCH64" ]; then ++ dir2=$(echo $dir | sed "s,64$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_TARGET_MULTIARCH64 " ++ fi ++ ;; ++ esac ++ ;; ++ */libx32) ++ case "${target}" in ++ x86_64-*-linux-gnux32) ++ dir2=$(echo $dir | sed "s,x32$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_TARGET_MULTIARCH " ++ ;; ++ *) ++ if [ -n "$DEB_TARGET_MULTIARCHX32" ]; then ++ dir2=$(echo $dir | sed "s,x32$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCHX32 " ++ fi ++ ;; ++ esac ++ ;; ++ */libn32) ++ case "${target}" in ++ mips64*-*-linux-gnuabin32) ++ dir2=$(echo $dir | sed "s,n32$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_TARGET_MULTIARCH " ++ ;; ++ *) ++ if [ -n "$DEB_TARGET_MULTIARCHN32" ]; then ++ dir2=$(echo $dir | sed "s,n32$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCHN32 " ++ fi ++ ;; ++ esac ++ ;; ++ */libilp32) ++ if [ -n "$DEB_TARGET_MULTIARCH32" ]; then ++ dir2=$(echo $dir | sed "s,ilp32$,,") ++ temp_dirs="${temp_dirs}${dir2}/$DEB_TARGET_MULTIARCH32 " ++ fi ++ ;; ++ *) ++ ;; ++ esac ++ temp_dirs="${temp_dirs}${dir} " ++ done ++ LIB_SEARCH_DIRS= ++ for dir in $temp_dirs; do ++ if echo "$LIB_SEARCH_DIRS" | fgrep -q "\"$dir\""; then ++ continue ++ fi ++ LIB_SEARCH_DIRS="${LIB_SEARCH_DIRS}SEARCH_DIR(\"$dir\"); " ++ done ++fi + + # We need it for testsuite. + set $EMULATION_LIBPATH +Index: b/gold/Makefile.am +=================================================================== +--- a/gold/Makefile.am ++++ b/gold/Makefile.am +@@ -32,6 +32,7 @@ + -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \ + -DLOCALEDIR="\"$(datadir)/locale\"" \ + -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \ ++ @MULTIARCH_DIRNAME@ $(if $(APPEND_TOOLLIBDIR),-DAPPEND_TOOLLIBDIR) \ + -DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@ + + LIBIBERTY = ../libiberty/libiberty.a +Index: b/gold/configure +=================================================================== +--- a/gold/configure ++++ b/gold/configure +@@ -594,6 +594,7 @@ + MAINT + MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE ++MULTIARCH_DIRNAME + DLOPEN_LIBS + CXXCPP + HAVE_NO_USE_LINKER_PLUGIN_FALSE +@@ -7648,6 +7649,14 @@ + fi + + ++if test x$DEB_TARGET_MULTIARCH != x; then ++ multiarch=$DEB_TARGET_MULTIARCH ++ if test -n "$multiarch"; then ++ MULTIARCH_DIRNAME='-DMULTIARCH_DIRNAME=\"'$multiarch'\"' ++ fi ++fi ++ ++ + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 + $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } +Index: b/gold/configure.ac +=================================================================== +--- a/gold/configure.ac ++++ b/gold/configure.ac +@@ -628,6 +628,14 @@ + AC_CHECK_FUNCS(setlocale) + AM_LC_MESSAGES + ++if test x$DEB_TARGET_MULTIARCH != x; then ++ multiarch=$DEB_TARGET_MULTIARCH ++ if test -n "$multiarch"; then ++ MULTIARCH_DIRNAME='-DMULTIARCH_DIRNAME=\"'$multiarch'\"' ++ fi ++fi ++AC_SUBST(MULTIARCH_DIRNAME) ++ + AM_MAINTAINER_MODE + + AC_OUTPUT(Makefile testsuite/Makefile po/Makefile.in:po/Make-in) +Index: b/gold/options.cc +=================================================================== +--- a/gold/options.cc ++++ b/gold/options.cc +@@ -1142,8 +1142,15 @@ + || this->user_set_sysroot() + || *TARGET_SYSTEM_ROOT != '\0') + { ++#ifdef MULTIARCH_DIRNAME ++ this->add_to_library_path_with_sysroot("/lib/" MULTIARCH_DIRNAME); ++ this->add_to_library_path_with_sysroot("/usr/lib/" MULTIARCH_DIRNAME); ++#endif + this->add_to_library_path_with_sysroot("/lib"); + this->add_to_library_path_with_sysroot("/usr/lib"); ++#ifdef APPEND_TOOLLIBDIR ++ this->add_to_library_path_with_sysroot(TOOLLIBDIR); ++#endif + } + else + this->add_to_library_path_with_sysroot(TOOLLIBDIR); +Index: b/gold/Makefile.in +=================================================================== +--- a/gold/Makefile.in ++++ b/gold/Makefile.in +@@ -415,6 +415,7 @@ + -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \ + -DLOCALEDIR="\"$(datadir)/locale\"" \ + -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \ ++ @MULTIARCH_DIRNAME@ $(if $(APPEND_TOOLLIBDIR),-DAPPEND_TOOLLIBDIR) \ + -DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@ + + LIBIBERTY = ../libiberty/libiberty.a --- binutils-2.25.orig/debian/patches/130_gold_disable_testsuite_build.patch +++ binutils-2.25/debian/patches/130_gold_disable_testsuite_build.patch @@ -0,0 +1,30 @@ +Author: +Description: Description: Disable build of gold/testsuite +Author: Matthias Klose +Upstream status: local +Index: b/gold/Makefile.am +=================================================================== +--- a/gold/Makefile.am ++++ b/gold/Makefile.am +@@ -19,7 +19,7 @@ + + AUTOMAKE_OPTIONS = foreign + +-SUBDIRS = po testsuite ++SUBDIRS = po + + tooldir = $(exec_prefix)/$(target_alias) + +Index: b/gold/Makefile.in +=================================================================== +--- a/gold/Makefile.in ++++ b/gold/Makefile.in +@@ -406,7 +406,7 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = po testsuite ++SUBDIRS = po + tooldir = $(exec_prefix)/$(target_alias) + ACLOCAL_AMFLAGS = -I ../bfd -I ../config + AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) --- binutils-2.25.orig/debian/patches/131_ld_bootstrap_testsuite.patch +++ binutils-2.25/debian/patches/131_ld_bootstrap_testsuite.patch @@ -0,0 +1,47 @@ +Author: +Description: Description: Fix ld-bootstrap testsuite when configured with --enable-plugins +Author: Rafael Espindola +Upstream status: proposed patch +Index: b/ld/testsuite/ld-bootstrap/bootstrap.exp +=================================================================== +--- a/ld/testsuite/ld-bootstrap/bootstrap.exp ++++ b/ld/testsuite/ld-bootstrap/bootstrap.exp +@@ -44,6 +44,15 @@ if [check_plugin_api_available] { + set plugins "yes" + } + ++remote_exec host "$nm --help" "" "/dev/null" "plugin-support" ++set tmp [file_contents "plugin-support"] ++regexp ".*\(--plugin\).*\n" $tmp foo plugins ++if [info exists plugins] then { ++ set plugins "yes" ++} else { ++ set plugins "no" ++} ++ + # Bootstrap ld. First link the object files together using -r, in + # order to test -r. Then link the result into an executable, ld1, to + # really test -r. Use ld1 to link a fresh ld, ld2. Use ld2 to link a +@@ -90,6 +99,11 @@ foreach flags $test_flags { + continue + } + ++ if { $flags == "--static" && $plugins == "yes" } then { ++ untested $testname ++ continue ++ } ++ + # If we only have a shared libbfd, we probably can't run the + # --static test. + if { $flags == "--static" && ! [string match "*libbfd.a*" $BFDLIB] } then { +@@ -127,6 +141,10 @@ foreach flags $test_flags { + } + } + ++ if { $plugins == "yes" } { ++ set extralibs "$extralibs -ldl" ++ } ++ + # On Irix 5, linking with --static only works if all the files are + # compiled using -non_shared. + if {"$flags" == "--static"} { --- binutils-2.25.orig/debian/patches/135_bfd_version.patch +++ binutils-2.25/debian/patches/135_bfd_version.patch @@ -0,0 +1,49 @@ +Author: +Description: Description: Fix bfd version handling for extra builds + +Index: b/bfd/Makefile.am +=================================================================== +--- a/bfd/Makefile.am ++++ b/bfd/Makefile.am +@@ -1024,15 +1024,15 @@ + + 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_version=`echo "$(VERSION)" | sed -e 's/-.*$$//' | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ ++ bfd_version_string="\"`echo $(VERSION) | sed -e 's/-.*$$//'`\"" ;\ + bfd_soversion="$(VERSION)" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ + . $(srcdir)/development.sh ;\ + if test "$$development" = true ; then \ + bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ +- bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ ++ bfd_version_string="\"`echo $(VERSION) | sed -e 's/-.*$$//'`.$${bfd_version_date}\"" ;\ + bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ + fi ;\ + sed -e "s,@bfd_version@,$$bfd_version," \ +Index: b/bfd/Makefile.in +=================================================================== +--- a/bfd/Makefile.in ++++ b/bfd/Makefile.in +@@ -2084,15 +2084,15 @@ + + 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_version=`echo "$(VERSION)" | sed -e 's/-.*$$//' | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ ++ bfd_version_string="\"`echo $(VERSION) | sed -e 's/-.*$$//'`\"" ;\ + bfd_soversion="$(VERSION)" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ + . $(srcdir)/development.sh ;\ + if test "$$development" = true ; then \ + bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ +- bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ ++ bfd_version_string="\"`echo $(VERSION) | sed -e 's/-.*$$//'`.$${bfd_version_date}\"" ;\ + bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ + fi ;\ + sed -e "s,@bfd_version@,$$bfd_version," \ --- binutils-2.25.orig/debian/patches/157_ar_scripts_with_tilde.patch +++ binutils-2.25/debian/patches/157_ar_scripts_with_tilde.patch @@ -0,0 +1,13 @@ +Index: b/binutils/arlex.l +=================================================================== +--- a/binutils/arlex.l ++++ b/binutils/arlex.l +@@ -78,7 +78,7 @@ + "(" { return '('; } + ")" { return ')'; } + "," { return ','; } +-[A-Za-z0-9/\\$:.\-\_]+ { ++[A-Za-z0-9/\\$:.\-\_~]+ { + yylval.name = xstrdup (yytext); + return FILENAME; + } --- binutils-2.25.orig/debian/patches/158_ld_system_root.patch +++ binutils-2.25/debian/patches/158_ld_system_root.patch @@ -0,0 +1,42 @@ +Index: b/ld/configure.ac +=================================================================== +--- a/ld/configure.ac ++++ b/ld/configure.ac +@@ -56,7 +56,9 @@ + *) TARGET_SYSTEM_ROOT=$with_sysroot ;; + esac + ++ if test "x$TARGET_SYSTEM_ROOT" != x/; then + TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' ++ fi + use_sysroot=yes + + if test "x$prefix" = xNONE; then +Index: b/ld/configure +=================================================================== +--- a/ld/configure ++++ b/ld/configure +@@ -4283,7 +4283,9 @@ + *) TARGET_SYSTEM_ROOT=$with_sysroot ;; + esac + ++ if test "x$TARGET_SYSTEM_ROOT" != x/; then + TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' ++ fi + use_sysroot=yes + + if test "x$prefix" = xNONE; then +Index: b/ld/ldmain.c +=================================================================== +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -226,8 +226,8 @@ + { + if (*TARGET_SYSTEM_ROOT == 0) + { +- einfo ("%P%F: this linker was not configured to use sysroots\n"); + ld_sysroot = ""; ++ ld_canon_sysroot = ""; + } + else + ld_canon_sysroot = lrealpath (ld_sysroot); --- binutils-2.25.orig/debian/patches/161_gold_dummy_zoption.diff +++ binutils-2.25/debian/patches/161_gold_dummy_zoption.diff @@ -0,0 +1,29 @@ +# DP: let gold accept a dummy -z buildd- option. + +Index: b/gold/options.h +=================================================================== +--- a/gold/options.h ++++ b/gold/options.h +@@ -1323,6 +1323,9 @@ class General_options + DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0', + N_("Permit relocations in read-only segments (default)"), + NULL, true); ++ DEFINE_bool(buildd, options::DASH_Z, '\0', false, ++ N_("Dummy z option"), ++ NULL); + + public: + typedef options::Dir_list Dir_list; +Index: b/gold/options.cc +=================================================================== +--- a/gold/options.cc ++++ b/gold/options.cc +@@ -897,6 +897,8 @@ parse_short_option(int argc, const char* + { + int dummy_i = 0; + const char* dash_z_arg = *arg; ++ if (strncmp(dash_z_arg, "buildd", strlen("buildd")) == 0) ++ *arg = "buildd"; + retval = parse_long_option(1, arg, true, arg, &dummy_i); + if (retval == NULL) + usage(_("unknown -z option"), dash_z_arg); --- binutils-2.25.orig/debian/patches/164_ld_doc_remove_xref.diff +++ binutils-2.25/debian/patches/164_ld_doc_remove_xref.diff @@ -0,0 +1,16 @@ +# DP: In ld.texi, remove cross reference to BFD internals documentation. + +Index: b/ld/ld.texinfo +=================================================================== +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -7769,7 +7769,8 @@ may be spent optimizing algorithms for a + One minor artifact of the BFD solution which you should bear in + mind is the potential for information loss. There are two places where + useful information can be lost using the BFD mechanism: during +-conversion and during output. @xref{BFD information loss}. ++conversion and during output. See BFD information loss in the BFD ++internal documentation. + + @menu + * BFD outline:: How it works: an outline of BFD --- binutils-2.25.orig/debian/patches/170_doc_fixes.diff +++ binutils-2.25/debian/patches/170_doc_fixes.diff @@ -0,0 +1,15 @@ +# DP: Documentation fixes + +Index: b/ld/ld.texinfo +=================================================================== +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -1701,7 +1701,7 @@ ELF executable, the contents of the envi + @code{LD_RUN_PATH} will be used if it is defined. + + The @option{-rpath} option may also be used on SunOS. By default, on +-SunOS, the linker will form a runtime search patch out of all the ++SunOS, the linker will form a runtime search path out of all the + @option{-L} options it is given. If a @option{-rpath} option is used, the + runtime search path will be formed exclusively using the @option{-rpath} + options, ignoring the @option{-L} options. This can be useful when using --- binutils-2.25.orig/debian/patches/aarch64-bogus-assertion.diff +++ binutils-2.25/debian/patches/aarch64-bogus-assertion.diff @@ -0,0 +1,87 @@ +# DP: AArch64: Move biogus assertion + +gas/ +2014-10-21 Jan Beulich + + * config/tc-aarch64.c (output_operand_error_record): Move down + assertion of idx being non-negative. Use local variables when + available. + +--- a/gas/config/tc-aarch64.c ++++ b/gas/config/tc-aarch64.c +@@ -3939,11 +3939,11 @@ output_info (const char *format, ...) + static void + output_operand_error_record (const operand_error_record *record, char *str) + { +- int idx = record->detail.index; ++ const aarch64_operand_error *detail = &record->detail; ++ int idx = detail->index; + const aarch64_opcode *opcode = record->opcode; +- enum aarch64_opnd opd_code = (idx != -1 ? opcode->operands[idx] ++ enum aarch64_opnd opd_code = (idx >= 0 ? opcode->operands[idx] + : AARCH64_OPND_NIL); +- const aarch64_operand_error *detail = &record->detail; + + switch (detail->kind) + { +@@ -3955,20 +3955,22 @@ output_operand_error_record (const operand_error_record *record, char *str) + case AARCH64_OPDE_RECOVERABLE: + case AARCH64_OPDE_FATAL_SYNTAX_ERROR: + case AARCH64_OPDE_OTHER_ERROR: +- gas_assert (idx >= 0); + /* Use the prepared error message if there is, otherwise use the + operand description string to describe the error. */ + if (detail->error != NULL) + { +- if (detail->index == -1) ++ if (idx < 0) + as_bad (_("%s -- `%s'"), detail->error, str); + else + as_bad (_("%s at operand %d -- `%s'"), +- detail->error, detail->index + 1, str); ++ detail->error, idx + 1, str); + } + else +- as_bad (_("operand %d should be %s -- `%s'"), idx + 1, ++ { ++ gas_assert (idx >= 0); ++ as_bad (_("operand %d should be %s -- `%s'"), idx + 1, + aarch64_get_operand_desc (opd_code), str); ++ } + break; + + case AARCH64_OPDE_INVALID_VARIANT: +@@ -4073,28 +4075,28 @@ output_operand_error_record (const operand_error_record *record, char *str) + if (detail->data[0] != detail->data[1]) + as_bad (_("%s out of range %d to %d at operand %d -- `%s'"), + detail->error ? detail->error : _("immediate value"), +- detail->data[0], detail->data[1], detail->index + 1, str); ++ detail->data[0], detail->data[1], idx + 1, str); + else + as_bad (_("%s expected to be %d at operand %d -- `%s'"), + detail->error ? detail->error : _("immediate value"), +- detail->data[0], detail->index + 1, str); ++ detail->data[0], idx + 1, str); + break; + + case AARCH64_OPDE_REG_LIST: + if (detail->data[0] == 1) + as_bad (_("invalid number of registers in the list; " + "only 1 register is expected at operand %d -- `%s'"), +- detail->index + 1, str); ++ idx + 1, str); + else + as_bad (_("invalid number of registers in the list; " + "%d registers are expected at operand %d -- `%s'"), +- detail->data[0], detail->index + 1, str); ++ detail->data[0], idx + 1, str); + break; + + case AARCH64_OPDE_UNALIGNED: + as_bad (_("immediate value should be a multiple of " + "%d at operand %d -- `%s'"), +- detail->data[0], detail->index + 1, str); ++ detail->data[0], idx + 1, str); + break; + + default: --- binutils-2.25.orig/debian/patches/aarch64-enable-targets.diff +++ binutils-2.25/debian/patches/aarch64-enable-targets.diff @@ -0,0 +1,18 @@ +# DP: Fix build configured with --enable-targets=aarch64-linux. + +gold/ + +2014-10-18 Andreas Schwab + + * configure.tgt (targ_extra_obj) [aarch64*-*]: Define. + +--- a/gold/configure.tgt ++++ b/gold/configure.tgt +@@ -146,6 +146,7 @@ arm*-*-*) + ;; + aarch64*-*) + targ_obj=aarch64 ++ targ_extra_obj=aarch64-reloc-property + targ_machine=EM_AARCH64 + targ_size=64 + targ_extra_size=32 --- binutils-2.25.orig/debian/patches/aarch64-gold-updates.diff +++ binutils-2.25/debian/patches/aarch64-gold-updates.diff @@ -0,0 +1,2723 @@ +# DP: gold: Support relexation in the aarch64 backend. + +Index: b/gold/ChangeLog +=================================================================== +--- a/gold/ChangeLog ++++ b/gold/ChangeLog +@@ -66,6 +66,33 @@ + * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to + thread_starter. + ++2014-09-22 Han Shen ++ Jing Yu ++ ++ Patch for gold aarch64 backend to support relaxation. ++ * aarch64-reloc.def: Change format. ++ * aarch64.cc (class Reloc_stub): New class. ++ (class Stub_table): New class. ++ (class AArch64_relobj): New class. ++ (class AArch64_input_section): New class. ++ (class AArch64_output_section): New class. ++ (Target_aarch64::new_stub_table): New method. ++ (Target_aarch64::new_aarch64_input_section): New method. ++ (Target_aarch64::find_aarch64_input_section): New method. ++ (Target_aarch64::scan_section_for_stubs): New method. ++ (Target_aarch64::scan_reloc_section_for_stubs): New method. ++ (Target_aarch64::relocate_stub): New method. ++ (Target_aarch64::current_target): New method. ++ (Target_aarch64::do_make_elf_object): New method. ++ (Target_aarch64::do_may_relax): New method. ++ (Target_aarch64::do_relax): New method. ++ (Target_aarch64::group_sections): New method. ++ (Target_aarch64::scan_reloc_for_stub): New method. ++ (Target_aarch64::do_make_output_section): New method. ++ (Target_aarch64::stub_tables_): New data member. ++ (Target_aarch64::aarch64_input_section_map_): New data member. ++ (AArch64_relocate_functions::maybe_apply_stub): New method. ++ + 2014-09-30 Cary Coutant + + PR gold/17432 +Index: b/gold/aarch64-reloc.def +=================================================================== +--- a/gold/aarch64-reloc.def ++++ b/gold/aarch64-reloc.def +@@ -22,54 +22,53 @@ + // + // + // +-// Insn modified by relocation, see enum Reloc_inst -------------------------------------------------------------------------+ +-// Symbol reference type -----------------------------------------------------------------------------+ | +-// Portion off X to retrieve -------------------------------------------------------------------+ | | +-// Checking function, see Note(A)---------------------------------------+ | | | +-// Group index---------------------------------------------------+ | | | | +-// Implemented----------------------------------------------+ | | | | | +-// Class-------------------------------------+ | | | | | | +-// Type----------------------------+ | | | | | | | +-// Name | | | | | | | | +-// | | | | | | | | | +-ARD(ABS64 , STATIC , DATA , Y, -1, 0,0 , 0,0 , Symbol::ABSOLUTE_REF , DATA ) +-ARD(ABS32 , STATIC , DATA , Y, -1, 31,32 , 0,0 , Symbol::ABSOLUTE_REF , DATA ) +-ARD(ABS16 , STATIC , DATA , Y, -1, 15,16 , 0,0 , Symbol::ABSOLUTE_REF , DATA ) +-ARD(PREL64 , STATIC , DATA , Y, -1, 0,0 , 0,0 , Symbol::RELATIVE_REF , DATA ) +-ARD(PREL32 , STATIC , DATA , Y, -1, 31,32 , 0,0 , Symbol::RELATIVE_REF , DATA ) +-ARD(PREL16 , STATIC , DATA , Y, -1, 15,16 , 0,0 , Symbol::RELATIVE_REF , DATA ) ++// Insn modified by relocation, see enum Reloc_inst -------------------------------------------------------------------------------------------------+ ++// Symbol reference type -----------------------------------------------------------------------------+ | ++// Portion off X to retrieve -------------------------------------------------------------------+ | | ++// Checking function, see Note(A)---------------------------------------+ | | | ++// Group index---------------------------------------------------+ | | | | ++// Implemented----------------------------------------------+ | | | | | ++// Class-------------------------------------+ | | | | | | ++// Type----------------------------+ | | | | | | | ++// Name | | | | | | | | ++// | | | | | | | | | ++ARD(ABS64 , STATIC , DATA , Y, -1, 0,0 , 0,0 , Symbol::ABSOLUTE_REF , DATA ) ++ARD(ABS32 , STATIC , DATA , Y, -1, 31,32 , 0,0 , Symbol::ABSOLUTE_REF , DATA ) ++ARD(ABS16 , STATIC , DATA , Y, -1, 15,16 , 0,0 , Symbol::ABSOLUTE_REF , DATA ) ++ARD(PREL64 , STATIC , DATA , Y, -1, 0,0 , 0,0 , Symbol::RELATIVE_REF , DATA ) ++ARD(PREL32 , STATIC , DATA , Y, -1, 31,32 , 0,0 , Symbol::RELATIVE_REF , DATA ) ++ARD(PREL16 , STATIC , DATA , Y, -1, 15,16 , 0,0 , Symbol::RELATIVE_REF , DATA ) + // Above is from Table 4-6, Data relocations, 257-262. + +-ARD(ADR_PREL_PG_HI21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) +-ARD(ADR_PREL_PG_HI21_NC , STATIC , AARCH64 , Y, -1, 0,0 , 12,32 , Symbol::RELATIVE_REF , ADRP ) +-ARD(LDST8_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(LDST16_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN2 , 1,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(LDST32_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN4 , 2,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(LDST64_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(LDST128_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN16 , 4,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(ADD_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(ADR_GOT_PAGE , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) +-ARD(LD64_GOT_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(ADR_PREL_PG_HI21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) ++ARD(ADR_PREL_PG_HI21_NC , STATIC , AARCH64 , Y, -1, 0,0 , 12,32 , Symbol::RELATIVE_REF , ADRP ) ++ARD(LDST8_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(LDST16_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN2 , 1,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(LDST32_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN4 , 2,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(LDST64_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(LDST128_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN16 , 4,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(ADD_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) ++ARD(ADR_GOT_PAGE , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) ++ARD(LD64_GOT_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) + ARD(TSTBR14 , STATIC , CFLOW , N, -1, 15,15 , 2,15 , (Symbol::FUNCTION_CALL|Symbol::ABSOLUTE_REF) , TBZNZ ) + ARD(CONDBR19 , STATIC , CFLOW , N, -1, 20,20 , 2,20 , (Symbol::FUNCTION_CALL|Symbol::ABSOLUTE_REF) , CONDB ) +-ARD(CALL26 , STATIC , CFLOW , Y, -1, 27,27 , 2,27 , (Symbol::FUNCTION_CALL|Symbol::RELATIVE_REF) , CALL ) +-ARD(JUMP26 , STATIC , CFLOW , Y, -1, 27,27 , 2,27 , (Symbol::FUNCTION_CALL|Symbol::RELATIVE_REF) , B ) ++ARD(CALL26 , STATIC , CFLOW , Y, -1, 27,27 , 2,27 , (Symbol::FUNCTION_CALL|Symbol::RELATIVE_REF) , CALL ) ++ARD(JUMP26 , STATIC , CFLOW , Y, -1, 27,27 , 2,27 , (Symbol::FUNCTION_CALL|Symbol::RELATIVE_REF) , B ) + // Above is from Table 4-10, Relocations for control-flow instructions, + // 279-283. + +-ARD(TLSGD_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::ABSOLUTE_REF , ADRP ) +-ARD(TLSGD_ADD_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) +- +-ARD(TLSIE_MOVW_GOTTPREL_G1 , STATIC , AARCH64 , N, -1, 0,0 , 16,31 , Symbol::ABSOLUTE_REF , MOVW ) +-ARD(TLSIE_MOVW_GOTTPREL_G0_NC , STATIC , AARCH64 , N, -1, 0,0 , 0,15 , Symbol::ABSOLUTE_REF , MOVW ) +-ARD(TLSIE_ADR_GOTTPREL_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::ABSOLUTE_REF , ADRP ) +-ARD(TLSIE_LD64_GOTTPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(TLSIE_LD_GOTTPREL_PREL19 , STATIC , AARCH64 , N, -1, 20,20 , 2,20 , Symbol::ABSOLUTE_REF , LD ) ++ARD(TLSGD_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::ABSOLUTE_REF , ADRP ) ++ARD(TLSGD_ADD_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) ++ARD(TLSIE_MOVW_GOTTPREL_G1 , STATIC , AARCH64 , N, -1, 0,0 , 16,31 , Symbol::ABSOLUTE_REF , MOVW ) ++ARD(TLSIE_MOVW_GOTTPREL_G0_NC , STATIC , AARCH64 , N, -1, 0,0 , 0,15 , Symbol::ABSOLUTE_REF , MOVW ) ++ARD(TLSIE_ADR_GOTTPREL_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::ABSOLUTE_REF , ADRP ) ++ARD(TLSIE_LD64_GOTTPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) ++ARD(TLSIE_LD_GOTTPREL_PREL19 , STATIC , AARCH64 , N, -1, 20,20 , 2,20 , Symbol::ABSOLUTE_REF , LD ) + // Above is from Table 4-17, Initial Exec TLS relocations, 539-543. + +-ARD(TLSLE_ADD_TPREL_HI12 , STATIC , AARCH64 , Y, -1, 0,24 , 12,23 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(TLSLE_ADD_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(TLSLE_ADD_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) ++ARD(TLSLE_ADD_TPREL_HI12 , STATIC , AARCH64 , Y, -1, 0,24 , 12,23 , Symbol::ABSOLUTE_REF , ADD ) ++ARD(TLSLE_ADD_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) ++ARD(TLSLE_ADD_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) + // Above is from Table 4-18, Local Exec TLS relocations, 544-571. + + ARD(TLSDESC_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) +Index: b/gold/aarch64.cc +=================================================================== +--- a/gold/aarch64.cc ++++ b/gold/aarch64.cc +@@ -47,6 +47,7 @@ + // The first three .got.plt entries are reserved. + const int32_t AARCH64_GOTPLT_RESERVE_COUNT = 3; + ++ + namespace + { + +@@ -124,7 +125,7 @@ class Output_data_got_aarch64 : public O + gold_assert(tls_segment != NULL); + + AArch64_address aligned_tcb_address = +- align_address(Target_aarch64::TCB_SIZE, ++ align_address(Target_aarch64::TCB_SIZE, + tls_segment->maximum_alignment()); + + for (size_t i = 0; i < this->static_relocs_.size(); ++i) +@@ -254,49 +255,1366 @@ class Output_data_got_aarch64 : public O + return this->u_.global.symbol; + } + +- // For a relocation against a local symbol, the defining object. +- Sized_relobj_file* +- relobj() const +- { +- gold_assert(!this->symbol_is_global_); +- return this->u_.local.relobj; ++ // For a relocation against a local symbol, the defining object. ++ Sized_relobj_file* ++ relobj() const ++ { ++ gold_assert(!this->symbol_is_global_); ++ return this->u_.local.relobj; ++ } ++ ++ // For a relocation against a local symbol, the local symbol index. ++ unsigned int ++ index() const ++ { ++ gold_assert(!this->symbol_is_global_); ++ return this->u_.local.index; ++ } ++ ++ private: ++ // GOT offset of the entry to which this relocation is applied. ++ unsigned int got_offset_; ++ // Type of relocation. ++ unsigned int r_type_; ++ // Whether this relocation is against a global symbol. ++ bool symbol_is_global_; ++ // A global or local symbol. ++ union ++ { ++ struct ++ { ++ // For a global symbol, the symbol itself. ++ Symbol* symbol; ++ } global; ++ struct ++ { ++ // For a local symbol, the object defining the symbol. ++ Sized_relobj_file* relobj; ++ // For a local symbol, the symbol index. ++ unsigned int index; ++ } local; ++ } u_; ++ }; // End of inner class Static_reloc ++ ++ std::vector static_relocs_; ++}; // End of Output_data_got_aarch64 ++ ++ ++template ++class AArch64_input_section; ++ ++ ++template ++class AArch64_output_section; ++ ++ ++// Reloc stub class. ++ ++template ++class Reloc_stub ++{ ++ public: ++ typedef Reloc_stub This; ++ typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; ++ ++ // Do not change the value of the enums, they are used to index into ++ // stub_insns array. ++ typedef enum ++ { ++ ST_NONE = 0, ++ ++ // Using adrp/add pair, 4 insns (including alignment) without mem access, ++ // the fastest stub. This has a limited jump distance, which is tested by ++ // aarch64_valid_for_adrp_p. ++ ST_ADRP_BRANCH = 1, ++ ++ // Using ldr-absolute-address/br-register, 4 insns with 1 mem access, ++ // unlimited in jump distance. ++ ST_LONG_BRANCH_ABS = 2, ++ ++ // Using ldr/calculate-pcrel/jump, 8 insns (including alignment) with 1 mem ++ // access, slowest one. Only used in position independent executables. ++ ST_LONG_BRANCH_PCREL = 3, ++ ++ } Stub_type; ++ ++ // Branch range. This is used to calculate the section group size, as well as ++ // determine whether a stub is needed. ++ static const int MAX_BRANCH_OFFSET = ((1 << 25) - 1) << 2; ++ static const int MIN_BRANCH_OFFSET = -((1 << 25) << 2); ++ ++ // Constant used to determine if an offset fits in the adrp instruction ++ // encoding. ++ static const int MAX_ADRP_IMM = (1 << 20) - 1; ++ static const int MIN_ADRP_IMM = -(1 << 20); ++ ++ static const int BYTES_PER_INSN = 4; ++ static const int STUB_ADDR_ALIGN = 4; ++ ++ // Determine whether the offset fits in the jump/branch instruction. ++ static bool ++ aarch64_valid_branch_offset_p(int64_t offset) ++ { return offset >= MIN_BRANCH_OFFSET && offset <= MAX_BRANCH_OFFSET; } ++ ++ // Determine whether the offset fits in the adrp immediate field. ++ static bool ++ aarch64_valid_for_adrp_p(AArch64_address location, AArch64_address dest) ++ { ++ typedef AArch64_relocate_functions Reloc; ++ int64_t adrp_imm = (Reloc::Page(dest) - Reloc::Page(location)) >> 12; ++ return adrp_imm >= MIN_ADRP_IMM && adrp_imm <= MAX_ADRP_IMM; ++ } ++ ++ // Determine the stub type for a certain relocation or ST_NONE, if no stub is ++ // needed. ++ static Stub_type ++ stub_type_for_reloc(unsigned int r_type, AArch64_address address, ++ AArch64_address target); ++ ++ Reloc_stub(Stub_type stub_type) ++ : stub_type_(stub_type), offset_(invalid_offset), ++ destination_address_(invalid_address) ++ { } ++ ++ ~Reloc_stub() ++ { } ++ ++ // Return offset of code stub from beginning of its containing stub table. ++ section_offset_type ++ offset() const ++ { ++ gold_assert(this->offset_ != invalid_offset); ++ return this->offset_; ++ } ++ ++ // Set offset of code stub from beginning of its containing stub table. ++ void ++ set_offset(section_offset_type offset) ++ { this->offset_ = offset; } ++ ++ // Return destination address. ++ AArch64_address ++ destination_address() const ++ { ++ gold_assert(this->destination_address_ != this->invalid_address); ++ return this->destination_address_; ++ } ++ ++ // Set destination address. ++ void ++ set_destination_address(AArch64_address address) ++ { ++ gold_assert(address != this->invalid_address); ++ this->destination_address_ = address; ++ } ++ ++ // Reset the destination address. ++ void ++ reset_destination_address() ++ { this->destination_address_ = this->invalid_address; } ++ ++ // Return the stub type. ++ Stub_type ++ stub_type() const ++ { return stub_type_; } ++ ++ // Return the stub size. ++ uint32_t ++ stub_size() const ++ { return this->stub_insn_number() * BYTES_PER_INSN; } ++ ++ // Return the instruction number of this stub instance. ++ int ++ stub_insn_number() const ++ { return stub_insns_[this->stub_type_][0]; } ++ ++ // Note the first "insn" is the number of total insns in this array. ++ const uint32_t* ++ stub_insns() const ++ { return stub_insns_[this->stub_type_]; } ++ ++ // Write stub to output file. ++ void ++ write(unsigned char* view, section_size_type view_size) ++ { this->do_write(view, view_size); } ++ ++ // The key class used to index the stub instance in the stub table's stub map. ++ class Key ++ { ++ public: ++ Key(Stub_type stub_type, const Symbol* symbol, const Relobj* relobj, ++ unsigned int r_sym, int32_t addend) ++ : stub_type_(stub_type), addend_(addend) ++ { ++ if (symbol != NULL) ++ { ++ this->r_sym_ = Reloc_stub::invalid_index; ++ this->u_.symbol = symbol; ++ } ++ else ++ { ++ gold_assert(relobj != NULL && r_sym != invalid_index); ++ this->r_sym_ = r_sym; ++ this->u_.relobj = relobj; ++ } ++ } ++ ++ ~Key() ++ { } ++ ++ // Return stub type. ++ Stub_type ++ stub_type() const ++ { return this->stub_type_; } ++ ++ // Return the local symbol index or invalid_index. ++ unsigned int ++ r_sym() const ++ { return this->r_sym_; } ++ ++ // Return the symbol if there is one. ++ const Symbol* ++ symbol() const ++ { return this->r_sym_ == invalid_index ? this->u_.symbol : NULL; } ++ ++ // Return the relobj if there is one. ++ const Relobj* ++ relobj() const ++ { return this->r_sym_ != invalid_index ? this->u_.relobj : NULL; } ++ ++ // Whether this equals to another key k. ++ bool ++ eq(const Key& k) const ++ { ++ return ((this->stub_type_ == k.stub_type_) ++ && (this->r_sym_ == k.r_sym_) ++ && ((this->r_sym_ != Reloc_stub::invalid_index) ++ ? (this->u_.relobj == k.u_.relobj) ++ : (this->u_.symbol == k.u_.symbol)) ++ && (this->addend_ == k.addend_)); ++ } ++ ++ // Return a hash value. ++ size_t ++ hash_value() const ++ { ++ size_t name_hash_value = gold::string_hash( ++ (this->r_sym_ != Reloc_stub::invalid_index) ++ ? this->u_.relobj->name().c_str() ++ : this->u_.symbol->name()); ++ // We only have 4 stub types. ++ size_t stub_type_hash_value = 0x03 & this->stub_type_; ++ return (name_hash_value ++ ^ stub_type_hash_value ++ ^ ((this->r_sym_ & 0x3fff) << 2) ++ ^ ((this->addend_ & 0xffff) << 16)); ++ } ++ ++ // Functors for STL associative containers. ++ struct hash ++ { ++ size_t ++ operator()(const Key& k) const ++ { return k.hash_value(); } ++ }; ++ ++ struct equal_to ++ { ++ bool ++ operator()(const Key& k1, const Key& k2) const ++ { return k1.eq(k2); } ++ }; ++ ++ private: ++ // Stub type. ++ const Stub_type stub_type_; ++ // If this is a local symbol, this is the index in the defining object. ++ // Otherwise, it is invalid_index for a global symbol. ++ unsigned int r_sym_; ++ // If r_sym_ is an invalid index, this points to a global symbol. ++ // Otherwise, it points to a relobj. We used the unsized and target ++ // independent Symbol and Relobj classes instead of Sized_symbol<32> and ++ // Arm_relobj, in order to avoid making the stub class a template ++ // as most of the stub machinery is endianness-neutral. However, it ++ // may require a bit of casting done by users of this class. ++ union ++ { ++ const Symbol* symbol; ++ const Relobj* relobj; ++ } u_; ++ // Addend associated with a reloc. ++ int32_t addend_; ++ }; // End of inner class Reloc_stub::Key ++ ++ protected: ++ // This may be overridden in the child class. ++ virtual void ++ do_write(unsigned char*, section_size_type); ++ ++ private: ++ static const section_offset_type invalid_offset = ++ static_cast(-1); ++ static const unsigned int invalid_index = static_cast(-1); ++ static const AArch64_address invalid_address = ++ static_cast(-1); ++ ++ static const uint32_t stub_insns_[][10]; ++ ++ const Stub_type stub_type_; ++ section_offset_type offset_; ++ AArch64_address destination_address_; ++}; // End of Reloc_stub ++ ++ ++// Write data to output file. ++ ++template ++void ++Reloc_stub:: ++do_write(unsigned char* view, section_size_type) ++{ ++ typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype; ++ const uint32_t* insns = this->stub_insns(); ++ uint32_t num_insns = this->stub_insn_number(); ++ Insntype* ip = reinterpret_cast(view); ++ for (uint32_t i = 1; i <= num_insns; ++i) ++ elfcpp::Swap<32, big_endian>::writeval(ip + i - 1, insns[i]); ++} ++ ++ ++// Stubs instructions definition. ++ ++template ++const uint32_t ++Reloc_stub::stub_insns_[][10] = ++ { ++ // The first element of each group is the num of the insns. ++ ++ // ST_NONE ++ {0, 0}, ++ ++ // ST_ADRP_BRANCH ++ { ++ 4, ++ 0x90000010, /* adrp ip0, X */ ++ /* ADR_PREL_PG_HI21(X) */ ++ 0x91000210, /* add ip0, ip0, :lo12:X */ ++ /* ADD_ABS_LO12_NC(X) */ ++ 0xd61f0200, /* br ip0 */ ++ 0x00000000, /* alignment padding */ ++ }, ++ ++ // ST_LONG_BRANCH_ABS ++ { ++ 4, ++ 0x58000050, /* ldr ip0, 0x8 */ ++ 0xd61f0200, /* br ip0 */ ++ 0x00000000, /* address field */ ++ 0x00000000, /* address fields */ ++ }, ++ ++ // ST_LONG_BRANCH_PCREL ++ { ++ 8, ++ 0x58000090, /* ldr ip0, 0x10 */ ++ 0x10000011, /* adr ip1, #0 */ ++ 0x8b110210, /* add ip0, ip0, ip1 */ ++ 0xd61f0200, /* br ip0 */ ++ 0x00000000, /* address field */ ++ 0x00000000, /* address field */ ++ 0x00000000, /* alignment padding */ ++ 0x00000000, /* alignment padding */ ++ } ++ }; ++ ++ ++// Determine the stub type for a certain relocation or ST_NONE, if no stub is ++// needed. ++ ++template ++inline ++typename Reloc_stub::Stub_type ++Reloc_stub::stub_type_for_reloc( ++ unsigned int r_type, AArch64_address location, AArch64_address dest) ++{ ++ int64_t branch_offset = 0; ++ switch(r_type) ++ { ++ case elfcpp::R_AARCH64_CALL26: ++ case elfcpp::R_AARCH64_JUMP26: ++ branch_offset = dest - location; ++ break; ++ default: ++ gold_assert(false); ++ } ++ ++ if (aarch64_valid_branch_offset_p(branch_offset)) ++ return ST_NONE; ++ ++ if (aarch64_valid_for_adrp_p(location, dest)) ++ return ST_ADRP_BRANCH; ++ ++ if (parameters->options().output_is_position_independent() ++ && parameters->options().output_is_executable()) ++ return ST_LONG_BRANCH_PCREL; ++ ++ return ST_LONG_BRANCH_ABS; ++} ++ ++// A class to hold stubs for the ARM target. ++ ++template ++class Stub_table : public Output_data ++{ ++ public: ++ typedef Target_aarch64 The_target_aarch64; ++ typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; ++ typedef AArch64_input_section The_aarch64_input_section; ++ typedef Reloc_stub The_reloc_stub; ++ typedef typename The_reloc_stub::Key The_reloc_stub_key; ++ typedef typename The_reloc_stub_key::hash The_reloc_stub_key_hash; ++ typedef typename The_reloc_stub_key::equal_to The_reloc_stub_key_equal_to; ++ typedef Stub_table The_stub_table; ++ typedef Unordered_map ++ Reloc_stub_map; ++ typedef typename Reloc_stub_map::const_iterator Reloc_stub_map_const_iter; ++ typedef Relocate_info The_relocate_info; ++ ++ Stub_table(The_aarch64_input_section* owner) ++ : Output_data(), owner_(owner), reloc_stubs_size_(0), prev_data_size_(0) ++ { } ++ ++ ~Stub_table() ++ { } ++ ++ The_aarch64_input_section* ++ owner() const ++ { return owner_; } ++ ++ // Whether this stub table is empty. ++ bool ++ empty() const ++ { return reloc_stubs_.empty(); } ++ ++ // Return the current data size. ++ off_t ++ current_data_size() const ++ { return this->current_data_size_for_child(); } ++ ++ // Add a STUB using KEY. The caller is responsible for avoiding addition ++ // if a STUB with the same key has already been added. ++ void ++ add_reloc_stub(The_reloc_stub* stub, const The_reloc_stub_key& key); ++ ++ // Finalize stubs. No-op here, just for completeness. ++ void ++ finalize_stubs() ++ { } ++ ++ // Look up a relocation stub using KEY. Return NULL if there is none. ++ The_reloc_stub* ++ find_reloc_stub(The_reloc_stub_key& key) ++ { ++ Reloc_stub_map_const_iter p = this->reloc_stubs_.find(key); ++ return (p != this->reloc_stubs_.end()) ? p->second : NULL; ++ } ++ ++ // Relocate stubs in this stub table. ++ void ++ relocate_stubs(const The_relocate_info*, ++ The_target_aarch64*, ++ Output_section*, ++ unsigned char*, ++ AArch64_address, ++ section_size_type); ++ ++ // Update data size at the end of a relaxation pass. Return true if data size ++ // is different from that of the previous relaxation pass. ++ bool ++ update_data_size_changed_p() ++ { ++ // No addralign changed here. ++ off_t s = this->reloc_stubs_size_; ++ bool changed = (s != this->prev_data_size_); ++ this->prev_data_size_ = s; ++ return changed; ++ } ++ ++ protected: ++ // Write out section contents. ++ void ++ do_write(Output_file*); ++ ++ // Return the required alignment. ++ uint64_t ++ do_addralign() const ++ { return The_reloc_stub::STUB_ADDR_ALIGN; } ++ ++ // Reset address and file offset. ++ void ++ do_reset_address_and_file_offset() ++ { this->set_current_data_size_for_child(this->prev_data_size_); } ++ ++ // Set final data size. ++ void ++ set_final_data_size() ++ { this->set_data_size(this->current_data_size()); } ++ ++ private: ++ // Relocate one stub. ++ void ++ relocate_stub(The_reloc_stub*, ++ const The_relocate_info*, ++ The_target_aarch64*, ++ Output_section*, ++ unsigned char*, ++ AArch64_address, ++ section_size_type); ++ ++ private: ++ // Owner of this stub table. ++ The_aarch64_input_section* owner_; ++ // The relocation stubs. ++ Reloc_stub_map reloc_stubs_; ++ // Size of reloc stubs. ++ off_t reloc_stubs_size_; ++ // data size of this in the previous pass. ++ off_t prev_data_size_; ++}; // End of Stub_table ++ ++ ++// Add a STUB using KEY. The caller is responsible for avoiding addition ++// if a STUB with the same key has already been added. ++ ++template ++void ++Stub_table::add_reloc_stub( ++ The_reloc_stub* stub, const The_reloc_stub_key& key) ++{ ++ gold_assert(stub->stub_type() == key.stub_type()); ++ this->reloc_stubs_[key] = stub; ++ ++ // Assign stub offset early. We can do this because we never remove ++ // reloc stubs and they are in the beginning of the stub table. ++ this->reloc_stubs_size_ = align_address(this->reloc_stubs_size_, ++ The_reloc_stub::STUB_ADDR_ALIGN); ++ stub->set_offset(this->reloc_stubs_size_); ++ this->reloc_stubs_size_ += stub->stub_size(); ++} ++ ++ ++// Relocate all stubs in this stub table. ++ ++template ++void ++Stub_table:: ++relocate_stubs(const The_relocate_info* relinfo, ++ The_target_aarch64* target_aarch64, ++ Output_section* output_section, ++ unsigned char* view, ++ AArch64_address address, ++ section_size_type view_size) ++{ ++ // "view_size" is the total size of the stub_table. ++ gold_assert(address == this->address() && ++ view_size == static_cast(this->data_size())); ++ for(Reloc_stub_map_const_iter p = this->reloc_stubs_.begin(); ++ p != this->reloc_stubs_.end(); ++p) ++ relocate_stub(p->second, relinfo, target_aarch64, output_section, ++ view, address, view_size); ++} ++ ++ ++// Relocate one stub. This is a helper for Stub_table::relocate_stubs(). ++ ++template ++void ++Stub_table:: ++relocate_stub(The_reloc_stub* stub, ++ const The_relocate_info* relinfo, ++ The_target_aarch64* target_aarch64, ++ Output_section* output_section, ++ unsigned char* view, ++ AArch64_address address, ++ section_size_type view_size) ++{ ++ // "offset" is the offset from the beginning of the stub_table. ++ section_size_type offset = stub->offset(); ++ section_size_type stub_size = stub->stub_size(); ++ // "view_size" is the total size of the stub_table. ++ gold_assert(offset + stub_size <= view_size); ++ ++ target_aarch64->relocate_stub(stub, relinfo, output_section, ++ view + offset, address + offset, view_size); ++} ++ ++ ++// Write out the stubs to file. ++ ++template ++void ++Stub_table::do_write(Output_file* of) ++{ ++ off_t offset = this->offset(); ++ const section_size_type oview_size = ++ convert_to_section_size_type(this->data_size()); ++ unsigned char* const oview = of->get_output_view(offset, oview_size); ++ ++ // Write relocation stubs. ++ for (typename Reloc_stub_map::const_iterator p = this->reloc_stubs_.begin(); ++ p != this->reloc_stubs_.end(); ++p) ++ { ++ The_reloc_stub* stub = p->second; ++ AArch64_address address = this->address() + stub->offset(); ++ gold_assert(address == ++ align_address(address, The_reloc_stub::STUB_ADDR_ALIGN)); ++ stub->write(oview + stub->offset(), stub->stub_size()); ++ } ++ ++ of->write_output_view(this->offset(), oview_size, oview); ++} ++ ++ ++// AArch64_relobj class. ++ ++template ++class AArch64_relobj : public Sized_relobj_file ++{ ++ public: ++ typedef AArch64_relobj This; ++ typedef Target_aarch64 The_target_aarch64; ++ typedef AArch64_input_section The_aarch64_input_section; ++ typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; ++ typedef Stub_table The_stub_table; ++ typedef std::vector Stub_table_list; ++ static const AArch64_address invalid_address = ++ static_cast(-1); ++ ++ AArch64_relobj(const std::string& name, Input_file* input_file, off_t offset, ++ const typename elfcpp::Ehdr& ehdr) ++ : Sized_relobj_file(name, input_file, offset, ehdr), ++ stub_tables_() ++ { } ++ ++ ~AArch64_relobj() ++ { } ++ ++ // Return the stub table of the SHNDX-th section if there is one. ++ The_stub_table* ++ stub_table(unsigned int shndx) const ++ { ++ gold_assert(shndx < this->stub_tables_.size()); ++ return this->stub_tables_[shndx]; ++ } ++ ++ // Set STUB_TABLE to be the stub_table of the SHNDX-th section. ++ void ++ set_stub_table(unsigned int shndx, The_stub_table* stub_table) ++ { ++ gold_assert(shndx < this->stub_tables_.size()); ++ this->stub_tables_[shndx] = stub_table; ++ } ++ ++ // Scan all relocation sections for stub generation. ++ void ++ scan_sections_for_stubs(The_target_aarch64*, const Symbol_table*, ++ const Layout*); ++ ++ // Whether a section is a scannable text section. ++ bool ++ text_section_is_scannable(const elfcpp::Shdr&, unsigned int, ++ const Output_section*, const Symbol_table*); ++ ++ // Convert regular input section with index SHNDX to a relaxed section. ++ void ++ convert_input_section_to_relaxed_section(unsigned /* shndx */) ++ { ++ // The stubs have relocations and we need to process them after writing ++ // out the stubs. So relocation now must follow section write. ++ this->set_relocs_must_follow_section_writes(); ++ } ++ ++ protected: ++ // Post constructor setup. ++ void ++ do_setup() ++ { ++ // Call parent's setup method. ++ Sized_relobj_file::do_setup(); ++ ++ // Initialize look-up tables. ++ this->stub_tables_.resize(this->shnum()); ++ } ++ ++ virtual void ++ do_relocate_sections( ++ const Symbol_table* symtab, const Layout* layout, ++ const unsigned char* pshdrs, Output_file* of, ++ typename Sized_relobj_file::Views* pviews); ++ ++ private: ++ // Whether a section needs to be scanned for relocation stubs. ++ bool ++ section_needs_reloc_stub_scanning(const elfcpp::Shdr&, ++ const Relobj::Output_sections&, ++ const Symbol_table*, const unsigned char*); ++ ++ // List of stub tables. ++ Stub_table_list stub_tables_; ++}; // End of AArch64_relobj ++ ++ ++// Relocate sections. ++ ++template ++void ++AArch64_relobj::do_relocate_sections( ++ const Symbol_table* symtab, const Layout* layout, ++ const unsigned char* pshdrs, Output_file* of, ++ typename Sized_relobj_file::Views* pviews) ++{ ++ // Call parent to relocate sections. ++ Sized_relobj_file::do_relocate_sections(symtab, layout, ++ pshdrs, of, pviews); ++ ++ // We do not generate stubs if doing a relocatable link. ++ if (parameters->options().relocatable()) ++ return; ++ ++ Relocate_info relinfo; ++ relinfo.symtab = symtab; ++ relinfo.layout = layout; ++ relinfo.object = this; ++ ++ // Relocate stub tables. ++ unsigned int shnum = this->shnum(); ++ The_target_aarch64* target = The_target_aarch64::current_target(); ++ ++ for (unsigned int i = 1; i < shnum; ++i) ++ { ++ The_aarch64_input_section* aarch64_input_section = ++ target->find_aarch64_input_section(this, i); ++ if (aarch64_input_section != NULL ++ && aarch64_input_section->is_stub_table_owner() ++ && !aarch64_input_section->stub_table()->empty()) ++ { ++ Output_section* os = this->output_section(i); ++ gold_assert(os != NULL); ++ ++ relinfo.reloc_shndx = elfcpp::SHN_UNDEF; ++ relinfo.reloc_shdr = NULL; ++ relinfo.data_shndx = i; ++ relinfo.data_shdr = pshdrs + i * elfcpp::Elf_sizes::shdr_size; ++ ++ typename Sized_relobj_file::View_size& ++ view_struct = (*pviews)[i]; ++ gold_assert(view_struct.view != NULL); ++ ++ The_stub_table* stub_table = aarch64_input_section->stub_table(); ++ off_t offset = stub_table->address() - view_struct.address; ++ unsigned char* view = view_struct.view + offset; ++ AArch64_address address = stub_table->address(); ++ section_size_type view_size = stub_table->data_size(); ++ stub_table->relocate_stubs(&relinfo, target, os, view, address, ++ view_size); ++ } ++ } ++} ++ ++ ++// Determine if an input section is scannable for stub processing. SHDR is ++// the header of the section and SHNDX is the section index. OS is the output ++// section for the input section and SYMTAB is the global symbol table used to ++// look up ICF information. ++ ++template ++bool ++AArch64_relobj::text_section_is_scannable( ++ const elfcpp::Shdr& text_shdr, ++ unsigned int text_shndx, ++ const Output_section* os, ++ const Symbol_table* symtab) ++{ ++ // Skip any empty sections, unallocated sections or sections whose ++ // type are not SHT_PROGBITS. ++ if (text_shdr.get_sh_size() == 0 ++ || (text_shdr.get_sh_flags() & elfcpp::SHF_ALLOC) == 0 ++ || text_shdr.get_sh_type() != elfcpp::SHT_PROGBITS) ++ return false; ++ ++ // Skip any discarded or ICF'ed sections. ++ if (os == NULL || symtab->is_section_folded(this, text_shndx)) ++ return false; ++ ++ // Skip exception frame. ++ if (strcmp(os->name(), ".eh_frame") == 0) ++ return false ; ++ ++ gold_assert(!this->is_output_section_offset_invalid(text_shndx) || ++ os->find_relaxed_input_section(this, text_shndx) != NULL); ++ ++ return true; ++} ++ ++ ++// Determine if we want to scan the SHNDX-th section for relocation stubs. ++// This is a helper for AArch64_relobj::scan_sections_for_stubs(). ++ ++template ++bool ++AArch64_relobj::section_needs_reloc_stub_scanning( ++ const elfcpp::Shdr& shdr, ++ const Relobj::Output_sections& out_sections, ++ const Symbol_table* symtab, ++ const unsigned char* pshdrs) ++{ ++ unsigned int sh_type = shdr.get_sh_type(); ++ if (sh_type != elfcpp::SHT_RELA) ++ return false; ++ ++ // Ignore empty section. ++ off_t sh_size = shdr.get_sh_size(); ++ if (sh_size == 0) ++ return false; ++ ++ // Ignore reloc section with unexpected symbol table. The ++ // error will be reported in the final link. ++ if (this->adjust_shndx(shdr.get_sh_link()) != this->symtab_shndx()) ++ return false; ++ ++ gold_assert(sh_type == elfcpp::SHT_RELA); ++ unsigned int reloc_size = elfcpp::Elf_sizes::rela_size; ++ ++ // Ignore reloc section with unexpected entsize or uneven size. ++ // The error will be reported in the final link. ++ if (reloc_size != shdr.get_sh_entsize() || sh_size % reloc_size != 0) ++ return false; ++ ++ // Ignore reloc section with bad info. This error will be ++ // reported in the final link. ++ unsigned int text_shndx = this->adjust_shndx(shdr.get_sh_info()); ++ if (text_shndx >= this->shnum()) ++ return false; ++ ++ const unsigned int shdr_size = elfcpp::Elf_sizes::shdr_size; ++ const elfcpp::Shdr text_shdr(pshdrs + ++ text_shndx * shdr_size); ++ return this->text_section_is_scannable(text_shdr, text_shndx, ++ out_sections[text_shndx], symtab); ++} ++ ++ ++// Scan relocations for stub generation. ++ ++template ++void ++AArch64_relobj::scan_sections_for_stubs( ++ The_target_aarch64* target, ++ const Symbol_table* symtab, ++ const Layout* layout) ++{ ++ unsigned int shnum = this->shnum(); ++ const unsigned int shdr_size = elfcpp::Elf_sizes::shdr_size; ++ ++ // Read the section headers. ++ const unsigned char* pshdrs = this->get_view(this->elf_file()->shoff(), ++ shnum * shdr_size, ++ true, true); ++ ++ // To speed up processing, we set up hash tables for fast lookup of ++ // input offsets to output addresses. ++ this->initialize_input_to_output_maps(); ++ ++ const Relobj::Output_sections& out_sections(this->output_sections()); ++ ++ Relocate_info relinfo; ++ relinfo.symtab = symtab; ++ relinfo.layout = layout; ++ relinfo.object = this; ++ ++ // Do relocation stubs scanning. ++ const unsigned char* p = pshdrs + shdr_size; ++ for (unsigned int i = 1; i < shnum; ++i, p += shdr_size) ++ { ++ const elfcpp::Shdr shdr(p); ++ if (this->section_needs_reloc_stub_scanning(shdr, out_sections, symtab, ++ pshdrs)) ++ { ++ unsigned int index = this->adjust_shndx(shdr.get_sh_info()); ++ AArch64_address output_offset = ++ this->get_output_section_offset(index); ++ AArch64_address output_address; ++ if (output_offset != invalid_address) ++ { ++ output_address = out_sections[index]->address() + output_offset; ++ } ++ else ++ { ++ // Currently this only happens for a relaxed section. ++ const Output_relaxed_input_section* poris = ++ out_sections[index]->find_relaxed_input_section(this, index); ++ gold_assert(poris != NULL); ++ output_address = poris->address(); ++ } ++ ++ // Get the relocations. ++ const unsigned char* prelocs = this->get_view(shdr.get_sh_offset(), ++ shdr.get_sh_size(), ++ true, false); ++ ++ // Get the section contents. ++ section_size_type input_view_size = 0; ++ const unsigned char* input_view = ++ this->section_contents(index, &input_view_size, false); ++ ++ relinfo.reloc_shndx = i; ++ relinfo.data_shndx = index; ++ unsigned int sh_type = shdr.get_sh_type(); ++ unsigned int reloc_size; ++ gold_assert (sh_type == elfcpp::SHT_RELA); ++ reloc_size = elfcpp::Elf_sizes::rela_size; ++ ++ Output_section* os = out_sections[index]; ++ target->scan_section_for_stubs(&relinfo, sh_type, prelocs, ++ shdr.get_sh_size() / reloc_size, ++ os, ++ output_offset == invalid_address, ++ input_view, output_address, ++ input_view_size); ++ } ++ } ++} ++ ++ ++// A class to wrap an ordinary input section containing executable code. ++ ++template ++class AArch64_input_section : public Output_relaxed_input_section ++{ ++ public: ++ typedef Stub_table The_stub_table; ++ ++ AArch64_input_section(Relobj* relobj, unsigned int shndx) ++ : Output_relaxed_input_section(relobj, shndx, 1), ++ stub_table_(NULL), ++ original_contents_(NULL), original_size_(0), ++ original_addralign_(1) ++ { } ++ ++ ~AArch64_input_section() ++ { delete[] this->original_contents_; } ++ ++ // Initialize. ++ void ++ init(); ++ ++ // Set the stub_table. ++ void ++ set_stub_table(The_stub_table* st) ++ { this->stub_table_ = st; } ++ ++ // Whether this is a stub table owner. ++ bool ++ is_stub_table_owner() const ++ { return this->stub_table_ != NULL && this->stub_table_->owner() == this; } ++ ++ // Return the original size of the section. ++ uint32_t ++ original_size() const ++ { return this->original_size_; } ++ ++ // Return the stub table. ++ The_stub_table* ++ stub_table() ++ { return stub_table_; } ++ ++ protected: ++ // Write out this input section. ++ void ++ do_write(Output_file*); ++ ++ // Return required alignment of this. ++ uint64_t ++ do_addralign() const ++ { ++ if (this->is_stub_table_owner()) ++ return std::max(this->stub_table_->addralign(), ++ static_cast(this->original_addralign_)); ++ else ++ return this->original_addralign_; ++ } ++ ++ // Finalize data size. ++ void ++ set_final_data_size(); ++ ++ // Reset address and file offset. ++ void ++ do_reset_address_and_file_offset(); ++ ++ // Output offset. ++ bool ++ do_output_offset(const Relobj* object, unsigned int shndx, ++ section_offset_type offset, ++ section_offset_type* poutput) const ++ { ++ if ((object == this->relobj()) ++ && (shndx == this->shndx()) ++ && (offset >= 0) ++ && (offset <= ++ convert_types(this->original_size_))) ++ { ++ *poutput = offset; ++ return true; ++ } ++ else ++ return false; ++ } ++ ++ private: ++ // Copying is not allowed. ++ AArch64_input_section(const AArch64_input_section&); ++ AArch64_input_section& operator=(const AArch64_input_section&); ++ ++ // The relocation stubs. ++ The_stub_table* stub_table_; ++ // Original section contents. We have to make a copy here since the file ++ // containing the original section may not be locked when we need to access ++ // the contents. ++ unsigned char* original_contents_; ++ // Section size of the original input section. ++ uint32_t original_size_; ++ // Address alignment of the original input section. ++ uint32_t original_addralign_; ++}; // End of AArch64_input_section ++ ++ ++// Finalize data size. ++ ++template ++void ++AArch64_input_section::set_final_data_size() ++{ ++ off_t off = convert_types(this->original_size_); ++ ++ if (this->is_stub_table_owner()) ++ { ++ this->stub_table_->finalize_data_size(); ++ off = align_address(off, this->stub_table_->addralign()); ++ off += this->stub_table_->data_size(); ++ } ++ this->set_data_size(off); ++} ++ ++ ++// Reset address and file offset. ++ ++template ++void ++AArch64_input_section::do_reset_address_and_file_offset() ++{ ++ // Size of the original input section contents. ++ off_t off = convert_types(this->original_size_); ++ ++ // If this is a stub table owner, account for the stub table size. ++ if (this->is_stub_table_owner()) ++ { ++ The_stub_table* stub_table = this->stub_table_; ++ ++ // Reset the stub table's address and file offset. The ++ // current data size for child will be updated after that. ++ stub_table_->reset_address_and_file_offset(); ++ off = align_address(off, stub_table_->addralign()); ++ off += stub_table->current_data_size(); ++ } ++ ++ this->set_current_data_size(off); ++} ++ ++ ++// Initialize an Arm_input_section. ++ ++template ++void ++AArch64_input_section::init() ++{ ++ Relobj* relobj = this->relobj(); ++ unsigned int shndx = this->shndx(); ++ ++ // We have to cache original size, alignment and contents to avoid locking ++ // the original file. ++ this->original_addralign_ = ++ convert_types(relobj->section_addralign(shndx)); ++ ++ // This is not efficient but we expect only a small number of relaxed ++ // input sections for stubs. ++ section_size_type section_size; ++ const unsigned char* section_contents = ++ relobj->section_contents(shndx, §ion_size, false); ++ this->original_size_ = ++ convert_types(relobj->section_size(shndx)); ++ ++ gold_assert(this->original_contents_ == NULL); ++ this->original_contents_ = new unsigned char[section_size]; ++ memcpy(this->original_contents_, section_contents, section_size); ++ ++ // We want to make this look like the original input section after ++ // output sections are finalized. ++ Output_section* os = relobj->output_section(shndx); ++ off_t offset = relobj->output_section_offset(shndx); ++ gold_assert(os != NULL && !relobj->is_output_section_offset_invalid(shndx)); ++ this->set_address(os->address() + offset); ++ this->set_file_offset(os->offset() + offset); ++ this->set_current_data_size(this->original_size_); ++ this->finalize_data_size(); ++} ++ ++ ++// Write data to output file. ++ ++template ++void ++AArch64_input_section::do_write(Output_file* of) ++{ ++ // We have to write out the original section content. ++ gold_assert(this->original_contents_ != NULL); ++ of->write(this->offset(), this->original_contents_, ++ this->original_size_); ++ ++ // If this owns a stub table and it is not empty, write it. ++ if (this->is_stub_table_owner() && !this->stub_table_->empty()) ++ this->stub_table_->write(of); ++} ++ ++ ++// Arm output section class. This is defined mainly to add a number of stub ++// generation methods. ++ ++template ++class AArch64_output_section : public Output_section ++{ ++ public: ++ typedef Target_aarch64 The_target_aarch64; ++ typedef AArch64_relobj The_aarch64_relobj; ++ typedef Stub_table The_stub_table; ++ typedef AArch64_input_section The_aarch64_input_section; ++ ++ public: ++ AArch64_output_section(const char* name, elfcpp::Elf_Word type, ++ elfcpp::Elf_Xword flags) ++ : Output_section(name, type, flags) ++ { } ++ ++ ~AArch64_output_section() {} ++ ++ // Group input sections for stub generation. ++ void ++ group_sections(section_size_type, bool, Target_aarch64*, ++ const Task*); ++ ++ private: ++ typedef Output_section::Input_section Input_section; ++ typedef Output_section::Input_section_list Input_section_list; ++ ++ // Create a stub group. ++ void ++ create_stub_group(Input_section_list::const_iterator, ++ Input_section_list::const_iterator, ++ Input_section_list::const_iterator, ++ The_target_aarch64*, ++ std::vector&, ++ const Task*); ++}; // End of AArch64_output_section ++ ++ ++// Create a stub group for input sections from FIRST to LAST. OWNER points to ++// the input section that will be the owner of the stub table. ++ ++template void ++AArch64_output_section::create_stub_group( ++ Input_section_list::const_iterator first, ++ Input_section_list::const_iterator last, ++ Input_section_list::const_iterator owner, ++ The_target_aarch64* target, ++ std::vector& new_relaxed_sections, ++ const Task* task) ++{ ++ // Currently we convert ordinary input sections into relaxed sections only ++ // at this point. ++ The_aarch64_input_section* input_section; ++ if (owner->is_relaxed_input_section()) ++ gold_unreachable(); ++ else ++ { ++ gold_assert(owner->is_input_section()); ++ // Create a new relaxed input section. We need to lock the original ++ // file. ++ Task_lock_obj tl(task, owner->relobj()); ++ input_section = ++ target->new_aarch64_input_section(owner->relobj(), owner->shndx()); ++ new_relaxed_sections.push_back(input_section); ++ } ++ ++ // Create a stub table. ++ The_stub_table* stub_table = ++ target->new_stub_table(input_section); ++ ++ input_section->set_stub_table(stub_table); ++ ++ Input_section_list::const_iterator p = first; ++ // Look for input sections or relaxed input sections in [first ... last]. ++ do ++ { ++ if (p->is_input_section() || p->is_relaxed_input_section()) ++ { ++ // The stub table information for input sections live ++ // in their objects. ++ The_aarch64_relobj* aarch64_relobj = ++ static_cast(p->relobj()); ++ aarch64_relobj->set_stub_table(p->shndx(), stub_table); ++ } ++ } ++ while (p++ != last); ++} ++ ++ ++// Group input sections for stub generation. GROUP_SIZE is roughly the limit of ++// stub groups. We grow a stub group by adding input section until the size is ++// just below GROUP_SIZE. The last input section will be converted into a stub ++// table owner. If STUB_ALWAYS_AFTER_BRANCH is false, we also add input sectiond ++// after the stub table, effectively doubling the group size. ++// ++// This is similar to the group_sections() function in elf32-arm.c but is ++// implemented differently. ++ ++template ++void AArch64_output_section::group_sections( ++ section_size_type group_size, ++ bool stubs_always_after_branch, ++ Target_aarch64* target, ++ const Task* task) ++{ ++ typedef enum ++ { ++ NO_GROUP, ++ FINDING_STUB_SECTION, ++ HAS_STUB_SECTION ++ } State; ++ ++ std::vector new_relaxed_sections; ++ ++ State state = NO_GROUP; ++ section_size_type off = 0; ++ section_size_type group_begin_offset = 0; ++ section_size_type group_end_offset = 0; ++ section_size_type stub_table_end_offset = 0; ++ Input_section_list::const_iterator group_begin = ++ this->input_sections().end(); ++ Input_section_list::const_iterator stub_table = ++ this->input_sections().end(); ++ Input_section_list::const_iterator group_end = this->input_sections().end(); ++ for (Input_section_list::const_iterator p = this->input_sections().begin(); ++ p != this->input_sections().end(); ++ ++p) ++ { ++ section_size_type section_begin_offset = ++ align_address(off, p->addralign()); ++ section_size_type section_end_offset = ++ section_begin_offset + p->data_size(); ++ ++ // Check to see if we should group the previously seen sections. ++ switch (state) ++ { ++ case NO_GROUP: ++ break; ++ ++ case FINDING_STUB_SECTION: ++ // Adding this section makes the group larger than GROUP_SIZE. ++ if (section_end_offset - group_begin_offset >= group_size) ++ { ++ if (stubs_always_after_branch) ++ { ++ gold_assert(group_end != this->input_sections().end()); ++ this->create_stub_group(group_begin, group_end, group_end, ++ target, new_relaxed_sections, ++ task); ++ state = NO_GROUP; ++ } ++ else ++ { ++ // Input sections up to stub_group_size bytes after the stub ++ // table can be handled by it too. ++ state = HAS_STUB_SECTION; ++ stub_table = group_end; ++ stub_table_end_offset = group_end_offset; ++ } ++ } ++ break; ++ ++ case HAS_STUB_SECTION: ++ // Adding this section makes the post stub-section group larger ++ // than GROUP_SIZE. ++ gold_unreachable(); ++ // NOT SUPPORTED YET. For completeness only. ++ if (section_end_offset - stub_table_end_offset >= group_size) ++ { ++ gold_assert(group_end != this->input_sections().end()); ++ this->create_stub_group(group_begin, group_end, stub_table, ++ target, new_relaxed_sections, task); ++ state = NO_GROUP; ++ } ++ break; ++ ++ default: ++ gold_unreachable(); ++ } ++ ++ // If we see an input section and currently there is no group, start ++ // a new one. Skip any empty sections. We look at the data size ++ // instead of calling p->relobj()->section_size() to avoid locking. ++ if ((p->is_input_section() || p->is_relaxed_input_section()) ++ && (p->data_size() != 0)) ++ { ++ if (state == NO_GROUP) ++ { ++ state = FINDING_STUB_SECTION; ++ group_begin = p; ++ group_begin_offset = section_begin_offset; ++ } ++ ++ // Keep track of the last input section seen. ++ group_end = p; ++ group_end_offset = section_end_offset; ++ } ++ ++ off = section_end_offset; + } + +- // For a relocation against a local symbol, the local symbol index. +- unsigned int +- index() const ++ // Create a stub group for any ungrouped sections. ++ if (state == FINDING_STUB_SECTION || state == HAS_STUB_SECTION) + { +- gold_assert(!this->symbol_is_global_); +- return this->u_.local.index; ++ gold_assert(group_end != this->input_sections().end()); ++ this->create_stub_group(group_begin, group_end, ++ (state == FINDING_STUB_SECTION ++ ? group_end ++ : stub_table), ++ target, new_relaxed_sections, task); + } + +- private: +- // GOT offset of the entry to which this relocation is applied. +- unsigned int got_offset_; +- // Type of relocation. +- unsigned int r_type_; +- // Whether this relocation is against a global symbol. +- bool symbol_is_global_; +- // A global or local symbol. +- union +- { +- struct +- { +- // For a global symbol, the symbol itself. +- Symbol* symbol; +- } global; +- struct +- { +- // For a local symbol, the object defining object. +- Sized_relobj_file* relobj; +- // For a local symbol, the symbol index. +- unsigned int index; +- } local; +- } u_; +- }; // End of inner class Static_reloc ++ if (!new_relaxed_sections.empty()) ++ this->convert_input_sections_to_relaxed_sections(new_relaxed_sections); + +- std::vector static_relocs_; +-}; // End of Output_data_got_aarch64 ++ // Update the section offsets ++ for (size_t i = 0; i < new_relaxed_sections.size(); ++i) ++ { ++ The_aarch64_relobj* relobj = static_cast( ++ new_relaxed_sections[i]->relobj()); ++ unsigned int shndx = new_relaxed_sections[i]->shndx(); ++ // Tell AArch64_relobj that this input section is converted. ++ relobj->convert_input_section_to_relaxed_section(shndx); ++ } ++} // End of AArch64_output_section::group_sections + + + AArch64_reloc_property_table* aarch64_reloc_property_table = NULL; +@@ -309,10 +1627,23 @@ template + class Target_aarch64 : public Sized_target + { + public: +- typedef Target_aarch64 This; ++ typedef Target_aarch64 This; + typedef Output_data_reloc + Reloc_section; ++ typedef Relocate_info The_relocate_info; + typedef typename elfcpp::Elf_types::Elf_Addr Address; ++ typedef AArch64_relobj The_aarch64_relobj; ++ typedef Reloc_stub The_reloc_stub; ++ typedef typename The_reloc_stub::Stub_type The_reloc_stub_type; ++ typedef typename Reloc_stub::Key The_reloc_stub_key; ++ typedef Stub_table The_stub_table; ++ typedef std::vector Stub_table_list; ++ typedef typename Stub_table_list::iterator Stub_table_iterator; ++ typedef AArch64_input_section The_aarch64_input_section; ++ typedef AArch64_output_section The_aarch64_output_section; ++ typedef Unordered_map*, ++ Section_id_hash> AArch64_input_section_map; + const static int TCB_SIZE = size / 8 * 2; + + Target_aarch64(const Target::Target_info* info = &aarch64_info) +@@ -320,8 +1651,9 @@ class Target_aarch64 : public Sized_targ + got_(NULL), plt_(NULL), got_plt_(NULL), got_irelative_(NULL), + got_tlsdesc_(NULL), global_offset_table_(NULL), rela_dyn_(NULL), + rela_irelative_(NULL), copy_relocs_(elfcpp::R_AARCH64_COPY), +- got_mod_index_offset_(-1U), tlsdesc_reloc_info_(), +- tls_base_symbol_defined_(false) ++ got_mod_index_offset_(-1U), ++ tlsdesc_reloc_info_(), tls_base_symbol_defined_(false), ++ stub_tables_(), aarch64_input_section_map_() + { } + + // Scan the relocations to determine unreferenced sections for +@@ -442,9 +1774,59 @@ class Target_aarch64 : public Sized_targ + unsigned int + plt_entry_size() const; + ++ // Create a stub table. ++ The_stub_table* ++ new_stub_table(The_aarch64_input_section*); ++ ++ // Create an aarch64 input section. ++ The_aarch64_input_section* ++ new_aarch64_input_section(Relobj*, unsigned int); ++ ++ // Find an aarch64 input section instance for a given OBJ and SHNDX. ++ The_aarch64_input_section* ++ find_aarch64_input_section(Relobj*, unsigned int) const; ++ ++ // Return the thread control block size. + unsigned int + tcb_size() const { return This::TCB_SIZE; } + ++ // Scan a section for stub generation. ++ void ++ scan_section_for_stubs(const Relocate_info*, unsigned int, ++ const unsigned char*, size_t, Output_section*, ++ bool, const unsigned char*, ++ Address, ++ section_size_type); ++ ++ // Scan a relocation section for stub. ++ template ++ void ++ scan_reloc_section_for_stubs( ++ const The_relocate_info* relinfo, ++ const unsigned char* prelocs, ++ size_t reloc_count, ++ Output_section* output_section, ++ bool needs_special_offset_handling, ++ const unsigned char* view, ++ Address view_address, ++ section_size_type); ++ ++ // Relocate a single stub. ++ void ++ relocate_stub(The_reloc_stub*, const Relocate_info*, ++ Output_section*, unsigned char*, Address, ++ section_size_type); ++ ++ // Get the default AArch64 target. ++ static This* ++ current_target() ++ { ++ gold_assert(parameters->target().machine_code() == elfcpp::EM_AARCH64 ++ && parameters->target().get_size() == size ++ && parameters->target().is_big_endian() == big_endian); ++ return static_cast(parameters->sized_target()); ++ } ++ + protected: + void + do_select_as_default_target() +@@ -472,6 +1854,12 @@ class Target_aarch64 : public Sized_targ + layout, got, got_plt, got_irelative); + } + ++ ++ // do_make_elf_object to override the same function in the base class. ++ Object* ++ do_make_elf_object(const std::string&, Input_file*, off_t, ++ const elfcpp::Ehdr&); ++ + Output_data_plt_aarch64* + make_data_plt(Layout* layout, + Output_data_got_aarch64* got, +@@ -481,6 +1869,35 @@ class Target_aarch64 : public Sized_targ + return this->do_make_data_plt(layout, got, got_plt, got_irelative); + } + ++ // We only need to generate stubs, and hence perform relaxation if we are ++ // not doing relocatable linking. ++ virtual bool ++ do_may_relax() const ++ { return !parameters->options().relocatable(); } ++ ++ // Relaxation hook. This is where we do stub generation. ++ virtual bool ++ do_relax(int, const Input_objects*, Symbol_table*, Layout*, const Task*); ++ ++ void ++ group_sections(Layout* layout, ++ section_size_type group_size, ++ bool stubs_always_after_branch, ++ const Task* task); ++ ++ void ++ scan_reloc_for_stub(const The_relocate_info*, unsigned int, ++ const Sized_symbol*, unsigned int, ++ const Symbol_value*, ++ typename elfcpp::Elf_types::Elf_Swxword, ++ Address Elf_Addr); ++ ++ // Make an output section. ++ Output_section* ++ do_make_output_section(const char* name, elfcpp::Elf_Word type, ++ elfcpp::Elf_Xword flags) ++ { return new The_aarch64_output_section(name, type, flags); } ++ + private: + // The class which scans relocations. + class Scan +@@ -569,8 +1986,8 @@ class Target_aarch64 : public Sized_targ + section_size_type); + + private: +- inline typename AArch64_relocate_functions::Status +- relocate_tls(const Relocate_info*, ++ inline typename AArch64_relocate_functions::Status ++ relocate_tls(const Relocate_info*, + Target_aarch64*, + size_t, + const elfcpp::Rela&, +@@ -579,36 +1996,36 @@ class Target_aarch64 : public Sized_targ + unsigned char*, + typename elfcpp::Elf_types::Elf_Addr); + +- inline typename AArch64_relocate_functions::Status ++ inline typename AArch64_relocate_functions::Status + tls_gd_to_le( +- const Relocate_info*, ++ const Relocate_info*, + Target_aarch64*, + const elfcpp::Rela&, + unsigned int, + unsigned char*, + const Symbol_value*); + +- inline typename AArch64_relocate_functions::Status ++ inline typename AArch64_relocate_functions::Status + tls_ie_to_le( +- const Relocate_info*, ++ const Relocate_info*, + Target_aarch64*, + const elfcpp::Rela&, + unsigned int, + unsigned char*, + const Symbol_value*); + +- inline typename AArch64_relocate_functions::Status ++ inline typename AArch64_relocate_functions::Status + tls_desc_gd_to_le( +- const Relocate_info*, ++ const Relocate_info*, + Target_aarch64*, + const elfcpp::Rela&, + unsigned int, + unsigned char*, + const Symbol_value*); + +- inline typename AArch64_relocate_functions::Status ++ inline typename AArch64_relocate_functions::Status + tls_desc_gd_to_ie( +- const Relocate_info*, ++ const Relocate_info*, + Target_aarch64*, + const elfcpp::Rela&, + unsigned int, +@@ -773,6 +2190,9 @@ class Target_aarch64 : public Sized_targ + std::vector tlsdesc_reloc_info_; + // True if the _TLS_MODULE_BASE_ symbol has been defined. + bool tls_base_symbol_defined_; ++ // List of stub_tables ++ Stub_table_list stub_tables_; ++ AArch64_input_section_map aarch64_input_section_map_; + }; // End of Target_aarch64 + + +@@ -1022,6 +2442,407 @@ Target_aarch64::rela_i + } + + ++// do_make_elf_object to override the same function in the base class. We need ++// to use a target-specific sub-class of Sized_relobj_file to ++// store backend specific information. Hence we need to have our own ELF object ++// creation. ++ ++template ++Object* ++Target_aarch64::do_make_elf_object( ++ const std::string& name, ++ Input_file* input_file, ++ off_t offset, const elfcpp::Ehdr& ehdr) ++{ ++ int et = ehdr.get_e_type(); ++ // ET_EXEC files are valid input for --just-symbols/-R, ++ // and we treat them as relocatable objects. ++ if (et == elfcpp::ET_EXEC && input_file->just_symbols()) ++ return Sized_target::do_make_elf_object( ++ name, input_file, offset, ehdr); ++ else if (et == elfcpp::ET_REL) ++ { ++ AArch64_relobj* obj = ++ new AArch64_relobj(name, input_file, offset, ehdr); ++ obj->setup(); ++ return obj; ++ } ++ else if (et == elfcpp::ET_DYN) ++ { ++ // Keep base implementation. ++ Sized_dynobj* obj = ++ new Sized_dynobj(name, input_file, offset, ehdr); ++ obj->setup(); ++ return obj; ++ } ++ else ++ { ++ gold_error(_("%s: unsupported ELF file type %d"), ++ name.c_str(), et); ++ return NULL; ++ } ++} ++ ++ ++// Scan a relocation for stub generation. ++ ++template ++void ++Target_aarch64::scan_reloc_for_stub( ++ const Relocate_info* relinfo, ++ unsigned int r_type, ++ const Sized_symbol* gsym, ++ unsigned int r_sym, ++ const Symbol_value* psymval, ++ typename elfcpp::Elf_types::Elf_Swxword addend, ++ Address address) ++{ ++ const AArch64_relobj* aarch64_relobj = ++ static_cast*>(relinfo->object); ++ ++ Symbol_value symval; ++ if (gsym != NULL) ++ { ++ const AArch64_reloc_property* arp = aarch64_reloc_property_table-> ++ get_reloc_property(r_type); ++ if (gsym->use_plt_offset(arp->reference_flags())) ++ { ++ // This uses a PLT, change the symbol value. ++ symval.set_output_value(this->plt_section()->address() ++ + gsym->plt_offset()); ++ psymval = &symval; ++ } ++ else if (gsym->is_undefined()) ++ // There is no need to generate a stub symbol is undefined. ++ return; ++ } ++ ++ // Get the symbol value. ++ typename Symbol_value::Value value = psymval->value(aarch64_relobj, 0); ++ ++ // Owing to pipelining, the PC relative branches below actually skip ++ // two instructions when the branch offset is 0. ++ Address destination = static_cast
(-1); ++ switch (r_type) ++ { ++ case elfcpp::R_AARCH64_CALL26: ++ case elfcpp::R_AARCH64_JUMP26: ++ destination = value + addend; ++ break; ++ default: ++ gold_assert(false); ++ } ++ ++ typename The_reloc_stub::Stub_type stub_type = The_reloc_stub:: ++ stub_type_for_reloc(r_type, address, destination); ++ if (stub_type == The_reloc_stub::ST_NONE) ++ return ; ++ ++ The_stub_table* stub_table = aarch64_relobj->stub_table(relinfo->data_shndx); ++ gold_assert(stub_table != NULL); ++ ++ The_reloc_stub_key key(stub_type, gsym, aarch64_relobj, r_sym, addend); ++ The_reloc_stub* stub = stub_table->find_reloc_stub(key); ++ if (stub == NULL) ++ { ++ stub = new The_reloc_stub(stub_type); ++ stub_table->add_reloc_stub(stub, key); ++ } ++ stub->set_destination_address(destination); ++} // End of Target_aarch64::scan_reloc_for_stub ++ ++ ++// This function scans a relocation section for stub generation. ++// The template parameter Relocate must be a class type which provides ++// a single function, relocate(), which implements the machine ++// specific part of a relocation. ++ ++// BIG_ENDIAN is the endianness of the data. SH_TYPE is the section type: ++// SHT_REL or SHT_RELA. ++ ++// PRELOCS points to the relocation data. RELOC_COUNT is the number ++// of relocs. OUTPUT_SECTION is the output section. ++// NEEDS_SPECIAL_OFFSET_HANDLING is true if input offsets need to be ++// mapped to output offsets. ++ ++// VIEW is the section data, VIEW_ADDRESS is its memory address, and ++// VIEW_SIZE is the size. These refer to the input section, unless ++// NEEDS_SPECIAL_OFFSET_HANDLING is true, in which case they refer to ++// the output section. ++ ++template ++template ++void inline ++Target_aarch64::scan_reloc_section_for_stubs( ++ const Relocate_info* relinfo, ++ const unsigned char* prelocs, ++ size_t reloc_count, ++ Output_section* /*output_section*/, ++ bool /*needs_special_offset_handling*/, ++ const unsigned char* /*view*/, ++ Address view_address, ++ section_size_type) ++{ ++ typedef typename Reloc_types::Reloc Reltype; ++ ++ const int reloc_size = ++ Reloc_types::reloc_size; ++ AArch64_relobj* object = ++ static_cast*>(relinfo->object); ++ unsigned int local_count = object->local_symbol_count(); ++ ++ gold::Default_comdat_behavior default_comdat_behavior; ++ Comdat_behavior comdat_behavior = CB_UNDETERMINED; ++ ++ for (size_t i = 0; i < reloc_count; ++i, prelocs += reloc_size) ++ { ++ Reltype reloc(prelocs); ++ typename elfcpp::Elf_types::Elf_WXword r_info = reloc.get_r_info(); ++ unsigned int r_sym = elfcpp::elf_r_sym(r_info); ++ unsigned int r_type = elfcpp::elf_r_type(r_info); ++ if (r_type != elfcpp::R_AARCH64_CALL26 ++ && r_type != elfcpp::R_AARCH64_JUMP26) ++ continue; ++ ++ section_offset_type offset = ++ convert_to_section_size_type(reloc.get_r_offset()); ++ ++ // Get the addend. ++ typename elfcpp::Elf_types::Elf_Swxword addend = ++ reloc.get_r_addend(); ++ ++ const Sized_symbol* sym; ++ Symbol_value symval; ++ const Symbol_value *psymval; ++ bool is_defined_in_discarded_section; ++ unsigned int shndx; ++ if (r_sym < local_count) ++ { ++ sym = NULL; ++ psymval = object->local_symbol(r_sym); ++ ++ // If the local symbol belongs to a section we are discarding, ++ // and that section is a debug section, try to find the ++ // corresponding kept section and map this symbol to its ++ // counterpart in the kept section. The symbol must not ++ // correspond to a section we are folding. ++ bool is_ordinary; ++ shndx = psymval->input_shndx(&is_ordinary); ++ is_defined_in_discarded_section = ++ (is_ordinary ++ && shndx != elfcpp::SHN_UNDEF ++ && !object->is_section_included(shndx) ++ && !relinfo->symtab->is_section_folded(object, shndx)); ++ ++ // We need to compute the would-be final value of this local ++ // symbol. ++ if (!is_defined_in_discarded_section) ++ { ++ typedef Sized_relobj_file ObjType; ++ typename ObjType::Compute_final_local_value_status status = ++ object->compute_final_local_value(r_sym, psymval, &symval, ++ relinfo->symtab); ++ if (status == ObjType::CFLV_OK) ++ { ++ // Currently we cannot handle a branch to a target in ++ // a merged section. If this is the case, issue an error ++ // and also free the merge symbol value. ++ if (!symval.has_output_value()) ++ { ++ const std::string& section_name = ++ object->section_name(shndx); ++ object->error(_("cannot handle branch to local %u " ++ "in a merged section %s"), ++ r_sym, section_name.c_str()); ++ } ++ psymval = &symval; ++ } ++ else ++ { ++ // We cannot determine the final value. ++ continue; ++ } ++ } ++ } ++ else ++ { ++ const Symbol* gsym; ++ gsym = object->global_symbol(r_sym); ++ gold_assert(gsym != NULL); ++ if (gsym->is_forwarder()) ++ gsym = relinfo->symtab->resolve_forwards(gsym); ++ ++ sym = static_cast*>(gsym); ++ if (sym->has_symtab_index() && sym->symtab_index() != -1U) ++ symval.set_output_symtab_index(sym->symtab_index()); ++ else ++ symval.set_no_output_symtab_entry(); ++ ++ // We need to compute the would-be final value of this global ++ // symbol. ++ const Symbol_table* symtab = relinfo->symtab; ++ const Sized_symbol* sized_symbol = ++ symtab->get_sized_symbol(gsym); ++ Symbol_table::Compute_final_value_status status; ++ typename elfcpp::Elf_types::Elf_Addr value = ++ symtab->compute_final_value(sized_symbol, &status); ++ ++ // Skip this if the symbol has not output section. ++ if (status == Symbol_table::CFVS_NO_OUTPUT_SECTION) ++ continue; ++ symval.set_output_value(value); ++ ++ if (gsym->type() == elfcpp::STT_TLS) ++ symval.set_is_tls_symbol(); ++ else if (gsym->type() == elfcpp::STT_GNU_IFUNC) ++ symval.set_is_ifunc_symbol(); ++ psymval = &symval; ++ ++ is_defined_in_discarded_section = ++ (gsym->is_defined_in_discarded_section() ++ && gsym->is_undefined()); ++ shndx = 0; ++ } ++ ++ Symbol_value symval2; ++ if (is_defined_in_discarded_section) ++ { ++ if (comdat_behavior == CB_UNDETERMINED) ++ { ++ std::string name = object->section_name(relinfo->data_shndx); ++ comdat_behavior = default_comdat_behavior.get(name.c_str()); ++ } ++ if (comdat_behavior == CB_PRETEND) ++ { ++ bool found; ++ typename elfcpp::Elf_types::Elf_Addr value = ++ object->map_to_kept_section(shndx, &found); ++ if (found) ++ symval2.set_output_value(value + psymval->input_value()); ++ else ++ symval2.set_output_value(0); ++ } ++ else ++ { ++ if (comdat_behavior == CB_WARNING) ++ gold_warning_at_location(relinfo, i, offset, ++ _("relocation refers to discarded " ++ "section")); ++ symval2.set_output_value(0); ++ } ++ symval2.set_no_output_symtab_entry(); ++ psymval = &symval2; ++ } ++ ++ // If symbol is a section symbol, we don't know the actual type of ++ // destination. Give up. ++ if (psymval->is_section_symbol()) ++ continue; ++ ++ this->scan_reloc_for_stub(relinfo, r_type, sym, r_sym, psymval, ++ addend, view_address + offset); ++ } // End of iterating relocs in a section ++} // End of Target_aarch64::scan_reloc_section_for_stubs ++ ++ ++// Scan an input section for stub generation. ++ ++template ++void ++Target_aarch64::scan_section_for_stubs( ++ const Relocate_info* relinfo, ++ unsigned int sh_type, ++ const unsigned char* prelocs, ++ size_t reloc_count, ++ Output_section* output_section, ++ bool needs_special_offset_handling, ++ const unsigned char* view, ++ Address view_address, ++ section_size_type view_size) ++{ ++ gold_assert(sh_type == elfcpp::SHT_RELA); ++ this->scan_reloc_section_for_stubs( ++ relinfo, ++ prelocs, ++ reloc_count, ++ output_section, ++ needs_special_offset_handling, ++ view, ++ view_address, ++ view_size); ++} ++ ++ ++// Relocate a single stub. ++ ++template ++void Target_aarch64:: ++relocate_stub(The_reloc_stub* stub, ++ const The_relocate_info*, ++ Output_section*, ++ unsigned char* view, ++ Address address, ++ section_size_type) ++{ ++ typedef AArch64_relocate_functions The_reloc_functions; ++ typedef typename The_reloc_functions::Status The_reloc_functions_status; ++ typedef typename elfcpp::Swap<32,big_endian>::Valtype Insntype; ++ ++ Insntype* ip = reinterpret_cast(view); ++ int insn_number = stub->stub_insn_number(); ++ const uint32_t* insns = stub->stub_insns(); ++ // Check the insns are really those stub insns. ++ for (int i = 0; i < insn_number; ++i) ++ { ++ Insntype insn = elfcpp::Swap<32,big_endian>::readval(ip + i); ++ gold_assert(((uint32_t)insn == insns[i+1])); ++ } ++ ++ Address dest = stub->destination_address(); ++ ++ switch(stub->stub_type()) ++ { ++ case The_reloc_stub::ST_ADRP_BRANCH: ++ { ++ // 1st reloc is ADR_PREL_PG_HI21 ++ The_reloc_functions_status status = ++ The_reloc_functions::adrp(view, dest, address); ++ // An error should never arise in the above step. If so, please ++ // check 'aarch64_valid_for_adrp_p'. ++ gold_assert(status == The_reloc_functions::STATUS_OKAY); ++ ++ // 2nd reloc is ADD_ABS_LO12_NC ++ const AArch64_reloc_property* arp = ++ aarch64_reloc_property_table->get_reloc_property( ++ elfcpp::R_AARCH64_ADD_ABS_LO12_NC); ++ gold_assert(arp != NULL); ++ status = The_reloc_functions::template ++ rela_general<32>(view + 4, dest, 0, arp); ++ // An error should never arise, it is an "_NC" relocation. ++ gold_assert(status == The_reloc_functions::STATUS_OKAY); ++ } ++ break; ++ ++ case The_reloc_stub::ST_LONG_BRANCH_ABS: ++ // 1st reloc is R_AARCH64_PREL64, at offset 8 ++ elfcpp::Swap<64,big_endian>::writeval(view + 8, dest); ++ break; ++ ++ case The_reloc_stub::ST_LONG_BRANCH_PCREL: ++ { ++ // "PC" calculation is the 2nd insn in the stub. ++ uint64_t offset = dest - (address + 4); ++ // Offset is placed at offset 4 and 5. ++ elfcpp::Swap<64,big_endian>::writeval(view + 16, offset); ++ } ++ break; ++ ++ default: ++ gold_assert(false); ++ } ++} ++ ++ + // A class to handle the PLT data. + // This is an abstract base class that handles most of the linker details + // but does not know the actual contents of PLT entries. The derived +@@ -1477,6 +3298,7 @@ Output_data_plt_aarch64_standard<32, fal + 0xd503201f, /* nop */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<32, true>:: +@@ -1492,6 +3314,7 @@ Output_data_plt_aarch64_standard<32, tru + 0xd503201f, /* nop */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<64, false>:: +@@ -1507,6 +3330,7 @@ Output_data_plt_aarch64_standard<64, fal + 0xd503201f, /* nop */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<64, true>:: +@@ -1522,6 +3346,7 @@ Output_data_plt_aarch64_standard<64, tru + 0xd503201f, /* nop */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<32, false>:: +@@ -1533,6 +3358,7 @@ Output_data_plt_aarch64_standard<32, fal + 0xd61f0220, /* br x17. */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<32, true>:: +@@ -1544,6 +3370,7 @@ Output_data_plt_aarch64_standard<32, tru + 0xd61f0220, /* br x17. */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<64, false>:: +@@ -1555,6 +3382,7 @@ Output_data_plt_aarch64_standard<64, fal + 0xd61f0220, /* br x17. */ + }; + ++ + template<> + const uint32_t + Output_data_plt_aarch64_standard<64, true>:: +@@ -1566,6 +3394,7 @@ Output_data_plt_aarch64_standard<64, tru + 0xd61f0220, /* br x17. */ + }; + ++ + template + void + Output_data_plt_aarch64_standard::do_fill_first_plt_entry( +@@ -1605,6 +3434,7 @@ Output_data_plt_aarch64_standard This; + typedef typename elfcpp::Elf_types::Elf_Addr Address; ++ typedef Relocate_info The_relocate_info; ++ typedef AArch64_relobj The_aarch64_relobj; ++ typedef Reloc_stub The_reloc_stub; ++ typedef typename The_reloc_stub::Stub_type The_reloc_stub_type; ++ typedef Stub_table The_stub_table; ++ typedef elfcpp::Rela The_rela; + + // Return the page address of the address. + // Page(address) = address & ~0xFFF +@@ -1872,6 +3707,7 @@ class AArch64_relocate_functions + return (address & (~static_cast
(0xFFF))); + } + ++ private: + // Update instruction (pointed by view) with selected bits (immed). + // val = (val & ~dst_mask) | (immed << doffset) + +@@ -2042,7 +3878,7 @@ class AArch64_relocate_functions + const AArch64_reloc_property* reloc_property) + { + // Calculate relocation. +- Address x = psymval->value(object, addend); ++ Address x = psymval->value(object, addend); + + // Select bits from X. + Address immed = reloc_property->select_x_value(x); +@@ -2144,9 +3980,10 @@ class AArch64_relocate_functions + Address address) + { + typename elfcpp::Swap::Valtype x = +- This::Page(sa) - This::Page(address); ++ This::Page(sa) - This::Page(address); + update_adr(view, x, NULL); +- return (size == 64 && Bits<32>::has_overflow(x) ++ // Check -2^32 <= X < 2^32 ++ return (size == 64 && Bits<33>::has_overflow((x)) + ? This::STATUS_OVERFLOW + : This::STATUS_OKAY); + } +@@ -2200,9 +4037,248 @@ class AArch64_relocate_functions + : This::STATUS_OVERFLOW); + } + ++ static inline bool ++ maybe_apply_stub(unsigned int, ++ const The_relocate_info*, ++ const The_rela&, ++ unsigned char*, ++ Address, ++ const Sized_symbol*, ++ const Symbol_value*, ++ const Sized_relobj_file*); ++ + }; // End of AArch64_relocate_functions + + ++// For a certain relocation type (usually jump/branch), test to see if the ++// destination needs a stub to fulfil. If so, re-route the destination of the ++// original instruction to the stub, note, at this time, the stub has already ++// been generated. ++ ++template ++bool ++AArch64_relocate_functions:: ++maybe_apply_stub(unsigned int r_type, ++ const The_relocate_info* relinfo, ++ const The_rela& rela, ++ unsigned char* view, ++ Address address, ++ const Sized_symbol* gsym, ++ const Symbol_value* psymval, ++ const Sized_relobj_file* object) ++{ ++ if (parameters->options().relocatable()) ++ return false; ++ ++ typename elfcpp::Elf_types::Elf_Swxword addend = rela.get_r_addend(); ++ Address branch_target = psymval->value(object, 0) + addend; ++ The_reloc_stub_type stub_type = The_reloc_stub:: ++ stub_type_for_reloc(r_type, address, branch_target); ++ if (stub_type == The_reloc_stub::ST_NONE) ++ return false; ++ ++ const The_aarch64_relobj* aarch64_relobj = ++ static_cast(object); ++ The_stub_table* stub_table = aarch64_relobj->stub_table(relinfo->data_shndx); ++ gold_assert(stub_table != NULL); ++ ++ unsigned int r_sym = elfcpp::elf_r_sym(rela.get_r_info()); ++ typename The_reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend); ++ The_reloc_stub* stub = stub_table->find_reloc_stub(stub_key); ++ gold_assert(stub != NULL); ++ ++ Address new_branch_target = stub_table->address() + stub->offset(); ++ typename elfcpp::Swap::Valtype branch_offset = ++ new_branch_target - address; ++ const AArch64_reloc_property* arp = ++ aarch64_reloc_property_table->get_reloc_property(r_type); ++ gold_assert(arp != NULL); ++ This::Status status = This::template ++ rela_general<32>(view, branch_offset, 0, arp); ++ if (status != This::STATUS_OKAY) ++ gold_error(_("Stub is too far away, try a smaller value " ++ "for '--stub-group-size'. For example, 0x2000000.")); ++ return true; ++} ++ ++ ++// Group input sections for stub generation. ++// ++// We group input sections in an output section so that the total size, ++// including any padding space due to alignment is smaller than GROUP_SIZE ++// unless the only input section in group is bigger than GROUP_SIZE already. ++// Then an ARM stub table is created to follow the last input section ++// in group. For each group an ARM stub table is created an is placed ++// after the last group. If STUB_ALWAYS_AFTER_BRANCH is false, we further ++// extend the group after the stub table. ++ ++template ++void ++Target_aarch64::group_sections( ++ Layout* layout, ++ section_size_type group_size, ++ bool stubs_always_after_branch, ++ const Task* task) ++{ ++ // Group input sections and insert stub table ++ Layout::Section_list section_list; ++ layout->get_executable_sections(§ion_list); ++ for (Layout::Section_list::const_iterator p = section_list.begin(); ++ p != section_list.end(); ++ ++p) ++ { ++ AArch64_output_section* output_section = ++ static_cast*>(*p); ++ output_section->group_sections(group_size, stubs_always_after_branch, ++ this, task); ++ } ++} ++ ++ ++// Find the AArch64_input_section object corresponding to the SHNDX-th input ++// section of RELOBJ. ++ ++template ++AArch64_input_section* ++Target_aarch64::find_aarch64_input_section( ++ Relobj* relobj, unsigned int shndx) const ++{ ++ Section_id sid(relobj, shndx); ++ typename AArch64_input_section_map::const_iterator p = ++ this->aarch64_input_section_map_.find(sid); ++ return (p != this->aarch64_input_section_map_.end()) ? p->second : NULL; ++} ++ ++ ++// Make a new AArch64_input_section object. ++ ++template ++AArch64_input_section* ++Target_aarch64::new_aarch64_input_section( ++ Relobj* relobj, unsigned int shndx) ++{ ++ Section_id sid(relobj, shndx); ++ ++ AArch64_input_section* input_section = ++ new AArch64_input_section(relobj, shndx); ++ input_section->init(); ++ ++ // Register new AArch64_input_section in map for look-up. ++ std::pair ins = ++ this->aarch64_input_section_map_.insert( ++ std::make_pair(sid, input_section)); ++ ++ // Make sure that it we have not created another AArch64_input_section ++ // for this input section already. ++ gold_assert(ins.second); ++ ++ return input_section; ++} ++ ++ ++// Relaxation hook. This is where we do stub generation. ++ ++template ++bool ++Target_aarch64::do_relax( ++ int pass, ++ const Input_objects* input_objects, ++ Symbol_table* symtab, ++ Layout* layout , ++ const Task* task) ++{ ++ gold_assert(!parameters->options().relocatable()); ++ if (pass == 1) ++ { ++ section_size_type stub_group_size = ++ parameters->options().stub_group_size(); ++ if (stub_group_size == 1) ++ { ++ // Leave room for 4096 4-byte stub entries. If we exceed that, then we ++ // will fail to link. The user will have to relink with an explicit ++ // group size option. ++ stub_group_size = The_reloc_stub::MAX_BRANCH_OFFSET - 4096 * 4; ++ } ++ group_sections(layout, stub_group_size, true, task); ++ } ++ else ++ { ++ // If this is not the first pass, addresses and file offsets have ++ // been reset at this point, set them here. ++ for (Stub_table_iterator sp = this->stub_tables_.begin(); ++ sp != this->stub_tables_.end(); ++sp) ++ { ++ The_stub_table* stt = *sp; ++ The_aarch64_input_section* owner = stt->owner(); ++ off_t off = align_address(owner->original_size(), ++ stt->addralign()); ++ stt->set_address_and_file_offset(owner->address() + off, ++ owner->offset() + off); ++ } ++ } ++ ++ // Scan relocs for relocation stubs ++ for (Input_objects::Relobj_iterator op = input_objects->relobj_begin(); ++ op != input_objects->relobj_end(); ++ ++op) ++ { ++ The_aarch64_relobj* aarch64_relobj = ++ static_cast(*op); ++ // Lock the object so we can read from it. This is only called ++ // single-threaded from Layout::finalize, so it is OK to lock. ++ Task_lock_obj tl(task, aarch64_relobj); ++ aarch64_relobj->scan_sections_for_stubs(this, symtab, layout); ++ } ++ ++ bool any_stub_table_changed = false; ++ for (Stub_table_iterator siter = this->stub_tables_.begin(); ++ siter != this->stub_tables_.end() && !any_stub_table_changed; ++siter) ++ { ++ The_stub_table* stub_table = *siter; ++ if (stub_table->update_data_size_changed_p()) ++ { ++ The_aarch64_input_section* owner = stub_table->owner(); ++ uint64_t address = owner->address(); ++ off_t offset = owner->offset(); ++ owner->reset_address_and_file_offset(); ++ owner->set_address_and_file_offset(address, offset); ++ ++ any_stub_table_changed = true; ++ } ++ } ++ ++ // Do not continue relaxation. ++ bool continue_relaxation = any_stub_table_changed; ++ if (!continue_relaxation) ++ for (Stub_table_iterator sp = this->stub_tables_.begin(); ++ (sp != this->stub_tables_.end()); ++ ++sp) ++ (*sp)->finalize_stubs(); ++ ++ return continue_relaxation; ++} ++ ++ ++// Make a new Stub_table. ++ ++template ++Stub_table* ++Target_aarch64::new_stub_table( ++ AArch64_input_section* owner) ++{ ++ Stub_table* stub_table = ++ new Stub_table(owner); ++ stub_table->set_address(align_address( ++ owner->address() + owner->data_size(), 8)); ++ stub_table->set_file_offset(owner->offset() + owner->data_size()); ++ stub_table->finalize_data_size(); ++ ++ this->stub_tables_.push_back(stub_table); ++ ++ return stub_table; ++} ++ ++ + template + typename elfcpp::Elf_types::Elf_Addr + Target_aarch64::do_reloc_addend( +@@ -3121,14 +5197,15 @@ Target_aarch64::scan_r + // pointers across shared library boundaries, as described in the + // processor specific ABI supplement. + +-template ++template + uint64_t +-Target_aarch64::do_dynsym_value(const Symbol* gsym) const ++Target_aarch64::do_dynsym_value(const Symbol* gsym) const + { + gold_assert(gsym->is_from_dynobj() && gsym->has_plt_offset()); + return this->plt_address_for_global(gsym); + } + ++ + // Finalize the sections. + + template +@@ -3352,14 +5429,17 @@ Target_aarch64::Reloca + case elfcpp::R_AARCH64_PREL64: + reloc_status = Reloc::template pcrela_ua<64>( + view, object, psymval, addend, address, reloc_property); ++ break; + + case elfcpp::R_AARCH64_PREL32: + reloc_status = Reloc::template pcrela_ua<32>( + view, object, psymval, addend, address, reloc_property); ++ break; + + case elfcpp::R_AARCH64_PREL16: + reloc_status = Reloc::template pcrela_ua<16>( + view, object, psymval, addend, address, reloc_property); ++ break; + + case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC: + case elfcpp::R_AARCH64_ADR_PREL_PG_HI21: +@@ -3391,10 +5471,14 @@ Target_aarch64::Reloca + // Return false to stop further processing this reloc. + return false; + } +- // Continue. ++ // Fallthrough ++ case elfcpp::R_AARCH64_JUMP26: ++ if (Reloc::maybe_apply_stub(r_type, relinfo, rela, view, address, ++ gsym, psymval, object)) ++ break; ++ // Fallthrough + case elfcpp::R_AARCH64_TSTBR14: + case elfcpp::R_AARCH64_CONDBR19: +- case elfcpp::R_AARCH64_JUMP26: + reloc_status = Reloc::template pcrela_general<32>( + view, object, psymval, addend, address, reloc_property); + break; +@@ -3477,9 +5561,9 @@ Target_aarch64::Reloca + + template + inline +-typename AArch64_relocate_functions::Status ++typename AArch64_relocate_functions::Status + Target_aarch64::Relocate::relocate_tls( +- const Relocate_info* relinfo, ++ const Relocate_info* relinfo, + Target_aarch64* target, + size_t relnum, + const elfcpp::Rela& rela, +@@ -3488,7 +5572,7 @@ Target_aarch64::Reloca + unsigned char* view, + typename elfcpp::Elf_types::Elf_Addr address) + { +- typedef AArch64_relocate_functions aarch64_reloc_funcs; ++ typedef AArch64_relocate_functions aarch64_reloc_funcs; + typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; + + Output_segment* tls_segment = relinfo->layout->tls_segment(); +@@ -3503,7 +5587,7 @@ Target_aarch64::Reloca + tls::Tls_optimization tlsopt = Target_aarch64:: + optimize_tls_reloc(is_final, r_type); + +- Sized_relobj_file* object = relinfo->object; ++ Sized_relobj_file* object = relinfo->object; + int tls_got_offset_type; + switch (r_type) + { +@@ -3733,16 +5817,16 @@ Target_aarch64::Reloca + + template + inline +-typename AArch64_relocate_functions::Status ++typename AArch64_relocate_functions::Status + Target_aarch64::Relocate::tls_gd_to_le( +- const Relocate_info* relinfo, ++ const Relocate_info* relinfo, + Target_aarch64* target, + const elfcpp::Rela& rela, + unsigned int r_type, + unsigned char* view, + const Symbol_value* psymval) + { +- typedef AArch64_relocate_functions aarch64_reloc_funcs; ++ typedef AArch64_relocate_functions aarch64_reloc_funcs; + typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype; + typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; + +@@ -3833,9 +5917,9 @@ Target_aarch64::Reloca + + template + inline +-typename AArch64_relocate_functions::Status ++typename AArch64_relocate_functions::Status + Target_aarch64::Relocate::tls_ie_to_le( +- const Relocate_info* relinfo, ++ const Relocate_info* relinfo, + Target_aarch64* target, + const elfcpp::Rela& rela, + unsigned int r_type, +@@ -3844,7 +5928,7 @@ Target_aarch64::Reloca + { + typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; + typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype; +- typedef AArch64_relocate_functions aarch64_reloc_funcs; ++ typedef AArch64_relocate_functions aarch64_reloc_funcs; + + AArch64_address value = psymval->value(relinfo->object, 0); + Output_segment* tls_segment = relinfo->layout->tls_segment(); +@@ -3888,9 +5972,9 @@ Target_aarch64::Reloca + + template + inline +-typename AArch64_relocate_functions::Status ++typename AArch64_relocate_functions::Status + Target_aarch64::Relocate::tls_desc_gd_to_le( +- const Relocate_info* relinfo, ++ const Relocate_info* relinfo, + Target_aarch64* target, + const elfcpp::Rela& rela, + unsigned int r_type, +@@ -3899,7 +5983,7 @@ Target_aarch64::Reloca + { + typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; + typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype; +- typedef AArch64_relocate_functions aarch64_reloc_funcs; ++ typedef AArch64_relocate_functions aarch64_reloc_funcs; + + // TLSDESC-GD sequence is like: + // adrp x0, :tlsdesc:v1 +@@ -3961,9 +6045,9 @@ Target_aarch64::Reloca + + template + inline +-typename AArch64_relocate_functions::Status ++typename AArch64_relocate_functions::Status + Target_aarch64::Relocate::tls_desc_gd_to_ie( +- const Relocate_info* /* relinfo */, ++ const Relocate_info* /* relinfo */, + Target_aarch64* /* target */, + const elfcpp::Rela& rela, + unsigned int r_type, +@@ -3973,7 +6057,7 @@ Target_aarch64::Reloca + typename elfcpp::Elf_types::Elf_Addr address) + { + typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype; +- typedef AArch64_relocate_functions aarch64_reloc_funcs; ++ typedef AArch64_relocate_functions aarch64_reloc_funcs; + + // TLSDESC-GD sequence is like: + // adrp x0, :tlsdesc:v1 +@@ -4143,6 +6227,7 @@ Target_aarch64::reloca + reloc_view_size); + } + ++ + // The selector for aarch64 object files. + + template --- binutils-2.25.orig/debian/patches/aarch64-gold-updates2.diff +++ binutils-2.25/debian/patches/aarch64-gold-updates2.diff @@ -0,0 +1,1285 @@ +# DP: gold: Misc updates for the aarch64 backend + +Index: b/gold/ChangeLog +=================================================================== +--- a/gold/ChangeLog ++++ b/gold/ChangeLog +@@ -59,6 +59,66 @@ + + * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters. + ++2014-10-29 Han Shen ++ Jing Yu ++ ++ * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21, ++ TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, ++ TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to ++ Symbol::TLS_REF. ++ * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New ++ method. ++ (Target_aarch64::reloc_needs_plt_for_ifunc): New method. ++ (Target_aarch64::tls_ld_to_le): New method. ++ (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections ++ for 64bit targets. ++ (Output_data_plt_aarch64::irelative_rel_): New data member. ++ (Output_data_plt_aarch64::add_entry): Add irelative entries to plt. ++ (Output_data_plt_aarch64::add_local_ifunc_entry): New method. ++ (Output_data_plt_aarch64::add_relocation): New method. ++ (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative ++ offset. Add got_irelative size to got size. ++ (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long ++ type string with the new typename. ++ (AArch64_relocate_functions::update_adr): Replace parameter x with ++ immed. ++ (AArch64_relocate_functions::update_movnz): Correct wrong val mask. ++ (AArch64_relocate_functions::reloc_common): New method. ++ (AArch64_relocate_funcsions::rela_general): Extract common part out ++ into reloc_common method. ++ (AArch64_relocate_functions::rela_general): Likewise. ++ (AArch64_relocate_functions::pcrela_general): Likewise. ++ (AArch64_relocate_functions::adr): New method. ++ (AArch64_relocate_functions::adrp): Calculate immed before calling ++ update_adr. ++ (AArch64_relocate_functions::adrp): Likewise. ++ (AArch64_relocate_functions::movnz): Cast x to SignedW type when ++ comparing x to 0. Calculate immed from ~x when x < 0. ++ (Target_aarch64::optimize_tls_reloc): Add new cases for ++ TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, ++ TLSLD_MOVW_DTPREL_G0_NC. ++ (Target_aarch64::possible_function_pointer_reloc): Implement this ++ method. ++ (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update ++ comment. ++ (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC ++ symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, ++ TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. ++ (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC ++ symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, ++ TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. ++ (Target_aarch64::make_plt_entry): Call add_entry with two more ++ parameters. ++ (Target_aarch64::make_local_ifunc_plt_entry): New method. ++ (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19, ++ ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, ++ TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. ++ (Target_aarch64::Relocate::relocate_tls): Add cases for ++ TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, ++ TLSLD_MOVW_DTPREL_G0_NC. ++ * testsuite/icf_safe_so_test.cc: Correct test comment. ++ * testsuite/icf_safe_test.sh: Add AArch64 arch. ++ + 2014-10-28 Alan Modra + + Apply trunk patches +Index: b/gold/aarch64-reloc.def +=================================================================== +--- a/gold/aarch64-reloc.def ++++ b/gold/aarch64-reloc.def +@@ -40,16 +40,22 @@ ARD(PREL32 , STATI + ARD(PREL16 , STATIC , DATA , Y, -1, 15,16 , 0,0 , Symbol::RELATIVE_REF , DATA ) + // Above is from Table 4-6, Data relocations, 257-262. + ++ARD(LD_PREL_LO19 , STATIC , AARCH64 , Y, -1, 20,20 , 2,20 , Symbol::RELATIVE_REF , LDST ) ++ARD(ADR_PREL_LO21 , STATIC , AARCH64 , Y, -1, 20,20 , 0,20 , Symbol::RELATIVE_REF , ADR ) + ARD(ADR_PREL_PG_HI21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) + ARD(ADR_PREL_PG_HI21_NC , STATIC , AARCH64 , Y, -1, 0,0 , 12,32 , Symbol::RELATIVE_REF , ADRP ) ++ARD(ADD_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) + ARD(LDST8_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , LDST ) + ARD(LDST16_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN2 , 1,11 , Symbol::ABSOLUTE_REF , LDST ) + ARD(LDST32_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN4 , 2,11 , Symbol::ABSOLUTE_REF , LDST ) + ARD(LDST64_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) + ARD(LDST128_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN16 , 4,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(ADD_ABS_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) ++// Above 10 relocs are from Table 4-9, Relocations to generate 19, 21 and 33 bit PC-relative addresses. ++ + ARD(ADR_GOT_PAGE , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) + ARD(LD64_GOT_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) ++// Above 2 relocs are from Table 4-14, GOT-relative instruction relocations. (Some relocs in the table are not implemented yet.) ++ + ARD(TSTBR14 , STATIC , CFLOW , N, -1, 15,15 , 2,15 , (Symbol::FUNCTION_CALL|Symbol::ABSOLUTE_REF) , TBZNZ ) + ARD(CONDBR19 , STATIC , CFLOW , N, -1, 20,20 , 2,20 , (Symbol::FUNCTION_CALL|Symbol::ABSOLUTE_REF) , CONDB ) + ARD(CALL26 , STATIC , CFLOW , Y, -1, 27,27 , 2,27 , (Symbol::FUNCTION_CALL|Symbol::RELATIVE_REF) , CALL ) +@@ -57,24 +63,32 @@ ARD(JUMP26 , STATI + // Above is from Table 4-10, Relocations for control-flow instructions, + // 279-283. + +-ARD(TLSGD_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::ABSOLUTE_REF , ADRP ) +-ARD(TLSGD_ADD_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(TLSIE_MOVW_GOTTPREL_G1 , STATIC , AARCH64 , N, -1, 0,0 , 16,31 , Symbol::ABSOLUTE_REF , MOVW ) +-ARD(TLSIE_MOVW_GOTTPREL_G0_NC , STATIC , AARCH64 , N, -1, 0,0 , 0,15 , Symbol::ABSOLUTE_REF , MOVW ) +-ARD(TLSIE_ADR_GOTTPREL_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::ABSOLUTE_REF , ADRP ) +-ARD(TLSIE_LD64_GOTTPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(TLSIE_LD_GOTTPREL_PREL19 , STATIC , AARCH64 , N, -1, 20,20 , 2,20 , Symbol::ABSOLUTE_REF , LD ) ++ARD(TLSGD_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::TLS_REF , ADRP ) ++ARD(TLSGD_ADD_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::TLS_REF , ADD ) ++// Above is from Table 4-15, General Dynamic TLS relocations, 512-516. ++ ++ARD(TLSLD_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::TLS_REF , ADRP ) ++ARD(TLSLD_ADD_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::TLS_REF , ADD ) ++ARD(TLSLD_MOVW_DTPREL_G1 , STATIC , AARCH64 , Y, 1, 32,32 , 16,31 , Symbol::TLS_REF , ADRP ) ++ARD(TLSLD_MOVW_DTPREL_G0_NC , STATIC , AARCH64 , Y, 0, 0,0 , 0,15 , Symbol::TLS_REF , MOVW ) ++// Above is from Table 4-16, Local Dynamic TLS relocations, 517-573. ++ ++ARD(TLSIE_MOVW_GOTTPREL_G1 , STATIC , AARCH64 , N, -1, 32,32 , 16,31 , Symbol::TLS_REF , MOVW ) ++ARD(TLSIE_MOVW_GOTTPREL_G0_NC , STATIC , AARCH64 , N, -1, 0,0 , 0,15 , Symbol::TLS_REF , MOVW ) ++ARD(TLSIE_ADR_GOTTPREL_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::TLS_REF , ADRP ) ++ARD(TLSIE_LD64_GOTTPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::TLS_REF , LDST ) ++ARD(TLSIE_LD_GOTTPREL_PREL19 , STATIC , AARCH64 , N, -1, 20,20 , 2,20 , Symbol::TLS_REF , LD ) + // Above is from Table 4-17, Initial Exec TLS relocations, 539-543. + +-ARD(TLSLE_ADD_TPREL_HI12 , STATIC , AARCH64 , Y, -1, 0,24 , 12,23 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(TLSLE_ADD_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(TLSLE_ADD_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) ++ARD(TLSLE_ADD_TPREL_HI12 , STATIC , AARCH64 , Y, -1, 0,24 , 12,23 , Symbol::TLS_REF , ADD ) ++ARD(TLSLE_ADD_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 0,11 , Symbol::TLS_REF , ADD ) ++ARD(TLSLE_ADD_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::TLS_REF , ADD ) + // Above is from Table 4-18, Local Exec TLS relocations, 544-571. + +-ARD(TLSDESC_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::RELATIVE_REF , ADRP ) +-ARD(TLSDESC_LD64_LO12 , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::ABSOLUTE_REF , LDST ) +-ARD(TLSDESC_ADD_LO12 , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::ABSOLUTE_REF , ADD ) +-ARD(TLSDESC_CALL , STATIC , CFLOW , Y, -1, 0,0 , 0,0 , (Symbol::FUNCTION_CALL|Symbol::ABSOLUTE_REF) , CALL ) ++ARD(TLSDESC_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::TLS_REF , ADRP ) ++ARD(TLSDESC_LD64_LO12 , STATIC , AARCH64 , Y, -1, 0,RL_CHECK_ALIGN8 , 3,11 , Symbol::TLS_REF , LDST ) ++ARD(TLSDESC_ADD_LO12 , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::TLS_REF , ADD ) ++ARD(TLSDESC_CALL , STATIC , CFLOW , Y, -1, 0,0 , 0,0 , Symbol::TLS_REF , CALL ) + // Above is from Table 4-19, TLS descriptor relocations, 560-569. + + // Note - +Index: b/gold/aarch64.cc +=================================================================== +--- a/gold/aarch64.cc ++++ b/gold/aarch64.cc +@@ -525,7 +525,7 @@ class Reloc_stub + { return k1.eq(k2); } + }; + +- private: ++ private: + // Stub type. + const Stub_type stub_type_; + // If this is a local symbol, this is the index in the defining object. +@@ -645,7 +645,7 @@ Reloc_stub::stub_type_ + branch_offset = dest - location; + break; + default: +- gold_assert(false); ++ gold_unreachable(); + } + + if (aarch64_valid_branch_offset_p(branch_offset)) +@@ -1762,6 +1762,15 @@ class Target_aarch64 : public Sized_targ + do_plt_address_for_local(const Relobj* relobj, unsigned int symndx) const + { return this->plt_section()->address_for_local(relobj, symndx); } + ++ // This function should be defined in targets that can use relocation ++ // types to determine (implemented in local_reloc_may_be_function_pointer ++ // and global_reloc_may_be_function_pointer) ++ // if a function's pointer is taken. ICF uses this in safe mode to only ++ // fold those functions whose pointer is defintely not taken. ++ bool ++ do_can_check_for_function_pointers() const ++ { return true; } ++ + // Return the number of entries in the PLT. + unsigned int + plt_entry_count() const; +@@ -1959,6 +1968,10 @@ class Target_aarch64 : public Sized_targ + void + check_non_pic(Relobj*, unsigned int r_type); + ++ bool ++ reloc_needs_plt_for_ifunc(Sized_relobj_file*, ++ unsigned int r_type); ++ + // Whether we have issued an error about a non-PIC compilation. + bool issued_non_pic_error_; + }; +@@ -2006,6 +2019,15 @@ class Target_aarch64 : public Sized_targ + const Symbol_value*); + + inline typename AArch64_relocate_functions::Status ++ tls_ld_to_le( ++ const Relocate_info*, ++ Target_aarch64*, ++ const elfcpp::Rela&, ++ unsigned int, ++ unsigned char*, ++ const Symbol_value*); ++ ++ inline typename AArch64_relocate_functions::Status + tls_ie_to_le( + const Relocate_info*, + Target_aarch64*, +@@ -2206,7 +2228,7 @@ const Target::Target_info Target_aarch64 + false, // has_resolve + false, // has_code_fill + true, // is_default_stack_executable +- false, // can_icf_inline_merge_sections ++ true, // can_icf_inline_merge_sections + '\0', // wrap_char + "/lib/ld.so.1", // program interpreter + 0x400000, // default_text_segment_address +@@ -2260,7 +2282,7 @@ const Target::Target_info Target_aarch64 + false, // has_resolve + false, // has_code_fill + true, // is_default_stack_executable +- false, // can_icf_inline_merge_sections ++ true, // can_icf_inline_merge_sections + '\0', // wrap_char + "/lib/ld.so.1", // program interpreter + 0x400000, // default_text_segment_address +@@ -2530,7 +2552,7 @@ Target_aarch64::scan_r + destination = value + addend; + break; + default: +- gold_assert(false); ++ gold_unreachable(); + } + + typename The_reloc_stub::Stub_type stub_type = The_reloc_stub:: +@@ -2838,7 +2860,7 @@ relocate_stub(The_reloc_stub* stub, + break; + + default: +- gold_assert(false); ++ gold_unreachable(); + } + } + +@@ -2861,7 +2883,7 @@ class Output_data_plt_aarch64 : public O + Output_data_got_aarch64* got, + Output_data_space* got_plt, + Output_data_space* got_irelative) +- : Output_section_data(addralign), tlsdesc_rel_(NULL), ++ : Output_section_data(addralign), tlsdesc_rel_(NULL), irelative_rel_(NULL), + got_(got), got_plt_(got_plt), got_irelative_(got_irelative), + count_(0), irelative_count_(0), tlsdesc_got_offset_(-1U) + { this->init(layout); } +@@ -2872,7 +2894,18 @@ class Output_data_plt_aarch64 : public O + + // Add an entry to the PLT. + void +- add_entry(Symbol* gsym); ++ add_entry(Symbol_table*, Layout*, Symbol* gsym); ++ ++ // Add an entry to the PLT for a local STT_GNU_IFUNC symbol. ++ unsigned int ++ add_local_ifunc_entry(Symbol_table* symtab, Layout*, ++ Sized_relobj_file* relobj, ++ unsigned int local_sym_index); ++ ++ // Add the relocation for a PLT entry. ++ void ++ add_relocation(Symbol_table*, Layout*, Symbol* gsym, ++ unsigned int got_offset); + + // Add the reserved TLSDESC_PLT entry to the PLT. + void +@@ -3081,32 +3114,100 @@ Output_data_plt_aarch64 + void +-Output_data_plt_aarch64::add_entry(Symbol* gsym) ++Output_data_plt_aarch64::add_entry(Symbol_table* symtab, ++ Layout* layout, Symbol* gsym) + { + gold_assert(!gsym->has_plt_offset()); + +- gsym->set_plt_offset((this->count_) * this->get_plt_entry_size() +- + this->first_plt_entry_offset()); ++ unsigned int* pcount; ++ unsigned int plt_reserved; ++ Output_section_data_build* got; + +- ++this->count_; ++ if (gsym->type() == elfcpp::STT_GNU_IFUNC ++ && gsym->can_use_relative_reloc(false)) ++ { ++ pcount = &this->irelative_count_; ++ plt_reserved = 0; ++ got = this->got_irelative_; ++ } ++ else ++ { ++ pcount = &this->count_; ++ plt_reserved = this->first_plt_entry_offset(); ++ got = this->got_plt_; ++ } ++ ++ gsym->set_plt_offset((*pcount) * this->get_plt_entry_size() ++ + plt_reserved); ++ ++ ++*pcount; + +- section_offset_type got_offset = this->got_plt_->current_data_size(); ++ section_offset_type got_offset = got->current_data_size(); + + // Every PLT entry needs a GOT entry which points back to the PLT + // entry (this will be changed by the dynamic linker, normally + // lazily when the function is called). +- this->got_plt_->set_current_data_size(got_offset + size / 8); ++ got->set_current_data_size(got_offset + size / 8); + + // Every PLT entry needs a reloc. +- gsym->set_needs_dynsym_entry(); +- this->rel_->add_global(gsym, elfcpp::R_AARCH64_JUMP_SLOT, +- this->got_plt_, got_offset, 0); ++ this->add_relocation(symtab, layout, gsym, got_offset); + + // Note that we don't need to save the symbol. The contents of the + // PLT are independent of which symbols are used. The symbols only + // appear in the relocations. + } + ++// Add an entry to the PLT for a local STT_GNU_IFUNC symbol. Return ++// the PLT offset. ++ ++template ++unsigned int ++Output_data_plt_aarch64::add_local_ifunc_entry( ++ Symbol_table* symtab, ++ Layout* layout, ++ Sized_relobj_file* relobj, ++ unsigned int local_sym_index) ++{ ++ unsigned int plt_offset = this->irelative_count_ * this->get_plt_entry_size(); ++ ++this->irelative_count_; ++ ++ section_offset_type got_offset = this->got_irelative_->current_data_size(); ++ ++ // Every PLT entry needs a GOT entry which points back to the PLT ++ // entry. ++ this->got_irelative_->set_current_data_size(got_offset + size / 8); ++ ++ // Every PLT entry needs a reloc. ++ Reloc_section* rela = this->rela_irelative(symtab, layout); ++ rela->add_symbolless_local_addend(relobj, local_sym_index, ++ elfcpp::R_AARCH64_IRELATIVE, ++ this->got_irelative_, got_offset, 0); ++ ++ return plt_offset; ++} ++ ++// Add the relocation for a PLT entry. ++ ++template ++void ++Output_data_plt_aarch64::add_relocation( ++ Symbol_table* symtab, Layout* layout, Symbol* gsym, unsigned int got_offset) ++{ ++ if (gsym->type() == elfcpp::STT_GNU_IFUNC ++ && gsym->can_use_relative_reloc(false)) ++ { ++ Reloc_section* rela = this->rela_irelative(symtab, layout); ++ rela->add_symbolless_global_addend(gsym, elfcpp::R_AARCH64_IRELATIVE, ++ this->got_irelative_, got_offset, 0); ++ } ++ else ++ { ++ gsym->set_needs_dynsym_entry(); ++ this->rel_->add_global(gsym, elfcpp::R_AARCH64_JUMP_SLOT, this->got_plt_, ++ got_offset, 0); ++ } ++} ++ + // Return where the TLSDESC relocations should go, creating it if + // necessary. These follow the JUMP_SLOT relocations. + +@@ -3588,8 +3689,12 @@ Output_data_plt_aarch64get_output_view(offset, oview_size); + + const off_t got_file_offset = this->got_plt_->offset(); ++ gold_assert(got_file_offset + this->got_plt_->data_size() ++ == this->got_irelative_->offset()); ++ + const section_size_type got_size = +- convert_to_section_size_type(this->got_plt_->data_size()); ++ convert_to_section_size_type(this->got_plt_->data_size() ++ + this->got_irelative_->data_size()); + unsigned char* const got_view = of->get_output_view(got_file_offset, + got_size); + +@@ -3697,11 +3802,12 @@ class AArch64_relocate_functions + typedef typename The_reloc_stub::Stub_type The_reloc_stub_type; + typedef Stub_table The_stub_table; + typedef elfcpp::Rela The_rela; ++ typedef typename elfcpp::Swap::Valtype AArch64_valtype; + + // Return the page address of the address. + // Page(address) = address & ~0xFFF + +- static inline typename elfcpp::Swap::Valtype ++ static inline AArch64_valtype + Page(Address address) + { + return (address & (~static_cast
(0xFFF))); +@@ -3714,7 +3820,7 @@ class AArch64_relocate_functions + template + static inline void + update_view(unsigned char* view, +- typename elfcpp::Swap::Valtype immed, ++ AArch64_valtype immed, + elfcpp::Elf_Xword doffset, + elfcpp::Elf_Xword dst_mask) + { +@@ -3736,8 +3842,8 @@ class AArch64_relocate_functions + static inline void + update_view_two_parts( + unsigned char* view, +- typename elfcpp::Swap::Valtype immed1, +- typename elfcpp::Swap::Valtype immed2, ++ AArch64_valtype immed1, ++ AArch64_valtype immed2, + elfcpp::Elf_Xword doffset1, + elfcpp::Elf_Xword doffset2, + elfcpp::Elf_Xword dst_mask) +@@ -3751,17 +3857,13 @@ class AArch64_relocate_functions + (immed2 << doffset2))); + } + +- // Update adr or adrp instruction with [32:12] of X. ++ // Update adr or adrp instruction with immed. + // In adr and adrp: [30:29] immlo [23:5] immhi + + static inline void +- update_adr(unsigned char* view, +- typename elfcpp::Swap::Valtype x, +- const AArch64_reloc_property* /* reloc_property */) ++ update_adr(unsigned char* view, AArch64_valtype immed) + { + elfcpp::Elf_Xword dst_mask = (0x3 << 29) | (0x7ffff << 5); +- typename elfcpp::Swap<32, big_endian>::Valtype immed = +- (x >> 12) & 0x1fffff; + This::template update_view_two_parts<32>( + view, + immed & 0x3, +@@ -3774,9 +3876,10 @@ class AArch64_relocate_functions + // Update movz/movn instruction with bits immed. + // Set instruction to movz if is_movz is true, otherwise set instruction + // to movn. ++ + static inline void + update_movnz(unsigned char* view, +- typename elfcpp::Swap::Valtype immed, ++ AArch64_valtype immed, + bool is_movz) + { + typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype; +@@ -3789,17 +3892,44 @@ class AArch64_relocate_functions + aarch64_howto[AArch64_reloc_property::INST_MOVW].dst_mask; + + // Clear immediate fields and opc code. +- val &= ~(dst_mask | (0x11 << 29)); ++ val &= ~(dst_mask | (0x3 << 29)); + + // Set instruction to movz or movn. + // movz: [30:29] is 10 movn: [30:29] is 00 + if (is_movz) +- val |= (0x10 << 29); ++ val |= (0x2 << 29); + + elfcpp::Swap<32, big_endian>::writeval(wv, + static_cast(val | (immed << doffset))); + } + ++ // Update selected bits in text. ++ ++ template ++ static inline typename This::Status ++ reloc_common(unsigned char* view, Address x, ++ const AArch64_reloc_property* reloc_property) ++ { ++ // Select bits from X. ++ Address immed = reloc_property->select_x_value(x); ++ ++ // Update view. ++ const AArch64_reloc_property::Reloc_inst inst = ++ reloc_property->reloc_inst(); ++ // If it is a data relocation or instruction has 2 parts of immediate ++ // fields, you should not call pcrela_general. ++ gold_assert(aarch64_howto[inst].doffset2 == -1 && ++ aarch64_howto[inst].doffset != -1); ++ This::template update_view(view, immed, ++ aarch64_howto[inst].doffset, ++ aarch64_howto[inst].dst_mask); ++ ++ // Do check overflow or alignment if needed. ++ return (reloc_property->checkup_x_value(x) ++ ? This::STATUS_OKAY ++ : This::STATUS_OVERFLOW); ++ } ++ + public: + + // Do a simple rela relocation at unaligned addresses. +@@ -3809,7 +3939,7 @@ class AArch64_relocate_functions + rela_ua(unsigned char* view, + const Sized_relobj_file* object, + const Symbol_value* psymval, +- typename elfcpp::Swap::Valtype addend, ++ AArch64_valtype addend, + const AArch64_reloc_property* reloc_property) + { + typedef typename elfcpp::Swap_unaligned::Valtype +@@ -3830,7 +3960,7 @@ class AArch64_relocate_functions + pcrela_ua(unsigned char* view, + const Sized_relobj_file* object, + const Symbol_value* psymval, +- typename elfcpp::Swap::Valtype addend, ++ AArch64_valtype addend, + Address address, + const AArch64_reloc_property* reloc_property) + { +@@ -3852,15 +3982,13 @@ class AArch64_relocate_functions + unsigned char* view, + const Sized_relobj_file* object, + const Symbol_value* psymval, +- typename elfcpp::Swap::Valtype addend, ++ AArch64_valtype addend, + const AArch64_reloc_property* reloc_property) + { +- typedef typename elfcpp::Swap::Valtype +- Valtype; ++ typedef typename elfcpp::Swap::Valtype Valtype; + Valtype* wv = reinterpret_cast(view); + Address x = psymval->value(object, addend); +- elfcpp::Swap::writeval(wv, +- static_cast(x)); ++ elfcpp::Swap::writeval(wv,static_cast(x)); + return (reloc_property->checkup_x_value(x) + ? This::STATUS_OKAY + : This::STATUS_OVERFLOW); +@@ -3874,30 +4002,12 @@ class AArch64_relocate_functions + rela_general(unsigned char* view, + const Sized_relobj_file* object, + const Symbol_value* psymval, +- typename elfcpp::Swap::Valtype addend, ++ AArch64_valtype addend, + const AArch64_reloc_property* reloc_property) + { + // Calculate relocation. + Address x = psymval->value(object, addend); +- +- // Select bits from X. +- Address immed = reloc_property->select_x_value(x); +- +- // Update view. +- const AArch64_reloc_property::Reloc_inst inst = +- reloc_property->reloc_inst(); +- // If it is a data relocation or instruction has 2 parts of immediate +- // fields, you should not call rela_general. +- gold_assert(aarch64_howto[inst].doffset2 == -1 && +- aarch64_howto[inst].doffset != -1); +- This::template update_view(view, immed, +- aarch64_howto[inst].doffset, +- aarch64_howto[inst].dst_mask); +- +- // Do check overflow or alignment if needed. +- return (reloc_property->checkup_x_value(x) +- ? This::STATUS_OKAY +- : This::STATUS_OVERFLOW); ++ return This::template reloc_common(view, x, reloc_property); + } + + // Do relocate. Update selected bits in text. +@@ -3907,31 +4017,13 @@ class AArch64_relocate_functions + static inline typename This::Status + rela_general( + unsigned char* view, +- typename elfcpp::Swap::Valtype s, +- typename elfcpp::Swap::Valtype addend, ++ AArch64_valtype s, ++ AArch64_valtype addend, + const AArch64_reloc_property* reloc_property) + { + // Calculate relocation. + Address x = s + addend; +- +- // Select bits from X. +- Address immed = reloc_property->select_x_value(x); +- +- // Update view. +- const AArch64_reloc_property::Reloc_inst inst = +- reloc_property->reloc_inst(); +- // If it is a data relocation or instruction has 2 parts of immediate +- // fields, you should not call rela_general. +- gold_assert(aarch64_howto[inst].doffset2 == -1 && +- aarch64_howto[inst].doffset != -1); +- This::template update_view(view, immed, +- aarch64_howto[inst].doffset, +- aarch64_howto[inst].dst_mask); +- +- // Do check overflow or alignment if needed. +- return (reloc_property->checkup_x_value(x) +- ? This::STATUS_OKAY +- : This::STATUS_OVERFLOW); ++ return This::template reloc_common(view, x, reloc_property); + } + + // Do address relative relocate. Update selected bits in text. +@@ -3943,31 +4035,34 @@ class AArch64_relocate_functions + unsigned char* view, + const Sized_relobj_file* object, + const Symbol_value* psymval, +- typename elfcpp::Swap::Valtype addend, ++ AArch64_valtype addend, + Address address, + const AArch64_reloc_property* reloc_property) + { + // Calculate relocation. + Address x = psymval->value(object, addend) - address; ++ return This::template reloc_common(view, x, reloc_property); ++ } + +- // Select bits from X. +- Address immed = reloc_property->select_x_value(x); + +- // Update view. +- const AArch64_reloc_property::Reloc_inst inst = +- reloc_property->reloc_inst(); +- // If it is a data relocation or instruction has 2 parts of immediate +- // fields, you should not call pcrela_general. +- gold_assert(aarch64_howto[inst].doffset2 == -1 && +- aarch64_howto[inst].doffset != -1); +- This::template update_view(view, immed, +- aarch64_howto[inst].doffset, +- aarch64_howto[inst].dst_mask); ++ // Calculate (S + A) - address, update adr instruction. + +- // Do check overflow or alignment if needed. +- return (reloc_property->checkup_x_value(x) +- ? This::STATUS_OKAY +- : This::STATUS_OVERFLOW); ++ static inline typename This::Status ++ adr(unsigned char* view, ++ const Sized_relobj_file* object, ++ const Symbol_value* psymval, ++ Address addend, ++ Address address, ++ const AArch64_reloc_property* /* reloc_property */) ++ { ++ AArch64_valtype x = psymval->value(object, addend) - address; ++ // Pick bits [20:0] of X. ++ AArch64_valtype immed = x & 0x1fffff; ++ update_adr(view, immed); ++ // Check -2^20 <= X < 2^20 ++ return (size == 64 && Bits<21>::has_overflow((x)) ++ ? This::STATUS_OVERFLOW ++ : This::STATUS_OKAY); + } + + // Calculate PG(S+A) - PG(address), update adrp instruction. +@@ -3979,9 +4074,10 @@ class AArch64_relocate_functions + Address sa, + Address address) + { +- typename elfcpp::Swap::Valtype x = +- This::Page(sa) - This::Page(address); +- update_adr(view, x, NULL); ++ AArch64_valtype x = This::Page(sa) - This::Page(address); ++ // Pick [32:12] of X. ++ AArch64_valtype immed = (x >> 12) & 0x1fffff; ++ update_adr(view, immed); + // Check -2^32 <= X < 2^32 + return (size == 64 && Bits<33>::has_overflow((x)) + ? This::STATUS_OVERFLOW +@@ -4000,9 +4096,10 @@ class AArch64_relocate_functions + const AArch64_reloc_property* reloc_property) + { + Address sa = psymval->value(object, addend); +- typename elfcpp::Swap::Valtype x = +- This::Page(sa) - This::Page(address); +- update_adr(view, x, reloc_property); ++ AArch64_valtype x = This::Page(sa) - This::Page(address); ++ // Pick [32:12] of X. ++ AArch64_valtype immed = (x >> 12) & 0x1fffff; ++ update_adr(view, immed); + return (reloc_property->checkup_x_value(x) + ? This::STATUS_OKAY + : This::STATUS_OVERFLOW); +@@ -4016,15 +4113,21 @@ class AArch64_relocate_functions + + static inline typename This::Status + movnz(unsigned char* view, +- typename elfcpp::Swap::Valtype x, ++ AArch64_valtype x, + const AArch64_reloc_property* reloc_property) + { + // Select bits from X. +- Address immed = reloc_property->select_x_value(x); +- bool is_movz = true; +- if (static_cast(x) < 0) ++ Address immed; ++ bool is_movz; ++ typedef typename elfcpp::Elf_types::Elf_Swxword SignedW; ++ if (static_cast(x) >= 0) ++ { ++ immed = reloc_property->select_x_value(x); ++ is_movz = true; ++ } ++ else + { +- immed = ~immed; ++ immed = reloc_property->select_x_value(~x);; + is_movz = false; + } + +@@ -4433,6 +4536,15 @@ Target_aarch64::optimi + return tls::TLSOPT_TO_LE; + return tls::TLSOPT_TO_IE; + ++ case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21: ++ case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: ++ // These are Local-Dynamic, which refer to local symbols in the ++ // dynamic TLS block. Since we know that we generating an ++ // executable, we can switch to Local-Exec. ++ return tls::TLSOPT_TO_LE; ++ + case elfcpp::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1: + case elfcpp::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC: + case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: +@@ -4472,8 +4584,11 @@ Target_aarch64::Scan:: + { + switch (r_type) + { +- case elfcpp::R_AARCH64_ABS64: +- //TODO ++ case elfcpp::R_AARCH64_ADR_PREL_PG_HI21: ++ case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC: ++ case elfcpp::R_AARCH64_ADD_ABS_LO12_NC: ++ case elfcpp::R_AARCH64_ADR_GOT_PAGE: ++ case elfcpp::R_AARCH64_LD64_GOT_LO12_NC: + { + return true; + } +@@ -4498,9 +4613,7 @@ Target_aarch64::Scan:: + unsigned int r_type, + const elfcpp::Sym&) + { +- // When building a shared library, do not fold any local symbols as it is +- // not possible to distinguish pointer taken versus a call by looking at +- // the relocation types. ++ // When building a shared library, do not fold any local symbols. + return (parameters->options().shared() + || possible_function_pointer_reloc(r_type)); + } +@@ -4586,6 +4699,29 @@ Target_aarch64::Scan:: + return; + } + ++// Return whether we need to make a PLT entry for a relocation of the ++// given type against a STT_GNU_IFUNC symbol. ++ ++template ++bool ++Target_aarch64::Scan::reloc_needs_plt_for_ifunc( ++ Sized_relobj_file* object, ++ unsigned int r_type) ++{ ++ const AArch64_reloc_property* arp = ++ aarch64_reloc_property_table->get_reloc_property(r_type); ++ gold_assert(arp != NULL); ++ ++ int flags = arp->reference_flags(); ++ if (flags & Symbol::TLS_REF) ++ { ++ gold_error(_("%s: unsupported TLS reloc %s for IFUNC symbol"), ++ object->name().c_str(), arp->name().c_str()); ++ return false; ++ } ++ return flags != 0; ++} ++ + // Scan a relocation for a local symbol. + + template +@@ -4599,7 +4735,7 @@ Target_aarch64::Scan:: + Output_section* output_section, + const elfcpp::Rela& rela, + unsigned int r_type, +- const elfcpp::Sym& /* lsym */, ++ const elfcpp::Sym& lsym, + bool is_discarded) + { + if (is_discarded) +@@ -4611,6 +4747,11 @@ Target_aarch64::Scan:: + target->got_section(symtab, layout); + unsigned int r_sym = elfcpp::elf_r_sym(rela.get_r_info()); + ++ // A local STT_GNU_IFUNC symbol may require a PLT entry. ++ bool is_ifunc = lsym.get_st_type() == elfcpp::STT_GNU_IFUNC; ++ if (is_ifunc && this->reloc_needs_plt_for_ifunc(object, r_type)) ++ target->make_local_ifunc_plt_entry(symtab, layout, object, r_sym); ++ + switch (r_type) + { + case elfcpp::R_AARCH64_ABS32: +@@ -4634,7 +4775,7 @@ Target_aarch64::Scan:: + data_shndx, + rela.get_r_offset(), + rela.get_r_addend(), +- false /* is ifunc */); ++ is_ifunc); + } + break; + +@@ -4725,6 +4866,25 @@ Target_aarch64::Scan:: + } + break; + ++ case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21: ++ case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: ++ { ++ tls::Tls_optimization tlsopt = Target_aarch64:: ++ optimize_tls_reloc(!parameters->options().shared(), r_type); ++ if (tlsopt == tls::TLSOPT_NONE) ++ { ++ // Create a GOT entry for the module index. ++ target->got_mod_index_entry(symtab, layout, object); ++ } ++ else if (tlsopt != tls::TLSOPT_TO_LE) ++ unsupported_reloc_local(object, r_type); ++ } ++ break; ++ ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: ++ break; ++ + case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21: + case elfcpp::R_AARCH64_TLSDESC_LD64_LO12: + case elfcpp::R_AARCH64_TLSDESC_ADD_LO12: +@@ -4801,6 +4961,11 @@ Target_aarch64::Scan:: + unsigned int r_type, + Symbol* gsym) + { ++ // A STT_GNU_IFUNC symbol may require a PLT entry. ++ if (gsym->type() == elfcpp::STT_GNU_IFUNC ++ && this->reloc_needs_plt_for_ifunc(object, r_type)) ++ target->make_plt_entry(symtab, layout, gsym); ++ + typedef Output_data_reloc + Reloc_section; + const AArch64_reloc_property* arp = +@@ -4834,6 +4999,25 @@ Target_aarch64::Scan:: + data_shndx, output_section, gsym, rela); + } + else if (r_type == elfcpp::R_AARCH64_ABS64 ++ && gsym->type() == elfcpp::STT_GNU_IFUNC ++ && gsym->can_use_relative_reloc(false) ++ && !gsym->is_from_dynobj() ++ && !gsym->is_undefined() ++ && !gsym->is_preemptible()) ++ { ++ // Use an IRELATIVE reloc for a locally defined STT_GNU_IFUNC ++ // symbol. This makes a function address in a PIE executable ++ // match the address in a shared library that it links against. ++ Reloc_section* rela_dyn = ++ target->rela_irelative_section(layout); ++ unsigned int r_type = elfcpp::R_AARCH64_IRELATIVE; ++ rela_dyn->add_symbolless_global_addend(gsym, r_type, ++ output_section, object, ++ data_shndx, ++ rela.get_r_offset(), ++ rela.get_r_addend()); ++ } ++ else if (r_type == elfcpp::R_AARCH64_ABS64 + && gsym->can_use_relative_reloc(false)) + { + Reloc_section* rela_dyn = target->rela_dyn_section(layout); +@@ -4905,21 +5089,54 @@ Target_aarch64::Scan:: + target->got_section(symtab, layout); + if (gsym->final_value_is_known()) + { +- got->add_global(gsym, GOT_TYPE_STANDARD); ++ // For a STT_GNU_IFUNC symbol we want the PLT address. ++ if (gsym->type() == elfcpp::STT_GNU_IFUNC) ++ got->add_global_plt(gsym, GOT_TYPE_STANDARD); ++ else ++ got->add_global(gsym, GOT_TYPE_STANDARD); + } + else + { ++ // If this symbol is not fully resolved, we need to add a dynamic ++ // relocation for it. + Reloc_section* rela_dyn = target->rela_dyn_section(layout); ++ ++ // Use a GLOB_DAT rather than a RELATIVE reloc if: ++ // ++ // 1) The symbol may be defined in some other module. ++ // 2) We are building a shared library and this is a protected ++ // symbol; using GLOB_DAT means that the dynamic linker can use ++ // the address of the PLT in the main executable when appropriate ++ // so that function address comparisons work. ++ // 3) This is a STT_GNU_IFUNC symbol in position dependent code, ++ // again so that function address comparisons work. + if (gsym->is_from_dynobj() + || gsym->is_undefined() + || gsym->is_preemptible() + || (gsym->visibility() == elfcpp::STV_PROTECTED +- && parameters->options().shared())) ++ && parameters->options().shared()) ++ || (gsym->type() == elfcpp::STT_GNU_IFUNC ++ && parameters->options().output_is_position_independent())) + got->add_global_with_rel(gsym, GOT_TYPE_STANDARD, + rela_dyn, elfcpp::R_AARCH64_GLOB_DAT); + else + { +- if (got->add_global(gsym, GOT_TYPE_STANDARD)) ++ // For a STT_GNU_IFUNC symbol we want to write the PLT ++ // offset into the GOT, so that function pointer ++ // comparisons work correctly. ++ bool is_new; ++ if (gsym->type() != elfcpp::STT_GNU_IFUNC) ++ is_new = got->add_global(gsym, GOT_TYPE_STANDARD); ++ else ++ { ++ is_new = got->add_global_plt(gsym, GOT_TYPE_STANDARD); ++ // Tell the dynamic linker to use the PLT address ++ // when resolving relocations. ++ if (gsym->is_from_dynobj() ++ && !parameters->options().shared()) ++ gsym->set_needs_dynsym_value(); ++ } ++ if (is_new) + { + rela_dyn->add_global_relative( + gsym, elfcpp::R_AARCH64_RELATIVE, +@@ -4974,10 +5191,29 @@ Target_aarch64::Scan:: + } + break; + ++ case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21: ++ case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: // Local dynamic ++ { ++ tls::Tls_optimization tlsopt = Target_aarch64:: ++ optimize_tls_reloc(!parameters->options().shared(), r_type); ++ if (tlsopt == tls::TLSOPT_NONE) ++ { ++ // Create a GOT entry for the module index. ++ target->got_mod_index_entry(symtab, layout, object); ++ } ++ else if (tlsopt != tls::TLSOPT_TO_LE) ++ unsupported_reloc_local(object, r_type); ++ } ++ break; ++ ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: // Other local dynamic ++ break; ++ + case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: + case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: // Initial executable + { +- tls::Tls_optimization tlsopt =Target_aarch64:: ++ tls::Tls_optimization tlsopt = Target_aarch64:: + optimize_tls_reloc(gsym->final_value_is_known(), r_type); + if (tlsopt == tls::TLSOPT_TO_LE) + break; +@@ -5113,7 +5349,26 @@ Target_aarch64::make_p + if (this->plt_ == NULL) + this->make_plt_section(symtab, layout); + +- this->plt_->add_entry(gsym); ++ this->plt_->add_entry(symtab, layout, gsym); ++} ++ ++// Make a PLT entry for a local STT_GNU_IFUNC symbol. ++ ++template ++void ++Target_aarch64::make_local_ifunc_plt_entry( ++ Symbol_table* symtab, Layout* layout, ++ Sized_relobj_file* relobj, ++ unsigned int local_sym_index) ++{ ++ if (relobj->local_has_plt_offset(local_sym_index)) ++ return; ++ if (this->plt_ == NULL) ++ this->make_plt_section(symtab, layout); ++ unsigned int plt_offset = this->plt_->add_local_ifunc_entry(symtab, layout, ++ relobj, ++ local_sym_index); ++ relobj->set_local_plt_offset(local_sym_index, plt_offset); + } + + template +@@ -5441,6 +5696,16 @@ Target_aarch64::Reloca + view, object, psymval, addend, address, reloc_property); + break; + ++ case elfcpp::R_AARCH64_LD_PREL_LO19: ++ reloc_status = Reloc::template pcrela_general<32>( ++ view, object, psymval, addend, address, reloc_property); ++ break; ++ ++ case elfcpp::R_AARCH64_ADR_PREL_LO21: ++ reloc_status = Reloc::adr(view, object, psymval, addend, ++ address, reloc_property); ++ break; ++ + case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC: + case elfcpp::R_AARCH64_ADR_PREL_PG_HI21: + reloc_status = Reloc::adrp(view, object, psymval, addend, address, +@@ -5498,6 +5763,10 @@ Target_aarch64::Reloca + + case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21: + case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC: ++ case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21: ++ case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: + case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: + case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12: +@@ -5640,7 +5909,7 @@ Target_aarch64::Reloca + break; + + default: +- gold_assert(false); ++ gold_unreachable(); + } + } + gold_error_at_location(relinfo, relnum, rela.get_r_offset(), +@@ -5649,6 +5918,81 @@ Target_aarch64::Reloca + } + break; + ++ case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21: ++ case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: // Local-dynamic ++ { ++ if (tlsopt == tls::TLSOPT_TO_LE) ++ { ++ if (tls_segment == NULL) ++ { ++ gold_assert(parameters->errors()->error_count() > 0 ++ || issue_undefined_symbol_error(gsym)); ++ return aarch64_reloc_funcs::STATUS_BAD_RELOC; ++ } ++ return this->tls_ld_to_le(relinfo, target, rela, r_type, view, ++ psymval); ++ } ++ ++ gold_assert(tlsopt == tls::TLSOPT_NONE); ++ // Relocate the field with the offset of the GOT entry for ++ // the module index. ++ typename elfcpp::Elf_types::Elf_Addr got_entry_address; ++ got_entry_address = (target->got_mod_index_entry(NULL, NULL, NULL) + ++ target->got_->address()); ++ ++ switch (r_type) ++ { ++ case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21: ++ return aarch64_reloc_funcs::adrp( ++ view, got_entry_address + addend, address); ++ break; ++ ++ case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: ++ return aarch64_reloc_funcs::template rela_general<32>( ++ view, got_entry_address, addend, reloc_property); ++ break; ++ ++ default: ++ gold_unreachable(); ++ } ++ } ++ break; ++ ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1: ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: // Other local-dynamic ++ { ++ AArch64_address value = psymval->value(object, 0); ++ if (tlsopt == tls::TLSOPT_TO_LE) ++ { ++ if (tls_segment == NULL) ++ { ++ gold_assert(parameters->errors()->error_count() > 0 ++ || issue_undefined_symbol_error(gsym)); ++ return aarch64_reloc_funcs::STATUS_BAD_RELOC; ++ } ++ // If building executable, _TLS_MODULE_BASE_ points to segment ++ // end. Thus we must subtract it from value. ++ value -= tls_segment->memsz(); ++ } ++ switch (r_type) ++ { ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1: ++ return aarch64_reloc_funcs::movnz(view, value + addend, ++ reloc_property); ++ break; ++ ++ case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: ++ return aarch64_reloc_funcs::template rela_general<32>( ++ view, value, addend, reloc_property); ++ break; ++ ++ default: ++ gold_unreachable(); ++ } ++ // We should never reach here. ++ } ++ break; ++ + case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: + case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: // Initial-exec + { +@@ -5692,7 +6036,7 @@ Target_aarch64::Reloca + return aarch64_reloc_funcs::template rela_general<32>( + view, got_entry_address, addend, reloc_property); + default: +- gold_assert(false); ++ gold_unreachable(); + } + } + // We shall never reach here. +@@ -5918,6 +6262,106 @@ Target_aarch64::Reloca + template + inline + typename AArch64_relocate_functions::Status ++Target_aarch64::Relocate::tls_ld_to_le( ++ const Relocate_info* relinfo, ++ Target_aarch64* target, ++ const elfcpp::Rela& rela, ++ unsigned int r_type, ++ unsigned char* view, ++ const Symbol_value* psymval) ++{ ++ typedef AArch64_relocate_functions aarch64_reloc_funcs; ++ typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype; ++ typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; ++ ++ Insntype* ip = reinterpret_cast(view); ++ Insntype insn1 = elfcpp::Swap<32, big_endian>::readval(ip); ++ Insntype insn2 = elfcpp::Swap<32, big_endian>::readval(ip + 1); ++ Insntype insn3 = elfcpp::Swap<32, big_endian>::readval(ip + 2); ++ ++ if (r_type == elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC) ++ { ++ // This is the 2nd relocs, optimization should already have been ++ // done. ++ gold_assert((insn1 & 0xfff00000) == 0x91400000); ++ return aarch64_reloc_funcs::STATUS_OKAY; ++ } ++ ++ // The original sequence is - ++ // 90000000 adrp x0, 0
++ // 91000000 add x0, x0, #0x0 ++ // 94000000 bl 0 <__tls_get_addr> ++ // optimized to sequence - ++ // d53bd040 mrs x0, tpidr_el0 ++ // 91400000 add x0, x0, #0x0, lsl #12 ++ // 91000000 add x0, x0, #0x0 ++ ++ // Unlike tls_ie_to_le, we change the 3 insns in one function call when we ++ // encounter the first relocation "R_AARCH64_TLSLD_ADR_PAGE21". Because we ++ // have to change "bl tls_get_addr", which does not have a corresponding tls ++ // relocation type. So before proceeding, we need to make sure compiler ++ // does not change the sequence. ++ if(!(insn1 == 0x90000000 // adrp x0,0 ++ && insn2 == 0x91000000 // add x0, x0, #0x0 ++ && insn3 == 0x94000000)) // bl 0 ++ { ++ // Ideally we should give up gd_to_le relaxation and do gd access. ++ // However the gd_to_le relaxation decision has been made early ++ // in the scan stage, where we did not allocate any GOT entry for ++ // this symbol. Therefore we have to exit and report error now. ++ gold_error(_("unexpected reloc insn sequence while relaxing " ++ "tls gd to le for reloc %u."), r_type); ++ return aarch64_reloc_funcs::STATUS_BAD_RELOC; ++ } ++ ++ // Write new insns. ++ insn1 = 0xd53bd040; // mrs x0, tpidr_el0 ++ insn2 = 0x91400000; // add x0, x0, #0x0, lsl #12 ++ insn3 = 0x91000000; // add x0, x0, #0x0 ++ elfcpp::Swap<32, big_endian>::writeval(ip, insn1); ++ elfcpp::Swap<32, big_endian>::writeval(ip + 1, insn2); ++ elfcpp::Swap<32, big_endian>::writeval(ip + 2, insn3); ++ ++ // Calculate tprel value. ++ Output_segment* tls_segment = relinfo->layout->tls_segment(); ++ gold_assert(tls_segment != NULL); ++ AArch64_address value = psymval->value(relinfo->object, 0); ++ const elfcpp::Elf_Xword addend = rela.get_r_addend(); ++ AArch64_address aligned_tcb_size = ++ align_address(target->tcb_size(), tls_segment->maximum_alignment()); ++ AArch64_address x = value + aligned_tcb_size; ++ ++ // After new insns are written, apply TLSLE relocs. ++ const AArch64_reloc_property* rp1 = ++ aarch64_reloc_property_table->get_reloc_property( ++ elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12); ++ const AArch64_reloc_property* rp2 = ++ aarch64_reloc_property_table->get_reloc_property( ++ elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12); ++ gold_assert(rp1 != NULL && rp2 != NULL); ++ ++ typename aarch64_reloc_funcs::Status s1 = ++ aarch64_reloc_funcs::template rela_general<32>(view + 4, ++ x, ++ addend, ++ rp1); ++ if (s1 != aarch64_reloc_funcs::STATUS_OKAY) ++ return s1; ++ ++ typename aarch64_reloc_funcs::Status s2 = ++ aarch64_reloc_funcs::template rela_general<32>(view + 8, ++ x, ++ addend, ++ rp2); ++ ++ this->skip_call_tls_get_addr_ = true; ++ return s2; ++ ++} // End of tls_ld_to_le ++ ++template ++inline ++typename AArch64_relocate_functions::Status + Target_aarch64::Relocate::tls_ie_to_le( + const Relocate_info* relinfo, + Target_aarch64* target, +@@ -5963,7 +6407,7 @@ Target_aarch64::Reloca + newinsn = (0xf2800000 | regno) | ((x & 0xffff) << 5); + } + else +- gold_assert(false); ++ gold_unreachable(); + + elfcpp::Swap<32, big_endian>::writeval(ip, newinsn); + return aarch64_reloc_funcs::STATUS_OKAY; +Index: b/gold/testsuite/icf_safe_so_test.cc +=================================================================== +--- a/gold/testsuite/icf_safe_so_test.cc ++++ b/gold/testsuite/icf_safe_so_test.cc +@@ -22,10 +22,10 @@ + + // The goal of this program is to verify if identical code folding + // in safe mode correctly folds functions in a shared object. The +-// foo_* functions below should not be folded. For x86-64, +-// foo_glob and bar_glob should be folded as their function pointers +-// are addresses of PLT entries in shared objects. For 32-bit X86, +-// the hidden protected and internal symbols can be folded. ++// foo_* functions below should not be folded on X86_64. ++// For 32-bit X86, the hidden protected and internal symbols can be folded. ++// foo_glob and bar_glob should not be folded, because function pointer ++// of foo_glob is taken. + + int __attribute__ ((visibility ("protected"))) + foo_prot() +Index: b/gold/testsuite/icf_safe_test.sh +=================================================================== +--- a/gold/testsuite/icf_safe_test.sh ++++ b/gold/testsuite/icf_safe_test.sh +@@ -57,7 +57,7 @@ END { + + arch_specific_safe_fold() + { +- grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e "ARM" -e "TILE" -e "PowerPC" $2` ++ grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e "ARM" -e "TILE" -e "PowerPC" -e "AArch64" $2` + if [ $? -eq 0 ]; + then + check_fold $3 $4 $5 --- binutils-2.25.orig/debian/patches/aarch64-libpath.diff +++ binutils-2.25/debian/patches/aarch64-libpath.diff @@ -0,0 +1,27 @@ +Index: b/ld/emulparams/aarch64linux.sh +=================================================================== +--- a/ld/emulparams/aarch64linux.sh ++++ b/ld/emulparams/aarch64linux.sh +@@ -38,12 +38,15 @@ + + # Linux modifies the default library search path to first include + # a 64-bit specific directory. +-case "$target" in +- aarch64*-linux*) +- case "$EMULATION_NAME" in +- aarch64linux*) LIBPATH_SUFFIX=64 ;; +- esac +- ;; +-esac ++ ++# not for multiarch systems ... ++ ++#case "$target" in ++# aarch64*-linux*) ++# case "$EMULATION_NAME" in ++# aarch64linux*) LIBPATH_SUFFIX=64 ;; ++# esac ++# ;; ++#esac + + ELF_INTERPRETER_NAME=\"/lib/ld-linux-aarch64.so.1\" --- binutils-2.25.orig/debian/patches/aarch64-thunderx.diff +++ binutils-2.25/debian/patches/aarch64-thunderx.diff @@ -0,0 +1,28 @@ +# DP: gas: Recognize: AAarch64 ThunderX processor. + +Index: b/gas/config/tc-aarch64.c +=================================================================== +--- a/gas/config/tc-aarch64.c ++++ b/gas/config/tc-aarch64.c +@@ -7191,6 +7191,9 @@ static const struct aarch64_cpu_option_t + {"exynos-m1", AARCH64_FEATURE (AARCH64_ARCH_V8, + AARCH64_FEATURE_CRC | AARCH64_FEATURE_CRYPTO), + "Samsung Exynos M1"}, ++ {"thunderx", AARCH64_FEATURE (AARCH64_ARCH_V8, ++ AARCH64_FEATURE_CRC | AARCH64_FEATURE_CRYPTO), ++ "Cavium ThunderX"}, + /* The 'xgene-1' name is an older name for 'xgene1', which was used + in earlier releases and is superseded by 'xgene1' in all + tools. */ +Index: b/gas/doc/c-aarch64.texi +=================================================================== +--- a/gas/doc/c-aarch64.texi ++++ b/gas/doc/c-aarch64.texi +@@ -59,6 +59,7 @@ on the target processor. The following + @code{cortex-a57}, + @code{cortex-a72}, + @code{exynos-m1}, ++@code{thunderx}, + @code{xgene1}, + and + @code{xgene2}. --- binutils-2.25.orig/debian/patches/arm-ld-unique-tests.diff +++ binutils-2.25/debian/patches/arm-ld-unique-tests.diff @@ -0,0 +1,55 @@ +# DP: ld/testsuite/ld-unique: Fix running unique tests on ARM + +The @ character is a comment character on ARM, so use % instead. Also +use a wider glob for matching ARM targets to make sure the test gets +run. + +ld/testsuite/ChangeLog: + +2014-10-23 Will Newton + + * ld-unique/unique.exp: Use a wider glob for matching ARM + targets. + * ld-unique/unique.s: Use % instead of @ in .type directive. + * ld-unique/unique_shared.s: Likewise. +--- + ld/testsuite/ld-unique/unique.exp | 2 +- + ld/testsuite/ld-unique/unique.s | 2 +- + ld/testsuite/ld-unique/unique_shared.s | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ld/testsuite/ld-unique/unique.exp b/ld/testsuite/ld-unique/unique.exp +index a93f9b2..994ed87 100644 +--- a/ld/testsuite/ld-unique/unique.exp ++++ b/ld/testsuite/ld-unique/unique.exp +@@ -28,7 +28,7 @@ + # arm, powerpc, and sparc so far. + if {!(([istarget "i?86-*-*"] + || [istarget "x86_64-*-*"] +- || [istarget "arm-*-*"] ++ || [istarget "arm*-*-*"] + || [istarget "powerpc*-*-*"] + || [istarget "sparc*-*-*"]) + && ([istarget "*-*-elf*"] +diff --git a/ld/testsuite/ld-unique/unique.s b/ld/testsuite/ld-unique/unique.s +index 9b0593c..7477a69 100644 +--- a/ld/testsuite/ld-unique/unique.s ++++ b/ld/testsuite/ld-unique/unique.s +@@ -1,4 +1,4 @@ +- .type a, @gnu_unique_object ++ .type a, %gnu_unique_object + a: .long 0 + .size a, .-a + +diff --git a/ld/testsuite/ld-unique/unique_shared.s b/ld/testsuite/ld-unique/unique_shared.s +index b18a5b1..8022291 100644 +--- a/ld/testsuite/ld-unique/unique_shared.s ++++ b/ld/testsuite/ld-unique/unique_shared.s +@@ -1,3 +1,3 @@ +- .type b, @gnu_unique_object ++ .type b, %gnu_unique_object + b: .long 0 + .size b, .-b +-- +1.9.3 + --- binutils-2.25.orig/debian/patches/branch-updates.diff +++ binutils-2.25/debian/patches/branch-updates.diff @@ -0,0 +1,32522 @@ +# DP: updates from the binutils-2.25 branch + +# git diff 15a2e5b3fab5543c499a58783d9562c0c973fc1f 8bcb55cd84d01e30166b1fdf1c177ae32533f946 +# exclude bfd/{configure{,.ac},Makefile.{am,in}} + +diff --git a/bfd/ChangeLog b/bfd/ChangeLog +index 86193b7..d39fddd 100644 +--- a/bfd/ChangeLog ++++ b/bfd/ChangeLog +@@ -1,3 +1,918 @@ ++2015-06-19 Nick Clifton ++ ++ PR 18481 ++ * elf32-arm.c (R_ARM_TLS_LE32): Set the special function to NULL. ++ ++2015-05-05 Jiong Wang ++ ++ Apply from master: ++ ++ 2015-04-24 Jiong. Wang ++ ++ PR ld/18270 ++ * elfnn-aarch64.c (elfNN_aarch64_size_dynamic): Count local symbol for ++ GOT_NORMAL for both sgot/srelgot section. ++ (elfNN_aarch64_final_link_relocate): Relocate against GOT entry address ++ and generate necessary runtime relocation for GOT entry. ++ ++2015-05-05 Jiong Wang ++ ++ Apply from master: ++ ++ 2015-04-24 Jiong. Wang ++ ++ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Reject ++ PC-relative relocation for external symbol. ++ ++2015-04-10 Alan Modra ++ ++ PR ld/18222 ++ * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't report an error ++ on adding a protected visibility variable to .dynbss. ++ ++2015-04-10 Alan Modra ++ ++ Revert 2015-03-06 H.J. Lu ++ PR ld/pr15228 ++ PR ld/pr17709 ++ * elf-bfd.h (elf_backend_data): Delete extern_protected_data. ++ * elf32-i386.c (elf_backend_extern_protected_data): Delete. ++ * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. ++ * elflink.c (_bfd_elf_adjust_dynamic_copy): Remove ++ extern_protected_data test. ++ (_bfd_elf_symbol_refs_local_p): Likewise. ++ * elfxx-target.h (elf_backend_extern_protected_data): Delete. ++ (elfNN_bed): Delete elf_backend_extern_protected_data init. ++ ++2015-03-27 Alan Modra ++ ++ PR ld/15228 ++ PR ld/18167 ++ * elflink.c (elf_merge_st_other): Add "sec" parameter. Don't set ++ protected_def when symbol section is read-only. Adjust all calls. ++ * elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment. ++ ++2015-03-26 Tejas Belagod ++ ++ * elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic ++ _bfd_final_link_relocate with aarch64_relocate. ++ ++2015-03-25 Nick Clifton ++ ++ Apply from master: ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * elf.c (elf_fake_sections): Handle excessive alignmment powers. ++ (assign_file_positions_for_non_load_sections): Replace assertion ++ with an error message. ++ (rewrite_elf_program_header): Handle excessive segment ++ alignments. ++ ++ 2015-02-13 Alan Modra ++ ++ PR binutils/17512 ++ * elf64-ppc.c (opd_entry_value): Tighten offset check. Remove ++ now redundant assert. ++ ++ 2015-02-12 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf2.c (read_1_byte, read_1_signed_byte, read_2_bytes) ++ (read_4_bytes, read_8_bytes, read_n_bytes, read_string) ++ (read_indirect_string, read_alt_indirect_string) ++ (read_alt_indirect_ref, read_address, read_abbrevs) ++ (read_attribute_value, read_attribute, decode_line_info) ++ (find_abstract_instance_name, read_rangelist) ++ (scan_unit_for_symbols, parse_comp_unit) ++ (_bfd_dwarf2_find_nearest_line): Harden DWARF reading code. Pass ++ end pointers to reading functions and check for offsets taking ++ pointers out of range. Replace calls to read_*_leb128 with calls ++ to safe_read_leb128. ++ ++ * elf64-ppc.c (opd_entry_value): Add a check for an overlarge ++ offset. ++ ++ 2015-02-03 Nick Clifton ++ ++ PR binutils/17512 ++ * elf-m10300.c (mn10300_info_to_howto): Fix typo in error message. ++ * elf32-arc.c (arc_info_to_howto_rel): Likewise. ++ * elf32-avr.c (avr_info_to_howto_rela): Likewise. ++ * elf32-cr16.c (elf_cr16_info_to_howto): Likewise. ++ * elf32-cr16c.c (elf_cr16c_info_to_howto_rel): Likewise. ++ * elf32-cris.c (cris_info_to_howto_rela): Likewise. ++ * elf32-crx.c (elf_crx_info_to_howto): Likewise. ++ * elf32-d10v.c (d10v_info_to_howto_rel): Likewise. ++ * elf32-d30v.c (d30v_info_to_howto_rel): Likewise. ++ * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise. ++ * elf32-fr30.c (fr30_info_to_howto_rela): Likewise. ++ * elf32-frv.c (frv_info_to_howto_rela): Likewise. ++ * elf32-i370.c (i370_elf_info_to_howto): Likewise. ++ * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise. ++ * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise. ++ * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise. ++ * elf32-lm32.c (lm32_info_to_howto_rela): Likewise. ++ * elf32-m32c.c (m32c_info_to_howto_rela): Likewise. ++ * elf32-m32r.c (m32r_info_to_howto_rel): Likewise. ++ * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise. ++ * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise. ++ * elf32-mcore.c (mcore_elf_info_to_howto): Likewise. ++ * elf32-mep.c (mep_info_to_howto_rela): Likewise. ++ * elf32-metag.c (metag_info_to_howto_rela): Likewise. ++ * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise. ++ * elf32-moxie.c (moxie_info_to_howto_rela): Likewise. ++ * elf32-msp430.c (msp430_info_to_howto_rela): Likewise. ++ * elf32-mt.c (mt_info_to_howto_rela): Likewise. ++ * elf32-nds32.c (nds32_info_to_howto_rel): Likewise. ++ * elf32-or1k.c (or1k_info_to_howto_rela): Likewise. ++ * elf32-pj.c (pj_elf_info_to_howto): Likewise. ++ * elf32-ppc.c (ppc_elf_info_to_howto): Likewise. ++ * elf32-rl78.c (rl78_info_to_howto_rela): Likewise. ++ * elf32-rx.c (rx_info_to_howto_rela): Likewise. ++ * elf32-sh.c (sh_elf_info_to_howto): Likewise. ++ * elf32-spu.c (spu_elf_info_to_howto): Likewise. ++ * elf32-v850.c (v850_elf_perform_relocation): Likewise. ++ * elf32-vax.c (rtype_to_howto): Likewise. ++ * elf32-visium.c (visium_info_to_howto_rela): Likewise. ++ * elf32-xgate.c (xgate_info_to_howto_rel): Likewise. ++ * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise. ++ * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise. ++ * elf64-mmix.c (mmix_info_to_howto_rela): Likewise. ++ ++ 2015-01-27 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf2.c (concat_filename): Check for an empty directory table. ++ (scan_unit_for_symbols): Check for reading off the end of the ++ unit. ++ (parse_comp_unit): Check for a DW_AT_comp_dir attribute with a ++ non-string form. ++ ++ 2015-01-15 Nick Clifton ++ ++ PR binutils/17512 ++ * elf-m10300.c (mn10300_info_to_howto): Replace assertion with an ++ error message. Never return an invalid howto pointer. ++ * elf32-cr16.c (cr16_info_to_howto): Likewise. ++ * elf32-crx.c (elf_crx_info_to_howto): Likewise. ++ * elf32-i370.c (i370_elf_info_to_howto): Likewise. ++ * elf32-mcore.c (mcore_elf_info_to_howto): Likewise. ++ * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise. ++ * elf32-mips.c (mips_elf32_rtype_to_howto): Likewise. ++ * elf32-pj.c (pj_elf_info_to_howto): Likewise. ++ * elf32-ppc.c (ppc_elf_info_to_howto): Likewise. ++ * elf32-spu.c (spu_elf_info_to_howto): Likewise. ++ * elf32-v850.c (v850_elf_info_to_howto_rela): Likewise. ++ * elf32-vax.c (rtype_to_howto): Likewise. ++ * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise. ++ * elf64-mips.c (mips_elf64_rtype_to_howto): Likewise. ++ * elfn32-mips.c (sh_elf_info_to_howto): Likewise. ++ * elf32-sh.c (sh_elf_info_to_howto): Likewise. ++ (sh_elf_reloc): Check that the reloc is in range. ++ * reloc.c (bfd_perform_relocation): Check that the section is big ++ enough for the entire reloc. ++ (bfd_generic_get_relocated_section_contents): Report unexpected ++ return values from perform_reloc. ++ ++ 2015-01-08 Nick Clifton ++ ++ PR binutils/17512 ++ * elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum ++ maxpagesize of 1. ++ ++ 2015-01-06 H.J. Lu ++ ++ PR binutils/17512 ++ * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocation. ++ * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise. ++ ++ 2014-12-22 Nick Clifton ++ ++ PR binutils/17512 ++ * elf32-arc.c (arc_info_to_howto_rel): Replace BFD_ASSERT with ++ error message. ++ * elf32-avr.c (avr_info_to_howto_rela): Likewise. ++ * elf32-cr16c.c (elf_cr16c_info_to_howto_rel): Likewise. ++ * elf32-cris.c (cris_info_to_howto_rela): Likewise. ++ * elf32-d10v.c (d10v_info_to_howto_rel): Likewise. ++ * elf32-d30v.c (d30v_info_to_howto_rel): Likewise. ++ * elf32-dlx.c (dlx_rtype_to_howto): Likewise. ++ * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise. ++ * elf32-fr30.c (fr30_info_to_howto_rela): Likewise. ++ * elf32-frv.c (frv_info_to_howto_rela): Likewise. ++ * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise. ++ * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise. ++ * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise. ++ * elf32-lm32.c (lm32_info_to_howto_rela): Likewise. ++ * elf32-m32c.c (m32c_info_to_howto_rela): Likewise. ++ * elf32-m32r.c (m32r_info_to_howto_rel): Likewise. ++ * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise. ++ * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise. ++ * elf32-mep.c (mep_info_to_howto_rela): Likewise. ++ * elf32-metag.c (metag_info_to_howto_rela): Likewise. ++ * elf32-moxie.c (moxie_info_to_howto_rela): Likewise. ++ * elf32-msp430.c (msp430_info_to_howto_rela): Likewise. ++ * elf32-mt.c (mt_info_to_howto_rela): Likewise. ++ * elf32-nds32.c (nds32_info_to_howto_rel): Likewise. ++ * elf32-or1k.c (or1k_info_to_howto_rela): Likewise. ++ * elf32-rl78.c (rl78_info_to_howto_rela): Likewise. ++ * elf32-rx.c (rx_info_to_howto_rela): Likewise. ++ * elf32-v850.c (v850_elf_info_to_howto_rel): Likewise. ++ * elf32-xgate.c (xgate_info_to_howto_rel): Likewise. ++ * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise. ++ * elf64-mmix.c (mmix_info_to_howto_rela): Likewise. ++ * elf64-x86-64.c (elf_x86_64_reloc_type_lookup): Likewise. ++ * elfnn-aarch64.c (elfNN_aarch64_bfd_reloc_from_type): Likewise. ++ * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Add range ++ checking of reloc symbol index. ++ ++ 2014-12-09 Nick Clifton ++ ++ PR binutils/17512 ++ * elf-attrs.c (_bfd_elf_parse_attributes): Use safe_read_leb128. ++ Check for an over-long subsection length. ++ * elf.c (elf_parse_notes): Check that the namedata is long enough ++ for the string comparison that is about to be performed. ++ (elf_read_notes): Zero-terminate the note buffer. ++ ++ 2014-12-01 Nick Clifton ++ ++ PR binutils/17512 ++ * elf-attrs.c (_bfd_elf_parse_attributes): Check for an empty ++ header. Add range checks to avoid running off the end of the ++ section. ++ * elf.c (bfd_elf_get_str_section): Seek before allocating so that ++ if the seek fails, no memory is allocated. ++ (bfd_elf_string_from_elf_section): Do not allocate a string from a ++ non string section. It only leads to trouble later on. ++ (_bfd_elf_print_private_bfd_data): Check for there being too ++ little external dynamic data. ++ (bfd_section_from_shdr): Replace assertion with a failure mode. ++ (bfd_section_from_shdr): When walking a loaded group section use ++ the internal structure size, not the external size. Check for the ++ group section being empty. ++ * elf32-i386.c (elf_i386_rtype_to_howto): Replace assertion with a ++ failure mode. ++ * elfcode.h (elf_slurp_reloc_table): Likewise. ++ ++ 2014-11-27 Nick Clifton ++ ++ PR binutils/17512 ++ * elf.c (_bfd_elf_print_private_bfd_data): Fix the range check ++ scanning the external dynamic entries. ++ ++2015-03-25 Nick Clifton ++ ++ Apply from master: ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * mach-o.c (bfd_mach_o_read_section_32): Likewise. ++ (bfd_mach_o_read_section_64): Likewise. ++ ++ 2015-02-10 Nick Clifton ++ ++ PR binutils/17512 ++ * versados.c (process_otr): Check the esdid value before using it ++ to access the EDATA. ++ ++ 2015-02-03 Nick Clifton ++ ++ PR binutils/17512 ++ * mach-o.c: Use bfd_alloc2 to allocate space for structure arrays. ++ (bfd_mach_o_canonicalize_one_reloc): Fix check on out ++ of range symbol indicies. ++ (bfd_mach_o_canonicalize_relocs): Check for out of range alloc. ++ (bfd_mach_o_canonicalize_dynamic_reloc): Likewise. ++ (bfd_mach_o_build_dysymtab): Likewise. ++ (bfd_mach_o_write_symtab_content): Set the string table size to ++ zero upon error. ++ (bfd_mach_o_read_symtab_symbols): Reset the nsyms value if the ++ read fails. ++ * tekhex.c (first_phase): Check for src pointer reaching end of ++ buffer. ++ ++ 2015-01-27 Nick Clifton ++ ++ PR binutils/17512 ++ * pdp11.c (aout_get_external_symbols): Return false if there are ++ no symbols. ++ ++ 2015-01-22 DJ Delorie ++ ++ * elf32-m32c.c (m32c_apply_reloc_24): New. ++ (m32c_elf_howto_table): Use it for R_M32C_24. ++ (m32c_elf_relocate_section): Handle R_M32C_24 specially. ++ ++ 2015-01-21 Nick Clifton ++ ++ PR binutils/17512 ++ * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always ++ initialise the fields of the dyld_info structure. ++ (bfd_mach_o_build_exec_seg_command): Replace assertion with an ++ error message and a return value. ++ (bfd_mach_o_layout_commands): Change the function to boolean. ++ Return FALSE if the function fails. ++ (bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands ++ fails. ++ (bfd_mach_o_read_command): Fail if an unrecognised command is ++ encountered. ++ * tekhex.c (first_phase): Fail if the section is too big. ++ * versados.c (struct esdid): Add content_size field. ++ (process_otr): Use and check the new field. ++ (versados_get_section_contents): Check that the section exists and ++ that the requested data is available. ++ ++ 2015-01-19 Alan Modra ++ ++ * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from.. ++ (bfd_get_section_limit): ..here. ++ * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check. ++ (bfd_install_relocation, _bfd_final_link_relocate): Add same check here. ++ * bfd-in2.h: Regenerate. ++ ++ * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok ++ on zero size relocs. ++ * ecoff.c (ecoff_reloc_link_order): Likewise. ++ * elf32-nds32.c (nds32_relocate_contents): Likewise. ++ * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. ++ ++ * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs. ++ (_bfd_clear_contents): Likewise. ++ * elfxx-mips.c (mips_elf_obtain_contents): Likewise. ++ (mips_elf_perform_relocation): Likewise. ++ ++ * aoutx.h (aout_link_reloc_link_order): Allow for NULL return ++ from malloc on zero size alloc. ++ * cofflink.c (_bfd_coff_reloc_link_order): Likewise. ++ * elflink.c (elf_reloc_link_order): Likewise. ++ * linker.c (_bfd_generic_reloc_link_order): Likewise. ++ * pdp11.c (aout_link_reloc_link_order): Likewise. ++ * xcofflink.c (xcoff_reloc_link_order): Likewise. ++ ++ * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3, ++ bitsize 0, and complain_overflow_dont. ++ * coff-sparc.c (coff_sparc_howto_table): Likewise. ++ * elf-hppa.h (elf_hppa_howto_table): Likewise. ++ * elf-m10200.c (elf_mn10200_howto_table): Likewise. ++ * elf-m10300.c (elf_mn10300_howto_table): Likewise. ++ * elf32-arc.c (elf_arc_howto_table): Likewise. ++ * elf32-arm.c (elf32_arm_howto_table_1): Likewise. ++ * elf32-avr.c (elf_avr_howto_table): Likewise. ++ * elf32-bfin.c (bfin_howto_table): Likewise. ++ * elf32-cr16.c (cr16_elf_howto_table): Likewise. ++ * elf32-cris.c (cris_elf_howto_table): Likewise. ++ * elf32-crx.c (crx_elf_howto_table): Likewise. ++ * elf32-d10v.c (elf_d10v_howto_table): Likewise. ++ * elf32-d30v.c (elf_d30v_howto_table): Likewise. ++ * elf32-dlx.c (dlx_elf_howto_table): Likewise. ++ * elf32-epiphany.c (epiphany_elf_howto_table): Likewise. ++ * elf32-fr30.c (fr30_elf_howto_table): Likewise. ++ * elf32-frv.c (elf32_frv_howto_table): Likewise. ++ * elf32-h8300.c (h8_elf_howto_table): Likewise. ++ * elf32-i370.c (i370_elf_howto_raw): Likewise. ++ * elf32-i386.c (elf_howto_table): Likewise. ++ * elf32-i860.c (elf32_i860_howto_table): Likewise. ++ * elf32-i960.c (elf32_i960_relocate): Likewise. ++ * elf32-ip2k.c (ip2k_elf_howto_table): Likewise. ++ * elf32-iq2000.c (iq2000_elf_howto_table): Likewise. ++ * elf32-lm32.c (lm32_elf_howto_table): Likewise. ++ * elf32-m32c.c (m32c_elf_howto_table): Likewise. ++ * elf32-m32r.c (m32r_elf_howto_table): Likewise. ++ * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise. ++ * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise. ++ * elf32-m68k.c (howto_table): Likewise. ++ * elf32-mcore.c (mcore_elf_howto_raw): Likewise. ++ * elf32-mep.c (mep_elf_howto_table): Likewise. ++ * elf32-metag.c (elf_metag_howto_table): Likewise. ++ * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise. ++ * elf32-mips.c (elf_mips_howto_table_rel): Likewise. ++ * elf32-moxie.c (moxie_elf_howto_table): Likewise. ++ * elf32-msp430.c (elf_msp430_howto_table): Likewise. ++ * elf32-mt.c (mt_elf_howto_table): Likewise. ++ * elf32-nds32.c (nds32_elf_howto_table): Likewise. ++ * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise. ++ * elf32-or1k.c (or1k_elf_howto_table): Likewise. ++ * elf32-pj.c (pj_elf_howto_table): Likewise. ++ * elf32-ppc.c (ppc_elf_howto_raw): Likewise. ++ * elf32-rl78.c (rl78_elf_howto_table): Likewise. ++ * elf32-rx.c (rx_elf_howto_table): Likewise. ++ * elf32-s390.c (elf_howto_table): Likewise. ++ * elf32-score.c (elf32_score_howto_table): Likewise. ++ * elf32-score7.c (elf32_score_howto_table): Likewise. ++ * elf32-sh-relocs.h (R_SH_NONE): Likewise. ++ * elf32-spu.c (elf_howto_table): Likewise. ++ * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise. ++ * elf32-tilepro.c (tilepro_elf_howto_table): Likewise. ++ * elf32-v850.c (v850_elf_howto_table): Likewise. ++ * elf32-vax.c (howto_table): Likewise. ++ * elf32-xc16x.c (xc16x_elf_howto_table): Likewise. ++ * elf32-xgate.c (elf_xgate_howto_table): Likewise. ++ * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise. ++ * elf32-xtensa.c (elf_howto_table): Likewise. ++ * elf64-alpha.c (elf64_alpha_howto_table): Likewise. ++ * elf64-mips.c (mips_elf64_howto_table_rel): Likewise. ++ * elf64-mmix.c (elf_mmix_howto_table): Likewise. ++ * elf64-ppc.c (ppc64_elf_howto_raw): Likewise. ++ * elf64-s390.c (elf_howto_table): Likewise. ++ * elf64-sh64.c (sh_elf64_howto_table): Likewise. ++ * elf64-x86-64.c (x86_64_elf_howto_table): Likewise. ++ * elfn32-mips.c (elf_mips_howto_table_rel): Likewise. ++ * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. ++ (elfNN_aarch64_howto_none): Likewise. ++ * elfxx-ia64.c (ia64_howto_table): Likewise. ++ * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise. ++ * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise. ++ * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise. ++ ++ 2015-01-06 Nick Clifton ++ ++ PR binutils/17512 ++ * mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the ++ string table. ++ ++ * reloc.c (bfd_get_reloc_size): Handle a reloc size of -1. ++ (bfd_perform_relocation): Include the size of the reloc in the ++ test for an out of range relocation. ++ (bfd_generic_get_relocated_section_contents): Remove reloc range ++ test. ++ ++ * tekhex.c (getvalue): Add an end pointer parameter. Use it to ++ avoid reading off the end of the buffer. ++ (getsym): Likewise. ++ (first_phase): Likewise. ++ (pass_over): Pass an end pointer to the invoked function. ++ ++ 2015-01-05 Nick Clifton ++ ++ PR binutils/17512 ++ * archive.c (do_slurp_bsd_armap): Make sure that the parsed sized ++ is at least big enough for the header to be read. ++ * mach-o.c (bfd_mach_o_get_synthetic_symtab): Add range checks. ++ (bfd_mach_o_read_command): Prevetn duplicate error messages about ++ unrecognized commands. ++ * syms.c (_bfd_stab_section_find_nearest_line): Add range checks ++ when indexing into the string table. ++ ++ 2014-12-22 Nick Clifton ++ ++ PR binutils/17512 ++ * archive.c (do_slurp_bsd_armap): Return if the parsed_size is ++ zero. ++ (bfd_slurp_armap): Zero terminate the name. ++ (bfd_generic_stat_arch_elt): If there is no header, fail. ++ * mach-o.c (bfd_mach_o_canonicalize_one_reloc): If no symbols have ++ been provided then set the reloc's symbol to undefined. ++ * reloc.c (bfd_generic_get_relocated_section_contents): Add range ++ checking of the reloc to be applied. ++ * versados.c (process_otr): Add more range checks. ++ (versados_canonicalize_reloc): If the section is unknown, set the ++ symbol to undefined. ++ * vms-alpha.c (_bfd_vms_slurp_eisd): Add range checks. ++ (alpha_vms_object_p): Likewise. ++ ++ 2014-12-16 Nick Clifton ++ ++ PR binutils/17512 ++ * format.c (bfd_check_format_matches): Check for a matching vector ++ before using match priorities. ++ * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Fix off-by-one ++ errors with previous delta. ++ ++ 2014-12-09 Nick Clifton ++ ++ PR binutils/17512 ++ * archive64.c (bfd_elf64_archive_slurp_armap): Add range checks. ++ * libbfd.c (safe_read_leb128): New function. ++ * libbfd-in.h (safe_read_leb128): Add prototype. ++ * libbfd.h: Regenerate. ++ ++ 2014-12-03 Nick Clifton ++ ++ PR binutils/17512 ++ * compress.c (bfd_get_full_section_contents): Fail if there are no ++ section contents available when the compress_status is ++ COMPRESS_SECTION_DONE. ++ * libbfd.c (bfd_malloc): Refuse to allocate a negative size. ++ (bfd_malloc2): Use bfd_malloc. ++ (bfd_realloc): Refuse to reallocate a negative size. ++ (bfd_realloc2): Use bfd_realloc. ++ (bfd_realloc_or_free): Use bfd_realloc. ++ (bfd_zmalloc): Use bfd_malloc. ++ (bfd_zmalloc): Use bfd_malloc2. ++ * opncls.c (bfd_alloc): Refuse to allocate a negative size. ++ ++ 2014-12-01 Nick Clifton ++ ++ PR binutils/17512 ++ * archive.c (do_slurp_coff_armap): Add range checks to prevent ++ running off the end of the string table. ++ * compress.c (bfd_get_full_section_contents): Return a NULL ++ pointer for zero sized sections. Do not attempt to copy a buffer ++ onto itself. ++ * reloc.c (bfd_perform_relocation): Avoid seg-fault if the howto ++ parameter is NULL. ++ ++ 2014-11-26 Nick Clifton ++ ++ PR binutils/17512 ++ * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Likewise. ++ (bfd_mach_o_mangle_sections): Move test for too many sections to ++ before the allocation of the section table. ++ (bfd_mach_o_read_symtab_strtab): If the read fails, free the ++ memory and nullify the symbol pointer. ++ * reloc.c (bfd_generic_get_relocated_section_contents): Add ++ handling of a bfd_reloc_notsupported return value. ++ * versados.c (EDATA): Add range checking. ++ (get_record): Likewise. ++ (process_otr): Check for contents being available before updating ++ them. ++ (versados_canonicalize_reloc): Add range check. ++ ++ 2014-11-21 Nick Clifton ++ ++ PR binutils/17512 ++ * ieee.c (next_byte): Convert to a function. Return FALSE if the ++ next byte is beyond the end of the buffer. ++ (parse_int): Test the return value of next_byte. ++ (parse_expression): Convert to boolean. Return FALSE if the ++ parsing failed. Test the return value of next_byte. ++ (ieee_seek): Convert to a function. Return FALSE if the seek goes ++ beyond the end of the buffer. ++ (ieee_slurp_external_symbols): Test the return value of ieee_seek ++ and next_byte. ++ (ieee_slurp_sections): Convert to boolean. Return FALSE if the ++ operation failed. Test the return value of ieee_seek and ++ next_byte. ++ (ieee_archive_p): Test the return value of ieee_seek and ++ next_byte. ++ (do_one): Likewise. ++ (ieee_slurp_section_data): Likewise. ++ (ieee_object_p): Likewise. Store the size of the buffer in the ++ total_amt field in the header. ++ * libieee.h (common_header_type): Add amt field. ++ * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Check that the ++ reloc's value is within range. ++ (bfd_mach_o_read_symtab_symbols): Nullify the symbols field if the ++ operation fails. ++ * versados.c (process_otr): Check that the section exists before ++ taking its size. ++ (versados_object_p): Make sure that enough data was read for the ++ header to be checked. ++ * vms-alpha.c (vms_get_remaining_object_record): Change ++ read_so_far parameter to an unsigned int. Check that the amount ++ read is in range. ++ ++2015-03-24 Nick Clifton ++ ++ Apply from master: ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * coffcode.h (coff_compute_section_file_positions): Report ++ negative page sizes. ++ ++ 2015-02-10 Nick Clifton ++ ++ PR binutils/17512 ++ * coffcode.h (styp_to_sec_flags): Use an unsigned long type to ++ hold the flag bits. ++ ++ 2015-02-06 Nick Clifton ++ ++ PR binutils/17512 ++ * peXXigen.c (rsrc_print_resource_entries): Add range check for ++ addresses that wrap around the address space. ++ (rsrc_parse_entry): Likewise. ++ ++ 2015-02-03 Nick Clifton ++ ++ PR binutils/17512 ++ * ecoff.c: Use bfd_alloc2 to allocate space for structure arrays. ++ (_bfd_ecoff_slurp_symbol_table): Check for a negative symbol ++ index or an out of range fdr index. ++ * peXXigen.c (pe_print_edata): Check for numeric overflow in edt ++ fields. ++ ++ 2015-01-22 Nick Clifton ++ ++ PR binutils/17512 ++ * coffcode.h (handle_COMDAT): When searching for the section ++ symbol, make sure that there is space left in the symbol table. ++ ++ 2015-01-21 Nick Clifton ++ ++ PR binutils/17512 ++ * coffcode.h (coff_set_arch_mach_hook): Check return value from ++ bfd_malloc. ++ (coff_slurp_line_table): Return FALSE if the line number ++ information was corrupt. ++ (coff_slurp_symbol_table): Return FALSE if the symbol information ++ was corrupt. ++ * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the ++ read fails. ++ (slurp_symtab): Check the return from bfd_malloc. ++ (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy ++ encountered an error. ++ (_bfd_XXi_final_link_postscript): Fail if a section could not be ++ copied. ++ * peicode.h (pe_bfd_object_p): Fail if the header could not be ++ swapped in. ++ ++ 2015-01-08 Nick Clifton ++ ++ PR binutils/17512 ++ * coffcode.h (coff_slurp_symbol_table): Return false if we failed ++ to load the line table. ++ ++ 2015-01-06 Nick Clifton ++ ++ PR binutils/17512 ++ * coff-i860.c (CALC_ADDEND): Always set an addend value. ++ ++ 2014-11-27 Nick Clifton ++ ++ PR binutils/17512 ++ * ecoff.c (_bfd_ecoff_slurp_symbol_table): Warn about and correct ++ a discrepancy between the isymMax and ifdMax values in the ++ symbolic header. ++ ++ 2014-11-26 Nick Clifton ++ ++ PR binutils/17512 ++ * coff-h8300.c (rtype2howto): Replace abort with returning a NULL ++ value. ++ * coff-h8500.c (rtype2howto): Likewise. ++ * coff-tic30.c (rtype2howto): Likewise. ++ * coff-z80.c (rtype2howto): Likewise. ++ * coff-z8k.c (rtype2howto): Likewise. ++ * coff-ia64.c (RTYPE2HOWTO): Always return a valid howto. ++ * coff-m68k.c (m68k_rtype2howto): Return a NULL howto if none ++ could be found. ++ * coff-mcore.c (RTYPE2HOWTO): Add range checking. ++ * coff-w65.c (rtype2howto): Likewise. ++ * coff-we32k.c (RTYPE2HOWTO): Likewise. ++ * pe-mips.c (RTYPE2HOWTO): Likewise. ++ * coff-x86_64.c (coff_amd64_reloc): Likewise. Replace abort with ++ an error return. ++ * coffcode.h (coff_slurp_reloc_table): Allow the rel parameter to ++ be unused. ++ * coffgen.c (make_a_section_from_file): Check the length of a ++ section name before testing to see if it is a debug section name. ++ (coff_object_p): Zero out any uninitialised bytes in the opt ++ header. ++ * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Test for the raw ++ source being empty when there are values to be processed. ++ (_bfd_ecoff_slurp_symbol_table): Add range check. ++ ++ 2014-11-21 Nick Clifton ++ ++ PR binutils/17512 ++ * coffgen.c (coff_get_normalized_symtab): Check for an excessive ++ number of auxillary entries. ++ ++ 2014-11-21 Alexander Cherepanov ++ ++ PR binutils/17512 ++ * coffgen.c (_bfd_coff_read_string_table): Test allocation of ++ string table before clearing the first few bytes. ++ ++2014-11-18 Nick Clifton ++ ++ PR binutils/17512 ++ * peXXigen.c (pe_print_pdata): Fail if the section's virtual size ++ is larger than its real size. ++ (rsrc_print_section): Fix off-by-one error checking for overflow. ++ * pei-x86_64.c (pex64_bfd_print_pdata): Handle empty unwind ++ sections. ++ ++2015-03-18 Alan Modra ++ ++ Apply from master ++ 2015-03-14 Andreas Krebbel ++ * elf-s390-common.c (elf_s390_elf_sort_relocs_p): Don't sort ++ relocs against code sections. ++ * elf32-s390.c: Define elf_backend_sort_relocs_p. ++ * elf64-s390.c: Likewise. ++ ++ 2015-03-11 Alan Modra ++ * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Examine stubs in ++ reverse order. Account for larger size of __tls_get_addr_opt stub. ++ ++ 2015-02-28 Alan Modra ++ * elf32-ppc.c (ppc_elf_tls_setup): Set no_tls_get_addr_opt if ++ not PLT_NEW. ++ ++ 2015-02-26 Alan Modra ++ * elf64-ppc.c (plt_stub_size, build_plt_stub): Don't build ++ thread-safe stubs for iplt. ++ (build_tls_get_addr_stub): Restore r2 immediately after call. ++ ++ 2015-02-26 Alan Modra ++ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc. ++ Use text relocs rather than giving an error on trying to use ++ .dynbss for protected shared lib vars. ++ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. ++ ++2015-03-06 H.J. Lu ++ ++ Backport from master ++ 2015-03-05 H.J. Lu ++ ++ PR ld/pr15228 ++ PR ld/pr17709 ++ * elf-bfd.h (elf_backend_data): Add extern_protected_data. ++ * elf32-i386.c (elf_backend_extern_protected_data): New. ++ Defined to 1. ++ * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. ++ * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on ++ copy relocs against protected symbols if extern_protected_data ++ is true. ++ (_bfd_elf_symbol_refs_local_p): Don't return true on protected ++ non-function symbols if extern_protected_data is true. ++ * elfxx-target.h (elf_backend_extern_protected_data): New. ++ Default to 0. ++ (elfNN_bed): Initialize extern_protected_data with ++ elf_backend_extern_protected_data. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2015-02-09 Alan Modra ++ * elf32-ppc.c (ppc_elf_relocate_section): Don't segfault on NULL ++ tls_sec. ++ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. ++ * elflink.c (elf_link_output_extsym): Don't assert on NULL tls_sec. ++ ++ 2015-01-29 Alan Modra ++ * elf64-ppc.c (ppc64_elf_relocate_section): Correct GOT_TLSLD ++ optimization. Tidy mask for GOT_TLSGD optimization. ++ * elf32-ppc.c (ppc_elf_relocate_section): Likewise. Correct ++ location of nop zapping high insn too. ++ ++ 2015-01-20 Alan Modra ++ PR ld/17615 ++ * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Don't drop ++ ELF_COMMON_DEF syms. ++ ++ 2015-01-19 Alan Modra ++ PR 17165 ++ * elf-bfd.h (ELF_COMMON_DEF_P): Note that this might be true for ++ linker script assignments too. ++ * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms. ++ (bfd_elf_gc_mark_dynamic_ref_symbol): Similarly. ++ ++ 2015-01-15 Alan Modra ++ * elflink.c (_bfd_elf_link_omit_section_dynsym): Return true for ++ any output section matching a linker created dynobj section. ++ ++ 2015-01-15 Alan Modra ++ PR 17842 ++ * elflink.c (elf_link_output_sym): Assert elf_onesymtab set. ++ (bfd_elf_final_link): Always create a symbol table when emit_relocs. ++ Don't assign symtab file position unless symbols will be output. ++ Merge blocks with condition in common. Don't call ++ elf_backend_output_arch_local_syms or elf_backend_output_arch_syms ++ unless other symbols are output. Move assignment of symtab_shndx ++ file position. Localize variable. ++ ++ 2014-12-26 Alan Modra ++ PR 17755 ++ * elf64-sh64.c (sh_elf64_copy_private_data_internal): Delete code ++ copying SHF_SH5_ISA32. ++ ++ 2014-12-23 Alan Modra ++ * elflink.c (_bfd_elf_define_linkage_sym): Set linker_def. ++ * linker.c (_bfd_generic_link_add_one_symbol): Clear linker_def ++ for CDEF, DEF, DEFW, COM. ++ ++ 2014-12-18 Richard Henderson ++ * elf32-ppc.c (ELF_COMMONPAGESIZE): Set to 64k. ++ * elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise. ++ ++ 2014-12-12 Alan Modra ++ PR 15228 ++ * elflink.c (_bfd_elf_adjust_dynamic_copy): Call bfd_set_error. ++ ++ 2014-12-12 Alan Modra ++ PR 15228 ++ * elflink.c (_bfd_elf_adjust_dynamic_copy): Add "info" param. ++ Error on copy relocs against protected symbols. ++ (elf_merge_st_other): Set h->protected_def. ++ * elf-bfd.h (struct elf_link_hash_entry): Add "protected_def". ++ (_bfd_elf_adjust_dynamic_copy): Update prototype. ++ * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Update ++ _bfd_elf_adjust_dynamic_copy call. ++ * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. ++ * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. ++ * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. ++ * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. ++ * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. ++ * elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise. ++ * elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. ++ * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. ++ * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise. ++ * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. ++ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. ++ * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. ++ * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. ++ * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. ++ * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise. ++ * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise. ++ * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. ++ * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise. ++ ++ 2014-12-10 Alan Modra ++ PR 17541 ++ * dwarf2.c (struct comp_unit): Add "lang". ++ (non_mangled): New function. ++ (struct funcinfo): Add "is_linkage". Reorder for better packing. ++ Make "name" a const char*. ++ (lookup_address_in_function_table): Delete functionname_ptr param. ++ (find_abstract_instance_name): Add is_linkage param. Set if we ++ have DW_AT_linkage_name or non_mangled DW_AT_name. ++ (scan_unit_for_symbols): Similarly set func->is_linkage. ++ (parse_comp_unit): Stash DW_AT_language. ++ (comp_unit_find_nearest_line): Replace functionname_ptr param ++ with function_ptr param. ++ (_bfd_dwarf2_find_nearest_line): Adjust above calls. Set ++ functionname_ptr from function->name. Call _bfd_elf_find_function ++ to retrieve symbol for function if not linkage name. ++ (_bfd_elf_find_function): Add bfd_target_elf_flavour test, moved from.. ++ * elf.c (elf_find_function): ..here. ++ (_bfd_elf_find_nearest_line): Adjust calls. ++ * elf-bfd.h (_bfd_elf_find_function): Declare. ++ ++ 2014-12-10 Alan Modra ++ PR 17666 ++ * elf-bfd.h (struct elf_backend_data): Add sort_relocs_p. ++ * elfxx-target.h (elf_backend_sort_relocs_p): Define. ++ (elfNN_bed): Init new field. ++ * elflink.c (elf_link_adjust_relocs): Conditionally sort. ++ (bfd_elf_final_link): Control sorting of relocs. ++ * elfxx-mips.c (_bfd_mips_elf_sort_relocs_p): New function. ++ * elfxx-mips.h (_bfd_mips_elf_sort_relocs_p): Declare. ++ * elf32-mips.c (elf_backend_sort_relocs_p): Define. ++ * elf64-mips.c (elf_backend_sort_relocs_p): Define. ++ ++ 2014-12-09 Alan Modra ++ * elf64-ppc.c (sort_r_offset): Delete. ++ (ppc64_elf_edit_opd): Don't sort input relocs. ++ ++ 2014-12-04 Alan Modra ++ PR 17666 ++ * elflink.c: Include bfd_stdint.h. ++ (cmp_ext32l_r_offset, cmp_ext32b_r_offset) ++ (cmp_ext64l_r_offset, cmp_ext64b_r_offset): New functions. ++ (elf_link_adjust_relocs): Sort relocs. Free rel hashes after ++ sorting invalidates. ++ ++ 2014-12-02 Alan Modra ++ * elf64-ppc.c (OPD_NDX): Define. Use throughout for sizing/indexing ++ _opd_sec_data array, halving required memory. ++ (sort_r_offset): New function. ++ (ppc64_elf_edit_opd): Sort incoming relocs. Accept .opd ++ sections with a mix of 16 and 24 byte OPD entries. Don't ++ attempt to honour --non-overlapping-opd for .opd sections with ++ unexpected relocs. Simplify opd entry size calculations by ++ first finding the reloc for the next entry. Make edit loop ++ handle one opd entry per iteration, with an inner loop ++ handling relocs per entry. ++ ++2015-01-22 Thomas Preud'homme ++ ++ Backport from mainline ++ 2015-01-13 Thomas Preud'homme ++ ++ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND ++ to check if a symbol should be bound symbolically. ++ ++2015-01-20 Chung-Lin Tang ++ ++ Backport from master ++ * elf32-nios2.c (elf_backend_default_execstack): Define as 0. ++ ++2015-01-11 H.J. Lu ++ ++ PR ld/17827 ++ * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): For PIE, ++ only discard space for pc-relative relocs symbols which turn ++ out to need copy relocs. ++ ++2015-01-05 H.J. Lu ++ ++ PR ld/17773 ++ * elflink.c (bfd_elf_final_link): Assign the file position for ++ the symbol string table only there are symbols to be emitted. ++ + 2014-12-23 Tristan Gingold + + * version.m4: Bump version to 2.25.0 +diff --git a/bfd/aoutx.h b/bfd/aoutx.h +index 9385a98..764d163 100644 +--- a/bfd/aoutx.h ++++ b/bfd/aoutx.h +@@ -203,8 +203,8 @@ reloc_howto_type howto_table_ext[] = + HOWTO (RELOC_GLOB_DAT,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "GLOB_DAT", FALSE, 0, 0x00000000, FALSE), + HOWTO (RELOC_JMP_SLOT,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "JMP_SLOT", FALSE, 0, 0x00000000, FALSE), + HOWTO (RELOC_RELATIVE,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "RELATIVE", FALSE, 0, 0x00000000, FALSE), +- HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE), +- HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE), ++ HOWTO (0, 0, 3, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE), ++ HOWTO (0, 0, 3, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE), + #define RELOC_SPARC_REV32 RELOC_WDISP19 + HOWTO (RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont, 0,"R_SPARC_REV32",FALSE, 0, 0xffffffff, FALSE), + }; +@@ -3816,7 +3816,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, + + size = bfd_get_reloc_size (howto); + buf = (bfd_byte *) bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + r = MY_relocate_contents (howto, flaginfo->output_bfd, + (bfd_vma) pr->addend, buf); +diff --git a/bfd/archive.c b/bfd/archive.c +index df37996..34a9830 100644 +--- a/bfd/archive.c ++++ b/bfd/archive.c +@@ -311,8 +311,7 @@ _bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos) + struct ar_cache *entry = (struct ar_cache *) htab_find (hash_table, &m); + if (!entry) + return NULL; +- else +- return entry->arbfd; ++ return entry->arbfd; + } + else + return NULL; +@@ -902,6 +901,10 @@ do_slurp_bsd_armap (bfd *abfd) + return FALSE; + parsed_size = mapdata->parsed_size; + free (mapdata); ++ /* PR 17512: file: 883ff754. */ ++ /* PR 17512: file: 0458885f. */ ++ if (parsed_size < 4) ++ return FALSE; + + raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size); + if (raw_armap == NULL) +@@ -1038,12 +1041,19 @@ do_slurp_coff_armap (bfd *abfd) + } + + /* OK, build the carsyms. */ +- for (i = 0; i < nsymz; i++) ++ for (i = 0; i < nsymz && stringsize > 0; i++) + { ++ bfd_size_type len; ++ + rawptr = raw_armap + i; + carsyms->file_offset = swap ((bfd_byte *) rawptr); + carsyms->name = stringbase; +- stringbase += strlen (stringbase) + 1; ++ /* PR 17512: file: 4a1d50c1. */ ++ len = strnlen (stringbase, stringsize); ++ if (len < stringsize) ++ len ++; ++ stringbase += len; ++ stringsize -= len; + carsyms++; + } + *stringbase = 0; +@@ -1131,6 +1141,7 @@ bfd_slurp_armap (bfd *abfd) + return FALSE; + if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0) + return FALSE; ++ extname[20] = 0; + if (CONST_STRNEQ (extname, "__.SYMDEF SORTED") + || CONST_STRNEQ (extname, "__.SYMDEF")) + return do_slurp_bsd_armap (abfd); +@@ -1964,6 +1975,9 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf) + } + + hdr = arch_hdr (abfd); ++ /* PR 17512: file: 3d9e9fe9. */ ++ if (hdr == NULL) ++ return -1; + + #define foo(arelt, stelt, size) \ + buf->stelt = strtol (hdr->arelt, &aloser, size); \ +diff --git a/bfd/archive64.c b/bfd/archive64.c +index 6b87ec5..9d29b90 100644 +--- a/bfd/archive64.c ++++ b/bfd/archive64.c +@@ -46,6 +46,7 @@ bfd_elf64_archive_slurp_armap (bfd *abfd) + struct areltdata *mapdata; + bfd_byte int_buf[8]; + char *stringbase; ++ char *stringend; + bfd_byte *raw_armap = NULL; + carsym *carsyms; + bfd_size_type amt; +@@ -92,11 +93,18 @@ bfd_elf64_archive_slurp_armap (bfd *abfd) + ptrsize = 8 * nsymz; + + amt = carsym_size + stringsize + 1; ++ if (carsym_size < nsymz || ptrsize < nsymz || amt < nsymz) ++ { ++ bfd_set_error (bfd_error_malformed_archive); ++ return FALSE; ++ } + ardata->symdefs = (struct carsym *) bfd_zalloc (abfd, amt); + if (ardata->symdefs == NULL) + return FALSE; + carsyms = ardata->symdefs; + stringbase = ((char *) ardata->symdefs) + carsym_size; ++ stringbase[stringsize] = 0; ++ stringend = stringbase + stringsize; + + raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize); + if (raw_armap == NULL) +@@ -114,7 +122,8 @@ bfd_elf64_archive_slurp_armap (bfd *abfd) + { + carsyms->file_offset = bfd_getb64 (raw_armap + i * 8); + carsyms->name = stringbase; +- stringbase += strlen (stringbase) + 1; ++ if (stringbase < stringend) ++ stringbase += strlen (stringbase) + 1; + ++carsyms; + } + *stringbase = '\0'; +diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h +index 1f80a76..1607872 100644 +--- a/bfd/bfd-in.h ++++ b/bfd/bfd-in.h +@@ -292,10 +292,13 @@ typedef struct bfd_section *sec_ptr; + + #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) + ++#define bfd_get_section_limit_octets(bfd, sec) \ ++ ((bfd)->direction != write_direction && (sec)->rawsize != 0 \ ++ ? (sec)->rawsize : (sec)->size) ++ + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ +- (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +- ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) ++ (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) + + /* Return TRUE if input section SEC has been discarded. */ + #define discarded_section(sec) \ +diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h +index c7a2bb5..bca5181 100644 +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -299,10 +299,13 @@ typedef struct bfd_section *sec_ptr; + + #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) + ++#define bfd_get_section_limit_octets(bfd, sec) \ ++ ((bfd)->direction != write_direction && (sec)->rawsize != 0 \ ++ ? (sec)->rawsize : (sec)->size) ++ + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ +- (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +- ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) ++ (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) + + /* Return TRUE if input section SEC has been discarded. */ + #define discarded_section(sec) \ +diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c +index 5ec48c9..10123d3 100644 +--- a/bfd/coff-h8300.c ++++ b/bfd/coff-h8300.c +@@ -337,7 +337,7 @@ rtype2howto (arelent *internal, struct internal_reloc *dst) + internal->howto = howto_table + 19; + break; + default: +- abort (); ++ internal->howto = NULL; + break; + } + } +diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c +index 574f956..b6a996e 100644 +--- a/bfd/coff-h8500.c ++++ b/bfd/coff-h8500.c +@@ -95,7 +95,7 @@ rtype2howto (arelent * internal, struct internal_reloc *dst) + switch (dst->r_type) + { + default: +- abort (); ++ internal->howto = NULL; + break; + case R_H8500_IMM8: + internal->howto = &r_imm8; +diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c +index 341183f..338ec75 100644 +--- a/bfd/coff-i860.c ++++ b/bfd/coff-i860.c +@@ -467,7 +467,10 @@ static reloc_howto_type howto_table[] = + FIXME: This macro refers to symbols and asect; these are from the + calling function, not the macro arguments. */ + +-#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) ++/* PR 17512: file: 0a38fb7c ++ Set an addend value, even if it is not going to be used. A tool ++ like coffdump might be used to print out the contents of the reloc. */ ++#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) (cache_ptr)->addend = 0 + + /* We use the special COFF backend linker. */ + #define coff_relocate_section _bfd_coff_generic_relocate_section +diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c +index f7089a6..5ebf52c 100644 +--- a/bfd/coff-m68k.c ++++ b/bfd/coff-m68k.c +@@ -143,6 +143,7 @@ m68k_rtype2howto (arelent *internal, int relocentry) + case R_PCRWORD: internal->howto = m68kcoff_howto_table + 4; break; + case R_PCRLONG: internal->howto = m68kcoff_howto_table + 5; break; + case R_RELLONG_NEG: internal->howto = m68kcoff_howto_table + 6; break; ++ default: internal->howto = NULL; break; + } + } + +diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c +index 7dad44f..9f30cfc 100644 +--- a/bfd/coff-mcore.c ++++ b/bfd/coff-mcore.c +@@ -273,16 +273,15 @@ mcore_coff_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, + } + #undef HOW2MAP + ++#define NUM_HOWTOS NUM_ELEM (mcore_coff_howto_table) ++ + static reloc_howto_type * + mcore_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) + { + unsigned int i; + +- for (i = 0; +- i < (sizeof (mcore_coff_howto_table) +- / sizeof (mcore_coff_howto_table[0])); +- i++) ++ for (i = 0; i < NUM_HOWTOS; i++) + if (mcore_coff_howto_table[i].name != NULL + && strcasecmp (mcore_coff_howto_table[i].name, r_name) == 0) + return &mcore_coff_howto_table[i]; +@@ -290,8 +289,11 @@ mcore_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + return NULL; + } + +-#define RTYPE2HOWTO(cache_ptr, dst) \ +- (cache_ptr)->howto = mcore_coff_howto_table + (dst)->r_type; ++#define RTYPE2HOWTO(cache_ptr, dst) \ ++ ((cache_ptr)->howto = \ ++ ((dst)->r_type < NUM_HOWTOS \ ++ ? mcore_coff_howto_table + (dst)->r_type \ ++ : NULL)) + + static reloc_howto_type * + coff_mcore_rtype_to_howto (bfd * abfd ATTRIBUTE_UNUSED, +@@ -303,7 +305,7 @@ coff_mcore_rtype_to_howto (bfd * abfd ATTRIBUTE_UNUSED, + { + reloc_howto_type * howto; + +- if (rel->r_type >= NUM_ELEM (mcore_coff_howto_table)) ++ if (rel->r_type >= NUM_HOWTOS) + return NULL; + + howto = mcore_coff_howto_table + rel->r_type; +diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c +index 031dcd0..21d9933 100644 +--- a/bfd/coff-sparc.c ++++ b/bfd/coff-sparc.c +@@ -74,7 +74,7 @@ bfd_coff_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, + + static reloc_howto_type coff_sparc_howto_table[] = + { +- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), ++ HOWTO(R_SPARC_NONE, 0,3, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", FALSE,0,0x000000ff,TRUE), + HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE), + HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", FALSE,0,0xffffffff,TRUE), +diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c +index 740c82c..ab95308 100644 +--- a/bfd/coff-tic30.c ++++ b/bfd/coff-tic30.c +@@ -136,7 +136,7 @@ rtype2howto (arelent *internal, struct internal_reloc *dst) + internal->howto = &tic30_coff_howto_table[4]; + break; + default: +- abort (); ++ internal->howto = NULL; + break; + } + } +diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c +index f208730..d575f58 100644 +--- a/bfd/coff-w65.c ++++ b/bfd/coff-w65.c +@@ -42,6 +42,8 @@ static reloc_howto_type howto_table[] = + HOWTO (R_W65_DP, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "dp", TRUE, 0x000000ff, 0x000000ff, FALSE), + }; + ++#define NUM_HOWTOS (sizeof (howto_table) / sizeof (howto_table[0])) ++ + /* Turn a howto into a reloc number. */ + + #define SELECT_RELOC(x,howto) \ +@@ -61,7 +63,7 @@ static reloc_howto_type howto_table[] = + static int + select_reloc (reloc_howto_type *howto) + { +- return howto->type ; ++ return howto->type; + } + + /* Code to turn a r_type into a howto ptr, uses the above howto table. */ +@@ -70,7 +72,10 @@ static void + rtype2howto (arelent *internal, + struct internal_reloc *dst) + { +- internal->howto = howto_table + dst->r_type - 1; ++ if (dst->r_type > 0 && dst->r_type <= NUM_HOWTOS) ++ internal->howto = howto_table + dst->r_type - 1; ++ else ++ internal->howto = NULL; + } + + #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) +diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c +index d5481b8..b754815 100644 +--- a/bfd/coff-we32k.c ++++ b/bfd/coff-we32k.c +@@ -53,14 +53,19 @@ static reloc_howto_type howto_table[] = + HOWTO(R_PCRLONG, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE, 0xffffffff,0xffffffff, FALSE), + }; + ++#define NUM_HOWTOS (sizeof (howto_table) / sizeof (howto_table[0])) ++ + /* Turn a howto into a reloc nunmber */ + + #define SELECT_RELOC(x,howto) { x.r_type = howto->type; } + #define BADMAG(x) WE32KBADMAG(x) + #define WE32K 1 + +-#define RTYPE2HOWTO(cache_ptr, dst) \ +- (cache_ptr)->howto = howto_table + (dst)->r_type; ++#define RTYPE2HOWTO(cache_ptr, dst) \ ++ ((cache_ptr)->howto = \ ++ ((dst)->r_type < NUM_HOWTOS \ ++ ? howto_table + (dst)->r_type \ ++ : NULL)) + + #ifndef bfd_pe_print_pdata + #define bfd_pe_print_pdata NULL +diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c +index 2a21bb8..742adc2 100644 +--- a/bfd/coff-x86_64.c ++++ b/bfd/coff-x86_64.c +@@ -143,6 +143,16 @@ coff_amd64_reloc (bfd *abfd, + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + ++ /* FIXME: We do not have an end address for data, so we cannot ++ accurately range check any addresses computed against it. ++ cf: PR binutils/17512: file: 1085-1761-0.004. ++ For now we do the best that we can. */ ++ if (addr < (unsigned char *) data || addr > ((unsigned char *) data) + input_section->size) ++ { ++ bfd_set_error (bfd_error_bad_value); ++ return bfd_reloc_notsupported; ++ } ++ + switch (howto->size) + { + case 0: +@@ -177,7 +187,8 @@ coff_amd64_reloc (bfd *abfd, + break; + + default: +- abort (); ++ bfd_set_error (bfd_error_bad_value); ++ return bfd_reloc_notsupported; + } + } + +diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c +index 7b62cdf..fd68b12 100644 +--- a/bfd/coff-z80.c ++++ b/bfd/coff-z80.c +@@ -81,7 +81,7 @@ rtype2howto (arelent *internal, struct internal_reloc *dst) + switch (dst->r_type) + { + default: +- abort (); ++ internal->howto = NULL; + break; + case R_IMM8: + internal->howto = &r_imm8; +diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c +index c85713f..7f67ee8 100644 +--- a/bfd/coff-z8k.c ++++ b/bfd/coff-z8k.c +@@ -85,7 +85,7 @@ rtype2howto (arelent *internal, struct internal_reloc *dst) + switch (dst->r_type) + { + default: +- abort (); ++ internal->howto = NULL; + break; + case R_IMM8: + internal->howto = &r_imm8; +diff --git a/bfd/coffcode.h b/bfd/coffcode.h +index 9990b16..2b1c3d0 100644 +--- a/bfd/coffcode.h ++++ b/bfd/coffcode.h +@@ -1009,6 +1009,13 @@ handle_COMDAT (bfd * abfd, + + seen_state = 1; + ++ /* PR 17512: file: e2cfe54f. */ ++ if (esym + bfd_coff_symesz (abfd) >= esymend) ++ { ++ _bfd_error_handler (_("%B: warning: No symbol for section '%s' found"), ++ abfd, symname); ++ break; ++ } + /* This is the section symbol. */ + bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)), + isym.n_type, isym.n_sclass, +@@ -1162,7 +1169,7 @@ styp_to_sec_flags (bfd *abfd, + flagword *flags_ptr) + { + struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; +- long styp_flags = internal_s->s_flags; ++ unsigned long styp_flags = internal_s->s_flags; + flagword sec_flags; + bfd_boolean result = TRUE; + bfd_boolean is_dbg = FALSE; +@@ -1185,7 +1192,7 @@ styp_to_sec_flags (bfd *abfd, + /* Process each flag bit in styp_flags in turn. */ + while (styp_flags) + { +- long flag = styp_flags & - styp_flags; ++ unsigned long flag = styp_flags & - styp_flags; + char * unhandled = NULL; + + styp_flags &= ~ flag; +@@ -2073,7 +2080,11 @@ coff_mkobject_hook (bfd * abfd, + #endif + + if ((internal_f->f_flags & F_GO32STUB) != 0) +- coff->go32stub = (char *) bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE); ++ { ++ coff->go32stub = (char *) bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE); ++ if (coff->go32stub == NULL) ++ return NULL; ++ } + if (coff->go32stub != NULL) + memcpy (coff->go32stub, internal_f->go32stub, GO32_STUBSIZE); + +@@ -2278,6 +2289,8 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr) + bfd_size_type amt = bfd_coff_symesz (abfd); + + buf = bfd_malloc (amt); ++ if (buf == NULL) ++ return FALSE; + if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 + || bfd_bread (buf, amt, abfd) != amt) + { +@@ -2666,10 +2679,16 @@ coff_write_relocs (bfd * abfd, int first_undef) + amt = s->reloc_count; + amt *= sizeof (arelent *); + p = bfd_malloc (amt); +- if (p == NULL && s->reloc_count > 0) +- return FALSE; +- memcpy (p, s->orelocation, (size_t) amt); +- qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); ++ if (p == NULL) ++ { ++ if (s->reloc_count > 0) ++ return FALSE; ++ } ++ else ++ { ++ memcpy (p, s->orelocation, (size_t) amt); ++ qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); ++ } + } + #endif + +@@ -3151,6 +3170,15 @@ coff_compute_section_file_positions (bfd * abfd) + This repairs 'ld -r' for arm-wince-pe target. */ + if (page_size == 0) + page_size = 1; ++ ++ /* PR 17512: file: 0ac816d3. */ ++ if (page_size < 0) ++ { ++ bfd_set_error (bfd_error_file_too_big); ++ (*_bfd_error_handler) ++ (_("%B: page size is too large (0x%x)"), abfd, page_size); ++ return FALSE; ++ } + } + else + page_size = PE_DEF_FILE_ALIGNMENT; +@@ -4526,6 +4554,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + unsigned int nbr_func; + LINENO *src; + bfd_boolean have_func; ++ bfd_boolean ret = TRUE; + + BFD_ASSERT (asect->lineno == NULL); + +@@ -4575,6 +4604,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + (_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), + abfd, (long) symndx, counter); + cache_ptr->line_number = -1; ++ ret = FALSE; + continue; + } + +@@ -4587,6 +4617,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + (_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), + abfd, (long) symndx, counter); + cache_ptr->line_number = -1; ++ ret = FALSE; + continue; + } + sym = (coff_symbol_type *) (ent->u.syment._n._n_n._n_zeroes); +@@ -4599,6 +4630,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + (_("%B: warning: illegal symbol in line number entry %d"), + abfd, counter); + cache_ptr->line_number = -1; ++ ret = FALSE; + continue; + } + +@@ -4678,11 +4710,15 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + + memcpy (lineno_cache, n_lineno_cache, amt); + } ++ else ++ ret = FALSE; + bfd_release (abfd, func_table); + } ++ else ++ ret = FALSE; + } + +- return TRUE; ++ return ret; + } + + /* Slurp in the symbol table, converting it to generic form. Note +@@ -4697,6 +4733,7 @@ coff_slurp_symbol_table (bfd * abfd) + unsigned int *table_ptr; + bfd_size_type amt; + unsigned int number_of_symbols = 0; ++ bfd_boolean ret = TRUE; + + if (obj_symbols (abfd)) + return TRUE; +@@ -5012,13 +5049,14 @@ coff_slurp_symbol_table (bfd * abfd) + #if defined(TIC80COFF) || defined(TICOFF) + case C_UEXT: /* Tentative external definition. */ + #endif +- case C_EXTLAB: /* External load time label. */ +- case C_HIDDEN: /* Ext symbol in dmert public lib. */ + default: + (*_bfd_error_handler) + (_("%B: Unrecognized storage class %d for %s symbol `%s'"), + abfd, src->u.syment.n_sclass, + dst->symbol.section->name, dst->symbol.name); ++ ret = FALSE; ++ case C_EXTLAB: /* External load time label. */ ++ case C_HIDDEN: /* Ext symbol in dmert public lib. */ + dst->symbol.flags = BSF_DEBUGGING; + dst->symbol.value = (src->u.syment.n_value); + break; +@@ -5046,12 +5084,13 @@ coff_slurp_symbol_table (bfd * abfd) + p = abfd->sections; + while (p) + { +- coff_slurp_line_table (abfd, p); ++ if (! coff_slurp_line_table (abfd, p)) ++ return FALSE; + p = p->next; + } + } + +- return TRUE; ++ return ret; + } + + /* Classify a COFF symbol. A couple of targets have globally visible +@@ -5310,7 +5349,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) + static reloc_howto_type * + coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, +- struct internal_reloc *rel, ++ struct internal_reloc *rel ATTRIBUTE_UNUSED, + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, + struct internal_syment *sym ATTRIBUTE_UNUSED, + bfd_vma *addendp ATTRIBUTE_UNUSED) +diff --git a/bfd/coffgen.c b/bfd/coffgen.c +index a22f67a..d071d8a 100644 +--- a/bfd/coffgen.c ++++ b/bfd/coffgen.c +@@ -146,8 +146,9 @@ make_a_section_from_file (bfd *abfd, + /* Compress/decompress DWARF debug sections with names: .debug_* and + .zdebug_*, after the section flags is set. */ + if ((flags & SEC_DEBUGGING) ++ && strlen (name) > 7 + && ((name[1] == 'd' && name[6] == '_') +- || (name[1] == 'z' && name[7] == '_'))) ++ || (strlen (name) > 8 && name[1] == 'z' && name[7] == '_'))) + { + enum { nothing, compress, decompress } action = nothing; + char *new_name = NULL; +@@ -365,6 +366,10 @@ coff_object_p (bfd *abfd) + bfd_release (abfd, opthdr); + return NULL; + } ++ /* PR 17512: file: 11056-1136-0.004. */ ++ if (internal_f.f_opthdr < aoutsz) ++ memset (((char *) opthdr) + internal_f.f_opthdr, 0, aoutsz - internal_f.f_opthdr); ++ + bfd_coff_swap_aouthdr_in (abfd, opthdr, (void *) &internal_a); + bfd_release (abfd, opthdr); + } +@@ -463,7 +468,10 @@ _bfd_coff_internal_syment_name (bfd *abfd, + if (strings == NULL) + return NULL; + } +- if (sym->_n._n_n._n_offset >= obj_coff_strings_len (abfd)) ++ /* PR 17910: Only check for string overflow if the length has been set. ++ Some DLLs, eg those produced by Visual Studio, may not set the length field. */ ++ if (obj_coff_strings_len (abfd) > 0 ++ && sym->_n._n_n._n_offset >= obj_coff_strings_len (abfd)) + return NULL; + return strings + sym->_n._n_n._n_offset; + } +@@ -760,8 +768,9 @@ coff_renumber_symbols (bfd *bfd_ptr, int *first_undef) + + for (symbol_index = 0; symbol_index < symbol_count; symbol_index++) + { +- coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); ++ coff_symbol_type *coff_symbol_ptr; + ++ coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); + symbol_ptr_ptr[symbol_index]->udata.i = symbol_index; + if (coff_symbol_ptr && coff_symbol_ptr->native) + { +@@ -805,9 +814,9 @@ coff_mangle_symbols (bfd *bfd_ptr) + + for (symbol_index = 0; symbol_index < symbol_count; symbol_index++) + { +- coff_symbol_type *coff_symbol_ptr = +- coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); ++ coff_symbol_type *coff_symbol_ptr; + ++ coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); + if (coff_symbol_ptr && coff_symbol_ptr->native) + { + int i; +@@ -1711,15 +1720,15 @@ _bfd_coff_read_string_table (bfd *abfd) + } + + strings = (char *) bfd_malloc (strsize + 1); ++ if (strings == NULL) ++ return NULL; ++ + /* PR 17521 file: 079-54929-0.004. + A corrupt file could contain an index that points into the first + STRING_SIZE_SIZE bytes of the string table, so make sure that + they are zero. */ + memset (strings, 0, STRING_SIZE_SIZE); + +- if (strings == NULL) +- return NULL; +- + if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd) + != strsize - STRING_SIZE_SIZE) + { +@@ -1808,6 +1817,16 @@ coff_get_normalized_symtab (bfd *abfd) + symbol_ptr = internal_ptr; + internal_ptr->is_sym = TRUE; + ++ /* PR 17512: file: 1353-1166-0.004. */ ++ if (symbol_ptr->u.syment.n_sclass == C_FILE ++ && symbol_ptr->u.syment.n_numaux > 0 ++ && raw_src + symesz + symbol_ptr->u.syment.n_numaux ++ * symesz > raw_end) ++ { ++ bfd_release (abfd, internal); ++ return NULL; ++ } ++ + for (i = 0; + i < symbol_ptr->u.syment.n_numaux; + i++) +@@ -1815,7 +1834,10 @@ coff_get_normalized_symtab (bfd *abfd) + internal_ptr++; + /* PR 17512: Prevent buffer overrun. */ + if (internal_ptr >= internal_end) +- return NULL; ++ { ++ bfd_release (abfd, internal); ++ return NULL; ++ } + + raw_src += symesz; + bfd_coff_swap_aux_in (abfd, (void *) raw_src, +@@ -1823,6 +1845,7 @@ coff_get_normalized_symtab (bfd *abfd) + symbol_ptr->u.syment.n_sclass, + (int) i, symbol_ptr->u.syment.n_numaux, + &(internal_ptr->u.auxent)); ++ + internal_ptr->is_sym = FALSE; + coff_pointerize_aux (abfd, internal, symbol_ptr, i, + internal_ptr); +diff --git a/bfd/cofflink.c b/bfd/cofflink.c +index 2782795..ef9e362 100644 +--- a/bfd/cofflink.c ++++ b/bfd/cofflink.c +@@ -2789,7 +2789,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd, + + size = bfd_get_reloc_size (howto); + buf = (bfd_byte *) bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + + rstat = _bfd_relocate_contents (howto, output_bfd, +diff --git a/bfd/compress.c b/bfd/compress.c +index 20eef95..6a87258 100644 +--- a/bfd/compress.c ++++ b/bfd/compress.c +@@ -239,6 +239,8 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + #endif + + case COMPRESS_SECTION_DONE: ++ if (sec->contents == NULL) ++ return FALSE; + if (p == NULL) + { + p = (bfd_byte *) bfd_malloc (sz); +@@ -246,7 +248,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + return FALSE; + *ptr = p; + } +- memcpy (p, sec->contents, sz); ++ /* PR 17512; file: 5bc29788. */ ++ if (p != sec->contents) ++ memcpy (p, sec->contents, sz); + return TRUE; + + default: +diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c +index 55ee030..cee72b3 100644 +--- a/bfd/cpu-ns32k.c ++++ b/bfd/cpu-ns32k.c +@@ -585,8 +585,9 @@ _bfd_do_ns32k_reloc_contents (reloc_howto_type *howto, + switch (size) + { + default: +- case 0: + abort (); ++ case 0: ++ return bfd_reloc_ok; + case 1: + case 2: + case 4: +diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog +index e2987ed..396cee4 100644 +--- a/bfd/doc/ChangeLog ++++ b/bfd/doc/ChangeLog +@@ -1,3 +1,24 @@ ++2015-06-21 Alan Modra ++ ++ * Makefile.am: Expand $<. ++ * Makefile.in: Regenerate. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2015-01-12 Bernd Edlinger ++ Alan Modra ++ PR 17817 ++ * Makefile.am (aoutx.stamp): cp -p $srcdir/aoutx.texi to keep ++ timestamps so that makeinfo need not be installed. ++ (archive.stamp, archures.stamp, bfdt.stamp, cache.stamp, ++ coffcode.stamp, core.stamp, elf.stamp, elfcode.stamp, mmo.stamp, ++ format.stamp, libbfd.stamp, bfdio.stamp, bfdwin.stamp, ++ opncls.stamp, reloc.stamp, section.stamp, syms.stamp, targets.stamp, ++ init.stamp, hash.stamp, linker.stamp): Similarly. ++ (bfdver.texi): Use test rather than [ ] in commands. ++ * Makefile.in: Regenerate. ++ + 2014-08-05 Doug Evans + + * chew.c (skip_past_newline_1): New function. +diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am +index 3f69859..c4f9d61 100644 +--- a/bfd/doc/Makefile.am ++++ b/bfd/doc/Makefile.am +@@ -96,19 +96,22 @@ protos: libbfd.h libcoff.h bfd.h + + aoutx.texi: aoutx.stamp ; @true + aoutx.stamp: $(srcdir)/../aoutx.h $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >aoutx.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../aoutx.h >aoutx.tmp ++ test -e aoutx.texi || test ! -f $(srcdir)/aoutx.texi || cp -p $(srcdir)/aoutx.texi . + $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi + touch $@ + + archive.texi: archive.stamp ; @true + archive.stamp: $(srcdir)/../archive.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >archive.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archive.c >archive.tmp ++ test -e archive.texi || test ! -f $(srcdir)/archive.texi || cp -p $(srcdir)/archive.texi . + $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi + touch $@ + + archures.texi: archures.stamp ; @true + archures.stamp: $(srcdir)/../archures.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >archures.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp ++ test -e archures.texi || test ! -f $(srcdir)/archures.texi || cp -p $(srcdir)/archures.texi . + $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi + touch $@ + +@@ -116,115 +119,134 @@ archures.stamp: $(srcdir)/../archures.c $(srcdir)/doc.str $(MKDOC) + # bfd.texinfo on an 8.3 filesystem. + bfdt.texi: bfdt.stamp ; @true + bfdt.stamp: $(srcdir)/../bfd.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >bfd.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp ++ test -e bfdt.texi || test ! -f $(srcdir)/bfdt.texi || cp -p $(srcdir)/bfdt.texi . + $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi + touch $@ + + cache.texi: cache.stamp ; @true + cache.stamp: $(srcdir)/../cache.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >cache.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp ++ test -e cache.texi || test ! -f $(srcdir)/cache.texi || cp -p $(srcdir)/cache.texi . + $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi + touch $@ + + coffcode.texi: coffcode.stamp ; @true + coffcode.stamp: $(srcdir)/../coffcode.h $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >coffcode.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../coffcode.h >coffcode.tmp ++ test -e coffcode.texi || test ! -f $(srcdir)/coffcode.texi || cp -p $(srcdir)/coffcode.texi . + $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi + touch $@ + + core.texi: core.stamp ; @true + core.stamp: $(srcdir)/../corefile.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >core.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../corefile.c >core.tmp ++ test -e core.texi || test ! -f $(srcdir)/core.texi || cp -p $(srcdir)/core.texi . + $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi + touch $@ + + elf.texi: elf.stamp ; @true + elf.stamp: $(srcdir)/../elf.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >elf.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../elf.c >elf.tmp ++ test -e elf.texi || test ! -f $(srcdir)/elf.texi || cp -p $(srcdir)/elf.texi . + $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi + touch $@ + + elfcode.texi: elfcode.stamp ; @true + elfcode.stamp: $(srcdir)/../elfcode.h $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >elfcode.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../elfcode.h >elfcode.tmp ++ test -e elfcode.texi || test ! -f $(srcdir)/elfcode.texi || cp -p $(srcdir)/elfcode.texi . + $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi + touch $@ + + mmo.texi: mmo.stamp ; @true + mmo.stamp: $(srcdir)/../mmo.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >mmo.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../mmo.c >mmo.tmp ++ test -e mmo.texi || test ! -f $(srcdir)/mmo.texi || cp -p $(srcdir)/mmo.texi . + $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi + touch $@ + + format.texi: format.stamp ; @true + format.stamp: $(srcdir)/../format.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >format.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../format.c >format.tmp ++ test -e format.texi || test ! -f $(srcdir)/format.texi || cp -p $(srcdir)/format.texi . + $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi + touch $@ + + libbfd.texi: libbfd.stamp ; @true + libbfd.stamp: $(srcdir)/../libbfd.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >libbfd.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp ++ test -e libbfd.texi || test ! -f $(srcdir)/libbfd.texi || cp -p $(srcdir)/libbfd.texi . + $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi + touch $@ + + bfdio.texi: bfdio.stamp ; @true + bfdio.stamp: $(srcdir)/../bfdio.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >bfdio.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp ++ test -e bfdio.texi || test ! -f $(srcdir)/bfdio.texi || cp -p $(srcdir)/bfdio.texi . + $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi + touch $@ + + bfdwin.texi: bfdwin.stamp ; @true + bfdwin.stamp: $(srcdir)/../bfdwin.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >bfdwin.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp ++ test -e bfdwin.texi || test ! -f $(srcdir)/bfdwin.texi || cp -p $(srcdir)/bfdwin.texi . + $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi + touch $@ + + opncls.texi: opncls.stamp ; @true + opncls.stamp: $(srcdir)/../opncls.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >opncls.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../opncls.c >opncls.tmp ++ test -e opncls.texi || test ! -f $(srcdir)/opncls.texi || cp -p $(srcdir)/opncls.texi . + $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi + touch $@ + + reloc.texi: reloc.stamp ; @true + reloc.stamp: $(srcdir)/../reloc.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >reloc.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../reloc.c >reloc.tmp ++ test -e reloc.texi || test ! -f $(srcdir)/reloc.texi || cp -p $(srcdir)/reloc.texi . + $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi + touch $@ + + section.texi: section.stamp ; @true + section.stamp: $(srcdir)/../section.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >section.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../section.c >section.tmp ++ test -e section.texi || test ! -f $(srcdir)/section.texi || cp -p $(srcdir)/section.texi . + $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi + touch $@ + + syms.texi: syms.stamp ; @true + syms.stamp: $(srcdir)/../syms.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >syms.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../syms.c >syms.tmp ++ test -e syms.texi || test ! -f $(srcdir)/syms.texi || cp -p $(srcdir)/syms.texi . + $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi + touch $@ + + targets.texi: targets.stamp ; @true + targets.stamp: $(srcdir)/../targets.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >targets.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../targets.c >targets.tmp ++ test -e targets.texi || test ! -f $(srcdir)/targets.texi || cp -p $(srcdir)/targets.texi . + $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi + touch $@ + + init.texi: init.stamp ; @true + init.stamp: $(srcdir)/../init.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >init.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../init.c >init.tmp ++ test -e init.texi || test ! -f $(srcdir)/init.texi || cp -p $(srcdir)/init.texi . + $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi + touch $@ + + hash.texi: hash.stamp ; @true + hash.stamp: $(srcdir)/../hash.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >hash.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../hash.c >hash.tmp ++ test -e hash.texi || test ! -f $(srcdir)/hash.texi || cp -p $(srcdir)/hash.texi . + $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi + touch $@ + + linker.texi: linker.stamp ; @true + linker.stamp: $(srcdir)/../linker.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >linker.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../linker.c >linker.tmp ++ test -e linker.texi || test ! -f $(srcdir)/linker.texi || cp -p $(srcdir)/linker.texi . + $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi + touch $@ + +@@ -316,11 +338,11 @@ bfd.h: $(BFD_H_DEP) + bfdver.texi: $(srcdir)/Makefile.in + @echo "creating $@"; \ + echo "@set VERSION $(VERSION)" > bfdver.texi; \ +- if [ -n "$(PKGVERSION)" ]; then \ ++ if test -n "$(PKGVERSION)"; then \ + echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \ + fi; \ + echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \ +- if [ -n "$(REPORT_BUGS_TEXI)" ]; then \ ++ if test -n "$(REPORT_BUGS_TEXI)"; then \ + echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \ + fi + +diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in +index 65ad42d..d194d3e 100644 +--- a/bfd/doc/Makefile.in ++++ b/bfd/doc/Makefile.in +@@ -795,19 +795,22 @@ protos: libbfd.h libcoff.h bfd.h + + aoutx.texi: aoutx.stamp ; @true + aoutx.stamp: $(srcdir)/../aoutx.h $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >aoutx.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../aoutx.h >aoutx.tmp ++ test -e aoutx.texi || test ! -f $(srcdir)/aoutx.texi || cp -p $(srcdir)/aoutx.texi . + $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi + touch $@ + + archive.texi: archive.stamp ; @true + archive.stamp: $(srcdir)/../archive.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >archive.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archive.c >archive.tmp ++ test -e archive.texi || test ! -f $(srcdir)/archive.texi || cp -p $(srcdir)/archive.texi . + $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi + touch $@ + + archures.texi: archures.stamp ; @true + archures.stamp: $(srcdir)/../archures.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >archures.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp ++ test -e archures.texi || test ! -f $(srcdir)/archures.texi || cp -p $(srcdir)/archures.texi . + $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi + touch $@ + +@@ -815,115 +818,134 @@ archures.stamp: $(srcdir)/../archures.c $(srcdir)/doc.str $(MKDOC) + # bfd.texinfo on an 8.3 filesystem. + bfdt.texi: bfdt.stamp ; @true + bfdt.stamp: $(srcdir)/../bfd.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >bfd.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp ++ test -e bfdt.texi || test ! -f $(srcdir)/bfdt.texi || cp -p $(srcdir)/bfdt.texi . + $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi + touch $@ + + cache.texi: cache.stamp ; @true + cache.stamp: $(srcdir)/../cache.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >cache.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp ++ test -e cache.texi || test ! -f $(srcdir)/cache.texi || cp -p $(srcdir)/cache.texi . + $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi + touch $@ + + coffcode.texi: coffcode.stamp ; @true + coffcode.stamp: $(srcdir)/../coffcode.h $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >coffcode.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../coffcode.h >coffcode.tmp ++ test -e coffcode.texi || test ! -f $(srcdir)/coffcode.texi || cp -p $(srcdir)/coffcode.texi . + $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi + touch $@ + + core.texi: core.stamp ; @true + core.stamp: $(srcdir)/../corefile.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >core.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../corefile.c >core.tmp ++ test -e core.texi || test ! -f $(srcdir)/core.texi || cp -p $(srcdir)/core.texi . + $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi + touch $@ + + elf.texi: elf.stamp ; @true + elf.stamp: $(srcdir)/../elf.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >elf.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../elf.c >elf.tmp ++ test -e elf.texi || test ! -f $(srcdir)/elf.texi || cp -p $(srcdir)/elf.texi . + $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi + touch $@ + + elfcode.texi: elfcode.stamp ; @true + elfcode.stamp: $(srcdir)/../elfcode.h $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >elfcode.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../elfcode.h >elfcode.tmp ++ test -e elfcode.texi || test ! -f $(srcdir)/elfcode.texi || cp -p $(srcdir)/elfcode.texi . + $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi + touch $@ + + mmo.texi: mmo.stamp ; @true + mmo.stamp: $(srcdir)/../mmo.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >mmo.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../mmo.c >mmo.tmp ++ test -e mmo.texi || test ! -f $(srcdir)/mmo.texi || cp -p $(srcdir)/mmo.texi . + $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi + touch $@ + + format.texi: format.stamp ; @true + format.stamp: $(srcdir)/../format.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >format.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../format.c >format.tmp ++ test -e format.texi || test ! -f $(srcdir)/format.texi || cp -p $(srcdir)/format.texi . + $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi + touch $@ + + libbfd.texi: libbfd.stamp ; @true + libbfd.stamp: $(srcdir)/../libbfd.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >libbfd.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp ++ test -e libbfd.texi || test ! -f $(srcdir)/libbfd.texi || cp -p $(srcdir)/libbfd.texi . + $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi + touch $@ + + bfdio.texi: bfdio.stamp ; @true + bfdio.stamp: $(srcdir)/../bfdio.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >bfdio.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp ++ test -e bfdio.texi || test ! -f $(srcdir)/bfdio.texi || cp -p $(srcdir)/bfdio.texi . + $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi + touch $@ + + bfdwin.texi: bfdwin.stamp ; @true + bfdwin.stamp: $(srcdir)/../bfdwin.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >bfdwin.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp ++ test -e bfdwin.texi || test ! -f $(srcdir)/bfdwin.texi || cp -p $(srcdir)/bfdwin.texi . + $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi + touch $@ + + opncls.texi: opncls.stamp ; @true + opncls.stamp: $(srcdir)/../opncls.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >opncls.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../opncls.c >opncls.tmp ++ test -e opncls.texi || test ! -f $(srcdir)/opncls.texi || cp -p $(srcdir)/opncls.texi . + $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi + touch $@ + + reloc.texi: reloc.stamp ; @true + reloc.stamp: $(srcdir)/../reloc.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >reloc.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../reloc.c >reloc.tmp ++ test -e reloc.texi || test ! -f $(srcdir)/reloc.texi || cp -p $(srcdir)/reloc.texi . + $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi + touch $@ + + section.texi: section.stamp ; @true + section.stamp: $(srcdir)/../section.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >section.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../section.c >section.tmp ++ test -e section.texi || test ! -f $(srcdir)/section.texi || cp -p $(srcdir)/section.texi . + $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi + touch $@ + + syms.texi: syms.stamp ; @true + syms.stamp: $(srcdir)/../syms.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >syms.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../syms.c >syms.tmp ++ test -e syms.texi || test ! -f $(srcdir)/syms.texi || cp -p $(srcdir)/syms.texi . + $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi + touch $@ + + targets.texi: targets.stamp ; @true + targets.stamp: $(srcdir)/../targets.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >targets.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../targets.c >targets.tmp ++ test -e targets.texi || test ! -f $(srcdir)/targets.texi || cp -p $(srcdir)/targets.texi . + $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi + touch $@ + + init.texi: init.stamp ; @true + init.stamp: $(srcdir)/../init.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >init.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../init.c >init.tmp ++ test -e init.texi || test ! -f $(srcdir)/init.texi || cp -p $(srcdir)/init.texi . + $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi + touch $@ + + hash.texi: hash.stamp ; @true + hash.stamp: $(srcdir)/../hash.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >hash.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../hash.c >hash.tmp ++ test -e hash.texi || test ! -f $(srcdir)/hash.texi || cp -p $(srcdir)/hash.texi . + $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi + touch $@ + + linker.texi: linker.stamp ; @true + linker.stamp: $(srcdir)/../linker.c $(srcdir)/doc.str $(MKDOC) +- ./$(MKDOC) -f $(srcdir)/doc.str < $< >linker.tmp ++ ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../linker.c >linker.tmp ++ test -e linker.texi || test ! -f $(srcdir)/linker.texi || cp -p $(srcdir)/linker.texi . + $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi + touch $@ + +@@ -970,11 +992,11 @@ bfd.h: $(BFD_H_DEP) + bfdver.texi: $(srcdir)/Makefile.in + @echo "creating $@"; \ + echo "@set VERSION $(VERSION)" > bfdver.texi; \ +- if [ -n "$(PKGVERSION)" ]; then \ ++ if test -n "$(PKGVERSION)"; then \ + echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \ + fi; \ + echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \ +- if [ -n "$(REPORT_BUGS_TEXI)" ]; then \ ++ if test -n "$(REPORT_BUGS_TEXI)"; then \ + echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \ + fi + +diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c +index 93236a6..2ba36fd 100644 +--- a/bfd/dwarf2.c ++++ b/bfd/dwarf2.c +@@ -222,6 +222,9 @@ struct comp_unit + /* The abbrev hash table. */ + struct abbrev_info **abbrevs; + ++ /* DW_AT_language. */ ++ int lang; ++ + /* Note that an error was found by comp_unit_find_nearest_line. */ + int error; + +@@ -553,83 +556,124 @@ read_section (bfd * abfd, + return TRUE; + } + +-/* VERBATIM +- The following function up to the END VERBATIM mark are +- copied directly from dwarf2read.c. */ +- + /* Read dwarf information from a buffer. */ + + static unsigned int +-read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) ++read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf, bfd_byte *end) + { ++ if (buf + 1 > end) ++ return 0; + return bfd_get_8 (abfd, buf); + } + + static int +-read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) ++read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf, bfd_byte *end) + { ++ if (buf + 1 > end) ++ return 0; + return bfd_get_signed_8 (abfd, buf); + } + + static unsigned int +-read_2_bytes (bfd *abfd, bfd_byte *buf) ++read_2_bytes (bfd *abfd, bfd_byte *buf, bfd_byte *end) + { ++ if (buf + 2 > end) ++ return 0; + return bfd_get_16 (abfd, buf); + } + + static unsigned int +-read_4_bytes (bfd *abfd, bfd_byte *buf) ++read_4_bytes (bfd *abfd, bfd_byte *buf, bfd_byte *end) + { ++ if (buf + 4 > end) ++ return 0; + return bfd_get_32 (abfd, buf); + } + + static bfd_uint64_t +-read_8_bytes (bfd *abfd, bfd_byte *buf) ++read_8_bytes (bfd *abfd, bfd_byte *buf, bfd_byte *end) + { ++ if (buf + 8 > end) ++ return 0; + return bfd_get_64 (abfd, buf); + } + + static bfd_byte * + read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, + bfd_byte *buf, ++ bfd_byte *end, + unsigned int size ATTRIBUTE_UNUSED) + { ++ if (buf + size > end) ++ return NULL; + return buf; + } + ++/* Scans a NUL terminated string starting at BUF, returning a pointer to it. ++ Returns the number of characters in the string, *including* the NUL byte, ++ in BYTES_READ_PTR. This value is set even if the function fails. Bytes ++ at or beyond BUF_END will not be read. Returns NULL if there was a ++ problem, or if the string is empty. */ ++ + static char * +-read_string (bfd *abfd ATTRIBUTE_UNUSED, +- bfd_byte *buf, +- unsigned int *bytes_read_ptr) ++read_string (bfd * abfd ATTRIBUTE_UNUSED, ++ bfd_byte * buf, ++ bfd_byte * buf_end, ++ unsigned int * bytes_read_ptr) + { +- /* Return a pointer to the embedded string. */ +- char *str = (char *) buf; ++ bfd_byte *str = buf; ++ ++ if (buf >= buf_end) ++ { ++ * bytes_read_ptr = 0; ++ return NULL; ++ } + + if (*str == '\0') + { +- *bytes_read_ptr = 1; ++ * bytes_read_ptr = 1; + return NULL; + } + +- *bytes_read_ptr = strlen (str) + 1; +- return str; ++ while (buf < buf_end) ++ if (* buf ++ == 0) ++ { ++ * bytes_read_ptr = buf - str; ++ return (char *) str; ++ } ++ ++ * bytes_read_ptr = buf - str; ++ return NULL; + } + +-/* END VERBATIM */ ++/* Reads an offset from BUF and then locates the string at this offset ++ inside the debug string section. Returns a pointer to the string. ++ Returns the number of bytes read from BUF, *not* the length of the string, ++ in BYTES_READ_PTR. This value is set even if the function fails. Bytes ++ at or beyond BUF_END will not be read from BUF. Returns NULL if there was ++ a problem, or if the string is empty. Does not check for NUL termination ++ of the string. */ + + static char * + read_indirect_string (struct comp_unit * unit, + bfd_byte * buf, ++ bfd_byte * buf_end, + unsigned int * bytes_read_ptr) + { + bfd_uint64_t offset; + struct dwarf2_debug *stash = unit->stash; + char *str; + ++ if (buf + unit->offset_size > buf_end) ++ { ++ * bytes_read_ptr = 0; ++ return NULL; ++ } ++ + if (unit->offset_size == 4) +- offset = read_4_bytes (unit->abfd, buf); ++ offset = read_4_bytes (unit->abfd, buf, buf_end); + else +- offset = read_8_bytes (unit->abfd, buf); ++ offset = read_8_bytes (unit->abfd, buf, buf_end); + + *bytes_read_ptr = unit->offset_size; + +@@ -638,6 +682,8 @@ read_indirect_string (struct comp_unit * unit, + &stash->dwarf_str_buffer, &stash->dwarf_str_size)) + return NULL; + ++ if (offset >= stash->dwarf_str_size) ++ return NULL; + str = (char *) stash->dwarf_str_buffer + offset; + if (*str == '\0') + return NULL; +@@ -651,16 +697,23 @@ read_indirect_string (struct comp_unit * unit, + static char * + read_alt_indirect_string (struct comp_unit * unit, + bfd_byte * buf, ++ bfd_byte * buf_end, + unsigned int * bytes_read_ptr) + { + bfd_uint64_t offset; + struct dwarf2_debug *stash = unit->stash; + char *str; + ++ if (buf + unit->offset_size > buf_end) ++ { ++ * bytes_read_ptr = 0; ++ return NULL; ++ } ++ + if (unit->offset_size == 4) +- offset = read_4_bytes (unit->abfd, buf); ++ offset = read_4_bytes (unit->abfd, buf, buf_end); + else +- offset = read_8_bytes (unit->abfd, buf); ++ offset = read_8_bytes (unit->abfd, buf, buf_end); + + *bytes_read_ptr = unit->offset_size; + +@@ -684,7 +737,7 @@ read_alt_indirect_string (struct comp_unit * unit, + } + stash->alt_bfd_ptr = debug_bfd; + } +- ++ + if (! read_section (unit->stash->alt_bfd_ptr, + stash->debug_sections + debug_str_alt, + NULL, /* FIXME: Do we need to load alternate symbols ? */ +@@ -693,6 +746,8 @@ read_alt_indirect_string (struct comp_unit * unit, + &stash->alt_dwarf_str_size)) + return NULL; + ++ if (offset >= stash->alt_dwarf_str_size) ++ return NULL; + str = (char *) stash->alt_dwarf_str_buffer + offset; + if (*str == '\0') + return NULL; +@@ -730,7 +785,7 @@ read_alt_indirect_ref (struct comp_unit * unit, + } + stash->alt_bfd_ptr = debug_bfd; + } +- ++ + if (! read_section (unit->stash->alt_bfd_ptr, + stash->debug_sections + debug_info_alt, + NULL, /* FIXME: Do we need to load alternate symbols ? */ +@@ -739,17 +794,22 @@ read_alt_indirect_ref (struct comp_unit * unit, + &stash->alt_dwarf_info_size)) + return NULL; + ++ if (offset >= stash->alt_dwarf_info_size) ++ return NULL; + return stash->alt_dwarf_info_buffer + offset; + } + + static bfd_uint64_t +-read_address (struct comp_unit *unit, bfd_byte *buf) ++read_address (struct comp_unit *unit, bfd_byte *buf, bfd_byte * buf_end) + { + int signed_vma = 0; + + if (bfd_get_flavour (unit->abfd) == bfd_target_elf_flavour) + signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma; + ++ if (buf + unit->addr_size > buf_end) ++ return 0; ++ + if (signed_vma) + { + switch (unit->addr_size) +@@ -812,6 +872,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) + { + struct abbrev_info **abbrevs; + bfd_byte *abbrev_ptr; ++ bfd_byte *abbrev_end; + struct abbrev_info *cur_abbrev; + unsigned int abbrev_number, bytes_read, abbrev_name; + unsigned int abbrev_form, hash_number; +@@ -822,13 +883,17 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) + &stash->dwarf_abbrev_buffer, &stash->dwarf_abbrev_size)) + return NULL; + ++ if (offset >= stash->dwarf_abbrev_size) ++ return NULL; ++ + amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE; + abbrevs = (struct abbrev_info **) bfd_zalloc (abfd, amt); + if (abbrevs == NULL) + return NULL; + + abbrev_ptr = stash->dwarf_abbrev_buffer + offset; +- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ abbrev_end = stash->dwarf_abbrev_buffer + stash->dwarf_abbrev_size; ++ abbrev_number = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; + + /* Loop until we reach an abbrev number of 0. */ +@@ -842,15 +907,15 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) + /* Read in abbrev header. */ + cur_abbrev->number = abbrev_number; + cur_abbrev->tag = (enum dwarf_tag) +- read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; +- cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr); ++ cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr, abbrev_end); + abbrev_ptr += 1; + + /* Now read in declarations. */ +- abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ abbrev_name = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; +- abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ abbrev_form = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; + + while (abbrev_name) +@@ -885,9 +950,9 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) + = (enum dwarf_attribute) abbrev_name; + cur_abbrev->attrs[cur_abbrev->num_attrs++].form + = (enum dwarf_form) abbrev_form; +- abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ abbrev_name = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; +- abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ abbrev_form = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; + } + +@@ -905,9 +970,9 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) + if ((unsigned int) (abbrev_ptr - stash->dwarf_abbrev_buffer) + >= stash->dwarf_abbrev_size) + break; +- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); ++ abbrev_number = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_ptr += bytes_read; +- if (lookup_abbrev (abbrev_number,abbrevs) != NULL) ++ if (lookup_abbrev (abbrev_number, abbrevs) != NULL) + break; + } + +@@ -922,19 +987,29 @@ is_str_attr (enum dwarf_form form) + return form == DW_FORM_string || form == DW_FORM_strp || form == DW_FORM_GNU_strp_alt; + } + +-/* Read an attribute value described by an attribute form. */ ++/* Read and fill in the value of attribute ATTR as described by FORM. ++ Read data starting from INFO_PTR, but never at or beyond INFO_PTR_END. ++ Returns an updated INFO_PTR taking into account the amount of data read. */ + + static bfd_byte * +-read_attribute_value (struct attribute *attr, +- unsigned form, +- struct comp_unit *unit, +- bfd_byte *info_ptr) ++read_attribute_value (struct attribute * attr, ++ unsigned form, ++ struct comp_unit * unit, ++ bfd_byte * info_ptr, ++ bfd_byte * info_ptr_end) + { + bfd *abfd = unit->abfd; + unsigned int bytes_read; + struct dwarf_block *blk; + bfd_size_type amt; + ++ if (info_ptr >= info_ptr_end) ++ { ++ (*_bfd_error_handler) (_("Dwarf Error: Info pointer extends beyond end of attributes")); ++ bfd_set_error (bfd_error_bad_value); ++ return info_ptr; ++ } ++ + attr->form = (enum dwarf_form) form; + + switch (form) +@@ -945,23 +1020,23 @@ read_attribute_value (struct attribute *attr, + if (unit->version == 3 || unit->version == 4) + { + if (unit->offset_size == 4) +- attr->u.val = read_4_bytes (unit->abfd, info_ptr); ++ attr->u.val = read_4_bytes (unit->abfd, info_ptr, info_ptr_end); + else +- attr->u.val = read_8_bytes (unit->abfd, info_ptr); ++ attr->u.val = read_8_bytes (unit->abfd, info_ptr, info_ptr_end); + info_ptr += unit->offset_size; + break; + } + /* FALLTHROUGH */ + case DW_FORM_addr: +- attr->u.val = read_address (unit, info_ptr); ++ attr->u.val = read_address (unit, info_ptr, info_ptr_end); + info_ptr += unit->addr_size; + break; + case DW_FORM_GNU_ref_alt: + case DW_FORM_sec_offset: + if (unit->offset_size == 4) +- attr->u.val = read_4_bytes (unit->abfd, info_ptr); ++ attr->u.val = read_4_bytes (unit->abfd, info_ptr, info_ptr_end); + else +- attr->u.val = read_8_bytes (unit->abfd, info_ptr); ++ attr->u.val = read_8_bytes (unit->abfd, info_ptr, info_ptr_end); + info_ptr += unit->offset_size; + break; + case DW_FORM_block2: +@@ -969,9 +1044,9 @@ read_attribute_value (struct attribute *attr, + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); + if (blk == NULL) + return NULL; +- blk->size = read_2_bytes (abfd, info_ptr); ++ blk->size = read_2_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 2; +- blk->data = read_n_bytes (abfd, info_ptr, blk->size); ++ blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); + info_ptr += blk->size; + attr->u.blk = blk; + break; +@@ -980,34 +1055,34 @@ read_attribute_value (struct attribute *attr, + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); + if (blk == NULL) + return NULL; +- blk->size = read_4_bytes (abfd, info_ptr); ++ blk->size = read_4_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 4; +- blk->data = read_n_bytes (abfd, info_ptr, blk->size); ++ blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); + info_ptr += blk->size; + attr->u.blk = blk; + break; + case DW_FORM_data2: +- attr->u.val = read_2_bytes (abfd, info_ptr); ++ attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 2; + break; + case DW_FORM_data4: +- attr->u.val = read_4_bytes (abfd, info_ptr); ++ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 4; + break; + case DW_FORM_data8: +- attr->u.val = read_8_bytes (abfd, info_ptr); ++ attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 8; + break; + case DW_FORM_string: +- attr->u.str = read_string (abfd, info_ptr, &bytes_read); ++ attr->u.str = read_string (abfd, info_ptr, info_ptr_end, &bytes_read); + info_ptr += bytes_read; + break; + case DW_FORM_strp: +- attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read); ++ attr->u.str = read_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read); + info_ptr += bytes_read; + break; + case DW_FORM_GNU_strp_alt: +- attr->u.str = read_alt_indirect_string (unit, info_ptr, &bytes_read); ++ attr->u.str = read_alt_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read); + info_ptr += bytes_read; + break; + case DW_FORM_exprloc: +@@ -1016,9 +1091,9 @@ read_attribute_value (struct attribute *attr, + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); + if (blk == NULL) + return NULL; +- blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ blk->size = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); + info_ptr += bytes_read; +- blk->data = read_n_bytes (abfd, info_ptr, blk->size); ++ blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); + info_ptr += blk->size; + attr->u.blk = blk; + break; +@@ -1027,59 +1102,59 @@ read_attribute_value (struct attribute *attr, + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); + if (blk == NULL) + return NULL; +- blk->size = read_1_byte (abfd, info_ptr); ++ blk->size = read_1_byte (abfd, info_ptr, info_ptr_end); + info_ptr += 1; +- blk->data = read_n_bytes (abfd, info_ptr, blk->size); ++ blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); + info_ptr += blk->size; + attr->u.blk = blk; + break; + case DW_FORM_data1: +- attr->u.val = read_1_byte (abfd, info_ptr); ++ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); + info_ptr += 1; + break; + case DW_FORM_flag: +- attr->u.val = read_1_byte (abfd, info_ptr); ++ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); + info_ptr += 1; + break; + case DW_FORM_flag_present: + attr->u.val = 1; + break; + case DW_FORM_sdata: +- attr->u.sval = read_signed_leb128 (abfd, info_ptr, &bytes_read); ++ attr->u.sval = safe_read_leb128 (abfd, info_ptr, &bytes_read, TRUE, info_ptr_end); + info_ptr += bytes_read; + break; + case DW_FORM_udata: +- attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ attr->u.val = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); + info_ptr += bytes_read; + break; + case DW_FORM_ref1: +- attr->u.val = read_1_byte (abfd, info_ptr); ++ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); + info_ptr += 1; + break; + case DW_FORM_ref2: +- attr->u.val = read_2_bytes (abfd, info_ptr); ++ attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 2; + break; + case DW_FORM_ref4: +- attr->u.val = read_4_bytes (abfd, info_ptr); ++ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 4; + break; + case DW_FORM_ref8: +- attr->u.val = read_8_bytes (abfd, info_ptr); ++ attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 8; + break; + case DW_FORM_ref_sig8: +- attr->u.val = read_8_bytes (abfd, info_ptr); ++ attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); + info_ptr += 8; + break; + case DW_FORM_ref_udata: +- attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ attr->u.val = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); + info_ptr += bytes_read; + break; + case DW_FORM_indirect: +- form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ form = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); + info_ptr += bytes_read; +- info_ptr = read_attribute_value (attr, form, unit, info_ptr); ++ 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."), +@@ -1093,16 +1168,44 @@ read_attribute_value (struct attribute *attr, + /* Read an attribute described by an abbreviated attribute. */ + + static bfd_byte * +-read_attribute (struct attribute *attr, +- struct attr_abbrev *abbrev, +- struct comp_unit *unit, +- bfd_byte *info_ptr) ++read_attribute (struct attribute * attr, ++ struct attr_abbrev * abbrev, ++ struct comp_unit * unit, ++ bfd_byte * info_ptr, ++ bfd_byte * info_ptr_end) + { + attr->name = abbrev->name; +- info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr); ++ info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr, info_ptr_end); + return info_ptr; + } + ++/* Return whether DW_AT_name will return the same as DW_AT_linkage_name ++ for a function. */ ++ ++static bfd_boolean ++non_mangled (int lang) ++{ ++ switch (lang) ++ { ++ default: ++ return FALSE; ++ ++ case DW_LANG_C89: ++ case DW_LANG_C: ++ case DW_LANG_Ada83: ++ case DW_LANG_Cobol74: ++ case DW_LANG_Cobol85: ++ case DW_LANG_Fortran77: ++ case DW_LANG_Pascal83: ++ case DW_LANG_C99: ++ case DW_LANG_Ada95: ++ case DW_LANG_PLI: ++ case DW_LANG_UPC: ++ case DW_LANG_C11: ++ return TRUE; ++ } ++} ++ + /* Source line information table routines. */ + + #define FILE_ALLOC_CHUNK 5 +@@ -1161,14 +1264,15 @@ struct funcinfo + struct funcinfo *caller_func; + /* Source location file name where caller_func inlines this func. */ + char *caller_file; +- /* Source location line number where caller_func inlines this func. */ +- int caller_line; + /* Source location file name. */ + char *file; ++ /* Source location line number where caller_func inlines this func. */ ++ int caller_line; + /* Source location line number. */ + int line; + int tag; +- char *name; ++ bfd_boolean is_linkage; ++ const char *name; + struct arange arange; + /* Where the symbol is defined. */ + asection *sec; +@@ -1356,7 +1460,11 @@ concat_filename (struct line_info_table *table, unsigned int file) + char *name; + size_t len; + +- if (table->files[file - 1].dir) ++ if (table->files[file - 1].dir ++ /* PR 17512: file: 0317e960. */ ++ && table->files[file - 1].dir <= table->num_dirs ++ /* PR 17512: file: 7f3d2e4b. */ ++ && table->dirs != NULL) + subdir_name = table->dirs[table->files[file - 1].dir - 1]; + + if (!subdir_name || !IS_ABSOLUTE_PATH (subdir_name)) +@@ -1577,27 +1685,47 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + + table->lcl_head = NULL; + ++ if (stash->dwarf_line_size < 16) ++ { ++ (*_bfd_error_handler) ++ (_("Dwarf Error: Line info section is too small (%ld)"), ++ (long) stash->dwarf_line_size); ++ bfd_set_error (bfd_error_bad_value); ++ return NULL; ++ } + line_ptr = stash->dwarf_line_buffer + unit->line_offset; ++ line_end = stash->dwarf_line_buffer + stash->dwarf_line_size; + + /* Read in the prologue. */ +- lh.total_length = read_4_bytes (abfd, line_ptr); ++ lh.total_length = read_4_bytes (abfd, line_ptr, line_end); + line_ptr += 4; + offset_size = 4; + if (lh.total_length == 0xffffffff) + { +- lh.total_length = read_8_bytes (abfd, line_ptr); ++ lh.total_length = read_8_bytes (abfd, line_ptr, line_end); + line_ptr += 8; + offset_size = 8; + } + else if (lh.total_length == 0 && unit->addr_size == 8) + { + /* Handle (non-standard) 64-bit DWARF2 formats. */ +- lh.total_length = read_4_bytes (abfd, line_ptr); ++ lh.total_length = read_4_bytes (abfd, line_ptr, line_end); + line_ptr += 4; + offset_size = 8; + } ++ ++ if (lh.total_length > stash->dwarf_line_size) ++ { ++ (*_bfd_error_handler) ++ (_("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); ++ return NULL; ++ } ++ + line_end = line_ptr + lh.total_length; +- lh.version = read_2_bytes (abfd, line_ptr); ++ ++ lh.version = read_2_bytes (abfd, line_ptr, line_end); + if (lh.version < 2 || lh.version > 4) + { + (*_bfd_error_handler) +@@ -1606,20 +1734,32 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + return NULL; + } + line_ptr += 2; ++ ++ if (line_ptr + offset_size + (lh.version >=4 ? 6 : 5) >= line_end) ++ { ++ (*_bfd_error_handler) ++ (_("Dwarf Error: Ran out of room reading prologue")); ++ bfd_set_error (bfd_error_bad_value); ++ return NULL; ++ } ++ + if (offset_size == 4) +- lh.prologue_length = read_4_bytes (abfd, line_ptr); ++ lh.prologue_length = read_4_bytes (abfd, line_ptr, line_end); + else +- lh.prologue_length = read_8_bytes (abfd, line_ptr); ++ lh.prologue_length = read_8_bytes (abfd, line_ptr, line_end); + line_ptr += offset_size; +- lh.minimum_instruction_length = read_1_byte (abfd, line_ptr); ++ ++ lh.minimum_instruction_length = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; ++ + if (lh.version >= 4) + { +- lh.maximum_ops_per_insn = read_1_byte (abfd, line_ptr); ++ lh.maximum_ops_per_insn = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; + } + else + lh.maximum_ops_per_insn = 1; ++ + if (lh.maximum_ops_per_insn == 0) + { + (*_bfd_error_handler) +@@ -1627,14 +1767,26 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + bfd_set_error (bfd_error_bad_value); + return NULL; + } +- lh.default_is_stmt = read_1_byte (abfd, line_ptr); ++ ++ lh.default_is_stmt = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; +- lh.line_base = read_1_signed_byte (abfd, line_ptr); ++ ++ lh.line_base = read_1_signed_byte (abfd, line_ptr, line_end); + line_ptr += 1; +- lh.line_range = read_1_byte (abfd, line_ptr); ++ ++ lh.line_range = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; +- lh.opcode_base = read_1_byte (abfd, line_ptr); ++ ++ lh.opcode_base = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; ++ ++ if (line_ptr + (lh.opcode_base - 1) >= line_end) ++ { ++ (*_bfd_error_handler) (_("Dwarf Error: Ran out of room reading opcodes")); ++ bfd_set_error (bfd_error_bad_value); ++ return NULL; ++ } ++ + amt = lh.opcode_base * sizeof (unsigned char); + lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt); + +@@ -1642,12 +1794,12 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + + for (i = 1; i < lh.opcode_base; ++i) + { +- lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr); ++ lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; + } + + /* Read directory table. */ +- while ((cur_dir = read_string (abfd, line_ptr, &bytes_read)) != NULL) ++ while ((cur_dir = read_string (abfd, line_ptr, line_end, &bytes_read)) != NULL) + { + line_ptr += bytes_read; + +@@ -1670,7 +1822,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + line_ptr += bytes_read; + + /* Read file name table. */ +- while ((cur_file = read_string (abfd, line_ptr, &bytes_read)) != NULL) ++ while ((cur_file = read_string (abfd, line_ptr, line_end, &bytes_read)) != NULL) + { + line_ptr += bytes_read; + +@@ -1689,13 +1841,11 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + + table->files[table->num_files].name = cur_file; + table->files[table->num_files].dir = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; +- table->files[table->num_files].time = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ table->files[table->num_files].time = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; +- table->files[table->num_files].size = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ table->files[table->num_files].size = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + table->num_files++; + } +@@ -1725,13 +1875,15 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + /* Decode the table. */ + while (! end_sequence) + { +- op_code = read_1_byte (abfd, line_ptr); ++ op_code = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; + + if (op_code >= lh.opcode_base) + { + /* Special operand. */ + adj_opcode = op_code - lh.opcode_base; ++ if (lh.line_range == 0) ++ goto line_fail; + if (lh.maximum_ops_per_insn == 1) + address += (adj_opcode / lh.line_range + * lh.minimum_instruction_length); +@@ -1757,9 +1909,9 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + else switch (op_code) + { + case DW_LNS_extended_op: +- exop_len = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ exop_len = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; +- extended_op = read_1_byte (abfd, line_ptr); ++ extended_op = read_1_byte (abfd, line_ptr, line_end); + line_ptr += 1; + + switch (extended_op) +@@ -1778,12 +1930,12 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + goto line_fail; + break; + case DW_LNE_set_address: +- address = read_address (unit, line_ptr); ++ address = read_address (unit, line_ptr, line_end); + op_index = 0; + line_ptr += unit->addr_size; + break; + case DW_LNE_define_file: +- cur_file = read_string (abfd, line_ptr, &bytes_read); ++ cur_file = read_string (abfd, line_ptr, line_end, &bytes_read); + line_ptr += bytes_read; + if ((table->num_files % FILE_ALLOC_CHUNK) == 0) + { +@@ -1798,19 +1950,19 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + } + table->files[table->num_files].name = cur_file; + table->files[table->num_files].dir = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + table->files[table->num_files].time = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + table->files[table->num_files].size = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + table->num_files++; + break; + case DW_LNE_set_discriminator: + discriminator = +- read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + break; + case DW_LNE_HP_source_file_correlation: +@@ -1839,12 +1991,12 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + case DW_LNS_advance_pc: + if (lh.maximum_ops_per_insn == 1) + address += (lh.minimum_instruction_length +- * read_unsigned_leb128 (abfd, line_ptr, +- &bytes_read)); ++ * safe_read_leb128 (abfd, line_ptr, &bytes_read, ++ FALSE, line_end)); + else + { +- bfd_vma adjust = read_unsigned_leb128 (abfd, line_ptr, +- &bytes_read); ++ bfd_vma adjust = safe_read_leb128 (abfd, line_ptr, &bytes_read, ++ FALSE, line_end); + address = ((op_index + adjust) / lh.maximum_ops_per_insn + * lh.minimum_instruction_length); + op_index = (op_index + adjust) % lh.maximum_ops_per_insn; +@@ -1852,7 +2004,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + line_ptr += bytes_read; + break; + case DW_LNS_advance_line: +- line += read_signed_leb128 (abfd, line_ptr, &bytes_read); ++ line += safe_read_leb128 (abfd, line_ptr, &bytes_read, TRUE, line_end); + line_ptr += bytes_read; + break; + case DW_LNS_set_file: +@@ -1861,7 +2013,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + + /* The file and directory tables are 0 + based, the references are 1 based. */ +- file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ file = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + if (filename) + free (filename); +@@ -1869,7 +2021,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + break; + } + case DW_LNS_set_column: +- column = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ column = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + break; + case DW_LNS_negate_stmt: +@@ -1891,7 +2043,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + } + break; + case DW_LNS_fixed_advance_pc: +- address += read_2_bytes (abfd, line_ptr); ++ address += read_2_bytes (abfd, line_ptr, line_end); + op_index = 0; + line_ptr += 2; + break; +@@ -1899,7 +2051,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) + /* Unknown standard opcode, ignore it. */ + for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++) + { +- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); ++ (void) safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); + line_ptr += bytes_read; + } + break; +@@ -1992,7 +2144,7 @@ read_debug_ranges (struct comp_unit *unit) + + /* Function table functions. */ + +-/* If ADDR is within UNIT's function tables, set FUNCTIONNAME_PTR, and return ++/* 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 + them being ordered in TABLE by increasing range. */ +@@ -2000,8 +2152,7 @@ read_debug_ranges (struct comp_unit *unit) + static bfd_boolean + lookup_address_in_function_table (struct comp_unit *unit, + bfd_vma addr, +- struct funcinfo **function_ptr, +- const char **functionname_ptr) ++ struct funcinfo **function_ptr) + { + struct funcinfo* each_func; + struct funcinfo* best_fit = NULL; +@@ -2030,14 +2181,10 @@ lookup_address_in_function_table (struct comp_unit *unit, + + if (best_fit) + { +- *functionname_ptr = best_fit->name; + *function_ptr = best_fit; + return TRUE; + } +- else +- { +- return FALSE; +- } ++ return FALSE; + } + + /* If SYM at ADDR is within function table of UNIT, set FILENAME_PTR +@@ -2128,10 +2275,12 @@ lookup_symbol_in_variable_table (struct comp_unit *unit, + + static char * + find_abstract_instance_name (struct comp_unit *unit, +- struct attribute *attr_ptr) ++ struct attribute *attr_ptr, ++ bfd_boolean *is_linkage) + { + bfd *abfd = unit->abfd; + bfd_byte *info_ptr; ++ bfd_byte *info_ptr_end; + unsigned int abbrev_number, bytes_read, i; + struct abbrev_info *abbrev; + bfd_uint64_t die_ref = attr_ptr->u.val; +@@ -2148,6 +2297,7 @@ find_abstract_instance_name (struct comp_unit *unit, + abort (); + + info_ptr = unit->sec_info_ptr + die_ref; ++ info_ptr_end = unit->end_ptr; + + /* Now find the CU containing this pointer. */ + if (info_ptr >= unit->info_ptr_unit && info_ptr < unit->end_ptr) +@@ -2179,15 +2329,20 @@ find_abstract_instance_name (struct comp_unit *unit, + (*_bfd_error_handler) + (_("Dwarf Error: Unable to read alt ref %u."), die_ref); + bfd_set_error (bfd_error_bad_value); +- return name; ++ return NULL; + } ++ info_ptr_end = unit->stash->alt_dwarf_info_buffer + unit->stash->alt_dwarf_info_size; ++ + /* FIXME: Do we need to locate the correct CU, in a similar + fashion to the code in the DW_FORM_ref_addr case above ? */ + } + else +- info_ptr = unit->info_ptr_unit + die_ref; ++ { ++ info_ptr = unit->info_ptr_unit + die_ref; ++ info_ptr_end = unit->end_ptr; ++ } + +- abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); + info_ptr += bytes_read; + + if (abbrev_number) +@@ -2204,7 +2359,7 @@ find_abstract_instance_name (struct comp_unit *unit, + for (i = 0; i < abbrev->num_attrs; ++i) + { + info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, +- info_ptr); ++ info_ptr, info_ptr_end); + if (info_ptr == NULL) + break; + switch (attr.name) +@@ -2213,17 +2368,24 @@ find_abstract_instance_name (struct comp_unit *unit, + /* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name + over DW_AT_name. */ + if (name == NULL && is_str_attr (attr.form)) +- name = attr.u.str; ++ { ++ name = attr.u.str; ++ if (non_mangled (unit->lang)) ++ *is_linkage = TRUE; ++ } + break; + case DW_AT_specification: +- name = find_abstract_instance_name (unit, &attr); ++ name = find_abstract_instance_name (unit, &attr, is_linkage); + break; + case DW_AT_linkage_name: + case DW_AT_MIPS_linkage_name: + /* PR 16949: Corrupt debug info can place + non-string forms into these attributes. */ + if (is_str_attr (attr.form)) +- name = attr.u.str; ++ { ++ name = attr.u.str; ++ *is_linkage = TRUE; ++ } + break; + default: + break; +@@ -2239,6 +2401,7 @@ read_rangelist (struct comp_unit *unit, struct arange *arange, + bfd_uint64_t offset) + { + bfd_byte *ranges_ptr; ++ bfd_byte *ranges_end; + bfd_vma base_address = unit->base_address; + + if (! unit->stash->dwarf_ranges_buffer) +@@ -2246,16 +2409,24 @@ read_rangelist (struct comp_unit *unit, struct arange *arange, + if (! read_debug_ranges (unit)) + return FALSE; + } ++ + ranges_ptr = unit->stash->dwarf_ranges_buffer + offset; ++ if (ranges_ptr < unit->stash->dwarf_ranges_buffer) ++ return FALSE; ++ ranges_end = unit->stash->dwarf_ranges_buffer + unit->stash->dwarf_ranges_size; + + for (;;) + { + bfd_vma low_pc; + bfd_vma high_pc; + +- low_pc = read_address (unit, ranges_ptr); ++ /* PR 17512: file: 62cada7d. */ ++ if (ranges_ptr + 2 * unit->addr_size > ranges_end) ++ return FALSE; ++ ++ low_pc = read_address (unit, ranges_ptr, ranges_end); + ranges_ptr += unit->addr_size; +- high_pc = read_address (unit, ranges_ptr); ++ high_pc = read_address (unit, ranges_ptr, ranges_end); + ranges_ptr += unit->addr_size; + + if (low_pc == 0 && high_pc == 0) +@@ -2282,6 +2453,7 @@ scan_unit_for_symbols (struct comp_unit *unit) + { + bfd *abfd = unit->abfd; + bfd_byte *info_ptr = unit->first_child_die_ptr; ++ bfd_byte *info_ptr_end = unit->stash->info_ptr_end; + int nesting_level = 1; + struct funcinfo **nested_funcs; + int nested_funcs_size; +@@ -2306,7 +2478,11 @@ scan_unit_for_symbols (struct comp_unit *unit) + bfd_vma high_pc = 0; + bfd_boolean high_pc_relative = FALSE; + +- abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ /* PR 17512: file: 9f405d9d. */ ++ if (info_ptr >= info_ptr_end) ++ goto fail; ++ ++ abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); + info_ptr += bytes_read; + + if (! abbrev_number) +@@ -2370,7 +2546,7 @@ scan_unit_for_symbols (struct comp_unit *unit) + + for (i = 0; i < abbrev->num_attrs; ++i) + { +- info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); ++ info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr, info_ptr_end); + if (info_ptr == NULL) + goto fail; + +@@ -2389,14 +2565,19 @@ scan_unit_for_symbols (struct comp_unit *unit) + + case DW_AT_abstract_origin: + case DW_AT_specification: +- func->name = find_abstract_instance_name (unit, &attr); ++ func->name = find_abstract_instance_name (unit, &attr, ++ &func->is_linkage); + break; + + case DW_AT_name: + /* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name + over DW_AT_name. */ + if (func->name == NULL && is_str_attr (attr.form)) +- func->name = attr.u.str; ++ { ++ func->name = attr.u.str; ++ if (non_mangled (unit->lang)) ++ func->is_linkage = TRUE; ++ } + break; + + case DW_AT_linkage_name: +@@ -2404,7 +2585,10 @@ scan_unit_for_symbols (struct comp_unit *unit) + /* PR 16949: Corrupt debug info can place + non-string forms into these attributes. */ + if (is_str_attr (attr.form)) +- func->name = attr.u.str; ++ { ++ func->name = attr.u.str; ++ func->is_linkage = TRUE; ++ } + break; + + case DW_AT_low_pc: +@@ -2560,15 +2744,15 @@ parse_comp_unit (struct dwarf2_debug *stash, + bfd *abfd = stash->bfd_ptr; + bfd_boolean high_pc_relative = FALSE; + +- version = read_2_bytes (abfd, info_ptr); ++ version = read_2_bytes (abfd, info_ptr, end_ptr); + info_ptr += 2; + BFD_ASSERT (offset_size == 4 || offset_size == 8); + if (offset_size == 4) +- abbrev_offset = read_4_bytes (abfd, info_ptr); ++ abbrev_offset = read_4_bytes (abfd, info_ptr, end_ptr); + else +- abbrev_offset = read_8_bytes (abfd, info_ptr); ++ abbrev_offset = read_8_bytes (abfd, info_ptr, end_ptr); + info_ptr += offset_size; +- addr_size = read_1_byte (abfd, info_ptr); ++ addr_size = read_1_byte (abfd, info_ptr, end_ptr); + info_ptr += 1; + + if (version != 2 && version != 3 && version != 4) +@@ -2605,7 +2789,7 @@ parse_comp_unit (struct dwarf2_debug *stash, + if (! abbrevs) + return 0; + +- abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); ++ abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, end_ptr); + info_ptr += bytes_read; + if (! abbrev_number) + { +@@ -2640,7 +2824,7 @@ parse_comp_unit (struct dwarf2_debug *stash, + + for (i = 0; i < abbrev->num_attrs; ++i) + { +- info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); ++ info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr, end_ptr); + if (info_ptr == NULL) + return NULL; + +@@ -2679,6 +2863,15 @@ parse_comp_unit (struct dwarf2_debug *stash, + case DW_AT_comp_dir: + { + char *comp_dir = attr.u.str; ++ ++ /* PR 17512: file: 1fe726be. */ ++ if (! is_str_attr (attr.form)) ++ { ++ (*_bfd_error_handler) ++ (_("Dwarf Error: DW_AT_comp_dir attribute encountered with a non-string form.")); ++ comp_dir = NULL; ++ } ++ + if (comp_dir) + { + /* Irix 6.2 native cc prepends .: to the compilation +@@ -2692,6 +2885,10 @@ parse_comp_unit (struct dwarf2_debug *stash, + break; + } + ++ case DW_AT_language: ++ unit->lang = attr.u.val; ++ break; ++ + default: + break; + } +@@ -2736,7 +2933,7 @@ comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr) + + /* If UNIT contains ADDR, set the output parameters to the values for + the line containing ADDR. The output parameters, FILENAME_PTR, +- FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects ++ FUNCTION_PTR, and LINENUMBER_PTR, are pointers to the objects + to be filled in. + + Returns the range of addresses covered by the entry that was used +@@ -2746,13 +2943,12 @@ static bfd_vma + comp_unit_find_nearest_line (struct comp_unit *unit, + bfd_vma addr, + const char **filename_ptr, +- const char **functionname_ptr, ++ struct funcinfo **function_ptr, + unsigned int *linenumber_ptr, + unsigned int *discriminator_ptr, + struct dwarf2_debug *stash) + { + bfd_boolean func_p; +- struct funcinfo *function; + + if (unit->error) + return FALSE; +@@ -2781,11 +2977,10 @@ comp_unit_find_nearest_line (struct comp_unit *unit, + } + } + +- function = NULL; +- func_p = lookup_address_in_function_table (unit, addr, +- &function, functionname_ptr); +- if (func_p && (function->tag == DW_TAG_inlined_subroutine)) +- stash->inliner_chain = function; ++ *function_ptr = NULL; ++ func_p = lookup_address_in_function_table (unit, addr, function_ptr); ++ if (func_p && (*function_ptr)->tag == DW_TAG_inlined_subroutine) ++ stash->inliner_chain = *function_ptr; + + return lookup_address_in_line_info_table (unit->line_table, addr, + filename_ptr, +@@ -3593,6 +3788,57 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, + return TRUE; + } + ++/* Scan the debug information in PINFO looking for a DW_TAG_subprogram ++ abbrev with a DW_AT_low_pc attached to it. Then lookup that same ++ symbol in SYMBOLS and return the difference between the low_pc and ++ the symbol's address. Returns 0 if no suitable symbol could be found. */ ++ ++bfd_signed_vma ++_bfd_dwarf2_find_symbol_bias (asymbol ** symbols, void ** pinfo) ++{ ++ struct dwarf2_debug *stash; ++ struct comp_unit * unit; ++ ++ stash = (struct dwarf2_debug *) *pinfo; ++ ++ if (stash == NULL) ++ return 0; ++ ++ for (unit = stash->all_comp_units; unit; unit = unit->next_unit) ++ { ++ struct funcinfo * func; ++ ++ if (unit->function_table == NULL) ++ { ++ if (unit->line_table == NULL) ++ unit->line_table = decode_line_info (unit, stash); ++ if (unit->line_table != NULL) ++ scan_unit_for_symbols (unit); ++ } ++ ++ for (func = unit->function_table; func != NULL; func = func->prev_func) ++ if (func->name && func->arange.low) ++ { ++ asymbol ** psym; ++ ++ /* FIXME: Do we need to scan the aranges looking for the lowest pc value ? */ ++ ++ for (psym = symbols; * psym != NULL; psym++) ++ { ++ asymbol * sym = * psym; ++ ++ if (sym->flags & BSF_FUNCTION ++ && sym->section != NULL ++ && strcmp (sym->name, func->name) == 0) ++ return ((bfd_signed_vma) func->arange.low) - ++ ((bfd_signed_vma) (sym->value + sym->section->vma)); ++ } ++ } ++ } ++ ++ return 0; ++} ++ + /* Find the source code location of SYMBOL. If SYMBOL is NULL + then find the nearest source code location corresponding to + the address SECTION + OFFSET. +@@ -3631,6 +3877,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + /* What address are we looking for? */ + bfd_vma addr; + struct comp_unit* each; ++ struct funcinfo *function = NULL; + bfd_boolean found = FALSE; + bfd_boolean do_line; + +@@ -3713,7 +3960,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + { + bfd_vma min_range = (bfd_vma) -1; + const char * local_filename = NULL; +- const char * local_functionname = NULL; ++ struct funcinfo *local_function = NULL; + unsigned int local_linenumber = 0; + unsigned int local_discriminator = 0; + +@@ -3725,7 +3972,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + || comp_unit_contains_address (each, addr)) + && (range = comp_unit_find_nearest_line (each, addr, + & local_filename, +- & local_functionname, ++ & local_function, + & local_linenumber, + & local_discriminator, + stash)) != 0); +@@ -3746,8 +3993,8 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + { + if (filename_ptr && local_filename) + * filename_ptr = local_filename; +- if (functionname_ptr && local_functionname) +- * functionname_ptr = local_functionname; ++ if (local_function) ++ function = local_function; + if (discriminator_ptr && local_discriminator) + * discriminator_ptr = local_discriminator; + if (local_linenumber) +@@ -3778,13 +4025,13 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + unsigned int offset_size = addr_size; + bfd_byte *info_ptr_unit = stash->info_ptr; + +- length = read_4_bytes (stash->bfd_ptr, stash->info_ptr); ++ length = read_4_bytes (stash->bfd_ptr, stash->info_ptr, stash->info_ptr_end); + /* A 0xffffff length is the DWARF3 way of indicating + we use 64-bit offsets, instead of 32-bit offsets. */ + if (length == 0xffffffff) + { + offset_size = 8; +- length = read_8_bytes (stash->bfd_ptr, stash->info_ptr + 4); ++ length = read_8_bytes (stash->bfd_ptr, stash->info_ptr + 4, stash->info_ptr_end); + stash->info_ptr += 12; + } + /* A zero length is the IRIX way of indicating 64-bit offsets, +@@ -3793,7 +4040,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + else if (length == 0) + { + offset_size = 8; +- length = read_4_bytes (stash->bfd_ptr, stash->info_ptr + 4); ++ length = read_4_bytes (stash->bfd_ptr, stash->info_ptr + 4, stash->info_ptr_end); + stash->info_ptr += 8; + } + /* In the absence of the hints above, we assume 32-bit DWARF2 +@@ -3815,13 +4062,25 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + + if (length > 0) + { ++ bfd_byte * new_ptr; ++ + each = parse_comp_unit (stash, length, info_ptr_unit, + offset_size); + if (!each) + /* The dwarf information is damaged, don't trust it any + more. */ + break; +- stash->info_ptr += length; ++ ++ new_ptr = stash->info_ptr + length; ++ /* PR 17512: file: 1500698c. */ ++ if (new_ptr < stash->info_ptr) ++ { ++ /* A corrupt length value - do not trust the info any more. */ ++ found = FALSE; ++ break; ++ } ++ else ++ stash->info_ptr = new_ptr; + + if (stash->all_comp_units) + stash->all_comp_units->prev_unit = each; +@@ -3849,7 +4108,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + || comp_unit_contains_address (each, addr)) + && comp_unit_find_nearest_line (each, addr, + filename_ptr, +- functionname_ptr, ++ &function, + linenumber_ptr, + discriminator_ptr, + stash) != 0); +@@ -3868,6 +4127,19 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, + } + + done: ++ if (function) ++ { ++ if (!function->is_linkage ++ && _bfd_elf_find_function (abfd, symbols, section, offset, ++ *filename_ptr ? NULL : filename_ptr, ++ functionname_ptr)) ++ { ++ function->name = *functionname_ptr; ++ function->is_linkage = TRUE; ++ } ++ else ++ *functionname_ptr = function->name; ++ } + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + unset_sections (stash); + +@@ -3985,3 +4257,109 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abfd, void **pinfo) + if (stash->alt_bfd_ptr) + bfd_close (stash->alt_bfd_ptr); + } ++ ++/* Find the function to a particular section and offset, ++ for error reporting. */ ++ ++bfd_boolean ++_bfd_elf_find_function (bfd *abfd, ++ asymbol **symbols, ++ asection *section, ++ bfd_vma offset, ++ const char **filename_ptr, ++ const char **functionname_ptr) ++{ ++ struct elf_find_function_cache ++ { ++ asection *last_section; ++ asymbol *func; ++ const char *filename; ++ bfd_size_type func_size; ++ } *cache; ++ ++ if (symbols == NULL) ++ return FALSE; ++ ++ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) ++ return FALSE; ++ ++ cache = elf_tdata (abfd)->elf_find_function_cache; ++ if (cache == NULL) ++ { ++ cache = bfd_zalloc (abfd, sizeof (*cache)); ++ elf_tdata (abfd)->elf_find_function_cache = cache; ++ if (cache == NULL) ++ return FALSE; ++ } ++ if (cache->last_section != section ++ || cache->func == NULL ++ || offset < cache->func->value ++ || offset >= cache->func->value + cache->func_size) ++ { ++ asymbol *file; ++ bfd_vma low_func; ++ asymbol **p; ++ /* ??? Given multiple file symbols, it is impossible to reliably ++ choose the right file name for global symbols. File symbols are ++ local symbols, and thus all file symbols must sort before any ++ global symbols. The ELF spec may be interpreted to say that a ++ file symbol must sort before other local symbols, but currently ++ ld -r doesn't do this. So, for ld -r output, it is possible to ++ make a better choice of file name for local symbols by ignoring ++ file symbols appearing after a given local symbol. */ ++ enum { nothing_seen, symbol_seen, file_after_symbol_seen } state; ++ const struct elf_backend_data *bed = get_elf_backend_data (abfd); ++ ++ file = NULL; ++ low_func = 0; ++ state = nothing_seen; ++ cache->filename = NULL; ++ cache->func = NULL; ++ cache->func_size = 0; ++ cache->last_section = section; ++ ++ for (p = symbols; *p != NULL; p++) ++ { ++ asymbol *sym = *p; ++ bfd_vma code_off; ++ bfd_size_type size; ++ ++ if ((sym->flags & BSF_FILE) != 0) ++ { ++ file = sym; ++ if (state == symbol_seen) ++ state = file_after_symbol_seen; ++ continue; ++ } ++ ++ size = bed->maybe_function_sym (sym, section, &code_off); ++ if (size != 0 ++ && code_off <= offset ++ && (code_off > low_func ++ || (code_off == low_func ++ && size > cache->func_size))) ++ { ++ cache->func = sym; ++ cache->func_size = size; ++ cache->filename = NULL; ++ low_func = code_off; ++ if (file != NULL ++ && ((sym->flags & BSF_LOCAL) != 0 ++ || state != file_after_symbol_seen)) ++ cache->filename = bfd_asymbol_name (file); ++ } ++ if (state == nothing_seen) ++ state = symbol_seen; ++ } ++ } ++ ++ if (cache->func == NULL) ++ return FALSE; ++ ++ if (filename_ptr) ++ *filename_ptr = cache->filename; ++ if (functionname_ptr) ++ *functionname_ptr = bfd_asymbol_name (cache->func); ++ ++ return TRUE; ++} +diff --git a/bfd/ecoff.c b/bfd/ecoff.c +index 01f51e6..f65249b 100644 +--- a/bfd/ecoff.c ++++ b/bfd/ecoff.c +@@ -504,7 +504,6 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, + struct fdr *fdr_ptr; + bfd_size_type raw_end; + bfd_size_type cb_end; +- bfd_size_type amt; + file_ptr pos; + + BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info); +@@ -607,14 +606,16 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, + + We need to look at the fdr to deal with a lot of information in + the symbols, so we swap them here. */ +- amt = internal_symhdr->ifdMax; +- amt *= sizeof (struct fdr); +- debug->fdr = (FDR *) bfd_alloc (abfd, amt); ++ debug->fdr = (FDR *) bfd_alloc2 (abfd, internal_symhdr->ifdMax, ++ sizeof (struct fdr)); + if (debug->fdr == NULL) + return FALSE; + external_fdr_size = backend->debug_swap.external_fdr_size; + fdr_ptr = debug->fdr; + fraw_src = (char *) debug->external_fdr; ++ /* PR 17512: file: 3372-1243-0.004. */ ++ if (fraw_src == NULL && internal_symhdr->ifdMax > 0) ++ return FALSE; + fraw_end = fraw_src + internal_symhdr->ifdMax * external_fdr_size; + for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) + (*backend->debug_swap.swap_fdr_in) (abfd, (void *) fraw_src, fdr_ptr); +@@ -856,7 +857,6 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) + = backend->debug_swap.swap_ext_in; + void (* const swap_sym_in) (bfd *, void *, SYMR *) + = backend->debug_swap.swap_sym_in; +- bfd_size_type internal_size; + ecoff_symbol_type *internal; + ecoff_symbol_type *internal_ptr; + char *eraw_src; +@@ -875,9 +875,8 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) + if (bfd_get_symcount (abfd) == 0) + return TRUE; + +- internal_size = bfd_get_symcount (abfd); +- internal_size *= sizeof (ecoff_symbol_type); +- internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size); ++ internal = (ecoff_symbol_type *) bfd_alloc2 (abfd, bfd_get_symcount (abfd), ++ sizeof (ecoff_symbol_type)); + if (internal == NULL) + return FALSE; + +@@ -891,16 +890,30 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) + EXTR internal_esym; + + (*swap_ext_in) (abfd, (void *) eraw_src, &internal_esym); ++ ++ /* PR 17512: file: 3372-1000-0.004. */ ++ if (internal_esym.asym.iss >= ecoff_data (abfd)->debug_info.symbolic_header.issExtMax ++ || internal_esym.asym.iss < 0) ++ return FALSE; ++ + internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ssext + + internal_esym.asym.iss); ++ + if (!ecoff_set_symbol_info (abfd, &internal_esym.asym, + &internal_ptr->symbol, 1, + internal_esym.weakext)) + return FALSE; ++ + /* The alpha uses a negative ifd field for section symbols. */ + if (internal_esym.ifd >= 0) +- internal_ptr->fdr = (ecoff_data (abfd)->debug_info.fdr +- + internal_esym.ifd); ++ { ++ /* PR 17512: file: 3372-1983-0.004. */ ++ if (internal_esym.ifd >= ecoff_data (abfd)->debug_info.symbolic_header.ifdMax) ++ internal_ptr->fdr = NULL; ++ else ++ internal_ptr->fdr = (ecoff_data (abfd)->debug_info.fdr ++ + internal_esym.ifd); ++ } + else + internal_ptr->fdr = NULL; + internal_ptr->local = FALSE; +@@ -938,6 +951,20 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) + } + } + ++ /* PR 17512: file: 3372-3080-0.004. ++ A discrepancy between ecoff_data (abfd)->debug_info.symbolic_header.isymMax ++ and ecoff_data (abfd)->debug_info.symbolic_header.ifdMax can mean that ++ we have fewer symbols than we were expecting. Allow for this by updating ++ the symbol count and warning the user. */ ++ if (internal_ptr - internal < (ptrdiff_t) bfd_get_symcount (abfd)) ++ { ++ bfd_get_symcount (abfd) = internal_ptr - internal; ++ (*_bfd_error_handler) ++ (_("%B: warning: isymMax (%ld) is greater than ifdMax (%d)\n"), ++ abfd, ecoff_data (abfd)->debug_info.symbolic_header.isymMax, ++ ecoff_data (abfd)->debug_info.symbolic_header.ifdMax); ++ } ++ + ecoff_data (abfd)->canonical_symbols = internal; + + return TRUE; +@@ -3976,7 +4003,7 @@ ecoff_reloc_link_order (bfd *output_bfd, + + size = bfd_get_reloc_size (rel.howto); + buf = (bfd_byte *) bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + rstat = _bfd_relocate_contents (rel.howto, output_bfd, + (bfd_vma) addend, buf); +diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c +index cd0cbca..d20bbdd 100644 +--- a/bfd/elf-attrs.c ++++ b/bfd/elf-attrs.c +@@ -430,9 +430,13 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) + { + bfd_byte *contents; + bfd_byte *p; ++ bfd_byte *p_end; + bfd_vma len; + const char *std_sec; + ++ /* PR 17512: file: 2844a11d. */ ++ if (hdr->sh_size == 0) ++ return; + contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + if (!contents) + return; +@@ -443,11 +447,12 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) + return; + } + p = contents; ++ p_end = p + hdr->sh_size; + std_sec = get_elf_backend_data (abfd)->obj_attrs_vendor; + if (*(p++) == 'A') + { + len = hdr->sh_size - 1; +- while (len > 0) ++ while (len > 0 && p < p_end - 4) + { + unsigned namelen; + bfd_vma section_len; +@@ -455,6 +460,8 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) + + section_len = bfd_get_32 (abfd, p); + p += 4; ++ if (section_len == 0) ++ break; + if (section_len > len) + section_len = len; + len -= section_len; +@@ -475,7 +482,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) + } + + p += namelen; +- while (section_len > 0) ++ while (section_len > 0 && p < p_end) + { + int tag; + unsigned int n; +@@ -483,15 +490,23 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) + bfd_vma subsection_len; + bfd_byte *end; + +- tag = read_unsigned_leb128 (abfd, p, &n); ++ tag = safe_read_leb128 (abfd, p, &n, FALSE, p_end); + p += n; +- subsection_len = bfd_get_32 (abfd, p); ++ if (p < p_end - 4) ++ subsection_len = bfd_get_32 (abfd, p); ++ else ++ subsection_len = 0; + p += 4; ++ if (subsection_len == 0) ++ break; + if (subsection_len > section_len) + subsection_len = section_len; + section_len -= subsection_len; + subsection_len -= n + 4; + end = p + subsection_len; ++ /* PR 17512: file: 0e8c0c90. */ ++ if (end > p_end) ++ end = p_end; + switch (tag) + { + case Tag_File: +@@ -499,25 +514,25 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) + { + int type; + +- tag = read_unsigned_leb128 (abfd, p, &n); ++ tag = safe_read_leb128 (abfd, p, &n, FALSE, end); + p += n; + type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag); + switch (type & (ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL)) + { + case ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL: +- val = read_unsigned_leb128 (abfd, p, &n); ++ val = safe_read_leb128 (abfd, p, &n, FALSE, end); + p += n; + bfd_elf_add_obj_attr_int_string (abfd, vendor, tag, +- val, (char *)p); ++ val, (char *) p); + p += strlen ((char *)p) + 1; + break; + case ATTR_TYPE_FLAG_STR_VAL: + bfd_elf_add_obj_attr_string (abfd, vendor, tag, +- (char *)p); ++ (char *) p); + p += strlen ((char *)p) + 1; + break; + case ATTR_TYPE_FLAG_INT_VAL: +- val = read_unsigned_leb128 (abfd, p, &n); ++ val = safe_read_leb128 (abfd, p, &n, FALSE, end); + p += n; + bfd_elf_add_obj_attr_int (abfd, vendor, tag, val); + break; +diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h +index 72e7a66..6a87d71 100644 +--- a/bfd/elf-bfd.h ++++ b/bfd/elf-bfd.h +@@ -196,6 +196,9 @@ struct elf_link_hash_entry + unsigned int pointer_equality_needed : 1; + /* Symbol is a unique global symbol. */ + unsigned int unique_global : 1; ++ /* Symbol is defined by a shared library with non-default visibility ++ in a read/write section. */ ++ unsigned int protected_def : 1; + + /* String table index in .dynstr if this is a dynamic symbol. */ + unsigned long dynstr_index; +@@ -239,7 +242,8 @@ struct elf_link_hash_entry + _bfd_elf_symbol_refs_local_p (H, INFO, 1) + + /* Common symbols that are turned into definitions don't have the +- DEF_REGULAR flag set, so they might appear to be undefined. */ ++ DEF_REGULAR flag set, so they might appear to be undefined. ++ Symbols defined in linker scripts also don't have DEF_REGULAR set. */ + #define ELF_COMMON_DEF_P(H) \ + (!(H)->def_regular \ + && !(H)->def_dynamic \ +@@ -1109,6 +1113,11 @@ struct elf_backend_data + unsigned int (*elf_backend_count_relocs) + (struct bfd_link_info *, asection *); + ++ /* Say whether to sort relocs output by ld -r and ld --emit-relocs, ++ by r_offset. If NULL, default to true. */ ++ bfd_boolean (*sort_relocs_p) ++ (asection *); ++ + /* This function, if defined, is called when an NT_PRSTATUS note is found + in a core file. */ + bfd_boolean (*elf_backend_grok_prstatus) +@@ -1904,6 +1913,8 @@ extern bfd_boolean _bfd_elf_find_line + (bfd *, asymbol **, asymbol *, const char **, unsigned int *); + extern bfd_boolean _bfd_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); ++extern bfd_boolean _bfd_elf_find_function ++ (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **); + #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols + #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + extern int _bfd_elf_sizeof_headers +@@ -2017,7 +2028,7 @@ extern bfd_boolean _bfd_elf_link_output_relocs + struct elf_link_hash_entry **); + + extern bfd_boolean _bfd_elf_adjust_dynamic_copy +- (struct elf_link_hash_entry *, asection *); ++ (struct bfd_link_info *, struct elf_link_hash_entry *, asection *); + + extern bfd_boolean _bfd_elf_dynamic_symbol_p + (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean); +diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h +index 5ee7de8..705bdac 100644 +--- a/bfd/elf-hppa.h ++++ b/bfd/elf-hppa.h +@@ -47,7 +47,7 @@ + + static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] = + { +- { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, ++ { R_PARISC_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE }, + + /* The values in DIR32 are to placate the check in +diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c +index 86872b7..cbeda2f 100644 +--- a/bfd/elf-m10200.c ++++ b/bfd/elf-m10200.c +@@ -46,11 +46,11 @@ static reloc_howto_type elf_mn10200_howto_table[] = + /* Dummy relocation. Does nothing. */ + HOWTO (R_MN10200_NONE, + 0, +- 2, +- 16, ++ 3, ++ 0, + FALSE, + 0, +- complain_overflow_bitfield, ++ complain_overflow_dont, + bfd_elf_generic_reloc, + "R_MN10200_NONE", + FALSE, +diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c +index f29025d..fb8c1c6 100644 +--- a/bfd/elf-m10300.c ++++ b/bfd/elf-m10300.c +@@ -142,11 +142,11 @@ static reloc_howto_type elf_mn10300_howto_table[] = + /* Dummy relocation. Does nothing. */ + HOWTO (R_MN10300_NONE, + 0, +- 2, +- 16, ++ 3, ++ 0, + FALSE, + 0, +- complain_overflow_bitfield, ++ complain_overflow_dont, + bfd_elf_generic_reloc, + "R_MN10300_NONE", + FALSE, +@@ -806,7 +806,13 @@ mn10300_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_MN10300_MAX); ++ if (r_type >= R_MN10300_MAX) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised MN10300 reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_MN10300_NONE; ++ } + cache_ptr->howto = elf_mn10300_howto_table + r_type; + } + +@@ -5024,7 +5030,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Set the sizes of the dynamic sections. */ +diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c +index c74883c..3b0922b 100644 +--- a/bfd/elf-s390-common.c ++++ b/bfd/elf-s390-common.c +@@ -242,3 +242,15 @@ elf_s390_add_symbol_hook (bfd *abfd, + + return TRUE; + } ++ ++/* Whether to sort relocs output by ld -r or ld --emit-relocs, by ++ r_offset. Don't do so for code sections. We want to keep ordering ++ of GDCALL / PLT32DBL for TLS optimizations as is. On the other ++ hand, elf-eh-frame.c processing requires .eh_frame relocs to be ++ sorted. */ ++ ++static bfd_boolean ++elf_s390_elf_sort_relocs_p (asection *sec) ++{ ++ return (sec->flags & SEC_CODE) == 0; ++} +diff --git a/bfd/elf.c b/bfd/elf.c +index 8b207ad..9de3ddb 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -297,13 +297,14 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) + /* Allocate and clear an extra byte at the end, to prevent crashes + in case the string table is not terminated. */ + if (shstrtabsize + 1 <= 1 +- || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL +- || bfd_seek (abfd, offset, SEEK_SET) != 0) ++ || bfd_seek (abfd, offset, SEEK_SET) != 0 ++ || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL) + shstrtab = NULL; + else if (bfd_bread (shstrtab, shstrtabsize, abfd) != shstrtabsize) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_file_truncated); ++ bfd_release (abfd, shstrtab); + shstrtab = NULL; + /* Once we've failed to read it, make sure we don't keep + trying. Otherwise, we'll keep allocating space for +@@ -332,9 +333,19 @@ bfd_elf_string_from_elf_section (bfd *abfd, + + hdr = elf_elfsections (abfd)[shindex]; + +- if (hdr->contents == NULL +- && bfd_elf_get_str_section (abfd, shindex) == NULL) +- return NULL; ++ if (hdr->contents == NULL) ++ { ++ if (hdr->sh_type != SHT_STRTAB && hdr->sh_type < SHT_LOOS) ++ { ++ /* PR 17512: file: f057ec89. */ ++ _bfd_error_handler (_("%B: attempt to load strings from a non-string section (number %d)"), ++ abfd, shindex); ++ return NULL; ++ } ++ ++ if (bfd_elf_get_str_section (abfd, shindex) == NULL) ++ return NULL; ++ } + + if (strindex >= hdr->sh_size) + { +@@ -1253,8 +1264,13 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) + swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; + + extdyn = dynbuf; ++ /* PR 17512: file: 6f427532. */ ++ if (s->size < extdynsize) ++ goto error_return; + extdynend = extdyn + s->size; +- for (; extdyn < extdynend; extdyn += extdynsize) ++ /* PR 17512: file: id:000006,sig:06,src:000000,op:flip4,pos:5664. ++ Fix range check. */ ++ for (; extdyn <= (extdynend - extdynsize); extdyn += extdynsize) + { + Elf_Internal_Dyn dyn; + const char *name = ""; +@@ -1589,7 +1605,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) + if (++ nesting > 3) + { + /* PR17512: A corrupt ELF binary might contain a recursive group of +- sections, each the string indicies pointing to the next in the ++ sections, each with string indicies pointing to the next in the + loop. Detect this here, by refusing to load a section that we are + already in the process of loading. We only trigger this test if + we have nested at least three sections deep as normal ELF binaries +@@ -1956,7 +1972,9 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) + else + p_hdr = &esdt->rel.hdr; + +- BFD_ASSERT (*p_hdr == NULL); ++ /* PR 17512: file: 0b4f81b7. */ ++ if (*p_hdr != NULL) ++ goto fail; + amt = sizeof (*hdr2); + hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); + if (hdr2 == NULL) +@@ -2013,9 +2031,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) + if (hdr->contents != NULL) + { + Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents; +- unsigned int n_elt = hdr->sh_size / GRP_ENTRY_SIZE; ++ unsigned int n_elt = hdr->sh_size / sizeof (* idx); + asection *s; + ++ if (n_elt == 0) ++ goto fail; + if (idx->flags & GRP_COMDAT) + hdr->bfd_section->flags + |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; +@@ -2720,6 +2740,15 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg) + this_hdr->sh_offset = 0; + this_hdr->sh_size = asect->size; + this_hdr->sh_link = 0; ++ /* PR 17512: file: 0eb809fe, 8b0535ee. */ ++ if (asect->alignment_power >= (sizeof (bfd_vma) * 8) - 1) ++ { ++ (*_bfd_error_handler) ++ (_("%B: error: Alignment power %d of section `%A' is too big"), ++ abfd, asect, asect->alignment_power); ++ arg->failed = TRUE; ++ return; ++ } + this_hdr->sh_addralign = (bfd_vma) 1 << asect->alignment_power; + /* The sh_entsize and sh_info fields may have been set already by + copy_private_section_data. */ +@@ -3973,6 +4002,11 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info) + last_size = 0; + phdr_index = 0; + maxpagesize = bed->maxpagesize; ++ /* PR 17512: file: c8455299. ++ Avoid divide-by-zero errors later on. ++ FIXME: Should we abort if the maxpagesize is zero ? */ ++ if (maxpagesize == 0) ++ maxpagesize = 1; + writable = FALSE; + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec != NULL +@@ -5168,7 +5202,14 @@ assign_file_positions_for_non_load_sections (bfd *abfd, + && (p->p_type != PT_NOTE + || bfd_get_format (abfd) != bfd_core)) + { +- BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); ++ if (m->includes_filehdr || m->includes_phdrs) ++ { ++ /* PR 17512: file: 2195325e. */ ++ (*_bfd_error_handler) ++ (_("%B: warning: non-load segment includes file header and/or program header"), ++ abfd); ++ return FALSE; ++ } + + p->p_filesz = 0; + p->p_offset = m->sections[0]->filepos; +@@ -6523,7 +6564,15 @@ rewrite: + i++, segment++) + if (segment->p_type == PT_LOAD + && maxpagesize < segment->p_align) +- maxpagesize = segment->p_align; ++ { ++ /* PR 17512: file: f17299af. */ ++ if (segment->p_align > (bfd_vma) 1 << ((sizeof (bfd_vma) * 8) - 2)) ++ (*_bfd_error_handler) (_("\ ++%B: warning: segment alignment of 0x%llx is too large"), ++ ibfd, (long long) segment->p_align); ++ else ++ maxpagesize = segment->p_align; ++ } + + if (maxpagesize != get_elf_backend_data (obfd)->maxpagesize) + bfd_emul_set_maxpagesize (bfd_get_target (obfd), maxpagesize); +@@ -7648,109 +7697,6 @@ _bfd_elf_set_arch_mach (bfd *abfd, + return bfd_default_set_arch_mach (abfd, arch, machine); + } + +-/* Find the function to a particular section and offset, +- for error reporting. */ +- +-static bfd_boolean +-elf_find_function (bfd *abfd, +- asymbol **symbols, +- asection *section, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr) +-{ +- struct elf_find_function_cache +- { +- asection *last_section; +- asymbol *func; +- const char *filename; +- bfd_size_type func_size; +- } *cache; +- +- if (symbols == NULL) +- return FALSE; +- +- cache = elf_tdata (abfd)->elf_find_function_cache; +- if (cache == NULL) +- { +- cache = bfd_zalloc (abfd, sizeof (*cache)); +- elf_tdata (abfd)->elf_find_function_cache = cache; +- if (cache == NULL) +- return FALSE; +- } +- if (cache->last_section != section +- || cache->func == NULL +- || offset < cache->func->value +- || offset >= cache->func->value + cache->func_size) +- { +- asymbol *file; +- bfd_vma low_func; +- asymbol **p; +- /* ??? Given multiple file symbols, it is impossible to reliably +- choose the right file name for global symbols. File symbols are +- local symbols, and thus all file symbols must sort before any +- global symbols. The ELF spec may be interpreted to say that a +- file symbol must sort before other local symbols, but currently +- ld -r doesn't do this. So, for ld -r output, it is possible to +- make a better choice of file name for local symbols by ignoring +- file symbols appearing after a given local symbol. */ +- enum { nothing_seen, symbol_seen, file_after_symbol_seen } state; +- const struct elf_backend_data *bed = get_elf_backend_data (abfd); +- +- file = NULL; +- low_func = 0; +- state = nothing_seen; +- cache->filename = NULL; +- cache->func = NULL; +- cache->func_size = 0; +- cache->last_section = section; +- +- for (p = symbols; *p != NULL; p++) +- { +- asymbol *sym = *p; +- bfd_vma code_off; +- bfd_size_type size; +- +- if ((sym->flags & BSF_FILE) != 0) +- { +- file = sym; +- if (state == symbol_seen) +- state = file_after_symbol_seen; +- continue; +- } +- +- size = bed->maybe_function_sym (sym, section, &code_off); +- if (size != 0 +- && code_off <= offset +- && (code_off > low_func +- || (code_off == low_func +- && size > cache->func_size))) +- { +- cache->func = sym; +- cache->func_size = size; +- cache->filename = NULL; +- low_func = code_off; +- if (file != NULL +- && ((sym->flags & BSF_LOCAL) != 0 +- || state != file_after_symbol_seen)) +- cache->filename = bfd_asymbol_name (file); +- } +- if (state == nothing_seen) +- state = symbol_seen; +- } +- } +- +- if (cache->func == NULL) +- return FALSE; +- +- if (filename_ptr) +- *filename_ptr = cache->filename; +- if (functionname_ptr) +- *functionname_ptr = bfd_asymbol_name (cache->func); +- +- return TRUE; +-} +- + /* Find the nearest line to a particular section and offset, + for error reporting. */ + +@@ -7770,24 +7716,15 @@ _bfd_elf_find_nearest_line (bfd *abfd, + filename_ptr, functionname_ptr, + line_ptr, discriminator_ptr, + dwarf_debug_sections, 0, +- &elf_tdata (abfd)->dwarf2_find_line_info)) +- { +- if (!*functionname_ptr) +- elf_find_function (abfd, symbols, section, offset, +- *filename_ptr ? NULL : filename_ptr, +- functionname_ptr); +- +- return TRUE; +- } +- +- if (_bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset, +- filename_ptr, functionname_ptr, line_ptr)) ++ &elf_tdata (abfd)->dwarf2_find_line_info) ++ || _bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset, ++ filename_ptr, functionname_ptr, ++ line_ptr)) + { + if (!*functionname_ptr) +- elf_find_function (abfd, symbols, section, offset, +- *filename_ptr ? NULL : filename_ptr, +- functionname_ptr); +- ++ _bfd_elf_find_function (abfd, symbols, section, offset, ++ *filename_ptr ? NULL : filename_ptr, ++ functionname_ptr); + return TRUE; + } + +@@ -7802,8 +7739,8 @@ _bfd_elf_find_nearest_line (bfd *abfd, + if (symbols == NULL) + return FALSE; + +- if (! elf_find_function (abfd, symbols, section, offset, +- filename_ptr, functionname_ptr)) ++ if (! _bfd_elf_find_function (abfd, symbols, section, offset, ++ filename_ptr, functionname_ptr)) + return FALSE; + + *line_ptr = 0; +@@ -9822,10 +9759,14 @@ elf_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size) + if (bfd_seek (abfd, offset, SEEK_SET) != 0) + return FALSE; + +- buf = (char *) bfd_malloc (size); ++ buf = (char *) bfd_malloc (size + 1); + if (buf == NULL) + return FALSE; + ++ /* PR 17512: file: ec08f814 ++ 0-termintate the buffer so that string searches will not overflow. */ ++ buf[size] = 0; ++ + if (bfd_bread (buf, size, abfd) != size + || !elf_parse_notes (abfd, buf, size, offset)) + { +diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c +index e528e66..e805706 100644 +--- a/bfd/elf32-arc.c ++++ b/bfd/elf32-arc.c +@@ -58,11 +58,11 @@ static reloc_howto_type elf_arc_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_ARC_NONE, /* Type. */ + 0, /* Rightshift. */ +- 2, /* Size (0 = byte, 1 = short, 2 = long). */ +- 32, /* Bitsize. */ ++ 3, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* Bitsize. */ + FALSE, /* PC_relative. */ + 0, /* Bitpos. */ +- complain_overflow_bitfield, /* Complain_on_overflow. */ ++ complain_overflow_dont, /* Complain_on_overflow. */ + bfd_elf_generic_reloc, /* Special_function. */ + "R_ARC_NONE", /* Name. */ + TRUE, /* Partial_inplace. */ +@@ -172,7 +172,11 @@ arc_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_ARC_max); ++ if (r_type >= (unsigned int) R_ARC_max) ++ { ++ _bfd_error_handler (_("%B: invalid ARC reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_arc_howto_table[r_type]; + } + +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index 996889d..9fd5720 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -79,7 +79,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] = + /* No relocation. */ + HOWTO (R_ARM_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -1606,7 +1606,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] = + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ +- bfd_elf_generic_reloc, /* special_function */ ++ NULL, /* special_function */ + "R_ARM_TLS_LE32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ +@@ -13331,7 +13331,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c +index 54d67bf..bb84f69 100644 +--- a/bfd/elf32-avr.c ++++ b/bfd/elf32-avr.c +@@ -121,11 +121,11 @@ static reloc_howto_type elf_avr_howto_table[] = + { + HOWTO (R_AVR_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -859,7 +859,11 @@ avr_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_AVR_max); ++ if (r_type >= (unsigned int) R_AVR_max) ++ { ++ _bfd_error_handler (_("%B: invalid AVR reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_avr_howto_table[r_type]; + } + +diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c +index 692875b..db2a5ba 100644 +--- a/bfd/elf32-bfin.c ++++ b/bfd/elf32-bfin.c +@@ -423,11 +423,11 @@ static reloc_howto_type bfin_howto_table [] = + /* This reloc does nothing. . */ + HOWTO (R_BFIN_UNUSED0, /* type. */ + 0, /* rightshift. */ +- 2, /* size (0 = byte, 1 = short, 2 = long). */ +- 32, /* bitsize. */ ++ 3, /* size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* bitsize. */ + FALSE, /* pc_relative. */ + 0, /* bitpos. */ +- complain_overflow_bitfield, /* complain_on_overflow. */ ++ complain_overflow_dont,/* complain_on_overflow. */ + bfd_elf_generic_reloc, /* special_function. */ + "R_BFIN_UNUSED0", /* name. */ + FALSE, /* partial_inplace. */ +@@ -451,11 +451,11 @@ static reloc_howto_type bfin_howto_table [] = + + HOWTO (R_BFIN_UNUSED1, /* type. */ + 0, /* rightshift. */ +- 2, /* size (0 = byte, 1 = short, 2 = long). */ +- 32, /* bitsize. */ ++ 3, /* size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* bitsize. */ + FALSE, /* pc_relative. */ + 0, /* bitpos. */ +- complain_overflow_bitfield, /* complain_on_overflow. */ ++ complain_overflow_dont,/* complain_on_overflow. */ + bfd_elf_generic_reloc, /* special_function. */ + "R_BFIN_UNUSED1", /* name. */ + FALSE, /* partial_inplace. */ +@@ -581,8 +581,8 @@ static reloc_howto_type bfin_howto_table [] = + + HOWTO (R_BFIN_UNUSEDB, /* type. */ + 0, /* rightshift. */ +- 2, /* size (0 = byte, 1 = short, 2 = long). */ +- 32, /* bitsize. */ ++ 3, /* size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* bitsize. */ + FALSE, /* pc_relative. */ + 0, /* bitpos. */ + complain_overflow_dont, /* complain_on_overflow. */ +@@ -595,8 +595,8 @@ static reloc_howto_type bfin_howto_table [] = + + HOWTO (R_BFIN_UNUSEDC, /* type. */ + 0, /* rightshift. */ +- 2, /* size (0 = byte, 1 = short, 2 = long). */ +- 32, /* bitsize. */ ++ 3, /* size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* bitsize. */ + FALSE, /* pc_relative. */ + 0, /* bitpos. */ + complain_overflow_dont, /* complain_on_overflow. */ +diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c +index f16f1c6..e53064e 100644 +--- a/bfd/elf32-cr16.c ++++ b/bfd/elf32-cr16.c +@@ -115,8 +115,8 @@ static reloc_howto_type cr16_elf_howto_table[] = + { + HOWTO (R_CR16_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size */ +- 32, /* bitsize */ ++ 3, /* size */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +@@ -673,7 +673,13 @@ elf_cr16_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + { + unsigned int r_type = ELF32_R_TYPE (dst->r_info); + +- BFD_ASSERT (r_type < (unsigned int) R_CR16_MAX); ++ if (r_type >= R_CR16_MAX) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised CR16 reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_CR16_NONE; ++ } + cache_ptr->howto = cr16_elf_howto_table + r_type; + } + +@@ -2437,7 +2443,7 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Set the sizes of the dynamic sections. */ +diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c +index cf4503c..0980111 100644 +--- a/bfd/elf32-cr16c.c ++++ b/bfd/elf32-cr16c.c +@@ -180,7 +180,11 @@ elf_cr16c_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + { + unsigned int r_type = ELF32_R_TYPE (dst->r_info); + +- BFD_ASSERT (r_type < (unsigned int) RINDEX_16C_MAX); ++ if (r_type >= RINDEX_16C_MAX) ++ { ++ _bfd_error_handler (_("%B: invalid CR16C reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_howto_table[r_type]; + } + +diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c +index 9b2b956..c297339 100644 +--- a/bfd/elf32-cris.c ++++ b/bfd/elf32-cris.c +@@ -40,11 +40,11 @@ static reloc_howto_type cris_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_CRIS_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -461,7 +461,11 @@ cris_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + enum elf_cris_reloc_type r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_CRIS_max); ++ if (r_type >= R_CRIS_max) ++ { ++ _bfd_error_handler (_("%B: invalid CRIS reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & cris_elf_howto_table [r_type]; + } + +@@ -3054,7 +3058,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Adjust our "subclass" elements for an indirect symbol. */ +diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c +index f2925f5..9be3161 100644 +--- a/bfd/elf32-crx.c ++++ b/bfd/elf32-crx.c +@@ -82,8 +82,8 @@ static reloc_howto_type crx_elf_howto_table[] = + { + HOWTO (R_CRX_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size */ +- 32, /* bitsize */ ++ 3, /* size */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ +@@ -423,7 +423,13 @@ elf_crx_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) + { + unsigned int r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_CRX_MAX); ++ if (r_type >= R_CRX_MAX) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised CRX reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_CRX_NONE; ++ } + cache_ptr->howto = &crx_elf_howto_table[r_type]; + } + +diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c +index f45e2db..3e906ae 100644 +--- a/bfd/elf32-d10v.c ++++ b/bfd/elf32-d10v.c +@@ -33,8 +33,8 @@ static reloc_howto_type elf_d10v_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_D10V_NONE, /* Type. */ + 0, /* Rightshift. */ +- 2, /* Size (0 = byte, 1 = short, 2 = long). */ +- 32, /* Bitsize. */ ++ 3, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* Bitsize. */ + FALSE, /* PC_relative. */ + 0, /* Bitpos. */ + complain_overflow_dont,/* Complain_on_overflow. */ +@@ -228,7 +228,11 @@ d10v_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_D10V_max); ++ if (r_type >= (unsigned int) R_D10V_max) ++ { ++ _bfd_error_handler (_("%B: invalid D10V reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_d10v_howto_table[r_type]; + } + +diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c +index 211a673..479f6e1 100644 +--- a/bfd/elf32-d30v.c ++++ b/bfd/elf32-d30v.c +@@ -254,11 +254,11 @@ static reloc_howto_type elf_d30v_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_D30V_NONE, /* Type. */ + 0, /* Rightshift. */ +- 2, /* Size (0 = byte, 1 = short, 2 = long). */ +- 32, /* Bitsize. */ ++ 3, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* Bitsize. */ + FALSE, /* PC_relative. */ + 0, /* Bitpos. */ +- complain_overflow_bitfield, /* Complain_on_overflow. */ ++ complain_overflow_dont,/* Complain_on_overflow. */ + bfd_elf_generic_reloc, /* Special_function. */ + "R_D30V_NONE", /* Name. */ + FALSE, /* Partial_inplace. */ +@@ -516,7 +516,11 @@ d30v_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_D30V_max); ++ if (r_type >= (unsigned int) R_D30V_max) ++ { ++ _bfd_error_handler (_("%B: invalid D30V reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_d30v_howto_table[r_type]; + } + +@@ -530,7 +534,11 @@ d30v_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_D30V_max); ++ if (r_type >= (unsigned int) R_D30V_max) ++ { ++ _bfd_error_handler (_("%B: invalid D30V reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_d30v_howto_table[r_type]; + } + +diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c +index 91441aa..1ffbc3e 100644 +--- a/bfd/elf32-dlx.c ++++ b/bfd/elf32-dlx.c +@@ -237,7 +237,7 @@ static reloc_howto_type dlx_elf_howto_table[]= + /* No relocation. */ + HOWTO (R_DLX_NONE, /* Type. */ + 0, /* Rightshift. */ +- 0, /* size (0 = byte, 1 = short, 2 = long). */ ++ 3, /* size (0 = byte, 1 = short, 2 = long). */ + 0, /* Bitsize. */ + FALSE, /* PC_relative. */ + 0, /* Bitpos. */ +@@ -546,7 +546,11 @@ dlx_rtype_to_howto (unsigned int r_type) + case R_DLX_RELOC_16_LO: + return & elf_dlx_reloc_16_lo; + default: +- BFD_ASSERT (r_type < (unsigned int) R_DLX_max); ++ if (r_type >= (unsigned int) R_DLX_max) ++ { ++ _bfd_error_handler (_("Invalid DLX reloc number: %d"), r_type); ++ r_type = 0; ++ } + return & dlx_elf_howto_table[r_type]; + } + } +diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c +index 8d95cc9..addd467 100644 +--- a/bfd/elf32-epiphany.c ++++ b/bfd/elf32-epiphany.c +@@ -63,7 +63,7 @@ static reloc_howto_type epiphany_elf_howto_table [] = + pr) /* pcrel_offset */ + + /* This reloc does nothing. */ +- AHOW (R_EPIPHANY_NONE, 0, 0,32, FALSE, 0, complain_overflow_dont, "R_EPIPHANY_NONE", 0, 0), ++ AHOW (R_EPIPHANY_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, "R_EPIPHANY_NONE", 0, 0), + + /* 8 bit absolute (not likely) */ + AHOW (R_EPIPHANY_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, "R_EPIPHANY_8", 0x000000ff, 0x000000ff), +@@ -370,6 +370,11 @@ epiphany_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= (unsigned int) R_EPIPHANY_max) ++ { ++ _bfd_error_handler (_("%B: invalid Epiphany reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & epiphany_elf_howto_table [r_type]; + } + +diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c +index 022a0a9..0715d97 100644 +--- a/bfd/elf32-fr30.c ++++ b/bfd/elf32-fr30.c +@@ -37,11 +37,11 @@ static reloc_howto_type fr30_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_FR30_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -343,7 +343,7 @@ fr30_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int i; + + for (i = sizeof (fr30_reloc_map) / sizeof (fr30_reloc_map[0]); +- --i;) ++ i--;) + if (fr30_reloc_map [i].bfd_reloc_val == code) + return & fr30_elf_howto_table [fr30_reloc_map[i].fr30_reloc_val]; + +@@ -375,7 +375,11 @@ fr30_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_FR30_max); ++ if (r_type >= (unsigned int) R_FR30_max) ++ { ++ _bfd_error_handler (_("%B: invalid FR30 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & fr30_elf_howto_table [r_type]; + } + +diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c +index 46f299b..5c291c5 100644 +--- a/bfd/elf32-frv.c ++++ b/bfd/elf32-frv.c +@@ -34,11 +34,11 @@ static reloc_howto_type elf32_frv_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_FRV_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -2557,6 +2557,11 @@ frv_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + break; + + default: ++ if (r_type >= (unsigned int) R_FRV_max) ++ { ++ _bfd_error_handler (_("%B: invalid FRV reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & elf32_frv_howto_table [r_type]; + break; + } +diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c +index e9eae94..983e8c2 100644 +--- a/bfd/elf32-h8300.c ++++ b/bfd/elf32-h8300.c +@@ -61,7 +61,7 @@ static reloc_howto_type h8_elf_howto_table[] = + #define R_H8_NONE_X 0 + HOWTO (R_H8_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c +index 0588ebb..abc7124 100644 +--- a/bfd/elf32-hppa.c ++++ b/bfd/elf32-hppa.c +@@ -1915,7 +1915,7 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, + + sec = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (eh, sec); ++ return _bfd_elf_adjust_dynamic_copy (info, eh, sec); + } + + /* Allocate space in the .plt for entries that won't have relocations. +diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c +index c9ed6e0..d7c3885 100644 +--- a/bfd/elf32-i370.c ++++ b/bfd/elf32-i370.c +@@ -40,11 +40,11 @@ static reloc_howto_type i370_elf_howto_raw[] = + /* This reloc does nothing. */ + HOWTO (R_I370_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -294,12 +294,21 @@ i370_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, + Elf_Internal_Rela *dst) + { ++ unsigned int r_type; ++ + if (!i370_elf_howto_table[ R_I370_ADDR31 ]) + /* Initialize howto table. */ + i370_elf_howto_init (); + +- BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_I370_max); +- cache_ptr->howto = i370_elf_howto_table[ELF32_R_TYPE (dst->r_info)]; ++ r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= R_I370_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised I370 reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_I370_NONE; ++ } ++ cache_ptr->howto = i370_elf_howto_table[r_type]; + } + + /* Hack alert -- the following several routines look generic to me ... +@@ -534,7 +543,7 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Increment the index of a dynamic symbol by a given amount. Called +diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c +index f9b9428..69c0b54 100644 +--- a/bfd/elf32-i386.c ++++ b/bfd/elf32-i386.c +@@ -37,7 +37,7 @@ + + static reloc_howto_type elf_howto_table[]= + { +- HOWTO(R_386_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, ++ HOWTO(R_386_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_386_NONE", + TRUE, 0x00000000, 0x00000000, FALSE), + HOWTO(R_386_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, +@@ -379,7 +379,9 @@ elf_i386_rtype_to_howto (bfd *abfd, unsigned r_type) + abfd, (int) r_type); + indx = R_386_NONE; + } +- BFD_ASSERT (elf_howto_table [indx].type == r_type); ++ /* PR 17512: file: 0f67f69d. */ ++ if (elf_howto_table [indx].type != r_type) ++ return NULL; + return &elf_howto_table[indx]; + } + +@@ -2164,7 +2166,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +@@ -5015,7 +5017,7 @@ bad_return: + if (plt_sym_val == NULL) + goto bad_return; + +- for (i = 0; i < count; i++, p++) ++ for (i = 0; i < count; i++) + plt_sym_val[i] = -1; + + plt_offset = bed->plt->plt_entry_size; +@@ -5024,6 +5026,10 @@ bad_return: + { + long reloc_index; + ++ /* Skip unknown relocation. PR 17512: file: bc9d6cf5. */ ++ if (p->howto == NULL) ++ continue; ++ + if (p->howto->type != R_386_JUMP_SLOT + && p->howto->type != R_386_IRELATIVE) + continue; +diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c +index de900c1..8920feb 100644 +--- a/bfd/elf32-i860.c ++++ b/bfd/elf32-i860.c +@@ -264,11 +264,11 @@ static reloc_howto_type elf32_i860_howto_table [] = + /* This relocation does nothing. */ + HOWTO (R_860_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_NONE", /* name */ + FALSE, /* partial_inplace */ +diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c +index c6fbbb8..78a7ae9 100644 +--- a/bfd/elf32-i960.c ++++ b/bfd/elf32-i960.c +@@ -83,7 +83,7 @@ elf32_i960_relocate (bfd *abfd ATTRIBUTE_UNUSED, + + static reloc_howto_type elf_howto_table[]= + { +- HOWTO (R_960_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, ++ HOWTO (R_960_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, + elf32_i960_relocate, "R_960_NONE", TRUE, + 0x00000000, 0x00000000, FALSE), + EMPTY_HOWTO (1), +@@ -132,7 +132,12 @@ elf32_i960_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + enum elf_i960_reloc_type type; + + type = (enum elf_i960_reloc_type) ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (type < R_960_max); ++ /* PR 17521: file: 9609b8d6. */ ++ if (type >= R_960_max) ++ { ++ _bfd_error_handler (_("%B: invalid i960 reloc number: %d"), abfd, type); ++ type = 0; ++ } + + cache_ptr->howto = &elf_howto_table[(int) type]; + } +diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c +index 79e1ecc..b2bf343 100644 +--- a/bfd/elf32-ip2k.c ++++ b/bfd/elf32-ip2k.c +@@ -141,7 +141,7 @@ static reloc_howto_type ip2k_elf_howto_table [] = + pr) /* pcrel_offset */ + + /* This reloc does nothing. */ +- IP2K_HOWTO (R_IP2K_NONE, 0,2,32, FALSE, 0, "R_IP2K_NONE", 0, 0), ++ IP2K_HOWTO (R_IP2K_NONE, 0,3,0, FALSE, 0, "R_IP2K_NONE", 0, 0), + /* A 16 bit absolute relocation. */ + IP2K_HOWTO (R_IP2K_16, 0,1,16, FALSE, 0, "R_IP2K_16", 0, 0xffff), + /* A 32 bit absolute relocation. */ +@@ -1239,6 +1239,11 @@ ip2k_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= (unsigned int) R_IP2K_max) ++ { ++ _bfd_error_handler (_("%B: invalid IP2K reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & ip2k_elf_howto_table [r_type]; + } + +diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c +index a6bf8d2..7282651 100644 +--- a/bfd/elf32-iq2000.c ++++ b/bfd/elf32-iq2000.c +@@ -34,11 +34,11 @@ static reloc_howto_type iq2000_elf_howto_table [] = + + HOWTO (R_IQ2000_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -435,6 +435,11 @@ iq2000_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + break; + + default: ++ if (r_type >= (unsigned int) R_IQ2000_max) ++ { ++ _bfd_error_handler (_("%B: invalid IQ2000 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & iq2000_elf_howto_table [r_type]; + break; + } +diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c +index e694055..cb834d2 100644 +--- a/bfd/elf32-lm32.c ++++ b/bfd/elf32-lm32.c +@@ -262,11 +262,11 @@ static reloc_howto_type lm32_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_LM32_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield,/* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_LM32_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -588,7 +588,11 @@ lm32_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_LM32_max); ++ if (r_type >= (unsigned int) R_LM32_max) ++ { ++ _bfd_error_handler (_("%B: invalid LM32 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &lm32_elf_howto_table[r_type]; + } + +@@ -1892,7 +1896,7 @@ lm32_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c +index 3e2c802..7370103 100644 +--- a/bfd/elf32-m32c.c ++++ b/bfd/elf32-m32c.c +@@ -40,6 +40,8 @@ void dump_symtab (bfd *, void *, void *); + #endif + static bfd_boolean m32c_elf_relax_section + (bfd *abfd, asection *sec, struct bfd_link_info *link_info, bfd_boolean *again); ++static bfd_reloc_status_type m32c_apply_reloc_24 ++ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + + + static reloc_howto_type m32c_elf_howto_table [] = +@@ -47,11 +49,11 @@ static reloc_howto_type m32c_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_M32C_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32C_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -83,7 +85,7 @@ static reloc_howto_type m32c_elf_howto_table [] = + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +- bfd_elf_generic_reloc, /* special_function */ ++ m32c_apply_reloc_24, /* special_function */ + "R_M32C_24", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ +@@ -264,7 +266,7 @@ m32c_reloc_type_lookup + { + unsigned int i; + +- for (i = ARRAY_SIZE (m32c_reloc_map); --i;) ++ for (i = ARRAY_SIZE (m32c_reloc_map); i--;) + if (m32c_reloc_map [i].bfd_reloc_val == code) + return & m32c_elf_howto_table [m32c_reloc_map[i].m32c_reloc_val]; + +@@ -297,12 +299,58 @@ m32c_info_to_howto_rela + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_M32C_max); ++ if (r_type >= (unsigned int) R_M32C_max) ++ { ++ _bfd_error_handler (_("%B: invalid M32C reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & m32c_elf_howto_table [r_type]; + } + + + ++/* Apply R_M32C_24 relocations. We have to do this because it's not a ++ power-of-two size, and the generic code may think it overruns the ++ section if it's right at the end. ++ ++ Must return something other than bfd_reloc_continue to avoid the ++ above problem. Typical return values include bfd_reloc_ok or ++ bfd_reloc_overflow. ++*/ ++ ++static bfd_reloc_status_type m32c_apply_reloc_24 (bfd *abfd ATTRIBUTE_UNUSED, ++ arelent *reloc_entry, ++ asymbol *symbol, ++ void *vdata_start ATTRIBUTE_UNUSED, ++ asection *input_section, ++ bfd *ibfd ATTRIBUTE_UNUSED, ++ char **error_msg ATTRIBUTE_UNUSED) ++{ ++ bfd_vma relocation; ++ bfd_reloc_status_type s; ++ ++ s = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, ++ vdata_start, ++ input_section, ibfd, error_msg); ++ if (s != bfd_reloc_continue) ++ return s; ++ ++ /* Get symbol value. (Common symbols are special.) */ ++ if (bfd_is_com_section (symbol->section)) ++ relocation = 0; ++ else ++ relocation = symbol->value; ++ ++ relocation += symbol->section->output_offset; ++ ++ /* Add in supplied addend. */ ++ relocation += reloc_entry->addend; ++ ++ reloc_entry->addend = relocation; ++ reloc_entry->address += input_section->output_offset; ++ return bfd_reloc_ok; ++} ++ + /* Relocate an M32C ELF section. + There is some attempt to make this function usable for many architectures, + both USE_REL and USE_RELA ['twould be nice if such a critter existed], +@@ -531,9 +579,32 @@ m32c_elf_relocate_section + printf ("\n"); + } + #endif +- r = _bfd_final_link_relocate (howto, input_bfd, input_section, +- contents, rel->r_offset, relocation, +- rel->r_addend); ++ switch (ELF32_R_TYPE(rel->r_info)) ++ { ++ case R_M32C_24: ++ /* Like m32c_apply_reloc_24, we must handle this one separately. */ ++ relocation += rel->r_addend; ++ ++ /* Sanity check the address. */ ++ if (rel->r_offset + 3 ++ > bfd_get_section_limit_octets (input_bfd, input_section)) ++ r = bfd_reloc_outofrange; ++ else ++ { ++ bfd_put_8 (input_bfd, relocation & 0xff, contents + rel->r_offset); ++ bfd_put_8 (input_bfd, (relocation >> 8) & 0xff, contents + rel->r_offset + 1); ++ bfd_put_8 (input_bfd, (relocation >> 16) & 0xff, contents + rel->r_offset + 2); ++ r = bfd_reloc_ok; ++ } ++ ++ break; ++ ++ default: ++ r = _bfd_final_link_relocate (howto, input_bfd, input_section, ++ contents, rel->r_offset, relocation, ++ rel->r_addend); ++ break; ++ } + + if (r != bfd_reloc_ok) + { +diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c +index 8dba9f0..30d3a45 100644 +--- a/bfd/elf32-m32r.c ++++ b/bfd/elf32-m32r.c +@@ -474,11 +474,11 @@ static reloc_howto_type m32r_elf_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_M32R_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -1280,7 +1280,11 @@ m32r_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY); ++ if (r_type > (unsigned int) R_M32R_GNU_VTENTRY) ++ { ++ _bfd_error_handler (_("%B: invalid M32R reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &m32r_elf_howto_table[r_type]; + } + +@@ -1919,7 +1923,7 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +@@ -4079,4 +4083,3 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + #define elf32_bed elf32_m32r_lin_bed + + #include "elf32-target.h" +- +diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c +index 2101bdf..f0a7e7e 100644 +--- a/bfd/elf32-m68hc11.c ++++ b/bfd/elf32-m68hc11.c +@@ -65,8 +65,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { + /* This reloc does nothing. */ + HOWTO (R_M68HC11_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ +@@ -384,7 +384,11 @@ m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max); ++ if (r_type >= (unsigned int) R_M68HC11_max) ++ { ++ _bfd_error_handler (_("%B: invalid M68HC11 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; + } + +diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c +index 7f48b7e..488e338 100644 +--- a/bfd/elf32-m68hc12.c ++++ b/bfd/elf32-m68hc12.c +@@ -107,8 +107,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { + /* This reloc does nothing. */ + HOWTO (R_M68HC11_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ +@@ -504,7 +504,11 @@ m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max); ++ if (r_type >= (unsigned int) R_M68HC11_max) ++ { ++ _bfd_error_handler (_("%B: invalid M68HC12 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; + } + +diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c +index 0058da4..75ef6bc 100644 +--- a/bfd/elf32-m68k.c ++++ b/bfd/elf32-m68k.c +@@ -31,7 +31,7 @@ elf_m68k_discard_copies (struct elf_link_hash_entry *, void *); + + static reloc_howto_type howto_table[] = + { +- HOWTO(R_68K_NONE, 0, 0, 0, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_NONE", FALSE, 0, 0x00000000,FALSE), ++ HOWTO(R_68K_NONE, 0, 3, 0, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_NONE", FALSE, 0, 0x00000000,FALSE), + HOWTO(R_68K_32, 0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_32", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_16, 0, 1,16, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_16", FALSE, 0, 0x0000ffff,FALSE), + HOWTO(R_68K_8, 0, 0, 8, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_8", FALSE, 0, 0x000000ff,FALSE), +@@ -3237,7 +3237,7 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Set the sizes of the dynamic sections. */ +diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c +index 903d379..839812e 100644 +--- a/bfd/elf32-mcore.c ++++ b/bfd/elf32-mcore.c +@@ -110,11 +110,11 @@ static reloc_howto_type mcore_elf_howto_raw[] = + /* This reloc does nothing. */ + HOWTO (R_MCORE_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + NULL, /* special_function */ + "R_MCORE_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -340,13 +340,22 @@ mcore_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, + arelent * cache_ptr, + Elf_Internal_Rela * dst) + { ++ unsigned int r_type; ++ + if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) + /* Initialize howto table if needed. */ + mcore_elf_howto_init (); + +- BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_MCORE_max); ++ r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= R_MCORE_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised MCore reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_MCORE_NONE; ++ } + +- cache_ptr->howto = mcore_elf_howto_table [ELF32_R_TYPE (dst->r_info)]; ++ cache_ptr->howto = mcore_elf_howto_table [r_type]; + } + + /* The RELOCATE_SECTION function is called by the ELF backend linker +diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c +index 548359f..4aee881 100644 +--- a/bfd/elf32-mep.c ++++ b/bfd/elf32-mep.c +@@ -42,7 +42,7 @@ static bfd_reloc_status_type mep_reloc (bfd *, arelent *, struct bfd_symbol *, + static reloc_howto_type mep_elf_howto_table [] = + { + /* type, size, bits, leftshift, rightshift, pcrel, OD/OS/OU, mask. */ +- MEPREL (R_MEP_NONE, 0, 0, 0, 0, 0, N, 0), ++ MEPREL (R_MEP_NONE, 3, 0, 0, 0, 0, N, 0), + MEPREL (R_RELC, 0, 0, 0, 0, 0, N, 0), + /* MEPRELOC:HOWTO */ + /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */ +@@ -400,6 +400,11 @@ mep_info_to_howto_rela + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= R_MEP_max) ++ { ++ _bfd_error_handler (_("%B: invalid MEP reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & mep_elf_howto_table [r_type]; + } + +diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c +index 47ca5de..9c14880 100644 +--- a/bfd/elf32-metag.c ++++ b/bfd/elf32-metag.c +@@ -142,7 +142,7 @@ static reloc_howto_type elf_metag_howto_table[] = + /* No relocation. */ + HOWTO (R_METAG_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -896,7 +896,11 @@ metag_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_METAG_MAX); ++ if (r_type >= (unsigned int) R_METAG_MAX) ++ { ++ _bfd_error_handler (_("%B: invalid METAG reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & elf_metag_howto_table [r_type]; + } + +@@ -2587,7 +2591,7 @@ elf_metag_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (eh, s); ++ return _bfd_elf_adjust_dynamic_copy (info, eh, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c +index a4cc6a3..2fb1b68 100644 +--- a/bfd/elf32-microblaze.c ++++ b/bfd/elf32-microblaze.c +@@ -44,11 +44,11 @@ static reloc_howto_type microblaze_elf_howto_raw[] = + /* This reloc does nothing. */ + HOWTO (R_MICROBLAZE_NONE, /* Type. */ + 0, /* Rightshift. */ +- 2, /* Size (0 = byte, 1 = short, 2 = long). */ +- 32, /* Bitsize. */ ++ 3, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* Bitsize. */ + FALSE, /* PC_relative. */ + 0, /* Bitpos. */ +- complain_overflow_bitfield, /* Complain on overflow. */ ++ complain_overflow_dont,/* Complain on overflow. */ + NULL, /* Special Function. */ + "R_MICROBLAZE_NONE", /* Name. */ + FALSE, /* Partial Inplace. */ +@@ -179,11 +179,11 @@ static reloc_howto_type microblaze_elf_howto_raw[] = + /* This reloc does nothing. Used for relaxation. */ + HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ + 0, /* Rightshift. */ +- 2, /* Size (0 = byte, 1 = short, 2 = long). */ +- 32, /* Bitsize. */ ++ 3, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* Bitsize. */ + TRUE, /* PC_relative. */ + 0, /* Bitpos. */ +- complain_overflow_bitfield, /* Complain on overflow. */ ++ complain_overflow_dont,/* Complain on overflow. */ + NULL, /* Special Function. */ + "R_MICROBLAZE_64_NONE",/* Name. */ + FALSE, /* Partial Inplace. */ +@@ -643,13 +643,22 @@ microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, + arelent * cache_ptr, + Elf_Internal_Rela * dst) + { ++ unsigned int r_type; ++ + if (!microblaze_elf_howto_table [R_MICROBLAZE_32]) + /* Initialize howto table if needed. */ + microblaze_elf_howto_init (); + +- BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_MICROBLAZE_max); ++ r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= R_MICROBLAZE_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised MicroBlaze reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_MICROBLAZE_NONE; ++ } + +- cache_ptr->howto = microblaze_elf_howto_table [ELF32_R_TYPE (dst->r_info)]; ++ cache_ptr->howto = microblaze_elf_howto_table [r_type]; + } + + /* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ +diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c +index 4cfef7a..390fd9b 100644 +--- a/bfd/elf32-mips.c ++++ b/bfd/elf32-mips.c +@@ -107,7 +107,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = + /* No relocation. */ + HOWTO (R_MIPS_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -2204,7 +2204,12 @@ mips_elf32_rtype_to_howto (unsigned int r_type, + return &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min]; + if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) + return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; +- BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); ++ if (r_type >= (unsigned int) R_MIPS_max) ++ { ++ (*_bfd_error_handler) (_("Unrecognised MIPS reloc number: %d"), r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_MIPS_NONE; ++ } + return &elf_mips_howto_table_rel[r_type]; + } + } +@@ -2473,6 +2478,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { + #define elf_backend_write_section _bfd_mips_elf_write_section + #define elf_backend_mips_irix_compat elf32_mips_irix_compat + #define elf_backend_mips_rtype_to_howto mips_elf32_rtype_to_howto ++#define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p ++ + #define bfd_elf32_bfd_is_local_label_name \ + mips_elf_is_local_label_name + #define bfd_elf32_bfd_is_target_special_symbol \ +diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c +index 1f685b9..85952d1 100644 +--- a/bfd/elf32-moxie.c ++++ b/bfd/elf32-moxie.c +@@ -34,11 +34,11 @@ static reloc_howto_type moxie_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_MOXIE_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MOXIE_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -99,7 +99,7 @@ moxie_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int i; + + for (i = sizeof (moxie_reloc_map) / sizeof (moxie_reloc_map[0]); +- --i;) ++ i--;) + if (moxie_reloc_map [i].bfd_reloc_val == code) + return & moxie_elf_howto_table [moxie_reloc_map[i].moxie_reloc_val]; + +@@ -131,7 +131,11 @@ moxie_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_MOXIE_max); ++ if (r_type >= (unsigned int) R_MOXIE_max) ++ { ++ _bfd_error_handler (_("%B: invalid Moxie reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & moxie_elf_howto_table [r_type]; + } + +diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c +index 2f55c53..667ebd4 100644 +--- a/bfd/elf32-msp430.c ++++ b/bfd/elf32-msp430.c +@@ -30,11 +30,11 @@ static reloc_howto_type elf_msp430_howto_table[] = + { + HOWTO (R_MSP430_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield,/* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -197,11 +197,11 @@ static reloc_howto_type elf_msp430x_howto_table[] = + { + HOWTO (R_MSP430_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield,/* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -617,12 +617,20 @@ msp430_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + + if (uses_msp430x_relocs (abfd)) + { +- BFD_ASSERT (r_type < (unsigned int) R_MSP430x_max); ++ if (r_type >= (unsigned int) R_MSP430x_max) ++ { ++ _bfd_error_handler (_("%B: invalid MSP430X reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = elf_msp430x_howto_table + r_type; + return; + } + +- BFD_ASSERT (r_type < (unsigned int) R_MSP430_max); ++ if (r_type >= (unsigned int) R_MSP430_max) ++ { ++ _bfd_error_handler (_("%B: invalid MSP430 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_msp430_howto_table[r_type]; + } + +diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c +index 6df1521..db11cf8 100644 +--- a/bfd/elf32-mt.c ++++ b/bfd/elf32-mt.c +@@ -48,8 +48,8 @@ static reloc_howto_type mt_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_MT_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +@@ -236,6 +236,11 @@ mt_info_to_howto_rela + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= (unsigned int) R_MT_max) ++ { ++ _bfd_error_handler (_("%B: invalid MT reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & mt_elf_howto_table [r_type]; + } + +diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c +index 2b63024..f073621 100644 +--- a/bfd/elf32-nds32.c ++++ b/bfd/elf32-nds32.c +@@ -321,11 +321,11 @@ static reloc_howto_type nds32_elf_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_NDS32_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_NDS32_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -2965,7 +2965,11 @@ nds32_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + enum elf_nds32_reloc_type r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (ELF32_R_TYPE (dst->r_info) <= R_NDS32_GNU_VTENTRY); ++ if (r_type > R_NDS32_GNU_VTENTRY) ++ { ++ _bfd_error_handler (_("%B: invalid NDS32 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = bfd_elf32_bfd_reloc_type_table_lookup (r_type); + } + +@@ -4182,11 +4186,10 @@ nds32_relocate_contents (reloc_howto_type *howto, bfd *input_bfd, + switch (size) + { + default: +- case 0: +- case 1: +- case 8: + abort (); + break; ++ case 0: ++ return bfd_reloc_ok; + case 2: + x = bfd_getb16 (location); + break; +diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c +index 9b3f436..0105b70 100644 +--- a/bfd/elf32-nios2.c ++++ b/bfd/elf32-nios2.c +@@ -80,7 +80,7 @@ static reloc_howto_type elf_nios2_howto_table_rel[] = { + /* No relocation. */ + HOWTO (R_NIOS2_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -764,6 +764,7 @@ struct elf_reloc_map + }; + + static const struct elf_reloc_map nios2_reloc_map[] = { ++ {BFD_RELOC_NONE, R_NIOS2_NONE}, + {BFD_RELOC_NIOS2_S16, R_NIOS2_S16}, + {BFD_RELOC_NIOS2_U16, R_NIOS2_U16}, + {BFD_RELOC_16_PCREL, R_NIOS2_PCREL16}, +@@ -5307,5 +5308,6 @@ const struct bfd_elf_special_section elf32_nios2_special_sections[] = + #define TARGET_BIG_NAME "elf32-bignios2" + + #define elf_backend_got_header_size 12 ++#define elf_backend_default_execstack 0 + + #include "elf32-target.h" +diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c +index 5cf29e1..91d62d3 100644 +--- a/bfd/elf32-or1k.c ++++ b/bfd/elf32-or1k.c +@@ -60,8 +60,8 @@ static reloc_howto_type or1k_elf_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_OR1K_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +@@ -704,7 +704,7 @@ or1k_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, + { + unsigned int i; + +- for (i = ARRAY_SIZE (or1k_reloc_map); --i;) ++ for (i = ARRAY_SIZE (or1k_reloc_map); i--;) + if (or1k_reloc_map[i].bfd_reloc_val == code) + return & or1k_elf_howto_table[or1k_reloc_map[i].or1k_reloc_val]; + +@@ -738,7 +738,11 @@ or1k_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_OR1K_max); ++ if (r_type >= (unsigned int) R_OR1K_max) ++ { ++ _bfd_error_handler (_("%B: invalid OR1K reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = & or1k_elf_howto_table[r_type]; + } + +@@ -2187,7 +2191,7 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elf32-pj.c b/bfd/elf32-pj.c +index 84b61f9..caca721 100644 +--- a/bfd/elf32-pj.c ++++ b/bfd/elf32-pj.c +@@ -113,7 +113,7 @@ static reloc_howto_type pj_elf_howto_table[] = + /* No relocation. */ + HOWTO (R_PJ_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -319,7 +319,13 @@ pj_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + + r = ELF32_R_TYPE (dst->r_info); + +- BFD_ASSERT (r < (unsigned int) R_PJ_max); ++ if (r >= R_PJ_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised PicoJava reloc number: %d"), ++ abfd, r); ++ bfd_set_error (bfd_error_bad_value); ++ r = R_PJ_NONE; ++ } + + cache_ptr->howto = &pj_elf_howto_table[r]; + } +diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c +index b4d2075..5a37fdb 100644 +--- a/bfd/elf32-ppc.c ++++ b/bfd/elf32-ppc.c +@@ -187,8 +187,8 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + /* This reloc does nothing. */ + HOWTO (R_PPC_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +@@ -2019,19 +2019,28 @@ ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, + Elf_Internal_Rela *dst) + { ++ unsigned int r_type; ++ + /* Initialize howto table if not already done. */ + if (!ppc_elf_howto_table[R_PPC_ADDR32]) + ppc_elf_howto_init (); + +- BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max); +- cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)]; ++ r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= R_PPC_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised PPC reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_PPC_NONE; ++ } ++ cache_ptr->howto = ppc_elf_howto_table[r_type]; + + /* Just because the above assert didn't trigger doesn't mean that + ELF32_R_TYPE (dst->r_info) is necessarily a valid relocation. */ + if (!cache_ptr->howto) + { + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), +- abfd, ELF32_R_TYPE (dst->r_info)); ++ abfd, r_type); + bfd_set_error (bfd_error_bad_value); + + cache_ptr->howto = ppc_elf_howto_table[R_PPC_NONE]; +@@ -2057,9 +2066,6 @@ ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED, + return bfd_reloc_ok; + } + +- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) +- return bfd_reloc_outofrange; +- + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else +@@ -2919,7 +2925,6 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms, + } + + count = relplt->size / sizeof (Elf32_External_Rela); +- stub_vma = glink_vma - (bfd_vma) count * 16; + /* If the stubs are those for -shared/-pie then we might have + multiple stubs for each plt entry. If that is the case then + there is no way to associate stubs with their plt entries short +@@ -2950,9 +2955,10 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms, + if (s == NULL) + return -1; + ++ stub_vma = glink_vma; + names = (char *) (s + count + 1 + (resolv_vma != 0)); +- p = relplt->relocation; +- for (i = 0; i < count; i++, p++) ++ p = relplt->relocation + count - 1; ++ for (i = 0; i < count; i++) + { + size_t len; + +@@ -2963,6 +2969,9 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms, + s->flags |= BSF_GLOBAL; + s->flags |= BSF_SYNTHETIC; + s->section = glink; ++ stub_vma -= 16; ++ if (strcmp ((*p->sym_ptr_ptr)->name, "__tls_get_addr_opt") == 0) ++ stub_vma -= 32; + s->value = stub_vma - glink->vma; + s->name = names; + s->udata.p = NULL; +@@ -2979,7 +2988,7 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms, + memcpy (names, "@plt", sizeof ("@plt")); + names += sizeof ("@plt"); + ++s; +- stub_vma += 16; ++ --p; + } + + /* Add a symbol at the start of the glink branch table. */ +@@ -5087,6 +5096,9 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) + htab = ppc_elf_hash_table (info); + htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", + FALSE, FALSE, TRUE); ++ if (htab->plt_type != PLT_NEW) ++ htab->params->no_tls_get_addr_opt = TRUE; ++ + if (!htab->params->no_tls_get_addr_opt) + { + struct elf_link_hash_entry *opt, *tga; +@@ -5576,6 +5588,13 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + if (!h->non_got_ref) + return TRUE; + ++ /* If -z nocopyreloc was given, we won't generate them either. */ ++ if (info->nocopyreloc) ++ { ++ h->non_got_ref = 0; ++ return TRUE; ++ } ++ + /* 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. + We can't do this if there are any small data relocations. This +@@ -5592,6 +5611,16 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + return TRUE; + } + ++ /* Protected variables do not work with .dynbss. The copy in ++ .dynbss won't be used by the shared library with the protected ++ definition for the variable. Text relocations are preferable ++ to an incorrect program. */ ++ if (h->protected_def) ++ { ++ 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 +@@ -5628,7 +5657,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Generate a symbol to mark plt call stubs. For non-PIC code the sym is +@@ -7754,8 +7783,8 @@ ppc_elf_relocate_section (bfd *output_bfd, + + R_PPC_GOT_TPREL16); + else + { +- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); + rel->r_offset -= d_offset; ++ bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); + r_type = R_PPC_NONE; + } + rel->r_info = ELF32_R_INFO (r_symndx, r_type); +@@ -7788,12 +7817,16 @@ ppc_elf_relocate_section (bfd *output_bfd, + && branch_reloc_hash_match (input_bfd, rel + 1, + htab->tls_get_addr)) + offset = rel[1].r_offset; ++ /* We read the low GOT_TLS insn because we need to keep ++ the destination reg. It may be something other than ++ the usual r3, and moved to r3 before the call by ++ intervening code. */ ++ insn1 = bfd_get_32 (output_bfd, ++ contents + rel->r_offset - d_offset); + if ((tls_mask & tls_gd) != 0) + { + /* IE */ +- insn1 = bfd_get_32 (output_bfd, +- contents + rel->r_offset - d_offset); +- insn1 &= (1 << 26) - 1; ++ insn1 &= (0x1f << 21) | (0x1f << 16); + insn1 |= 32 << 26; /* lwz */ + if (offset != (bfd_vma) -1) + { +@@ -7808,7 +7841,8 @@ ppc_elf_relocate_section (bfd *output_bfd, + else + { + /* LE */ +- insn1 = 0x3c620000; /* addis 3,2,0 */ ++ insn1 &= 0x1f << 21; ++ insn1 |= 0x3c020000; /* addis r,2,0 */ + if (tls_gd == 0) + { + /* Was an LD reloc. */ +@@ -8210,7 +8244,12 @@ ppc_elf_relocate_section (bfd *output_bfd, + { + outrel.r_addend += relocation; + if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) +- outrel.r_addend -= htab->elf.tls_sec->vma; ++ { ++ if (htab->elf.tls_sec == NULL) ++ outrel.r_addend = 0; ++ else ++ outrel.r_addend -= htab->elf.tls_sec->vma; ++ } + } + loc = rsec->contents; + loc += (rsec->reloc_count++ +@@ -8228,9 +8267,14 @@ ppc_elf_relocate_section (bfd *output_bfd, + value = 1; + else if (tls_ty != 0) + { +- value -= htab->elf.tls_sec->vma + DTP_OFFSET; +- if (tls_ty == (TLS_TLS | TLS_TPREL)) +- value += DTP_OFFSET - TP_OFFSET; ++ if (htab->elf.tls_sec == NULL) ++ value = 0; ++ else ++ { ++ value -= htab->elf.tls_sec->vma + DTP_OFFSET; ++ if (tls_ty == (TLS_TLS | TLS_TPREL)) ++ value += DTP_OFFSET - TP_OFFSET; ++ } + + if (tls_ty == (TLS_TLS | TLS_GD)) + { +@@ -8316,7 +8360,8 @@ ppc_elf_relocate_section (bfd *output_bfd, + case R_PPC_DTPREL16_LO: + case R_PPC_DTPREL16_HI: + case R_PPC_DTPREL16_HA: +- addend -= htab->elf.tls_sec->vma + DTP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + DTP_OFFSET; + break; + + /* Relocations that may need to be propagated if this is a shared +@@ -8340,18 +8385,21 @@ ppc_elf_relocate_section (bfd *output_bfd, + bfd_put_32 (output_bfd, insn, p); + break; + } +- addend -= htab->elf.tls_sec->vma + TP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + TP_OFFSET; + /* The TPREL16 relocs shouldn't really be used in shared + libs as they will result in DT_TEXTREL being set, but + support them anyway. */ + goto dodyn; + + case R_PPC_TPREL32: +- addend -= htab->elf.tls_sec->vma + TP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + TP_OFFSET; + goto dodyn; + + case R_PPC_DTPREL32: +- addend -= htab->elf.tls_sec->vma + DTP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + DTP_OFFSET; + goto dodyn; + + case R_PPC_DTPMOD32: +@@ -10327,11 +10375,12 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + #define ELF_MACHINE_CODE EM_PPC + #ifdef __QNXTARGET__ + #define ELF_MAXPAGESIZE 0x1000 ++#define ELF_COMMONPAGESIZE 0x1000 + #else + #define ELF_MAXPAGESIZE 0x10000 ++#define ELF_COMMONPAGESIZE 0x10000 + #endif + #define ELF_MINPAGESIZE 0x1000 +-#define ELF_COMMONPAGESIZE 0x1000 + #define elf_info_to_howto ppc_elf_info_to_howto + + #ifdef EM_CYGNUS_POWERPC +diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c +index 2a5ec99..c07b237 100644 +--- a/bfd/elf32-rl78.c ++++ b/bfd/elf32-rl78.c +@@ -37,7 +37,7 @@ + + static reloc_howto_type rl78_elf_howto_table [] = + { +- RL78REL (NONE, 0, 0, 0, dont, FALSE), ++ RL78REL (NONE, 3, 0, 0, dont, FALSE), + RL78REL (DIR32, 2, 32, 0, signed, FALSE), + RL78REL (DIR24S, 2, 24, 0, signed, FALSE), + RL78REL (DIR16, 1, 16, 0, dont, FALSE), +@@ -246,7 +246,7 @@ rl78_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, + if (code == BFD_RELOC_RL78_32_OP) + return rl78_elf_howto_table + R_RL78_DIR32; + +- for (i = ARRAY_SIZE (rl78_reloc_map); --i;) ++ for (i = ARRAY_SIZE (rl78_reloc_map); i--;) + if (rl78_reloc_map [i].bfd_reloc_val == code) + return rl78_elf_howto_table + rl78_reloc_map[i].rl78_reloc_val; + +@@ -276,7 +276,11 @@ rl78_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_RL78_max); ++ if (r_type >= (unsigned int) R_RL78_max) ++ { ++ _bfd_error_handler (_("%B: invalid RL78 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = rl78_elf_howto_table + r_type; + } + +diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c +index 5d09f21..9f78a19 100644 +--- a/bfd/elf32-rx.c ++++ b/bfd/elf32-rx.c +@@ -49,7 +49,7 @@ void rx_dump_symtab (bfd *, void *, void *); + + static reloc_howto_type rx_elf_howto_table [] = + { +- RXREL (NONE, 0, 0, 0, dont, FALSE), ++ RXREL (NONE, 3, 0, 0, dont, FALSE), + RXREL (DIR32, 2, 32, 0, signed, FALSE), + RXREL (DIR24S, 2, 24, 0, signed, FALSE), + RXREL (DIR16, 1, 16, 0, dont, FALSE), +@@ -277,7 +277,7 @@ rx_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, + if (code == BFD_RELOC_RX_32_OP) + return rx_elf_howto_table + R_RX_DIR32; + +- for (i = ARRAY_SIZE (rx_reloc_map); --i;) ++ for (i = ARRAY_SIZE (rx_reloc_map); i--;) + if (rx_reloc_map [i].bfd_reloc_val == code) + return rx_elf_howto_table + rx_reloc_map[i].rx_reloc_val; + +@@ -307,7 +307,11 @@ rx_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_RX_max); ++ if (r_type >= (unsigned int) R_RX_max) ++ { ++ _bfd_error_handler (_("%B: invalid RX reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = rx_elf_howto_table + r_type; + } + +diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c +index ebcb028..3b050a8 100644 +--- a/bfd/elf32-s390.c ++++ b/bfd/elf32-s390.c +@@ -39,7 +39,7 @@ static reloc_howto_type elf_howto_table[] = + { + HOWTO (R_390_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */ ++ 3, /* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -1762,7 +1762,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +@@ -4028,6 +4028,7 @@ elf32_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd) + #define elf_backend_grok_prstatus elf_s390_grok_prstatus + #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 bfd_elf32_mkobject elf_s390_mkobject + #define elf_backend_object_p elf_s390_object_p +diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c +index 1ab54cd..fc4df66 100644 +--- a/bfd/elf32-score.c ++++ b/bfd/elf32-score.c +@@ -645,7 +645,7 @@ static reloc_howto_type elf32_score_howto_table[] = + /* No relocation. */ + HOWTO (R_SCORE_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c +index 0b3cf20..d605a46 100644 +--- a/bfd/elf32-score7.c ++++ b/bfd/elf32-score7.c +@@ -546,7 +546,7 @@ static reloc_howto_type elf32_score_howto_table[] = + /* No relocation. */ + HOWTO (R_SCORE_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +diff --git a/bfd/elf32-sh-relocs.h b/bfd/elf32-sh-relocs.h +index fb54c9a..a20828d 100644 +--- a/bfd/elf32-sh-relocs.h ++++ b/bfd/elf32-sh-relocs.h +@@ -20,7 +20,7 @@ + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c +index 44a3aa7..7027bdf 100644 +--- a/bfd/elf32-sh.c ++++ b/bfd/elf32-sh.c +@@ -255,6 +255,11 @@ sh_elf_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol_in, + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + ++ /* PR 17512: file: 9891ca98. */ ++ if (addr * bfd_octets_per_byte (abfd) + bfd_get_reloc_size (reloc_entry->howto) ++ > bfd_get_section_limit_octets (abfd, input_section)) ++ return bfd_reloc_outofrange; ++ + if (bfd_is_com_section (symbol_in->section)) + sym_value = 0; + else +@@ -474,13 +479,19 @@ sh_elf_info_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) + + r = ELF32_R_TYPE (dst->r_info); + +- BFD_ASSERT (r < (unsigned int) R_SH_max); +- BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC); +- BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_2 || r > R_SH_LAST_INVALID_RELOC_2); +- BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_3 || r > R_SH_LAST_INVALID_RELOC_3); +- BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4); +- BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_5 || r > R_SH_LAST_INVALID_RELOC_5); +- BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_6 || r > R_SH_LAST_INVALID_RELOC_6); ++ if (r >= R_SH_max ++ || (r >= R_SH_FIRST_INVALID_RELOC && r <= R_SH_LAST_INVALID_RELOC) ++ || (r >= R_SH_FIRST_INVALID_RELOC_2 && r <= R_SH_LAST_INVALID_RELOC_2) ++ || (r >= R_SH_FIRST_INVALID_RELOC_3 && r <= R_SH_LAST_INVALID_RELOC_3) ++ || (r >= R_SH_FIRST_INVALID_RELOC_4 && r <= R_SH_LAST_INVALID_RELOC_4) ++ || (r >= R_SH_FIRST_INVALID_RELOC_5 && r <= R_SH_LAST_INVALID_RELOC_5) ++ || (r >= R_SH_FIRST_INVALID_RELOC_6 && r <= R_SH_LAST_INVALID_RELOC_6)) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised SH reloc number: %d"), ++ abfd, r); ++ bfd_set_error (bfd_error_bad_value); ++ r = R_SH_NONE; ++ } + + cache_ptr->howto = get_howto_table (abfd) + r; + } +@@ -2919,7 +2930,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c +index 13806ad..10c683f 100644 +--- a/bfd/elf32-spu.c ++++ b/bfd/elf32-spu.c +@@ -37,7 +37,7 @@ static bfd_reloc_status_type spu_elf_rel9 (bfd *, arelent *, asymbol *, + array, so it must be declared in the order of that type. */ + + static reloc_howto_type elf_howto_table[] = { +- HOWTO (R_SPU_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont, ++ HOWTO (R_SPU_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "SPU_NONE", + FALSE, 0, 0x00000000, FALSE), + HOWTO (R_SPU_ADDR10, 4, 2, 10, FALSE, 14, complain_overflow_bitfield, +@@ -105,6 +105,8 @@ spu_elf_bfd_to_reloc_type (bfd_reloc_code_real_type code) + switch (code) + { + default: ++ return (enum elf_spu_reloc_type) -1; ++ case BFD_RELOC_NONE: + return R_SPU_NONE; + case BFD_RELOC_SPU_IMM10W: + return R_SPU_ADDR10; +@@ -151,7 +153,14 @@ spu_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + enum elf_spu_reloc_type r_type; + + r_type = (enum elf_spu_reloc_type) ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < R_SPU_max); ++ /* PR 17512: file: 90c2a92e. */ ++ if (r_type >= R_SPU_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised SPU reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_SPU_NONE; ++ } + cache_ptr->howto = &elf_howto_table[(int) r_type]; + } + +@@ -161,7 +170,7 @@ spu_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + { + enum elf_spu_reloc_type r_type = spu_elf_bfd_to_reloc_type (code); + +- if (r_type == R_SPU_NONE) ++ if (r_type == (enum elf_spu_reloc_type) -1) + return NULL; + + return elf_howto_table + r_type; +diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c +index 8381cfa..0f6f459 100644 +--- a/bfd/elf32-tic6x.c ++++ b/bfd/elf32-tic6x.c +@@ -152,7 +152,7 @@ static reloc_howto_type elf32_tic6x_howto_table[] = + { + HOWTO (R_C6000_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -820,7 +820,7 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] = + { + HOWTO (R_C6000_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -2168,7 +2168,7 @@ elf32_tic6x_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + static bfd_boolean +diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c +index b9a31d5..9c8a478 100644 +--- a/bfd/elf32-tilepro.c ++++ b/bfd/elf32-tilepro.c +@@ -34,11 +34,11 @@ static reloc_howto_type tilepro_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_TILEPRO_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_TILEPRO_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -2189,7 +2189,7 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, htab->sdynbss); ++ return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c +index 2589a25..c6fa72e 100644 +--- a/bfd/elf32-v850.c ++++ b/bfd/elf32-v850.c +@@ -494,7 +494,7 @@ v850_elf_perform_relocation (bfd *abfd, + { + default: + #ifdef DEBUG +- fprintf (stderr, "reloc number %d not recognised\n", r_type); ++ fprintf (stderr, "%B: reloc number %d not recognised\n", abfd, r_type); + #endif + return bfd_reloc_notsupported; + +@@ -895,11 +895,11 @@ static reloc_howto_type v850_elf_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_V850_NONE, /* Type. */ + 0, /* Rightshift. */ +- 2, /* Size (0 = byte, 1 = short, 2 = long). */ +- 32, /* Bitsize. */ ++ 3, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 0, /* Bitsize. */ + FALSE, /* PC_relative. */ + 0, /* Bitpos. */ +- complain_overflow_bitfield, /* Complain_on_overflow. */ ++ complain_overflow_dont, /* Complain_on_overflow. */ + bfd_elf_generic_reloc, /* Special_function. */ + "R_V850_NONE", /* Name. */ + FALSE, /* Partial_inplace. */ +@@ -1896,7 +1896,11 @@ v850_elf_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_V850_max); ++ if (r_type >= (unsigned int) R_V850_max) ++ { ++ _bfd_error_handler (_("%B: invalid V850 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &v850_elf_howto_table[r_type]; + } + +@@ -1910,7 +1914,11 @@ v850_elf_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_V850_max); ++ if (r_type >= (unsigned int) R_V850_max) ++ { ++ _bfd_error_handler (_("%B: invalid V850 reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &v850_elf_howto_table[r_type]; + } + +@@ -2139,7 +2147,7 @@ v850_elf_final_link_relocate (reloc_howto_type *howto, + + default: + #ifdef DEBUG +- fprintf (stderr, "reloc number %d not recognised\n", r_type); ++ fprintf (stderr, "%B: reloc number %d not recognised\n", input_bfd, r_type); + #endif + return bfd_reloc_notsupported; + } +diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c +index 1f41867..df73ef5 100644 +--- a/bfd/elf32-vax.c ++++ b/bfd/elf32-vax.c +@@ -56,7 +56,7 @@ static bfd_boolean elf32_vax_print_private_bfd_data (bfd *, void *); + static reloc_howto_type howto_table[] = { + HOWTO (R_VAX_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -280,11 +280,19 @@ static reloc_howto_type howto_table[] = { + }; + + static void +-rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, +- Elf_Internal_Rela *dst) ++rtype_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) + { +- BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_VAX_max); +- cache_ptr->howto = &howto_table[ELF32_R_TYPE(dst->r_info)]; ++ unsigned int r_type; ++ ++ r_type = ELF32_R_TYPE (dst->r_info); ++ if (r_type >= R_VAX_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised VAX reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_VAX_NONE; ++ } ++ cache_ptr->howto = &howto_table[r_type]; + } + + #define elf_info_to_howto rtype_to_howto +@@ -1043,7 +1051,7 @@ elf_vax_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* This function is called via elf_link_hash_traverse. It resets GOT +diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c +index 9e7deca..348cd1f 100644 +--- a/bfd/elf32-xc16x.c ++++ b/bfd/elf32-xc16x.c +@@ -32,11 +32,11 @@ static reloc_howto_type xc16x_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_XC16X_NONE, /* type */ + 0, /* rightshift */ +- 1, /* size (0 = byte, 1 = short, 2 = long) */ +- 16, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XC16X_NONE", /* name */ + FALSE, /* partial_inplace */ +diff --git a/bfd/elf32-xgate.c b/bfd/elf32-xgate.c +index 01f39fa..e2294ef 100644 +--- a/bfd/elf32-xgate.c ++++ b/bfd/elf32-xgate.c +@@ -52,8 +52,8 @@ static reloc_howto_type elf_xgate_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_XGATE_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ +@@ -422,7 +422,11 @@ xgate_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); +- BFD_ASSERT(r_type < (unsigned int) R_XGATE_max); ++ if (r_type >= (unsigned int) R_XGATE_max) ++ { ++ _bfd_error_handler (_("%B: invalid XGate reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_xgate_howto_table[r_type]; + } + +diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c +index f918a1e..90c1171 100644 +--- a/bfd/elf32-xstormy16.c ++++ b/bfd/elf32-xstormy16.c +@@ -73,11 +73,11 @@ static reloc_howto_type xstormy16_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_XSTORMY16_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_NONE", /* name */ + FALSE, /* partial_inplace */ +diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c +index e32496a..50d0fc4 100644 +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -161,7 +161,7 @@ int elf32xtensa_no_literal_movement = 1; + + static reloc_howto_type elf_howto_table[] = + { +- HOWTO (R_XTENSA_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont, ++ HOWTO (R_XTENSA_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_NONE", + FALSE, 0, 0, FALSE), + HOWTO (R_XTENSA_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, +@@ -479,7 +479,11 @@ elf_xtensa_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + { + unsigned int r_type = ELF32_R_TYPE (dst->r_info); + +- BFD_ASSERT (r_type < (unsigned int) R_XTENSA_max); ++ if (r_type >= (unsigned int) R_XTENSA_max) ++ { ++ _bfd_error_handler (_("%B: invalid XTENSA reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_howto_table[r_type]; + } + +diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c +index 1a4fc23..8f8cf7b 100644 +--- a/bfd/elf64-alpha.c ++++ b/bfd/elf64-alpha.c +@@ -486,8 +486,8 @@ static reloc_howto_type elf64_alpha_howto_table[] = + { + HOWTO (R_ALPHA_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ +- 8, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +@@ -1105,7 +1105,14 @@ elf64_alpha_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) + { + unsigned r_type = ELF64_R_TYPE(dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_ALPHA_max); ++ ++ if (r_type >= R_ALPHA_max) ++ { ++ (*_bfd_error_handler) (_("%B: unrecognised Alpha reloc number: %d"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_ALPHA_NONE; ++ } + cache_ptr->howto = &elf64_alpha_howto_table[r_type]; + } + +diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c +index 2f323c6..cbf504a 100644 +--- a/bfd/elf64-mips.c ++++ b/bfd/elf64-mips.c +@@ -145,7 +145,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = + /* No relocation. */ + HOWTO (R_MIPS_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -908,7 +908,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = + /* No relocation. */ + HOWTO (R_MIPS_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -4444,6 +4444,7 @@ const struct elf_size_info mips_elf64_size_info = + #define elf_backend_sign_extend_vma TRUE + + #define elf_backend_write_section _bfd_mips_elf_write_section ++#define elf_backend_sort_relocs_p _bfd_mips_elf_sort_relocs_p + + /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit + MIPS-specific function only applies to IRIX5, which had no 64-bit +diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c +index 58fca92..b6f4232 100644 +--- a/bfd/elf64-mmix.c ++++ b/bfd/elf64-mmix.c +@@ -192,11 +192,11 @@ static reloc_howto_type elf_mmix_howto_table[] = + /* This reloc does nothing. */ + HOWTO (R_MMIX_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -1259,7 +1259,11 @@ mmix_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int r_type; + + r_type = ELF64_R_TYPE (dst->r_info); +- BFD_ASSERT (r_type < (unsigned int) R_MMIX_max); ++ if (r_type >= (unsigned int) R_MMIX_max) ++ { ++ _bfd_error_handler (_("%B: invalid MMIX reloc number: %d"), abfd, r_type); ++ r_type = 0; ++ } + cache_ptr->howto = &elf_mmix_howto_table[r_type]; + } + +diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c +index c1029df..fde5215 100644 +--- a/bfd/elf64-ppc.c ++++ b/bfd/elf64-ppc.c +@@ -64,7 +64,7 @@ static bfd_vma opd_entry_value + #define ELF_TARGET_ID PPC64_ELF_DATA + #define ELF_MACHINE_CODE EM_PPC64 + #define ELF_MAXPAGESIZE 0x10000 +-#define ELF_COMMONPAGESIZE 0x1000 ++#define ELF_COMMONPAGESIZE 0x10000 + #define elf_info_to_howto ppc64_elf_info_to_howto + + #define elf_backend_want_got_sym 0 +@@ -258,8 +258,8 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + /* This reloc does nothing. */ + HOWTO (R_PPC64_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ +@@ -2954,7 +2954,9 @@ struct _ppc64_elf_section_data + + union + { +- /* An array with one entry for each opd function descriptor. */ ++ /* An array with one entry for each opd function descriptor, ++ and some spares since opd entries may be either 16 or 24 bytes. */ ++#define OPD_NDX(OFF) ((OFF) >> 4) + struct _opd_sec_data + { + /* Points to the function code section for local opd entries. */ +@@ -3287,6 +3289,8 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd, + } + } + ++ if (size == 0) ++ goto done; + s = *ret = bfd_malloc (size); + if (s == NULL) + { +@@ -3458,6 +3462,8 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd, + } + } + ++ if (size == 0) ++ goto free_contents_and_exit; + s = *ret = bfd_malloc (size); + if (s == NULL) + goto free_contents_and_exit; +@@ -5005,7 +5011,7 @@ ppc64_elf_before_check_relocs (bfd *ibfd, struct bfd_link_info *info) + bfd_size_type amt; + asection **opd_sym_map; + +- amt = opd->size * sizeof (*opd_sym_map) / 8; ++ amt = OPD_NDX (opd->size) * sizeof (*opd_sym_map); + opd_sym_map = bfd_zalloc (ibfd, amt); + if (opd_sym_map == NULL) + return FALSE; +@@ -5676,7 +5682,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + + s = bfd_section_from_elf_index (abfd, isym->st_shndx); + if (s != NULL && s != sec) +- opd_sym_map[rel->r_offset / 8] = s; ++ opd_sym_map[OPD_NDX (rel->r_offset)] = s; + } + } + /* Fall through. */ +@@ -5941,6 +5947,10 @@ opd_entry_value (asection *opd_sec, + ppc64_elf_tdata (opd_bfd)->opd.contents = contents; + } + ++ /* PR 17512: file: 64b9dfbb. */ ++ if (offset + 7 >= opd_sec->size || offset + 7 < offset) ++ return (bfd_vma) -1; ++ + val = bfd_get_64 (opd_bfd, contents + offset); + if (code_sec != NULL) + { +@@ -5976,10 +5986,12 @@ opd_entry_value (asection *opd_sec, + relocs = ppc64_elf_tdata (opd_bfd)->opd.relocs; + if (relocs == NULL) + relocs = _bfd_elf_link_read_relocs (opd_bfd, opd_sec, NULL, NULL, TRUE); ++ /* PR 17512: file: df8e1fd6. */ ++ if (relocs == NULL) ++ return (bfd_vma) -1; + + /* Go find the opd reloc at the sym address. */ + lo = relocs; +- BFD_ASSERT (lo != NULL); + hi = lo + opd_sec->reloc_count - 1; /* ignore last reloc */ + val = (bfd_vma) -1; + while (lo < hi) +@@ -6230,7 +6242,7 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf) + if ((eh->elf.root.type == bfd_link_hash_defined + || eh->elf.root.type == bfd_link_hash_defweak) + && (eh->elf.ref_dynamic +- || (eh->elf.def_regular ++ || ((eh->elf.def_regular || ELF_COMMON_DEF_P (&eh->elf)) + && ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL + && ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN + && (!info->executable +@@ -6343,7 +6355,7 @@ ppc64_elf_gc_mark_hook (asection *sec, + { + rsec->gc_mark = 1; + +- rsec = opd->func_sec[(sym->st_value + rel->r_addend) / 8]; ++ rsec = opd->func_sec[OPD_NDX (sym->st_value + rel->r_addend)]; + } + } + +@@ -7073,6 +7085,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + if (!h->def_dynamic || !h->ref_regular || h->def_regular) + return TRUE; + ++ /* If -z nocopyreloc was given, don't generate them either. */ ++ if (info->nocopyreloc) ++ { ++ h->non_got_ref = 0; ++ return TRUE; ++ } ++ + /* 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. */ + if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h)) +@@ -7081,6 +7100,16 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + return TRUE; + } + ++ /* Protected variables do not work with .dynbss. The copy in ++ .dynbss won't be used by the shared library with the protected ++ definition for the variable. Text relocations are preferable ++ to an incorrect program. */ ++ if (h->protected_def) ++ { ++ h->non_got_ref = 0; ++ return TRUE; ++ } ++ + if (h->plt.plist != NULL) + { + /* We should never get here, but unfortunately there are versions +@@ -7119,7 +7148,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->dynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* If given a function descriptor symbol, hide both the function code +@@ -7404,7 +7433,7 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) + opd = get_opd_info (sym_sec); + if (opd != NULL && opd->adjust != NULL) + { +- long adjust = opd->adjust[eh->elf.root.u.def.value / 8]; ++ long adjust = opd->adjust[OPD_NDX (eh->elf.root.u.def.value)]; + if (adjust == -1) + { + /* This entry has been deleted. */ +@@ -7611,9 +7640,8 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + Elf_Internal_Rela *relstart, *rel, *relend; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *local_syms; +- bfd_vma offset; + struct _opd_sec_data *opd; +- bfd_boolean need_edit, add_aux_fields; ++ bfd_boolean need_edit, add_aux_fields, broken; + bfd_size_type cnt_16b = 0; + + if (!is_ppc64_elf (ibfd)) +@@ -7645,8 +7673,8 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + /* First run through the relocs to check they are sane, and to + determine whether we need to edit this opd section. */ + need_edit = FALSE; ++ broken = FALSE; + need_pad = sec; +- offset = 0; + relend = relstart + sec->reloc_count; + for (rel = relstart; rel < relend; ) + { +@@ -7655,13 +7683,14 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + asection *sym_sec; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; ++ bfd_vma offset; + +- /* .opd contains a regular array of 16 or 24 byte entries. We're ++ /* .opd contains an array of 16 or 24 byte entries. We're + only interested in the reloc pointing to a function entry + point. */ +- if (rel->r_offset != offset +- || rel + 1 >= relend +- || (rel + 1)->r_offset != offset + 8) ++ offset = rel->r_offset; ++ if (rel + 1 == relend ++ || rel[1].r_offset != offset + 8) + { + /* If someone messes with .opd alignment then after a + "ld -r" we might have padding in the middle of .opd. +@@ -7671,7 +7700,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + broken_opd: + (*_bfd_error_handler) + (_("%B: .opd is not a regular array of opd entries"), ibfd); +- need_edit = FALSE; ++ broken = TRUE; + break; + } + +@@ -7681,7 +7710,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + (*_bfd_error_handler) + (_("%B: unexpected reloc type %u in .opd section"), + ibfd, r_type); +- need_edit = FALSE; ++ broken = TRUE; + break; + } + +@@ -7702,7 +7731,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + (*_bfd_error_handler) + (_("%B: undefined sym `%s' in .opd section"), + ibfd, sym_name); +- need_edit = FALSE; ++ broken = TRUE; + break; + } + +@@ -7718,39 +7747,33 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + need_edit = TRUE; + + rel += 2; +- if (rel == relend +- || (rel + 1 == relend && rel->r_offset == offset + 16)) ++ if (rel + 1 == relend ++ || (rel + 2 < relend ++ && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_TOC)) ++ ++rel; ++ ++ if (rel == relend) + { + if (sec->size == offset + 24) + { + need_pad = NULL; + break; + } +- if (rel == relend && sec->size == offset + 16) ++ if (sec->size == offset + 16) + { + cnt_16b++; + break; + } + goto broken_opd; + } +- +- if (rel->r_offset == offset + 24) +- offset += 24; +- else if (rel->r_offset != offset + 16) +- goto broken_opd; + else if (rel + 1 < relend + && ELF64_R_TYPE (rel[0].r_info) == R_PPC64_ADDR64 + && ELF64_R_TYPE (rel[1].r_info) == R_PPC64_TOC) + { +- offset += 16; +- cnt_16b++; +- } +- else if (rel + 2 < relend +- && ELF64_R_TYPE (rel[1].r_info) == R_PPC64_ADDR64 +- && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_TOC) +- { +- offset += 24; +- rel += 1; ++ if (rel[0].r_offset == offset + 16) ++ cnt_16b++; ++ else if (rel[0].r_offset != offset + 24) ++ goto broken_opd; + } + else + goto broken_opd; +@@ -7758,18 +7781,16 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + + add_aux_fields = htab->params->non_overlapping_opd && cnt_16b > 0; + +- if (need_edit || add_aux_fields) ++ if (!broken && (need_edit || add_aux_fields)) + { + Elf_Internal_Rela *write_rel; + Elf_Internal_Shdr *rel_hdr; + bfd_byte *rptr, *wptr; + bfd_byte *new_contents; +- bfd_boolean skip; +- long opd_ent_size; + bfd_size_type amt; + + new_contents = NULL; +- amt = sec->size * sizeof (long) / 8; ++ amt = OPD_NDX (sec->size) * sizeof (long); + opd = &ppc64_elf_section_data (sec)->u.opd; + opd->adjust = bfd_zalloc (sec->owner, amt); + if (opd->adjust == NULL) +@@ -7807,123 +7828,134 @@ ppc64_elf_edit_opd (struct bfd_link_info *info) + new_contents = bfd_malloc (sec->size + cnt_16b * 8); + if (new_contents == NULL) + return FALSE; +- need_pad = FALSE; ++ need_pad = NULL; + } + wptr = new_contents; + rptr = sec->contents; +- + write_rel = relstart; +- skip = FALSE; +- offset = 0; +- opd_ent_size = 0; +- for (rel = relstart; rel < relend; rel++) ++ for (rel = relstart; rel < relend; ) + { + unsigned long r_symndx; + asection *sym_sec; + struct elf_link_hash_entry *h; ++ struct ppc_link_hash_entry *fdh = NULL; + Elf_Internal_Sym *sym; ++ long opd_ent_size; ++ Elf_Internal_Rela *next_rel; ++ bfd_boolean skip; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, + r_symndx, ibfd)) + goto error_ret; + +- if (rel->r_offset == offset) ++ next_rel = rel + 2; ++ if (next_rel + 1 == relend ++ || (next_rel + 2 < relend ++ && ELF64_R_TYPE (next_rel[2].r_info) == R_PPC64_TOC)) ++ ++next_rel; ++ ++ /* See if the .opd entry is full 24 byte or ++ 16 byte (with fd_aux entry overlapped with next ++ fd_func). */ ++ opd_ent_size = 24; ++ if (next_rel == relend) + { +- struct ppc_link_hash_entry *fdh = NULL; +- +- /* See if the .opd entry is full 24 byte or +- 16 byte (with fd_aux entry overlapped with next +- fd_func). */ +- opd_ent_size = 24; +- if ((rel + 2 == relend && sec->size == offset + 16) +- || (rel + 3 < relend +- && rel[2].r_offset == offset + 16 +- && rel[3].r_offset == offset + 24 +- && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_ADDR64 +- && ELF64_R_TYPE (rel[3].r_info) == R_PPC64_TOC)) ++ if (sec->size == rel->r_offset + 16) + opd_ent_size = 16; ++ } ++ else if (next_rel->r_offset == rel->r_offset + 16) ++ opd_ent_size = 16; + +- if (h != NULL +- && h->root.root.string[0] == '.') +- { +- fdh = lookup_fdh ((struct ppc_link_hash_entry *) h, htab); +- if (fdh != NULL +- && fdh->elf.root.type != bfd_link_hash_defined +- && fdh->elf.root.type != bfd_link_hash_defweak) +- fdh = NULL; +- } ++ if (h != NULL ++ && h->root.root.string[0] == '.') ++ { ++ fdh = lookup_fdh ((struct ppc_link_hash_entry *) h, htab); ++ if (fdh != NULL ++ && fdh->elf.root.type != bfd_link_hash_defined ++ && fdh->elf.root.type != bfd_link_hash_defweak) ++ fdh = NULL; ++ } + +- skip = (sym_sec->owner != ibfd +- || sym_sec->output_section == bfd_abs_section_ptr); +- if (skip) ++ skip = (sym_sec->owner != ibfd ++ || sym_sec->output_section == bfd_abs_section_ptr); ++ if (skip) ++ { ++ if (fdh != NULL && sym_sec->owner == ibfd) + { +- if (fdh != NULL && sym_sec->owner == ibfd) +- { +- /* Arrange for the function descriptor sym +- to be dropped. */ +- fdh->elf.root.u.def.value = 0; +- fdh->elf.root.u.def.section = sym_sec; +- } +- opd->adjust[rel->r_offset / 8] = -1; ++ /* Arrange for the function descriptor sym ++ to be dropped. */ ++ fdh->elf.root.u.def.value = 0; ++ fdh->elf.root.u.def.section = sym_sec; + } +- else +- { +- /* We'll be keeping this opd entry. */ ++ opd->adjust[OPD_NDX (rel->r_offset)] = -1; + +- if (fdh != NULL) +- { +- /* Redefine the function descriptor symbol to +- this location in the opd section. It is +- necessary to update the value here rather +- than using an array of adjustments as we do +- for local symbols, because various places +- in the generic ELF code use the value +- stored in u.def.value. */ +- fdh->elf.root.u.def.value = wptr - new_contents; +- fdh->adjust_done = 1; +- } ++ if (NO_OPD_RELOCS || info->relocatable) ++ rel = next_rel; ++ else ++ while (1) ++ { ++ if (!dec_dynrel_count (rel->r_info, sec, info, ++ NULL, h, sym)) ++ goto error_ret; + +- /* Local syms are a bit tricky. We could +- tweak them as they can be cached, but +- we'd need to look through the local syms +- for the function descriptor sym which we +- don't have at the moment. So keep an +- array of adjustments. */ +- opd->adjust[rel->r_offset / 8] +- = (wptr - new_contents) - (rptr - sec->contents); +- +- if (wptr != rptr) +- memcpy (wptr, rptr, opd_ent_size); +- wptr += opd_ent_size; +- if (add_aux_fields && opd_ent_size == 16) +- { +- memset (wptr, '\0', 8); +- wptr += 8; +- } +- } +- rptr += opd_ent_size; +- offset += opd_ent_size; +- } ++ if (++rel == next_rel) ++ break; + +- if (skip) +- { +- if (!NO_OPD_RELOCS +- && !info->relocatable +- && !dec_dynrel_count (rel->r_info, sec, info, +- NULL, h, sym)) +- goto error_ret; ++ r_symndx = ELF64_R_SYM (rel->r_info); ++ if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, ++ r_symndx, ibfd)) ++ goto error_ret; ++ } + } + else + { ++ /* We'll be keeping this opd entry. */ ++ long adjust; ++ ++ if (fdh != NULL) ++ { ++ /* Redefine the function descriptor symbol to ++ this location in the opd section. It is ++ necessary to update the value here rather ++ than using an array of adjustments as we do ++ for local symbols, because various places ++ in the generic ELF code use the value ++ stored in u.def.value. */ ++ fdh->elf.root.u.def.value = wptr - new_contents; ++ fdh->adjust_done = 1; ++ } ++ ++ /* Local syms are a bit tricky. We could ++ tweak them as they can be cached, but ++ we'd need to look through the local syms ++ for the function descriptor sym which we ++ don't have at the moment. So keep an ++ array of adjustments. */ ++ adjust = (wptr - new_contents) - (rptr - sec->contents); ++ opd->adjust[OPD_NDX (rel->r_offset)] = adjust; ++ ++ if (wptr != rptr) ++ memcpy (wptr, rptr, opd_ent_size); ++ wptr += opd_ent_size; ++ if (add_aux_fields && opd_ent_size == 16) ++ { ++ memset (wptr, '\0', 8); ++ wptr += 8; ++ } ++ + /* We need to adjust any reloc offsets to point to the +- new opd entries. While we're at it, we may as well +- remove redundant relocs. */ +- rel->r_offset += opd->adjust[(offset - opd_ent_size) / 8]; +- if (write_rel != rel) +- memcpy (write_rel, rel, sizeof (*rel)); +- ++write_rel; ++ new opd entries. */ ++ for ( ; rel != next_rel; ++rel) ++ { ++ rel->r_offset += adjust; ++ if (write_rel != rel) ++ memcpy (write_rel, rel, sizeof (*rel)); ++ ++write_rel; ++ } + } ++ ++ rptr += opd_ent_size; + } + + sec->size = wptr - new_contents; +@@ -10184,7 +10216,10 @@ plt_stub_size (struct ppc_link_hash_table *htab, + size += 4; + if (htab->params->plt_static_chain) + size += 4; +- if (htab->params->plt_thread_safe) ++ if (htab->params->plt_thread_safe ++ && htab->elf.dynamic_sections_created ++ && stub_entry->h != NULL ++ && stub_entry->h->elf.dynindx != -1) + size += 8; + if (PPC_HA (off + 8 + 8 * htab->params->plt_static_chain) != PPC_HA (off)) + size += 4; +@@ -10224,16 +10259,18 @@ build_plt_stub (struct ppc_link_hash_table *htab, + bfd *obfd = htab->params->stub_bfd; + bfd_boolean plt_load_toc = htab->opd_abi; + bfd_boolean plt_static_chain = htab->params->plt_static_chain; +- bfd_boolean plt_thread_safe = htab->params->plt_thread_safe; ++ bfd_boolean plt_thread_safe = (htab->params->plt_thread_safe ++ && htab->elf.dynamic_sections_created ++ && stub_entry->h != NULL ++ && stub_entry->h->elf.dynindx != -1); + bfd_boolean use_fake_dep = plt_thread_safe; + bfd_vma cmp_branch_off = 0; + + if (!ALWAYS_USE_FAKE_DEP + && plt_load_toc + && plt_thread_safe +- && !(stub_entry->h != NULL +- && (stub_entry->h == htab->tls_get_addr_fd +- || stub_entry->h == htab->tls_get_addr) ++ && !((stub_entry->h == htab->tls_get_addr_fd ++ || stub_entry->h == htab->tls_get_addr) + && !htab->params->no_tls_get_addr_opt)) + { + bfd_vma pltoff = stub_entry->plt_ent->plt.offset & ~1; +@@ -10426,8 +10463,8 @@ build_tls_get_addr_stub (struct ppc_link_hash_table *htab, + p = build_plt_stub (htab, stub_entry, p, offset, r); + bfd_put_32 (obfd, BCTRL, p - 4); + +- bfd_put_32 (obfd, LD_R11_0R1 + STK_LINKER (htab), p), p += 4; + bfd_put_32 (obfd, LD_R2_0R1 + STK_TOC (htab), p), p += 4; ++ bfd_put_32 (obfd, LD_R11_0R1 + STK_LINKER (htab), p), p += 4; + bfd_put_32 (obfd, MTLR_R11, p), p += 4; + bfd_put_32 (obfd, BLR, p), p += 4; + +@@ -11589,7 +11626,7 @@ toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec) + { + long adjust; + +- adjust = opd->adjust[sym->st_value / 8]; ++ adjust = opd->adjust[OPD_NDX (sym->st_value)]; + if (adjust == -1) + /* Assume deleted functions won't ever be called. */ + continue; +@@ -12165,7 +12202,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info) + + if (hash == NULL && opd->adjust != NULL) + { +- long adjust = opd->adjust[sym_value / 8]; ++ long adjust = opd->adjust[OPD_NDX (sym_value)]; + if (adjust == -1) + continue; + code_value += adjust; +@@ -13077,7 +13114,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, + opd = get_opd_info (sec); + if (opd != NULL && opd->adjust != NULL) + { +- long adjust = opd->adjust[(sym->st_value + rel->r_addend) / 8]; ++ long adjust = opd->adjust[OPD_NDX (sym->st_value ++ + rel->r_addend)]; + if (adjust == -1) + relocation = 0; + else +@@ -13400,12 +13438,16 @@ ppc64_elf_relocate_section (bfd *output_bfd, + htab->tls_get_addr, + htab->tls_get_addr_fd)) + offset = rel[1].r_offset; ++ /* We read the low GOT_TLS (or TOC16) insn because we ++ need to keep the destination reg. It may be ++ something other than the usual r3, and moved to r3 ++ before the call by intervening code. */ ++ insn1 = bfd_get_32 (output_bfd, ++ contents + rel->r_offset - d_offset); + if ((tls_mask & tls_gd) != 0) + { + /* IE */ +- insn1 = bfd_get_32 (output_bfd, +- contents + rel->r_offset - d_offset); +- insn1 &= (1 << 26) - (1 << 2); ++ insn1 &= (0x1f << 21) | (0x1f << 16); + insn1 |= 58 << 26; /* ld */ + insn2 = 0x7c636a14; /* add 3,3,13 */ + if (offset != (bfd_vma) -1) +@@ -13420,7 +13462,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, + else + { + /* LE */ +- insn1 = 0x3c6d0000; /* addis 3,13,0 */ ++ insn1 &= 0x1f << 21; ++ insn1 |= 0x3c0d0000; /* addis r,13,0 */ + insn2 = 0x38630000; /* addi 3,3,0 */ + if (tls_gd == 0) + { +@@ -14099,7 +14142,12 @@ ppc64_elf_relocate_section (bfd *output_bfd, + { + outrel.r_addend += relocation; + if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL)) +- outrel.r_addend -= htab->elf.tls_sec->vma; ++ { ++ if (htab->elf.tls_sec == NULL) ++ outrel.r_addend = 0; ++ else ++ outrel.r_addend -= htab->elf.tls_sec->vma; ++ } + } + loc = relgot->contents; + loc += (relgot->reloc_count++ +@@ -14116,9 +14164,14 @@ ppc64_elf_relocate_section (bfd *output_bfd, + relocation = 1; + else if (tls_type != 0) + { +- relocation -= htab->elf.tls_sec->vma + DTP_OFFSET; +- if (tls_type == (TLS_TLS | TLS_TPREL)) +- relocation += DTP_OFFSET - TP_OFFSET; ++ if (htab->elf.tls_sec == NULL) ++ relocation = 0; ++ else ++ { ++ relocation -= htab->elf.tls_sec->vma + DTP_OFFSET; ++ if (tls_type == (TLS_TLS | TLS_TPREL)) ++ relocation += DTP_OFFSET - TP_OFFSET; ++ } + + if (tls_type == (TLS_TLS | TLS_GD)) + { +@@ -14251,7 +14304,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, + bfd_put_32 (output_bfd, insn, p); + break; + } +- addend -= htab->elf.tls_sec->vma + TP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + TP_OFFSET; + if (info->shared) + /* The TPREL16 relocs shouldn't really be used in shared + libs as they will result in DT_TEXTREL being set, but +@@ -14271,7 +14325,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, + case R_PPC64_DTPREL16_HIGHERA: + case R_PPC64_DTPREL16_HIGHEST: + case R_PPC64_DTPREL16_HIGHESTA: +- addend -= htab->elf.tls_sec->vma + DTP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + DTP_OFFSET; + break; + + case R_PPC64_ADDR64_LOCAL: +@@ -14286,11 +14341,13 @@ ppc64_elf_relocate_section (bfd *output_bfd, + goto dodyn; + + case R_PPC64_TPREL64: +- addend -= htab->elf.tls_sec->vma + TP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + TP_OFFSET; + goto dodyn; + + case R_PPC64_DTPREL64: +- addend -= htab->elf.tls_sec->vma + DTP_OFFSET; ++ if (htab->elf.tls_sec != NULL) ++ addend -= htab->elf.tls_sec->vma + DTP_OFFSET; + /* Fall thru */ + + /* Relocations that may need to be propagated if this is a +@@ -14844,7 +14901,7 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info, + if (!info->relocatable) + value -= input_sec->output_section->vma; + +- adjust = opd->adjust[value / 8]; ++ adjust = opd->adjust[OPD_NDX (value)]; + if (adjust == -1) + return 2; + +@@ -15258,4 +15315,3 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, + #define elf64_bed elf64_powerpc_fbsd_bed + + #include "elf64-target.h" +- +diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c +index b2f1aa5..9745ea4 100644 +--- a/bfd/elf64-s390.c ++++ b/bfd/elf64-s390.c +@@ -42,7 +42,7 @@ static reloc_howto_type elf_howto_table[] = + { + HOWTO (R_390_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */ ++ 3, /* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -1707,7 +1707,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +@@ -3840,6 +3840,7 @@ const struct elf_size_info s390_elf64_size_info = + #define elf_backend_init_index_section _bfd_elf_init_1_index_section + #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 bfd_elf64_mkobject elf_s390_mkobject + #define elf_backend_object_p elf_s390_object_p +diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c +index 311d7c3..b0208c0 100644 +--- a/bfd/elf64-sh64.c ++++ b/bfd/elf64-sh64.c +@@ -105,7 +105,7 @@ static reloc_howto_type sh_elf64_howto_table[] = { + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -2259,31 +2259,10 @@ sh_elf64_set_private_flags (bfd *abfd, flagword flags) + static bfd_boolean + sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd) + { +- Elf_Internal_Shdr **o_shdrp; +- asection *isec; +- asection *osec; +- + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + +- o_shdrp = elf_elfsections (obfd); +- for (osec = obfd->sections; osec; osec = osec->next) +- { +- int oIndex = ((struct bfd_elf_section_data *) elf_section_data (osec))->this_idx; +- for (isec = ibfd->sections; isec; isec = isec->next) +- { +- if (strcmp (osec->name, isec->name) == 0) +- { +- /* Note that we're not disallowing mixing data and code. */ +- if ((elf_section_data (isec)->this_hdr.sh_flags +- & SHF_SH5_ISA32) != 0) +- o_shdrp[oIndex]->sh_flags |= SHF_SH5_ISA32; +- break; +- } +- } +- } +- + /* Copy object attributes. */ + _bfd_elf_copy_private_bfd_data (ibfd, obfd); + +@@ -3381,7 +3360,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* This function is called via sh_elf_link_hash_traverse if we are +diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c +index eeb94a9..0dcd14a 100644 +--- a/bfd/elf64-sparc.c ++++ b/bfd/elf64-sparc.c +@@ -97,7 +97,9 @@ elf64_sparc_slurp_one_reloc_table (bfd *abfd, asection *asect, + else + relent->address = rela.r_offset - asect->vma; + +- if (ELF64_R_SYM (rela.r_info) == STN_UNDEF) ++ if (ELF64_R_SYM (rela.r_info) == STN_UNDEF ++ /* PR 17512: file: 996185f8. */ ++ || ELF64_R_SYM (rela.r_info) > bfd_get_symcount (abfd)) + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + else + { +diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c +index fefb08c..18983e8 100644 +--- a/bfd/elf64-x86-64.c ++++ b/bfd/elf64-x86-64.c +@@ -54,7 +54,7 @@ + special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */ + static reloc_howto_type x86_64_elf_howto_table[] = + { +- HOWTO(R_X86_64_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont, ++ HOWTO(R_X86_64_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_X86_64_NONE", FALSE, 0x00000000, 0x00000000, + FALSE), + HOWTO(R_X86_64_64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, +@@ -302,7 +302,7 @@ elf_x86_64_reloc_type_lookup (bfd *abfd, + return elf_x86_64_rtype_to_howto (abfd, + x86_64_reloc_map[i].elf_reloc_val); + } +- return 0; ++ return NULL; + } + + static reloc_howto_type * +@@ -2431,7 +2431,7 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +@@ -2677,13 +2677,23 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } +- /* For PIE, discard space for relocs against symbols which +- turn out to need copy relocs. */ ++ /* For PIE, discard space for pc-relative relocs against ++ symbols which turn out to need copy relocs. */ + else if (info->executable + && (h->needs_copy || eh->needs_copy) + && h->def_dynamic + && !h->def_regular) +- eh->dyn_relocs = NULL; ++ { ++ struct elf_dyn_relocs **pp; ++ ++ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) ++ { ++ if (p->pc_count != 0) ++ *pp = p->next; ++ else ++ pp = &p->next; ++ } ++ } + } + } + else if (ELIMINATE_COPY_RELOCS) +@@ -5400,7 +5410,7 @@ bad_return: + if (plt_sym_val == NULL) + goto bad_return; + +- for (i = 0; i < count; i++, p++) ++ for (i = 0; i < count; i++) + plt_sym_val[i] = -1; + + plt_offset = bed->plt_entry_size; +@@ -5409,6 +5419,10 @@ bad_return: + { + long reloc_index; + ++ /* Skip unknown relocation. */ ++ if (p->howto == NULL) ++ continue; ++ + if (p->howto->type != R_X86_64_JUMP_SLOT + && p->howto->type != R_X86_64_IRELATIVE) + continue; +diff --git a/bfd/elfcode.h b/bfd/elfcode.h +index ec53c3b..d34e18e 100644 +--- a/bfd/elfcode.h ++++ b/bfd/elfcode.h +@@ -1501,7 +1501,9 @@ elf_slurp_reloc_table (bfd *abfd, + rel_hdr2 = d->rela.hdr; + reloc_count2 = rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0; + +- BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2); ++ /* PR 17512: file: 0b4f81b7. */ ++ if (asect->reloc_count != reloc_count + reloc_count2) ++ return FALSE; + BFD_ASSERT ((rel_hdr && asect->rel_filepos == rel_hdr->sh_offset) + || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset)); + +diff --git a/bfd/elflink.c b/bfd/elflink.c +index 94ab762..2c6b04b 100644 +--- a/bfd/elflink.c ++++ b/bfd/elflink.c +@@ -20,6 +20,7 @@ + + #include "sysdep.h" + #include "bfd.h" ++#include "bfd_stdint.h" + #include "bfdlink.h" + #include "libbfd.h" + #define ARCH_SIZE 0 +@@ -84,6 +85,7 @@ _bfd_elf_define_linkage_sym (bfd *abfd, + h = (struct elf_link_hash_entry *) bh; + h->def_regular = 1; + h->non_elf = 0; ++ h->root.linker_def = 1; + h->type = STT_OBJECT; + if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL) + h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; +@@ -760,6 +762,7 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, + asection *p) + { + struct elf_link_hash_table *htab; ++ asection *ip; + + switch (elf_section_data (p)->this_hdr.sh_type) + { +@@ -775,18 +778,9 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, + if (htab->text_index_section != NULL) + return p != htab->text_index_section && p != htab->data_index_section; + +- if (strcmp (p->name, ".got") == 0 +- || strcmp (p->name, ".got.plt") == 0 +- || strcmp (p->name, ".plt") == 0) +- { +- asection *ip; +- +- if (htab->dynobj != NULL ++ return (htab->dynobj != NULL + && (ip = bfd_get_linker_section (htab->dynobj, p->name)) != NULL +- && ip->output_section == p) +- return TRUE; +- } +- return FALSE; ++ && ip->output_section == p); + + /* There shouldn't be section relative relocations + against any other section. */ +@@ -851,7 +845,7 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, + + static void + elf_merge_st_other (bfd *abfd, struct elf_link_hash_entry *h, +- const Elf_Internal_Sym *isym, ++ const Elf_Internal_Sym *isym, asection *sec, + bfd_boolean definition, bfd_boolean dynamic) + { + const struct elf_backend_data *bed = get_elf_backend_data (abfd); +@@ -872,6 +866,10 @@ elf_merge_st_other (bfd *abfd, struct elf_link_hash_entry *h, + if (symvis - 1 < hvis - 1) + h->other = symvis | (h->other & ~ELF_ST_VISIBILITY (-1)); + } ++ else if (definition ++ && ELF_ST_VISIBILITY (isym->st_other) != STV_DEFAULT ++ && (sec->flags & SEC_READONLY) == 0) ++ h->protected_def = 1; + } + + /* This function is called when we want to merge a new symbol with an +@@ -1422,7 +1420,7 @@ _bfd_elf_merge_symbol (bfd *abfd, + /* Merge st_other. If the symbol already has a dynamic index, + but visibility says it should not be visible, turn it into a + local symbol. */ +- elf_merge_st_other (abfd, h, sym, newdef, newdyn); ++ elf_merge_st_other (abfd, h, sym, sec, newdef, newdyn); + if (h->dynindx != -1) + switch (ELF_ST_VISIBILITY (h->other)) + { +@@ -2636,7 +2634,8 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) + DYNBSS. */ + + bfd_boolean +-_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h, ++_bfd_elf_adjust_dynamic_copy (struct bfd_link_info *info, ++ struct elf_link_hash_entry *h, + asection *dynbss) + { + unsigned int power_of_two; +@@ -2675,6 +2674,11 @@ _bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h, + /* Increment the size of DYNBSS to make room for the symbol. */ + dynbss->size += h->size; + ++ if (h->protected_def) ++ info->callbacks->einfo ++ (_("%P: copy reloc against protected `%T' is dangerous\n"), ++ h->root.root.string); ++ + return TRUE; + } + +@@ -4351,7 +4355,7 @@ error_free_dyn: + } + + /* Merge st_other field. */ +- elf_merge_st_other (abfd, h, isym, definition, dynamic); ++ elf_merge_st_other (abfd, h, isym, sec, definition, dynamic); + + /* We don't want to make debug symbol dynamic. */ + if (definition && (sec->flags & SEC_DEBUGGING) && !info->relocatable) +@@ -7957,6 +7961,138 @@ bfd_elf_perform_complex_relocation (bfd *input_bfd, + return r; + } + ++/* qsort comparison functions sorting external relocs by r_offset. */ ++ ++static int ++cmp_ext32l_r_offset (const void *p, const void *q) ++{ ++ union aligned32 ++ { ++ uint32_t v; ++ unsigned char c[4]; ++ }; ++ const union aligned32 *a ++ = (const union aligned32 *) ((const Elf32_External_Rel *) p)->r_offset; ++ const union aligned32 *b ++ = (const union aligned32 *) ((const Elf32_External_Rel *) q)->r_offset; ++ ++ uint32_t aval = ( (uint32_t) a->c[0] ++ | (uint32_t) a->c[1] << 8 ++ | (uint32_t) a->c[2] << 16 ++ | (uint32_t) a->c[3] << 24); ++ uint32_t bval = ( (uint32_t) b->c[0] ++ | (uint32_t) b->c[1] << 8 ++ | (uint32_t) b->c[2] << 16 ++ | (uint32_t) b->c[3] << 24); ++ if (aval < bval) ++ return -1; ++ else if (aval > bval) ++ return 1; ++ return 0; ++} ++ ++static int ++cmp_ext32b_r_offset (const void *p, const void *q) ++{ ++ union aligned32 ++ { ++ uint32_t v; ++ unsigned char c[4]; ++ }; ++ const union aligned32 *a ++ = (const union aligned32 *) ((const Elf32_External_Rel *) p)->r_offset; ++ const union aligned32 *b ++ = (const union aligned32 *) ((const Elf32_External_Rel *) q)->r_offset; ++ ++ uint32_t aval = ( (uint32_t) a->c[0] << 24 ++ | (uint32_t) a->c[1] << 16 ++ | (uint32_t) a->c[2] << 8 ++ | (uint32_t) a->c[3]); ++ uint32_t bval = ( (uint32_t) b->c[0] << 24 ++ | (uint32_t) b->c[1] << 16 ++ | (uint32_t) b->c[2] << 8 ++ | (uint32_t) b->c[3]); ++ if (aval < bval) ++ return -1; ++ else if (aval > bval) ++ return 1; ++ return 0; ++} ++ ++#ifdef BFD_HOST_64_BIT ++static int ++cmp_ext64l_r_offset (const void *p, const void *q) ++{ ++ union aligned64 ++ { ++ uint64_t v; ++ unsigned char c[8]; ++ }; ++ const union aligned64 *a ++ = (const union aligned64 *) ((const Elf64_External_Rel *) p)->r_offset; ++ const union aligned64 *b ++ = (const union aligned64 *) ((const Elf64_External_Rel *) q)->r_offset; ++ ++ uint64_t aval = ( (uint64_t) a->c[0] ++ | (uint64_t) a->c[1] << 8 ++ | (uint64_t) a->c[2] << 16 ++ | (uint64_t) a->c[3] << 24 ++ | (uint64_t) a->c[4] << 32 ++ | (uint64_t) a->c[5] << 40 ++ | (uint64_t) a->c[6] << 48 ++ | (uint64_t) a->c[7] << 56); ++ uint64_t bval = ( (uint64_t) b->c[0] ++ | (uint64_t) b->c[1] << 8 ++ | (uint64_t) b->c[2] << 16 ++ | (uint64_t) b->c[3] << 24 ++ | (uint64_t) b->c[4] << 32 ++ | (uint64_t) b->c[5] << 40 ++ | (uint64_t) b->c[6] << 48 ++ | (uint64_t) b->c[7] << 56); ++ if (aval < bval) ++ return -1; ++ else if (aval > bval) ++ return 1; ++ return 0; ++} ++ ++static int ++cmp_ext64b_r_offset (const void *p, const void *q) ++{ ++ union aligned64 ++ { ++ uint64_t v; ++ unsigned char c[8]; ++ }; ++ const union aligned64 *a ++ = (const union aligned64 *) ((const Elf64_External_Rel *) p)->r_offset; ++ const union aligned64 *b ++ = (const union aligned64 *) ((const Elf64_External_Rel *) q)->r_offset; ++ ++ uint64_t aval = ( (uint64_t) a->c[0] << 56 ++ | (uint64_t) a->c[1] << 48 ++ | (uint64_t) a->c[2] << 40 ++ | (uint64_t) a->c[3] << 32 ++ | (uint64_t) a->c[4] << 24 ++ | (uint64_t) a->c[5] << 16 ++ | (uint64_t) a->c[6] << 8 ++ | (uint64_t) a->c[7]); ++ uint64_t bval = ( (uint64_t) b->c[0] << 56 ++ | (uint64_t) b->c[1] << 48 ++ | (uint64_t) b->c[2] << 40 ++ | (uint64_t) b->c[3] << 32 ++ | (uint64_t) b->c[4] << 24 ++ | (uint64_t) b->c[5] << 16 ++ | (uint64_t) b->c[6] << 8 ++ | (uint64_t) b->c[7]); ++ if (aval < bval) ++ return -1; ++ else if (aval > bval) ++ return 1; ++ return 0; ++} ++#endif ++ + /* When performing a relocatable link, the input relocations are + preserved. But, if they reference global symbols, the indices + referenced must be updated. Update all the relocations found in +@@ -7964,7 +8100,8 @@ bfd_elf_perform_complex_relocation (bfd *input_bfd, + + static void + elf_link_adjust_relocs (bfd *abfd, +- struct bfd_elf_section_reloc_data *reldata) ++ struct bfd_elf_section_reloc_data *reldata, ++ bfd_boolean sort) + { + unsigned int i; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); +@@ -8020,6 +8157,35 @@ elf_link_adjust_relocs (bfd *abfd, + | (irela[j].r_info & r_type_mask)); + (*swap_out) (abfd, irela, erela); + } ++ ++ if (sort) ++ { ++ int (*compare) (const void *, const void *); ++ ++ if (bed->s->arch_size == 32) ++ { ++ if (abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE) ++ compare = cmp_ext32l_r_offset; ++ else if (abfd->xvec->header_byteorder == BFD_ENDIAN_BIG) ++ compare = cmp_ext32b_r_offset; ++ else ++ abort (); ++ } ++ else ++ { ++#ifdef BFD_HOST_64_BIT ++ if (abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE) ++ compare = cmp_ext64l_r_offset; ++ else if (abfd->xvec->header_byteorder == BFD_ENDIAN_BIG) ++ compare = cmp_ext64b_r_offset; ++ else ++#endif ++ abort (); ++ } ++ qsort (reldata->hdr->contents, count, reldata->hdr->sh_entsize, compare); ++ free (reldata->hashes); ++ reldata->hashes = NULL; ++ } + } + + struct elf_link_sort_rela +@@ -8392,6 +8558,8 @@ elf_link_output_sym (struct elf_final_link_info *flinfo, + struct elf_link_hash_entry *); + const struct elf_backend_data *bed; + ++ BFD_ASSERT (elf_onesymtab (flinfo->output_bfd)); ++ + bed = get_elf_backend_data (flinfo->output_bfd); + output_symbol_hook = bed->elf_backend_link_output_symbol_hook; + if (output_symbol_hook != NULL) +@@ -8872,12 +9040,6 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) + asection *tls_sec = elf_hash_table (flinfo->info)->tls_sec; + if (tls_sec != NULL) + sym.st_value -= tls_sec->vma; +- else +- { +- /* The TLS section may have been garbage collected. */ +- BFD_ASSERT (flinfo->info->gc_sections +- && !input_sec->gc_mark); +- } + } + } + } +@@ -10159,7 +10321,7 @@ elf_reloc_link_order (bfd *output_bfd, + + size = (bfd_size_type) bfd_get_reloc_size (howto); + buf = (bfd_byte *) bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf); + switch (rstat) +@@ -10433,12 +10595,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + bfd_size_type max_internal_reloc_count; + bfd_size_type max_sym_count; + bfd_size_type max_sym_shndx_count; +- file_ptr off; + Elf_Internal_Sym elfsym; + unsigned int i; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Shdr *symtab_shndx_hdr; +- Elf_Internal_Shdr *symstrtab_hdr; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + struct elf_outext_info eoinfo; + bfd_boolean merged; +@@ -10669,7 +10829,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + /* Figure out the file positions for everything but the symbol table + and the relocs. We set symcount to force assign_section_numbers + to create a symbol table. */ +- bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1; ++ bfd_get_symcount (abfd) = info->strip != strip_all || emit_relocs; + BFD_ASSERT (! abfd->output_has_begun); + if (! _bfd_elf_compute_section_file_positions (abfd, info)) + goto error_return; +@@ -10710,13 +10870,6 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + /* sh_offset is set just below. */ + symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align; + +- off = elf_next_file_pos (abfd); +- off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE); +- +- /* Note that at this point elf_next_file_pos (abfd) is +- incorrect. We do not yet know the size of the .symtab section. +- We correct next_file_pos below, after we do know the size. */ +- + /* Allocate a buffer to hold swapped out symbols. This is to avoid + continuously seeking to the right position in the file. */ + if (! info->keep_memory || max_sym_count < 20) +@@ -10739,11 +10892,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + goto error_return; + } + +- /* Start writing out the symbol table. The first symbol is always a +- dummy symbol. */ +- if (info->strip != strip_all +- || emit_relocs) ++ if (info->strip != strip_all || emit_relocs) + { ++ file_ptr off = elf_next_file_pos (abfd); ++ ++ _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE); ++ ++ /* Note that at this point elf_next_file_pos (abfd) is ++ incorrect. We do not yet know the size of the .symtab section. ++ We correct next_file_pos below, after we do know the size. */ ++ ++ /* Start writing out the symbol table. The first symbol is always a ++ dummy symbol. */ + elfsym.st_value = 0; + elfsym.st_size = 0; + elfsym.st_info = 0; +@@ -10753,16 +10913,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + if (elf_link_output_sym (&flinfo, NULL, &elfsym, bfd_und_section_ptr, + NULL) != 1) + goto error_return; +- } + +- /* Output a symbol for each section. We output these even if we are +- discarding local symbols, since they are used for relocs. These +- symbols have no names. We store the index of each one in the +- index field of the section, so that we can find it again when +- outputting relocs. */ +- if (info->strip != strip_all +- || emit_relocs) +- { ++ /* Output a symbol for each section. We output these even if we are ++ discarding local symbols, since they are used for relocs. These ++ symbols have no names. We store the index of each one in the ++ index field of the section, so that we can find it again when ++ outputting relocs. */ ++ + elfsym.st_size = 0; + elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); + elfsym.st_other = 0; +@@ -10993,7 +11150,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + + /* If backend needs to output some local symbols not present in the hash + table, do it now. */ +- if (bed->elf_backend_output_arch_local_syms) ++ if (bed->elf_backend_output_arch_local_syms ++ && (info->strip != strip_all || emit_relocs)) + { + typedef int (*out_sym_func) + (void *, const char *, Elf_Internal_Sym *, asection *, +@@ -11103,7 +11261,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + + /* If backend needs to output some symbols not present in the hash + table, do it now. */ +- if (bed->elf_backend_output_arch_syms) ++ if (bed->elf_backend_output_arch_syms ++ && (info->strip != strip_all || emit_relocs)) + { + typedef int (*out_sym_func) + (void *, const char *, Elf_Internal_Sym *, asection *, +@@ -11119,45 +11278,46 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + return FALSE; + + /* Now we know the size of the symtab section. */ +- off += symtab_hdr->sh_size; +- +- symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; +- if (symtab_shndx_hdr->sh_name != 0) ++ if (bfd_get_symcount (abfd) > 0) + { +- symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; +- symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx); +- symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx); +- amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx); +- symtab_shndx_hdr->sh_size = amt; ++ /* Finish up and write out the symbol string table (.strtab) ++ section. */ ++ Elf_Internal_Shdr *symstrtab_hdr; ++ file_ptr off = symtab_hdr->sh_offset + symtab_hdr->sh_size; + +- off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr, +- off, TRUE); ++ symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; ++ if (symtab_shndx_hdr->sh_name != 0) ++ { ++ symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; ++ symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx); ++ symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx); ++ amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx); ++ symtab_shndx_hdr->sh_size = amt; + +- if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0 +- || (bfd_bwrite (flinfo.symshndxbuf, amt, abfd) != amt)) +- return FALSE; +- } ++ off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr, ++ off, TRUE); + ++ if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0 ++ || (bfd_bwrite (flinfo.symshndxbuf, amt, abfd) != amt)) ++ return FALSE; ++ } + +- /* Finish up and write out the symbol string table (.strtab) +- section. */ +- symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; +- /* sh_name was set in prep_headers. */ +- symstrtab_hdr->sh_type = SHT_STRTAB; +- symstrtab_hdr->sh_flags = 0; +- symstrtab_hdr->sh_addr = 0; +- symstrtab_hdr->sh_size = _bfd_stringtab_size (flinfo.symstrtab); +- symstrtab_hdr->sh_entsize = 0; +- symstrtab_hdr->sh_link = 0; +- symstrtab_hdr->sh_info = 0; +- /* sh_offset is set just below. */ +- symstrtab_hdr->sh_addralign = 1; ++ symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; ++ /* sh_name was set in prep_headers. */ ++ symstrtab_hdr->sh_type = SHT_STRTAB; ++ symstrtab_hdr->sh_flags = 0; ++ symstrtab_hdr->sh_addr = 0; ++ symstrtab_hdr->sh_size = _bfd_stringtab_size (flinfo.symstrtab); ++ symstrtab_hdr->sh_entsize = 0; ++ symstrtab_hdr->sh_link = 0; ++ symstrtab_hdr->sh_info = 0; ++ /* sh_offset is set just below. */ ++ symstrtab_hdr->sh_addralign = 1; + +- off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, TRUE); +- elf_next_file_pos (abfd) = off; ++ off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, ++ off, TRUE); ++ elf_next_file_pos (abfd) = off; + +- if (bfd_get_symcount (abfd) > 0) +- { + if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0 + || ! _bfd_stringtab_emit (abfd, flinfo.symstrtab)) + return FALSE; +@@ -11167,13 +11327,15 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + for (o = abfd->sections; o != NULL; o = o->next) + { + struct bfd_elf_section_data *esdo = elf_section_data (o); ++ bfd_boolean sort; + if ((o->flags & SEC_RELOC) == 0) + continue; + ++ sort = bed->sort_relocs_p == NULL || (*bed->sort_relocs_p) (o); + if (esdo->rel.hdr != NULL) +- elf_link_adjust_relocs (abfd, &esdo->rel); ++ elf_link_adjust_relocs (abfd, &esdo->rel, sort); + if (esdo->rela.hdr != NULL) +- elf_link_adjust_relocs (abfd, &esdo->rela); ++ elf_link_adjust_relocs (abfd, &esdo->rela, sort); + + /* Set the reloc_count field to 0 to prevent write_relocs from + trying to swap the relocs out itself. */ +@@ -11420,6 +11582,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) + { + /* The contents of the .dynstr section are actually in a + stringtab. */ ++ file_ptr off; ++ + off = elf_section_data (o->output_section)->this_hdr.sh_offset; + if (bfd_seek (abfd, off, SEEK_SET) != 0 + || ! _bfd_elf_strtab_emit (abfd, +@@ -11896,7 +12060,7 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data) + if (!h->mark + && (((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) +- && !(h->def_regular ++ && !((h->def_regular || ELF_COMMON_DEF_P (h)) + && h->root.u.def.section->gc_mark)) + || h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak)) +@@ -12119,7 +12283,7 @@ bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf) + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->ref_dynamic +- || (h->def_regular ++ || ((h->def_regular || ELF_COMMON_DEF_P (h)) + && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN + && (!info->executable +@@ -13038,7 +13202,7 @@ _bfd_elf_copy_link_hash_symbol_type (bfd *abfd, + ehdest->target_internal = ehsrc->target_internal; + + isym.st_other = ehsrc->other; +- elf_merge_st_other (abfd, ehdest, &isym, TRUE, FALSE); ++ elf_merge_st_other (abfd, ehdest, &isym, NULL, TRUE, FALSE); + } + + /* Append a RELA relocation REL to section S in BFD. */ +diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c +index 9ddde24..cbf0eb7 100644 +--- a/bfd/elfn32-mips.c ++++ b/bfd/elfn32-mips.c +@@ -108,7 +108,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = + /* No relocation. */ + HOWTO (R_MIPS_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -3403,7 +3403,12 @@ mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) + else + return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; + } +- BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); ++ if (r_type >= R_MIPS_max) ++ { ++ (*_bfd_error_handler) (_("unrecognised MIPS reloc number: %d"), r_type); ++ bfd_set_error (bfd_error_bad_value); ++ r_type = R_MIPS_NONE; ++ } + if (rela_p) + return &elf_mips_howto_table_rela[r_type]; + else +diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c +index 0879db9..4593a65 100644 +--- a/bfd/elfnn-aarch64.c ++++ b/bfd/elfnn-aarch64.c +@@ -296,7 +296,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = + #if ARCH_SIZE == 64 + HOWTO (R_AARCH64_NULL, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -310,7 +310,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = + #else + HOWTO (R_AARCH64_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -1377,7 +1377,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = + static reloc_howto_type elfNN_aarch64_howto_none = + HOWTO (R_AARCH64_NONE, /* type */ + 0, /* rightshift */ +- 0, /* size (0 = byte, 1 = short, 2 = long) */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +@@ -1431,6 +1431,14 @@ elfNN_aarch64_bfd_reloc_from_type (unsigned int r_type) + if (r_type == R_AARCH64_NONE || r_type == R_AARCH64_NULL) + return BFD_RELOC_AARCH64_NONE; + ++ /* PR 17512: file: b371e70a. */ ++ if (r_type >= R_AARCH64_end) ++ { ++ _bfd_error_handler (_("Invalid AArch64 reloc number: %d"), r_type); ++ bfd_set_error (bfd_error_bad_value); ++ return BFD_RELOC_AARCH64_NONE; ++ } ++ + return BFD_RELOC_AARCH64_RELOC_START + offsets[r_type]; + } + +@@ -2444,24 +2452,17 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry, + of range. */ + BFD_FAIL (); + +- _bfd_final_link_relocate +- (elfNN_aarch64_howto_from_type (AARCH64_R (ADD_ABS_LO12_NC)), +- stub_bfd, +- stub_sec, +- stub_sec->contents, +- stub_entry->stub_offset + 4, +- sym_value, +- 0); ++ if (aarch64_relocate (AARCH64_R (ADD_ABS_LO12_NC), stub_bfd, stub_sec, ++ stub_entry->stub_offset + 4, sym_value)) ++ BFD_FAIL (); + break; + + case aarch64_stub_long_branch: + /* We want the value relative to the address 12 bytes back from the + value itself. */ +- _bfd_final_link_relocate (elfNN_aarch64_howto_from_type +- (AARCH64_R (PRELNN)), stub_bfd, stub_sec, +- stub_sec->contents, +- stub_entry->stub_offset + 16, +- sym_value + 12, 0); ++ if (aarch64_relocate (AARCH64_R (PRELNN), stub_bfd, stub_sec, ++ stub_entry->stub_offset + 16, sym_value + 12)) ++ BFD_FAIL (); + break; + + case aarch64_stub_erratum_835769_veneer: +@@ -4072,10 +4073,11 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, + bfd_reloc_code_real_type new_bfd_r_type; + unsigned long r_symndx; + bfd_byte *hit_data = contents + rel->r_offset; +- bfd_vma place; ++ bfd_vma place, off; + bfd_signed_vma signed_addend; + struct elf_aarch64_link_hash_table *globals; + bfd_boolean weak_undef_p; ++ asection *base_got; + + globals = elf_aarch64_hash_table (info); + +@@ -4115,8 +4117,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, + { + asection *plt; + const char *name; +- asection *base_got; +- bfd_vma off; + + if ((input_section->flags & SEC_ALLOC) == 0 + || h->plt.offset == (bfd_vma) -1) +@@ -4329,7 +4329,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, + memset (&outrel, 0, sizeof outrel); + else if (h != NULL + && h->dynindx != -1 +- && (!info->shared || !info->symbolic || !h->def_regular)) ++ && (!info->shared || !SYMBOLIC_BIND (info, h) || !h->def_regular)) + outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type); + else + { +@@ -4426,16 +4426,36 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, + signed_addend, weak_undef_p); + break; + ++ case BFD_RELOC_AARCH64_ADR_LO21_PCREL: ++ case BFD_RELOC_AARCH64_ADR_HI21_PCREL: ++ case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL: ++ case BFD_RELOC_AARCH64_LD_LO19_PCREL: ++ case BFD_RELOC_AARCH64_16_PCREL: ++ case BFD_RELOC_AARCH64_32_PCREL: ++ case BFD_RELOC_AARCH64_64_PCREL: ++ if (info->shared ++ && (input_section->flags & SEC_ALLOC) != 0 ++ && (input_section->flags & SEC_READONLY) != 0 ++ && h != NULL ++ && !h->def_regular) ++ { ++ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START; ++ ++ (*_bfd_error_handler) ++ (_("%B: relocation %s against external symbol `%s' can not be used" ++ " when making a shared object; recompile with -fPIC"), ++ input_bfd, elfNN_aarch64_howto_table[howto_index].name, ++ h->root.root.string); ++ bfd_set_error (bfd_error_bad_value); ++ return FALSE; ++ } ++ + case BFD_RELOC_AARCH64_16: + #if ARCH_SIZE == 64 + case BFD_RELOC_AARCH64_32: + #endif + case BFD_RELOC_AARCH64_ADD_LO12: +- case BFD_RELOC_AARCH64_ADR_LO21_PCREL: +- case BFD_RELOC_AARCH64_ADR_HI21_PCREL: +- case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL: + case BFD_RELOC_AARCH64_BRANCH19: +- case BFD_RELOC_AARCH64_LD_LO19_PCREL: + case BFD_RELOC_AARCH64_LDST8_LO12: + case BFD_RELOC_AARCH64_LDST16_LO12: + case BFD_RELOC_AARCH64_LDST32_LO12: +@@ -4451,9 +4471,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, + case BFD_RELOC_AARCH64_MOVW_G2: + case BFD_RELOC_AARCH64_MOVW_G2_NC: + case BFD_RELOC_AARCH64_MOVW_G3: +- case BFD_RELOC_AARCH64_16_PCREL: +- case BFD_RELOC_AARCH64_32_PCREL: +- case BFD_RELOC_AARCH64_64_PCREL: + case BFD_RELOC_AARCH64_TSTBR14: + value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, + signed_addend, weak_undef_p); +@@ -4474,6 +4491,58 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, + value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, + 0, weak_undef_p); + } ++ else ++ { ++ struct elf_aarch64_local_symbol *locals ++ = elf_aarch64_locals (input_bfd); ++ ++ if (locals == NULL) ++ { ++ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START; ++ (*_bfd_error_handler) ++ (_("%B: Local symbol descriptor table be NULL when applying " ++ "relocation %s against local symbol"), ++ input_bfd, elfNN_aarch64_howto_table[howto_index].name); ++ abort (); ++ } ++ ++ off = symbol_got_offset (input_bfd, h, r_symndx); ++ base_got = globals->root.sgot; ++ bfd_vma got_entry_addr = (base_got->output_section->vma ++ + base_got->output_offset + off); ++ ++ if (!symbol_got_offset_mark_p (input_bfd, h, r_symndx)) ++ { ++ bfd_put_64 (output_bfd, value, base_got->contents + off); ++ ++ if (info->shared) ++ { ++ asection *s; ++ Elf_Internal_Rela outrel; ++ ++ /* For local symbol, we have done absolute relocation in static ++ linking stageh. While for share library, we need to update ++ the content of GOT entry according to the share objects ++ loading base address. So we need to generate a ++ R_AARCH64_RELATIVE reloc for dynamic linker. */ ++ s = globals->root.srelgot; ++ if (s == NULL) ++ abort (); ++ ++ outrel.r_offset = got_entry_addr; ++ outrel.r_info = ELFNN_R_INFO (0, AARCH64_R (RELATIVE)); ++ outrel.r_addend = value; ++ elf_append_rela (output_bfd, s, &outrel); ++ } ++ ++ symbol_got_offset_mark (input_bfd, h, r_symndx); ++ } ++ ++ /* Update the relocation value to GOT entry addr as we have transformed ++ the direct data access into indirect data access through GOT. */ ++ value = got_entry_addr; ++ } ++ + break; + + case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21: +@@ -5542,7 +5611,7 @@ elfNN_aarch64_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + + } + +@@ -7008,7 +7077,8 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + htab->root.sgot->size += GOT_ENTRY_SIZE * 2; + } + +- if (got_type & GOT_TLS_IE) ++ if (got_type & GOT_TLS_IE ++ || got_type & GOT_NORMAL) + { + locals[i].got_offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE; +@@ -7018,10 +7088,6 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + { + } + +- if (got_type == GOT_NORMAL) +- { +- } +- + if (info->shared) + { + if (got_type & GOT_TLSDESC_GD) +@@ -7034,7 +7100,8 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + if (got_type & GOT_TLS_GD) + htab->root.srelgot->size += RELOC_SIZE (htab) * 2; + +- if (got_type & GOT_TLS_IE) ++ if (got_type & GOT_TLS_IE ++ || got_type & GOT_NORMAL) + htab->root.srelgot->size += RELOC_SIZE (htab); + } + } +diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c +index 6ae4adf..fdb09f0 100644 +--- a/bfd/elfxx-aarch64.c ++++ b/bfd/elfxx-aarch64.c +@@ -187,6 +187,8 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, + size = bfd_get_reloc_size (howto); + switch (size) + { ++ case 0: ++ return status; + case 2: + contents = bfd_get_16 (abfd, address); + break; +diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c +index e9f884b..c3bc0a7 100644 +--- a/bfd/elfxx-ia64.c ++++ b/bfd/elfxx-ia64.c +@@ -91,7 +91,7 @@ ia64_elf_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc, + TYPE field. */ + static reloc_howto_type ia64_howto_table[] = + { +- IA64_HOWTO (R_IA64_NONE, "NONE", 0, FALSE, TRUE), ++ IA64_HOWTO (R_IA64_NONE, "NONE", 3, FALSE, TRUE), + + IA64_HOWTO (R_IA64_IMM14, "IMM14", 0, FALSE, TRUE), + IA64_HOWTO (R_IA64_IMM22, "IMM22", 0, FALSE, TRUE), +diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c +index a0cc26e..7bf545b 100644 +--- a/bfd/elfxx-mips.c ++++ b/bfd/elfxx-mips.c +@@ -6194,11 +6194,13 @@ mips_elf_obtain_contents (reloc_howto_type *howto, + const Elf_Internal_Rela *relocation, + bfd *input_bfd, bfd_byte *contents) + { +- bfd_vma x; ++ bfd_vma x = 0; + bfd_byte *location = contents + relocation->r_offset; ++ unsigned int size = bfd_get_reloc_size (howto); + + /* Obtain the bytes. */ +- x = bfd_get ((8 * bfd_get_reloc_size (howto)), input_bfd, location); ++ if (size != 0) ++ x = bfd_get (8 * size, input_bfd, location); + + return x; + } +@@ -6223,6 +6225,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info, + bfd_vma x; + bfd_byte *location; + int r_type = ELF_R_TYPE (input_bfd, relocation->r_info); ++ unsigned int size; + + /* Figure out where the relocation is occurring. */ + location = contents + relocation->r_offset; +@@ -6316,7 +6319,9 @@ mips_elf_perform_relocation (struct bfd_link_info *info, + } + + /* Put the value into the output. */ +- bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location); ++ size = bfd_get_reloc_size (howto); ++ if (size != 0) ++ bfd_put (8 * size, input_bfd, x, location); + + _bfd_mips_elf_reloc_shuffle (input_bfd, r_type, !info->relocatable, + location); +@@ -9221,7 +9226,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + dynamic will now refer to the local copy instead. */ + hmips->possibly_dynamic_relocs = 0; + +- return _bfd_elf_adjust_dynamic_copy (h, htab->sdynbss); ++ return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss); + } + + /* This function is called after all the input files have been read, +@@ -11912,6 +11917,18 @@ mips_set_isa_flags (bfd *abfd) + } + + ++/* Whether to sort relocs output by ld -r or ld --emit-relocs, by r_offset. ++ Don't do so for code sections. We want to keep ordering of HI16/LO16 ++ as is. On the other hand, elf-eh-frame.c processing requires .eh_frame ++ relocs to be sorted. */ ++ ++bfd_boolean ++_bfd_mips_elf_sort_relocs_p (asection *sec) ++{ ++ return (sec->flags & SEC_CODE) == 0; ++} ++ ++ + /* The final processing done just before writing out a MIPS ELF object + file. This gets the MIPS architecture right based on the machine + number. This is used by both the 32-bit and the 64-bit ABI. */ +diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h +index 8f5c53e..0605447 100644 +--- a/bfd/elfxx-mips.h ++++ b/bfd/elfxx-mips.h +@@ -67,6 +67,8 @@ extern bfd_boolean _bfd_mips_vxworks_finish_dynamic_symbol + Elf_Internal_Sym *); + extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections + (bfd *, struct bfd_link_info *); ++extern bfd_boolean _bfd_mips_elf_sort_relocs_p ++ (asection *); + extern void _bfd_mips_elf_final_write_processing + (bfd *, bfd_boolean); + extern int _bfd_mips_elf_additional_program_headers +diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c +index d5f92d4..2023229 100644 +--- a/bfd/elfxx-sparc.c ++++ b/bfd/elfxx-sparc.c +@@ -209,7 +209,7 @@ sparc_elf_lox10_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + + static reloc_howto_type _bfd_sparc_elf_howto_table[] = + { +- HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), ++ HOWTO(R_SPARC_NONE, 0,3, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", FALSE,0,0x000000ff,TRUE), + HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", FALSE,0,0x0000ffff,TRUE), + HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", FALSE,0,0xffffffff,TRUE), +@@ -2211,7 +2211,7 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + + s = htab->sdynbss; + +- return _bfd_elf_adjust_dynamic_copy (h, s); ++ return _bfd_elf_adjust_dynamic_copy (info, h, s); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h +index 692fb46..64d2461 100644 +--- a/bfd/elfxx-target.h ++++ b/bfd/elfxx-target.h +@@ -531,6 +531,9 @@ + #ifndef elf_backend_count_relocs + #define elf_backend_count_relocs NULL + #endif ++#ifndef elf_backend_sort_relocs_p ++#define elf_backend_sort_relocs_p NULL ++#endif + #ifndef elf_backend_grok_prstatus + #define elf_backend_grok_prstatus NULL + #endif +@@ -733,6 +736,7 @@ static struct elf_backend_data elfNN_bed = + elf_backend_ignore_undef_symbol, + elf_backend_emit_relocs, + elf_backend_count_relocs, ++ elf_backend_sort_relocs_p, + elf_backend_grok_prstatus, + elf_backend_grok_psinfo, + elf_backend_write_core_note, +diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c +index e206bc7..dcdec70 100644 +--- a/bfd/elfxx-tilegx.c ++++ b/bfd/elfxx-tilegx.c +@@ -72,11 +72,11 @@ static reloc_howto_type tilegx_elf_howto_table [] = + /* This reloc does nothing. */ + HOWTO (R_TILEGX_NONE, /* type */ + 0, /* rightshift */ +- 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 3, /* size (0 = byte, 1 = short, 2 = long) */ ++ 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_TILEGX_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -2456,7 +2456,7 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->needs_copy = 1; + } + +- return _bfd_elf_adjust_dynamic_copy (h, htab->sdynbss); ++ return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss); + } + + /* Allocate space in .plt, .got and associated reloc sections for +diff --git a/bfd/format.c b/bfd/format.c +index c4bc944..f0d1e66 100644 +--- a/bfd/format.c ++++ b/bfd/format.c +@@ -402,7 +402,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) + /* We still have more than one equally good match, and at least some + of the targets support match priority. Choose the first of the + best matches. */ +- if (match_count > 1 && best_count != match_count) ++ if (matching_vector && match_count > 1 && best_count != match_count) + { + int i; + +diff --git a/bfd/ieee.c b/bfd/ieee.c +index 313834e..04ac666 100644 +--- a/bfd/ieee.c ++++ b/bfd/ieee.c +@@ -170,9 +170,16 @@ ieee_write_id (bfd *abfd, const char *id) + standard requires. */ + + #define this_byte(ieee) *((ieee)->input_p) +-#define next_byte(ieee) ((ieee)->input_p++) + #define this_byte_and_next(ieee) (*((ieee)->input_p++)) + ++static bfd_boolean ++next_byte (common_header_type * ieee) ++{ ++ ieee->input_p++; ++ ++ return ieee->input_p < ieee->last_byte; ++} ++ + static unsigned short + read_2bytes (common_header_type *ieee) + { +@@ -348,15 +355,15 @@ parse_int (common_header_type *ieee, bfd_vma *value_ptr) + if (value >= 0 && value <= 127) + { + *value_ptr = value; +- next_byte (ieee); +- return TRUE; ++ return next_byte (ieee); + } + else if (value >= 0x80 && value <= 0x88) + { + unsigned int count = value & 0xf; + + result = 0; +- next_byte (ieee); ++ if (! next_byte (ieee)) ++ return FALSE; + while (count) + { + result = (result << 8) | this_byte_and_next (ieee); +@@ -496,7 +503,7 @@ static reloc_howto_type rel8_howto = + + static ieee_symbol_index_type NOSYMBOL = {0, 0}; + +-static void ++static bfd_boolean + parse_expression (ieee_data_type *ieee, + bfd_vma *value, + ieee_symbol_index_type *symbol, +@@ -529,68 +536,83 @@ parse_expression (ieee_data_type *ieee, + { + int section_n; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + *pcrel = TRUE; + section_n = must_parse_int (&(ieee->h)); + (void) section_n; + PUSH (NOSYMBOL, bfd_abs_section_ptr, 0); + break; + } ++ + case ieee_variable_L_enum: + /* L variable address of section N. */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0); + break; ++ + case ieee_variable_R_enum: + /* R variable, logical address of section module. */ + /* FIXME, this should be different to L. */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0); + break; ++ + case ieee_variable_S_enum: + /* S variable, size in MAUS of section module. */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + PUSH (NOSYMBOL, + 0, + ieee->section_table[must_parse_int (&(ieee->h))]->size); + break; ++ + case ieee_variable_I_enum: + /* Push the address of variable n. */ + { + ieee_symbol_index_type sy; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + sy.index = (int) must_parse_int (&(ieee->h)); + sy.letter = 'I'; + + PUSH (sy, bfd_abs_section_ptr, 0); + } + break; ++ + case ieee_variable_X_enum: + /* Push the address of external variable n. */ + { + ieee_symbol_index_type sy; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; ++ + sy.index = (int) (must_parse_int (&(ieee->h))); + sy.letter = 'X'; + + PUSH (sy, bfd_und_section_ptr, 0); + } + break; ++ + case ieee_function_minus_enum: + { + bfd_vma value1, value2; + asection *section1, *section_dummy; + ieee_symbol_index_type sy; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + + POP (sy, section1, value1); + POP (sy, section_dummy, value2); + PUSH (sy, section1 ? section1 : section_dummy, value2 - value1); + } + break; ++ + case ieee_function_plus_enum: + { + bfd_vma value1, value2; +@@ -599,7 +621,8 @@ parse_expression (ieee_data_type *ieee, + ieee_symbol_index_type sy1; + ieee_symbol_index_type sy2; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + + POP (sy1, section1, value1); + POP (sy2, section2, value2); +@@ -608,6 +631,7 @@ parse_expression (ieee_data_type *ieee, + value1 + value2); + } + break; ++ + default: + { + bfd_vma va; +@@ -644,17 +668,9 @@ parse_expression (ieee_data_type *ieee, + POP (*symbol, dummy, *value); + if (section) + *section = dummy; +-} +- + +-#define ieee_seek(ieee, offset) \ +- do \ +- { \ +- ieee->h.input_p = ieee->h.first_byte + offset; \ +- ieee->h.last_byte = (ieee->h.first_byte \ +- + ieee_part_after (ieee, offset)); \ +- } \ +- while (0) ++ return TRUE; ++} + + #define ieee_pos(ieee) \ + (ieee->h.input_p - ieee->h.first_byte) +@@ -676,6 +692,22 @@ ieee_part_after (ieee_data_type *ieee, file_ptr here) + return after; + } + ++static bfd_boolean ++ieee_seek (ieee_data_type * ieee, file_ptr offset) ++{ ++ /* PR 17512: file: 017-1157-0.004. */ ++ if (offset < 0 || (bfd_size_type) offset >= ieee->h.total_amt) ++ { ++ ieee->h.input_p = ieee->h.first_byte + ieee->h.total_amt; ++ ieee->h.last_byte = ieee->h.input_p; ++ return FALSE; ++ } ++ ++ ieee->h.input_p = ieee->h.first_byte + offset; ++ ieee->h.last_byte = (ieee->h.first_byte + ieee_part_after (ieee, offset)); ++ return TRUE; ++} ++ + static unsigned int last_index; + static char last_type; /* Is the index for an X or a D. */ + +@@ -730,14 +762,16 @@ ieee_slurp_external_symbols (bfd *abfd) + last_index = 0xffffff; + ieee->symbol_table_full = TRUE; + +- ieee_seek (ieee, offset); ++ if (! ieee_seek (ieee, offset)) ++ return FALSE; + + while (loop) + { + switch (this_byte (&(ieee->h))) + { + case ieee_nn_record: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + + symbol = get_symbol (abfd, ieee, symbol, &symbol_count, + & prev_symbols_ptr, +@@ -750,8 +784,10 @@ ieee_slurp_external_symbols (bfd *abfd) + symbol->symbol.udata.p = NULL; + symbol->symbol.flags = BSF_NO_FLAGS; + break; ++ + case ieee_external_symbol_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + + symbol = get_symbol (abfd, ieee, symbol, &symbol_count, + &prev_symbols_ptr, +@@ -842,6 +878,7 @@ ieee_slurp_external_symbols (bfd *abfd) + } + } + break; ++ + case ieee_value_record_enum >> 8: + { + unsigned int symbol_name_index; +@@ -849,17 +886,20 @@ ieee_slurp_external_symbols (bfd *abfd) + bfd_boolean pcrel_ignore; + unsigned int extra; + +- next_byte (&(ieee->h)); +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + + symbol_name_index = must_parse_int (&(ieee->h)); + (void) symbol_name_index; +- parse_expression (ieee, +- &symbol->symbol.value, +- &symbol_ignore, +- &pcrel_ignore, +- &extra, +- &symbol->symbol.section); ++ if (! parse_expression (ieee, ++ &symbol->symbol.value, ++ &symbol_ignore, ++ &pcrel_ignore, ++ &extra, ++ &symbol->symbol.section)) ++ return FALSE; + + /* Fully linked IEEE-695 files tend to give every symbol + an absolute value. Try to convert that back into a +@@ -892,7 +932,9 @@ ieee_slurp_external_symbols (bfd *abfd) + bfd_vma size; + bfd_vma value; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; ++ + /* Throw away the external reference index. */ + (void) must_parse_int (&(ieee->h)); + /* Fetch the default size if not resolved. */ +@@ -907,7 +949,8 @@ ieee_slurp_external_symbols (bfd *abfd) + break; + + case ieee_external_reference_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + + symbol = get_symbol (abfd, ieee, symbol, &symbol_count, + &prev_reference_ptr, +@@ -1092,7 +1135,7 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int sindex) + return ieee->section_table[sindex]; + } + +-static void ++static bfd_boolean + ieee_slurp_sections (bfd *abfd) + { + ieee_data_type *ieee = IEEE_DATA (abfd); +@@ -1103,7 +1146,9 @@ ieee_slurp_sections (bfd *abfd) + { + bfd_byte section_type[3]; + +- ieee_seek (ieee, offset); ++ if (! ieee_seek (ieee, offset)) ++ return FALSE; ++ + while (TRUE) + { + switch (this_byte (&(ieee->h))) +@@ -1113,7 +1158,8 @@ ieee_slurp_sections (bfd *abfd) + asection *section; + unsigned int section_index; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section_index = must_parse_int (&(ieee->h)); + + section = get_section_entry (abfd, ieee, section_index); +@@ -1132,22 +1178,26 @@ ieee_slurp_sections (bfd *abfd) + { + /* AS Absolute section attributes. */ + case 0xD3: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section_type[2] = this_byte (&(ieee->h)); + switch (section_type[2]) + { + case 0xD0: + /* Normal code. */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section->flags |= SEC_CODE; + break; + case 0xC4: + /* Normal data. */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section->flags |= SEC_DATA; + break; + case 0xD2: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + /* Normal rom data. */ + section->flags |= SEC_ROM | SEC_DATA; + break; +@@ -1164,15 +1214,18 @@ ieee_slurp_sections (bfd *abfd) + switch (section_type[1]) + { + case 0xD0: /* Normal code (CP). */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section->flags |= SEC_CODE; + break; + case 0xC4: /* Normal data (CD). */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section->flags |= SEC_DATA; + break; + case 0xD2: /* Normal rom data (CR). */ +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section->flags |= SEC_ROM | SEC_DATA; + break; + default: +@@ -1201,7 +1254,8 @@ ieee_slurp_sections (bfd *abfd) + bfd_vma value; + asection *section; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section_index = must_parse_int (&ieee->h); + section = get_section_entry (abfd, ieee, section_index); + if (section_index > ieee->section_count) +@@ -1251,15 +1305,17 @@ ieee_slurp_sections (bfd *abfd) + (void) must_parse_int (&(ieee->h)); + break; + default: +- return; ++ return TRUE; + } + } + break; + default: +- return; ++ return TRUE; + } + } + } ++ ++ return TRUE; + } + + /* Make a section for the debugging information, if any. We don't try +@@ -1323,7 +1379,8 @@ ieee_archive_p (bfd *abfd) + if (this_byte (&(ieee->h)) != Module_Beginning) + goto got_wrong_format_error; + +- next_byte (&(ieee->h)); ++ (void) next_byte (&(ieee->h)); ++ + library = read_id (&(ieee->h)); + if (strcmp (library, "LIBRARY") != 0) + goto got_wrong_format_error; +@@ -1334,7 +1391,7 @@ ieee_archive_p (bfd *abfd) + ieee->element_count = 0; + ieee->element_index = 0; + +- next_byte (&(ieee->h)); /* Drop the ad part. */ ++ (void) next_byte (&(ieee->h)); /* Drop the ad part. */ + must_parse_int (&(ieee->h)); /* And the two dummy numbers. */ + must_parse_int (&(ieee->h)); + +@@ -1407,8 +1464,9 @@ ieee_archive_p (bfd *abfd) + ieee->h.first_byte = buffer; + ieee->h.input_p = buffer; + +- next_byte (&(ieee->h)); /* Drop F8. */ +- next_byte (&(ieee->h)); /* Drop 14. */ ++ (void) next_byte (&(ieee->h)); /* Drop F8. */ ++ if (! next_byte (&(ieee->h))) /* Drop 14. */ ++ goto error_return; + must_parse_int (&(ieee->h)); /* Drop size of block. */ + + if (must_parse_int (&(ieee->h)) != 0) +@@ -1467,7 +1525,8 @@ do_one (ieee_data_type *ieee, + unsigned int number_of_maus; + unsigned int i; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + number_of_maus = must_parse_int (&(ieee->h)); + + for (i = 0; i < number_of_maus; i++) +@@ -1482,7 +1541,8 @@ do_one (ieee_data_type *ieee, + { + bfd_boolean loop = TRUE; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + while (loop) + { + switch (this_byte (&(ieee->h))) +@@ -1505,13 +1565,16 @@ do_one (ieee_data_type *ieee, + *(current_map->reloc_tail_ptr) = r; + current_map->reloc_tail_ptr = &r->next; + r->next = (ieee_reloc_type *) NULL; +- next_byte (&(ieee->h)); +-/* abort();*/ ++ if (! next_byte (&(ieee->h))) ++ return FALSE; ++ + r->relent.sym_ptr_ptr = 0; +- parse_expression (ieee, +- &r->relent.addend, +- &r->symbol, +- &pcrel, &extra, §ion); ++ if (! parse_expression (ieee, ++ &r->relent.addend, ++ &r->symbol, ++ &pcrel, &extra, §ion)) ++ return FALSE; ++ + r->relent.address = current_map->pc; + s->flags |= SEC_RELOC; + s->owner->flags |= HAS_RELOC; +@@ -1521,7 +1584,8 @@ do_one (ieee_data_type *ieee, + + if (this_byte (&(ieee->h)) == (int) ieee_comma) + { +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + /* Fetch number of bytes to pad. */ + extra = must_parse_int (&(ieee->h)); + }; +@@ -1529,13 +1593,16 @@ do_one (ieee_data_type *ieee, + switch (this_byte (&(ieee->h))) + { + case ieee_function_signed_close_b_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + break; + case ieee_function_unsigned_close_b_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + break; + case ieee_function_either_close_b_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + break; + default: + break; +@@ -1634,7 +1701,8 @@ do_one (ieee_data_type *ieee, + for (i = 0; i < this_size; i++) + { + location_ptr[current_map->pc++] = this_byte (&(ieee->h)); +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + } + } + else +@@ -1667,7 +1735,9 @@ ieee_slurp_section_data (bfd *abfd) + if (ieee->read_data) + return TRUE; + ieee->read_data = TRUE; +- ieee_seek (ieee, ieee->w.r.data_part); ++ ++ if (! ieee_seek (ieee, ieee->w.r.data_part)) ++ return FALSE; + + /* Allocate enough space for all the section contents. */ + for (s = abfd->sections; s != (asection *) NULL; s = s->next) +@@ -1693,7 +1763,8 @@ ieee_slurp_section_data (bfd *abfd) + return TRUE; + + case ieee_set_current_section_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + section_number = must_parse_int (&(ieee->h)); + s = ieee->section_table[section_number]; + s->flags |= SEC_LOAD | SEC_HAS_CONTENTS; +@@ -1706,7 +1777,8 @@ ieee_slurp_section_data (bfd *abfd) + break; + + case ieee_e2_first_byte_enum: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + switch (this_byte (&(ieee->h))) + { + case ieee_set_current_pc_enum & 0xff: +@@ -1716,21 +1788,28 @@ ieee_slurp_section_data (bfd *abfd) + unsigned int extra; + bfd_boolean pcrel; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + must_parse_int (&(ieee->h)); /* Throw away section #. */ +- parse_expression (ieee, &value, +- &symbol, +- &pcrel, &extra, +- 0); ++ if (! parse_expression (ieee, &value, ++ &symbol, ++ &pcrel, &extra, ++ 0)) ++ return FALSE; ++ + current_map->pc = value; + BFD_ASSERT ((unsigned) (value - s->vma) <= s->size); + } + break; + + case ieee_value_starting_address_enum & 0xff: +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + if (this_byte (&(ieee->h)) == ieee_function_either_open_b_enum) +- next_byte (&(ieee->h)); ++ { ++ if (! next_byte (&(ieee->h))) ++ return FALSE; ++ } + abfd->start_address = must_parse_int (&(ieee->h)); + /* We've got to the end of the data now - */ + return TRUE; +@@ -1748,7 +1827,8 @@ ieee_slurp_section_data (bfd *abfd) + unsigned int iterations; + unsigned char *start; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + iterations = must_parse_int (&(ieee->h)); + start = ieee->h.input_p; + if (start[0] == (int) ieee_load_constant_bytes_enum +@@ -1759,9 +1839,10 @@ ieee_slurp_section_data (bfd *abfd) + location_ptr[current_map->pc++] = start[2]; + iterations--; + } +- next_byte (&(ieee->h)); +- next_byte (&(ieee->h)); +- next_byte (&(ieee->h)); ++ (void) next_byte (&(ieee->h)); ++ (void) next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ return FALSE; + } + else + { +@@ -1806,6 +1887,7 @@ ieee_object_p (bfd *abfd) + goto got_wrong_format; + + ieee->h.input_p = buffer; ++ ieee->h.total_amt = sizeof (buffer); + if (this_byte_and_next (&(ieee->h)) != Module_Beginning) + goto got_wrong_format; + +@@ -1901,7 +1983,8 @@ ieee_object_p (bfd *abfd) + if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum) + goto fail; + +- next_byte (&(ieee->h)); ++ if (! next_byte (&(ieee->h))) ++ goto fail; + + if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau)) + goto fail; +@@ -1912,7 +1995,10 @@ ieee_object_p (bfd *abfd) + /* If there is a byte order info, take it. */ + if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum + || this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) +- next_byte (&(ieee->h)); ++ { ++ if (! next_byte (&(ieee->h))) ++ goto fail; ++ } + + for (part = 0; part < N_W_VARIABLES; part++) + { +@@ -1943,12 +2029,17 @@ ieee_object_p (bfd *abfd) + goto fail; + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + goto fail; ++ + /* FIXME: Check return value. I'm not sure whether it needs to read + the entire buffer or not. */ +- bfd_bread ((void *) (IEEE_DATA (abfd)->h.first_byte), +- (bfd_size_type) ieee->w.r.me_record + 1, abfd); ++ amt = bfd_bread ((void *) (IEEE_DATA (abfd)->h.first_byte), ++ (bfd_size_type) ieee->w.r.me_record + 1, abfd); ++ if (amt <= 0) ++ goto fail; + +- ieee_slurp_sections (abfd); ++ IEEE_DATA (abfd)->h.total_amt = amt; ++ if (ieee_slurp_sections (abfd)) ++ goto fail; + + if (! ieee_slurp_debug (abfd)) + goto fail; +@@ -3737,6 +3828,8 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + #define ieee_update_armap_timestamp bfd_true + #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index + ++#define ieee_get_symbol_version_string \ ++ _bfd_nosymbols_get_symbol_version_string + #define ieee_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) + #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name +diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h +index 50a46ac..ad27f2e 100644 +--- a/bfd/libbfd-in.h ++++ b/bfd/libbfd-in.h +@@ -837,3 +837,5 @@ extern void bfd_section_already_linked_table_traverse + + extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); + extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); ++extern bfd_vma safe_read_leb128 (bfd *, bfd_byte *, unsigned int *, ++ bfd_boolean, const bfd_byte * const); +diff --git a/bfd/libbfd.c b/bfd/libbfd.c +index 6352c9c..c079247 100644 +--- a/bfd/libbfd.c ++++ b/bfd/libbfd.c +@@ -171,15 +171,18 @@ void * + bfd_malloc (bfd_size_type size) + { + void *ptr; ++ size_t sz = (size_t) size; + +- if (size != (size_t) size) ++ if (size != sz ++ /* This is to pacify memory checkers like valgrind. */ ++ || ((signed long) sz) < 0) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + +- ptr = malloc ((size_t) size); +- if (ptr == NULL && (size_t) size != 0) ++ ptr = malloc (sz); ++ if (ptr == NULL && sz != 0) + bfd_set_error (bfd_error_no_memory); + + return ptr; +@@ -190,8 +193,6 @@ bfd_malloc (bfd_size_type size) + void * + bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size) + { +- void *ptr; +- + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) +@@ -200,19 +201,7 @@ bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size) + return NULL; + } + +- size *= nmemb; +- +- if (size != (size_t) size) +- { +- bfd_set_error (bfd_error_no_memory); +- return NULL; +- } +- +- ptr = malloc ((size_t) size); +- if (ptr == NULL && (size_t) size != 0) +- bfd_set_error (bfd_error_no_memory); +- +- return ptr; ++ return bfd_malloc (size * nmemb); + } + + /* Reallocate memory using realloc. */ +@@ -221,19 +210,22 @@ void * + bfd_realloc (void *ptr, bfd_size_type size) + { + void *ret; ++ size_t sz = (size_t) size; ++ ++ if (ptr == NULL) ++ return bfd_malloc (size); + +- if (size != (size_t) size) ++ if (size != sz ++ /* This is to pacify memory checkers like valgrind. */ ++ || ((signed long) sz) < 0) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + +- if (ptr == NULL) +- ret = malloc ((size_t) size); +- else +- ret = realloc (ptr, (size_t) size); ++ ret = realloc (ptr, sz); + +- if (ret == NULL && (size_t) size != 0) ++ if (ret == NULL && sz != 0) + bfd_set_error (bfd_error_no_memory); + + return ret; +@@ -244,8 +236,6 @@ bfd_realloc (void *ptr, bfd_size_type size) + void * + bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size) + { +- void *ret; +- + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) +@@ -254,23 +244,7 @@ bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size) + return NULL; + } + +- size *= nmemb; +- +- if (size != (size_t) size) +- { +- bfd_set_error (bfd_error_no_memory); +- return NULL; +- } +- +- if (ptr == NULL) +- ret = malloc ((size_t) size); +- else +- ret = realloc (ptr, (size_t) size); +- +- if (ret == NULL && (size_t) size != 0) +- bfd_set_error (bfd_error_no_memory); +- +- return ret; ++ return bfd_realloc (ptr, size * nmemb); + } + + /* Reallocate memory using realloc. +@@ -279,24 +253,10 @@ bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size) + void * + bfd_realloc_or_free (void *ptr, bfd_size_type size) + { +- size_t amount = (size_t) size; +- void *ret; ++ void *ret = bfd_realloc (ptr, size); + +- if (size != amount) +- ret = NULL; +- else if (ptr == NULL) +- ret = malloc (amount); +- else +- ret = realloc (ptr, amount); +- +- if (ret == NULL) +- { +- if (amount > 0) +- bfd_set_error (bfd_error_no_memory); +- +- if (ptr != NULL) +- free (ptr); +- } ++ if (ret == NULL && ptr != NULL) ++ free (ptr); + + return ret; + } +@@ -306,23 +266,10 @@ bfd_realloc_or_free (void *ptr, bfd_size_type size) + void * + bfd_zmalloc (bfd_size_type size) + { +- void *ptr; ++ void *ptr = bfd_malloc (size); + +- if (size != (size_t) size) +- { +- bfd_set_error (bfd_error_no_memory); +- return NULL; +- } +- +- ptr = malloc ((size_t) size); +- +- if ((size_t) size != 0) +- { +- if (ptr == NULL) +- bfd_set_error (bfd_error_no_memory); +- else +- memset (ptr, 0, (size_t) size); +- } ++ if (ptr != NULL && size > 0) ++ memset (ptr, 0, (size_t) size); + + return ptr; + } +@@ -333,32 +280,14 @@ bfd_zmalloc (bfd_size_type size) + void * + bfd_zmalloc2 (bfd_size_type nmemb, bfd_size_type size) + { +- void *ptr; ++ void *ptr = bfd_malloc2 (nmemb, size); + +- if ((nmemb | size) >= HALF_BFD_SIZE_TYPE +- && size != 0 +- && nmemb > ~(bfd_size_type) 0 / size) ++ if (ptr != NULL) + { +- bfd_set_error (bfd_error_no_memory); +- return NULL; +- } +- +- size *= nmemb; +- +- if (size != (size_t) size) +- { +- bfd_set_error (bfd_error_no_memory); +- return NULL; +- } ++ size_t sz = nmemb * size; + +- ptr = malloc ((size_t) size); +- +- if ((size_t) size != 0) +- { +- if (ptr == NULL) +- bfd_set_error (bfd_error_no_memory); +- else +- memset (ptr, 0, (size_t) size); ++ if (sz > 0) ++ memset (ptr, 0, sz); + } + + return ptr; +@@ -1074,6 +1003,45 @@ read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, + return result; + } + ++/* Read in a LEB128 encoded value from ABFD starting at DATA. ++ If SIGN is true, return a signed LEB128 value. ++ If LENGTH_RETURN is not NULL, return in it the number of bytes read. ++ No bytes will be read at address END or beyond. */ ++ ++bfd_vma ++safe_read_leb128 (bfd *abfd ATTRIBUTE_UNUSED, ++ bfd_byte *data, ++ unsigned int *length_return, ++ bfd_boolean sign, ++ const bfd_byte * const end) ++{ ++ bfd_vma result = 0; ++ unsigned int num_read = 0; ++ unsigned int shift = 0; ++ unsigned char byte = 0; ++ ++ while (data < end) ++ { ++ byte = bfd_get_8 (abfd, data); ++ data++; ++ num_read++; ++ ++ result |= ((bfd_vma) (byte & 0x7f)) << shift; ++ ++ shift += 7; ++ if ((byte & 0x80) == 0) ++ break; ++ } ++ ++ if (length_return != NULL) ++ *length_return = num_read; ++ ++ if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40)) ++ result |= (bfd_vma) -1 << shift; ++ ++ return result; ++} ++ + /* Helper function for reading sleb128 encoded data. */ + + bfd_signed_vma +diff --git a/bfd/libbfd.h b/bfd/libbfd.h +index 6c48f82..1c54d0f 100644 +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -842,6 +842,8 @@ extern void bfd_section_already_linked_table_traverse + + extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); + extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); ++extern bfd_vma safe_read_leb128 (bfd *, bfd_byte *, unsigned int *, ++ bfd_boolean, const bfd_byte * const); + /* Extracted from init.c. */ + /* Extracted from libbfd.c. */ + bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); +diff --git a/bfd/libieee.h b/bfd/libieee.h +index 7026b85..27fd467 100644 +--- a/bfd/libieee.h ++++ b/bfd/libieee.h +@@ -66,6 +66,7 @@ typedef struct { + unsigned char *input_p; + unsigned char *first_byte; + unsigned char *last_byte; ++ bfd_size_type total_amt; + bfd *abfd; + } common_header_type ; + +diff --git a/bfd/linker.c b/bfd/linker.c +index abdf5b0..f7f32a3 100644 +--- a/bfd/linker.c ++++ b/bfd/linker.c +@@ -1560,6 +1560,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, + h->type = bfd_link_hash_defined; + h->u.def.section = section; + h->u.def.value = value; ++ h->linker_def = 0; + + /* If we have been asked to, we act like collect2 and + identify all functions that might be global +@@ -1659,6 +1660,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, + } + else + h->u.c.p->section = section; ++ h->linker_def = 0; + break; + + case REF: +@@ -2432,7 +2434,7 @@ _bfd_generic_reloc_link_order (bfd *abfd, + + size = bfd_get_reloc_size (r->howto); + buf = (bfd_byte *) bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + rstat = _bfd_relocate_contents (r->howto, abfd, + (bfd_vma) link_order->u.reloc.p->addend, +diff --git a/bfd/mach-o.c b/bfd/mach-o.c +index 3952689..5364c50 100644 +--- a/bfd/mach-o.c ++++ b/bfd/mach-o.c +@@ -690,6 +690,20 @@ bfd_mach_o_bfd_copy_private_header_data (bfd *ibfd, bfd *obfd) + ody->export_size = idy->export_size; + ody->export_content = idy->export_content; + } ++ /* PR 17512: file: 730e492d. */ ++ else ++ { ++ ody->rebase_size = ++ ody->bind_size = ++ ody->weak_bind_size = ++ ody->lazy_bind_size = ++ ody->export_size = 0; ++ ody->rebase_content = ++ ody->bind_content = ++ ody->weak_bind_content = ++ ody->lazy_bind_content = ++ ody->export_content = NULL; ++ } + } + break; + +@@ -790,18 +804,19 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd, + bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab; + bfd_mach_o_symtab_command *symtab = mdata->symtab; + asymbol *s; ++ char * s_start; ++ char * s_end; + unsigned long count, i, j, n; + size_t size; + char *names; + char *nul_name; ++ const char stub [] = "$stub"; + + *ret = NULL; + + /* Stop now if no symbols or no indirect symbols. */ +- if (dysymtab == NULL || symtab == NULL || symtab->symbols == NULL) +- return 0; +- +- if (dysymtab->nindirectsyms == 0) ++ if (dysymtab == NULL || dysymtab->nindirectsyms == 0 ++ || symtab == NULL || symtab->symbols == NULL) + return 0; + + /* We need to allocate a bfd symbol for every indirect symbol and to +@@ -811,19 +826,23 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd, + + for (j = 0; j < count; j++) + { ++ const char * strng; + unsigned int isym = dysymtab->indirect_syms[j]; + + /* Some indirect symbols are anonymous. */ +- if (isym < symtab->nsyms && symtab->symbols[isym].symbol.name) +- size += strlen (symtab->symbols[isym].symbol.name) + sizeof ("$stub"); ++ if (isym < symtab->nsyms && (strng = symtab->symbols[isym].symbol.name)) ++ /* PR 17512: file: f5b8eeba. */ ++ size += strnlen (strng, symtab->strsize - (strng - symtab->strtab)) + sizeof (stub); + } + +- s = *ret = (asymbol *) bfd_malloc (size); ++ s_start = bfd_malloc (size); ++ s = *ret = (asymbol *) s_start; + if (s == NULL) + return -1; + names = (char *) (s + count); + nul_name = names; + *names++ = 0; ++ s_end = s_start + size; + + n = 0; + for (i = 0; i < mdata->nsects; i++) +@@ -843,10 +862,19 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd, + last = first + bfd_mach_o_section_get_nbr_indirect (abfd, sec); + addr = sec->addr; + entry_size = bfd_mach_o_section_get_entry_size (abfd, sec); ++ ++ /* PR 17512: file: 08e15eec. */ ++ if (first >= count || last >= count || first > last) ++ goto fail; ++ + for (j = first; j < last; j++) + { + unsigned int isym = dysymtab->indirect_syms[j]; + ++ /* PR 17512: file: 04d64d9b. */ ++ if (((char *) s) + sizeof (* s) > s_end) ++ goto fail; ++ + s->flags = BSF_GLOBAL | BSF_SYNTHETIC; + s->section = sec->bfdsection; + s->value = addr - sec->addr; +@@ -860,10 +888,16 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd, + + s->name = names; + len = strlen (sym); ++ /* PR 17512: file: 47dfd4d2. */ ++ if (names + len >= s_end) ++ goto fail; + memcpy (names, sym, len); + names += len; +- memcpy (names, "$stub", sizeof ("$stub")); +- names += sizeof ("$stub"); ++ /* PR 17512: file: 18f340a4. */ ++ if (names + sizeof (stub) >= s_end) ++ goto fail; ++ memcpy (names, stub, sizeof (stub)); ++ names += sizeof (stub); + } + else + s->name = nul_name; +@@ -879,6 +913,11 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd, + } + + return n; ++ ++ fail: ++ free (s_start); ++ * ret = NULL; ++ return -1; + } + + void +@@ -1349,8 +1388,14 @@ bfd_mach_o_canonicalize_one_reloc (bfd *abfd, + + if (reloc.r_extern) + { +- /* An external symbol number. */ +- sym = syms + num; ++ /* PR 17512: file: 8396-1185-0.004. */ ++ if (num >= (unsigned) bfd_mach_o_count_symbols (abfd)) ++ sym = bfd_und_section_ptr->symbol_ptr_ptr; ++ else if (syms == NULL) ++ sym = bfd_und_section_ptr->symbol_ptr_ptr; ++ else ++ /* An external symbol number. */ ++ sym = syms + num; + } + else if (num == 0x00ffffff || num == 0) + { +@@ -1363,9 +1408,11 @@ bfd_mach_o_canonicalize_one_reloc (bfd *abfd, + } + else + { ++ /* PR 17512: file: 006-2964-0.004. */ ++ if (num > mdata->nsects) ++ return -1; ++ + /* A section number. */ +- BFD_ASSERT (num <= mdata->nsects); +- + sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr; + /* For a symbol defined in section S, the addend (stored in the + binary) contains the address of the section. To comply with +@@ -1394,6 +1441,7 @@ bfd_mach_o_canonicalize_one_reloc (bfd *abfd, + + if (!(*bed->_bfd_mach_o_swap_reloc_in)(res, &reloc)) + return -1; ++ + return 0; + } + +@@ -1408,6 +1456,11 @@ bfd_mach_o_canonicalize_relocs (bfd *abfd, unsigned long filepos, + + /* Allocate and read relocs. */ + native_size = count * BFD_MACH_O_RELENT_SIZE; ++ ++ /* PR 17512: file: 09477b57. */ ++ if (native_size < count) ++ return -1; ++ + native_relocs = + (struct mach_o_reloc_info_external *) bfd_malloc (native_size); + if (native_relocs == NULL) +@@ -1447,6 +1500,8 @@ bfd_mach_o_canonicalize_reloc (bfd *abfd, asection *asect, + + if (asect->relocation == NULL) + { ++ if (asect->reloc_count * sizeof (arelent) < asect->reloc_count) ++ return -1; + res = bfd_malloc (asect->reloc_count * sizeof (arelent)); + if (res == NULL) + return -1; +@@ -1500,6 +1555,10 @@ bfd_mach_o_canonicalize_dynamic_reloc (bfd *abfd, arelent **rels, + + if (mdata->dyn_reloc_cache == NULL) + { ++ if ((dysymtab->nextrel + dysymtab->nlocrel) * sizeof (arelent) ++ < (dysymtab->nextrel + dysymtab->nlocrel)) ++ return -1; ++ + res = bfd_malloc ((dysymtab->nextrel + dysymtab->nlocrel) + * sizeof (arelent)); + if (res == NULL) +@@ -1814,11 +1873,10 @@ bfd_mach_o_write_symtab_content (bfd *abfd, bfd_mach_o_symtab_command *sym) + mdata->filelen += sym->strsize; + + if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0) +- return FALSE; ++ goto err; + + if (_bfd_stringtab_emit (abfd, strtab) != TRUE) + goto err; +- _bfd_stringtab_free (strtab); + + /* Pad string table. */ + padlen = bfd_mach_o_pad4 (abfd, sym->strsize); +@@ -1831,6 +1889,7 @@ bfd_mach_o_write_symtab_content (bfd *abfd, bfd_mach_o_symtab_command *sym) + + err: + _bfd_stringtab_free (strtab); ++ sym->strsize = 0; + return FALSE; + } + +@@ -1948,6 +2007,8 @@ bfd_mach_o_build_dysymtab (bfd *abfd, bfd_mach_o_dysymtab_command *cmd) + cmd->indirectsymoff = mdata->filelen; + mdata->filelen += cmd->nindirectsyms * 4; + ++ if (cmd->nindirectsyms * 4 < cmd->nindirectsyms) ++ return FALSE; + cmd->indirect_syms = bfd_zalloc (abfd, cmd->nindirectsyms * 4); + if (cmd->indirect_syms == NULL) + return FALSE; +@@ -2334,17 +2395,20 @@ bfd_mach_o_mangle_sections (bfd *abfd, bfd_mach_o_data_struct *mdata) + && (mdata->nsects == 0 || mdata->sections != NULL)) + return TRUE; + ++ /* We need to check that this can be done... */ ++ if (nsect > 255) ++ { ++ (*_bfd_error_handler) (_("mach-o: there are too many sections (%u)" ++ " maximum is 255,\n"), nsect); ++ return FALSE; ++ } ++ + mdata->nsects = nsect; +- mdata->sections = bfd_alloc (abfd, +- mdata->nsects * sizeof (bfd_mach_o_section *)); ++ mdata->sections = bfd_alloc2 (abfd, ++ mdata->nsects, sizeof (bfd_mach_o_section *)); + if (mdata->sections == NULL) + return FALSE; + +- /* We need to check that this can be done... */ +- if (nsect > 255) +- (*_bfd_error_handler) (_("mach-o: there are too many sections (%d)" +- " maximum is 255,\n"), nsect); +- + /* Create Mach-O sections. + Section type, attribute and align should have been set when the + section was created - either read in or specified. */ +@@ -2726,7 +2790,14 @@ bfd_mach_o_build_exec_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) + + bfd_mach_o_append_section_to_segment (seg, s); + +- BFD_ASSERT (s->addr >= vma); ++ if (s->addr < vma) ++ { ++ (*_bfd_error_handler) ++ (_("section address (%lx) below start of segment (%lx)"), ++ (unsigned long) s->addr, (unsigned long) vma); ++ return FALSE; ++ } ++ + vma = s->addr + s->size; + } + +@@ -2801,7 +2872,7 @@ bfd_mach_o_build_exec_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) + /* Layout the commands: set commands size and offset, set ncmds and sizeofcmds + fields in header. */ + +-static void ++static bfd_boolean + bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata) + { + unsigned wide = mach_o_wide_p (&mdata->header); +@@ -2809,6 +2880,7 @@ bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata) + ufile_ptr offset; + bfd_mach_o_load_command *cmd; + unsigned int align; ++ bfd_boolean ret = TRUE; + + hdrlen = wide ? BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE; + align = wide ? 8 - 1 : 4 - 1; +@@ -2864,6 +2936,7 @@ bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata) + (*_bfd_error_handler) + (_("unable to layout unknown load command 0x%lx"), + (unsigned long) cmd->type); ++ ret = FALSE; + break; + } + +@@ -2872,6 +2945,8 @@ bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata) + } + mdata->header.sizeofcmds = offset - hdrlen; + mdata->filelen = offset; ++ ++ return ret; + } + + /* Subroutine of bfd_mach_o_build_commands: set type, name and nsects of a +@@ -3006,8 +3081,7 @@ bfd_mach_o_build_commands (bfd *abfd) + if (nbr_commands == 0) + { + /* Layout commands (well none...) and set headers command fields. */ +- bfd_mach_o_layout_commands (mdata); +- return TRUE; ++ return bfd_mach_o_layout_commands (mdata); + } + + /* Create commands for segments (and symtabs), prepend them. */ +@@ -3090,7 +3164,8 @@ bfd_mach_o_build_commands (bfd *abfd) + } + + /* Layout commands. */ +- bfd_mach_o_layout_commands (mdata); ++ if (! bfd_mach_o_layout_commands (mdata)) ++ return FALSE; + + /* So, now we have sized the commands and the filelen set to that. + Now we can build the segment command and set the section file offsets. */ +@@ -3394,6 +3469,13 @@ bfd_mach_o_read_section_32 (bfd *abfd, + section->size = bfd_h_get_32 (abfd, raw.size); + section->offset = bfd_h_get_32 (abfd, raw.offset); + section->align = bfd_h_get_32 (abfd, raw.align); ++ /* PR 17512: file: 0017eb76. */ ++ if (section->align > 64) ++ { ++ (*_bfd_error_handler) (_("bfd_mach_o_read_section_32: overlarge alignment value: 0x%x, using 32 instead"), ++ section->align); ++ section->align = 32; ++ } + section->reloff = bfd_h_get_32 (abfd, raw.reloff); + section->nreloc = bfd_h_get_32 (abfd, raw.nreloc); + section->flags = bfd_h_get_32 (abfd, raw.flags); +@@ -3433,6 +3515,12 @@ bfd_mach_o_read_section_64 (bfd *abfd, + section->size = bfd_h_get_64 (abfd, raw.size); + section->offset = bfd_h_get_32 (abfd, raw.offset); + section->align = bfd_h_get_32 (abfd, raw.align); ++ if (section->align > 64) ++ { ++ (*_bfd_error_handler) (_("bfd_mach_o_read_section_64: overlarge alignment value: 0x%x, using 32 instead"), ++ section->align); ++ section->align = 32; ++ } + section->reloff = bfd_h_get_32 (abfd, raw.reloff); + section->nreloc = bfd_h_get_32 (abfd, raw.nreloc); + section->flags = bfd_h_get_32 (abfd, raw.flags); +@@ -3637,16 +3725,21 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd) + } + else + { +- sym->strtab = bfd_alloc (abfd, sym->strsize); ++ sym->strtab = bfd_alloc (abfd, sym->strsize + 1); + if (sym->strtab == NULL) + return FALSE; + + if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0 + || bfd_bread (sym->strtab, sym->strsize, abfd) != sym->strsize) + { ++ /* PR 17512: file: 10888-1609-0.004. */ ++ bfd_release (abfd, sym->strtab); ++ sym->strtab = NULL; + bfd_set_error (bfd_error_file_truncated); + return FALSE; + } ++ /* Zero terminate the string table. */ ++ sym->strtab[sym->strsize] = 0; + } + + return TRUE; +@@ -3660,29 +3753,31 @@ bfd_mach_o_read_symtab_symbols (bfd *abfd) + unsigned long i; + + if (sym == NULL || sym->symbols) +- { +- /* Return now if there are no symbols or if already loaded. */ +- return TRUE; +- } +- +- sym->symbols = bfd_alloc (abfd, sym->nsyms * sizeof (bfd_mach_o_asymbol)); ++ /* Return now if there are no symbols or if already loaded. */ ++ return TRUE; + ++ sym->symbols = bfd_alloc2 (abfd, sym->nsyms, sizeof (bfd_mach_o_asymbol)); + if (sym->symbols == NULL) + { + (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbols: unable to allocate memory for symbols")); ++ sym->nsyms = 0; + return FALSE; + } + + if (!bfd_mach_o_read_symtab_strtab (abfd)) +- return FALSE; ++ goto fail; + + for (i = 0; i < sym->nsyms; i++) +- { +- if (!bfd_mach_o_read_symtab_symbol (abfd, sym, &sym->symbols[i], i)) +- return FALSE; +- } ++ if (!bfd_mach_o_read_symtab_symbol (abfd, sym, &sym->symbols[i], i)) ++ goto fail; + + return TRUE; ++ ++ fail: ++ bfd_release (abfd, sym->symbols); ++ sym->symbols = NULL; ++ sym->nsyms = 0; ++ return FALSE; + } + + static const char * +@@ -3915,8 +4010,8 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command) + } + + /* Allocate threads. */ +- cmd->flavours = bfd_alloc +- (abfd, nflavours * sizeof (bfd_mach_o_thread_flavour)); ++ cmd->flavours = bfd_alloc2 ++ (abfd, nflavours, sizeof (bfd_mach_o_thread_flavour)); + if (cmd->flavours == NULL) + return FALSE; + cmd->nflavours = nflavours; +@@ -4039,7 +4134,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) + unsigned int module_len = wide ? 56 : 52; + + cmd->dylib_module = +- bfd_alloc (abfd, cmd->nmodtab * sizeof (bfd_mach_o_dylib_module)); ++ bfd_alloc2 (abfd, cmd->nmodtab, sizeof (bfd_mach_o_dylib_module)); + if (cmd->dylib_module == NULL) + return FALSE; + +@@ -4085,10 +4180,10 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) + + if (cmd->ntoc != 0) + { +- unsigned int i; ++ unsigned long i; + +- cmd->dylib_toc = bfd_alloc +- (abfd, cmd->ntoc * sizeof (bfd_mach_o_dylib_table_of_content)); ++ cmd->dylib_toc = bfd_alloc2 ++ (abfd, cmd->ntoc, sizeof (bfd_mach_o_dylib_table_of_content)); + if (cmd->dylib_toc == NULL) + return FALSE; + +@@ -4112,8 +4207,8 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) + { + unsigned int i; + +- cmd->indirect_syms = bfd_alloc +- (abfd, cmd->nindirectsyms * sizeof (unsigned int)); ++ cmd->indirect_syms = bfd_alloc2 ++ (abfd, cmd->nindirectsyms, sizeof (unsigned int)); + if (cmd->indirect_syms == NULL) + return FALSE; + +@@ -4137,8 +4232,8 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) + unsigned long v; + unsigned int i; + +- cmd->ext_refs = bfd_alloc +- (abfd, cmd->nextrefsyms * sizeof (bfd_mach_o_dylib_reference)); ++ cmd->ext_refs = bfd_alloc2 ++ (abfd, cmd->nextrefsyms, sizeof (bfd_mach_o_dylib_reference)); + if (cmd->ext_refs == NULL) + return FALSE; + +@@ -4638,9 +4733,10 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command) + return FALSE; + break; + default: ++ command->len = 0; + (*_bfd_error_handler)(_("%B: unknown load command 0x%lx"), +- abfd, (unsigned long) command->type); +- break; ++ abfd, (unsigned long) command->type); ++ return FALSE; + } + + return TRUE; +@@ -4668,8 +4764,8 @@ bfd_mach_o_flatten_sections (bfd *abfd) + } + + /* Allocate sections array. */ +- mdata->sections = bfd_alloc (abfd, +- mdata->nsects * sizeof (bfd_mach_o_section *)); ++ mdata->sections = bfd_alloc2 (abfd, ++ mdata->nsects, sizeof (bfd_mach_o_section *)); + + /* Fill the array. */ + csect = 0; +@@ -4841,7 +4937,8 @@ bfd_mach_o_scan (bfd *abfd, + + mdata->first_command = NULL; + mdata->last_command = NULL; +- cmd = bfd_alloc (abfd, header->ncmds * sizeof (bfd_mach_o_load_command)); ++ ++ cmd = bfd_alloc2 (abfd, header->ncmds, sizeof (bfd_mach_o_load_command)); + if (cmd == NULL) + return FALSE; + +@@ -5077,7 +5174,7 @@ bfd_mach_o_archive_p (bfd *abfd) + goto error; + + adata->archentries = +- bfd_alloc (abfd, adata->nfat_arch * sizeof (mach_o_fat_archentry)); ++ bfd_alloc2 (abfd, adata->nfat_arch, sizeof (mach_o_fat_archentry)); + if (adata->archentries == NULL) + goto error; + +@@ -5094,6 +5191,7 @@ bfd_mach_o_archive_p (bfd *abfd) + } + + abfd->tdata.mach_o_fat_data = adata; ++ + return abfd->xvec; + + error: +diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c +index 4a68fa2..815c0fa 100644 +--- a/bfd/nlm32-sparc.c ++++ b/bfd/nlm32-sparc.c +@@ -49,7 +49,7 @@ enum reloc_type + + static reloc_howto_type nlm32_sparc_howto_table[] = + { +- HOWTO (R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), ++ HOWTO (R_SPARC_NONE, 0,3, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8", FALSE,0,0x000000ff,TRUE), + HOWTO (R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE), + HOWTO (R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32", FALSE,0,0xffffffff,TRUE), +diff --git a/bfd/opncls.c b/bfd/opncls.c +index 75af627..404b944 100644 +--- a/bfd/opncls.c ++++ b/bfd/opncls.c +@@ -940,15 +940,19 @@ bfd_alloc (bfd *abfd, bfd_size_type size) + unsigned long ul_size = (unsigned long) size; + + if (size != ul_size +- /* A small negative size can result in objalloc_alloc allocating just +- 1 byte of memory, but the caller will be expecting more. So catch +- this case here. */ +- || (size != 0 && (((ul_size + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1)) == 0))) ++ /* Note - although objalloc_alloc takes an unsigned long as its ++ argument, internally the size is treated as a signed long. This can ++ lead to problems where, for example, a request to allocate -1 bytes ++ can result in just 1 byte being allocated, rather than ++ ((unsigned long) -1) bytes. Also memory checkers will often ++ complain about attempts to allocate a negative amount of memory. ++ So to stop these problems we fail if the size is negative. */ ++ || ((signed long) ul_size) < 0) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } +- ++ + ret = objalloc_alloc ((struct objalloc *) abfd->memory, ul_size); + if (ret == NULL) + bfd_set_error (bfd_error_no_memory); +diff --git a/bfd/pdp11.c b/bfd/pdp11.c +index 593c5ca..39e0583 100644 +--- a/bfd/pdp11.c ++++ b/bfd/pdp11.c +@@ -1172,6 +1172,14 @@ NAME (aout, set_section_contents) (bfd *abfd, + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) + return FALSE; ++ ++ /* If necessary, pad the section to its aligned size. */ ++ if ((section == obj_datasec (abfd) ++ || section == obj_textsec (abfd)) ++ && count < section->size ++ && (bfd_seek (abfd, section->filepos + offset + section->size - 1, SEEK_SET) != 0 ++ || bfd_bwrite ("", 1, abfd) != 1)) ++ return FALSE; + } + + return TRUE; +@@ -1189,6 +1197,14 @@ aout_get_external_symbols (bfd *abfd) + + count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE; + ++ /* PR 17512: file: 011f5a08. */ ++ if (count == 0) ++ { ++ obj_aout_external_syms (abfd) = NULL; ++ obj_aout_external_sym_count (abfd) = count; ++ return TRUE; ++ } ++ + #ifdef USE_MMAP + if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), + exec_hdr (abfd)->a_syms, +@@ -3152,7 +3168,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, + + size = bfd_get_reloc_size (howto); + buf = bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + r = MY_relocate_contents (howto, flaginfo->output_bfd, + pr->addend, buf); +diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c +index 57ec51f..d7edc2b 100644 +--- a/bfd/pe-mips.c ++++ b/bfd/pe-mips.c +@@ -349,8 +349,11 @@ static reloc_howto_type howto_table[] = + /* Customize coffcode.h. */ + #define MIPS 1 + +-#define RTYPE2HOWTO(cache_ptr, dst) \ +- (cache_ptr)->howto = howto_table + (dst)->r_type; ++#define RTYPE2HOWTO(cache_ptr, dst) \ ++ ((cache_ptr)->howto = \ ++ ((dst)->r_type < NUM_HOWTOS \ ++ ? howto_table + (dst)->r_type \ ++ : NULL)) + + /* Compute the addend of a reloc. If the reloc is to a common symbol, + the object file contains the value of the common symbol. By the +diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c +index 13e39e4..c09779a 100644 +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -526,6 +526,8 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + (*_bfd_error_handler) + (_("%B: aout header specifies an invalid number of data-directory entries: %d"), + abfd, a->NumberOfRvaAndSizes); ++ bfd_set_error (bfd_error_bad_value); ++ + /* Paranoia: If the number is corrupt, then assume that the + actual entries themselves might be corrupt as well. */ + a->NumberOfRvaAndSizes = 0; +@@ -1149,7 +1151,7 @@ _bfd_XXi_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length + /* Ensure null termination of filename. */ + buffer[256] = '\0'; + +- cvinfo->CVSignature = H_GET_32(abfd, buffer); ++ cvinfo->CVSignature = H_GET_32 (abfd, buffer); + cvinfo->Age = 0; + + if ((cvinfo->CVSignature == CVINFO_PDB70_CVSIGNATURE) +@@ -1755,6 +1757,8 @@ pe_print_edata (bfd * abfd, void * vfile) + + /* PR 17512: Handle corrupt PE binaries. */ + if (edt.eat_addr + (edt.num_functions * 4) - adj >= datasize ++ /* PR 17512: file: 092b1829 */ ++ || (edt.num_functions * 4) < edt.num_functions + /* PR 17512 file: 140-165018-0.004. */ + || data + edt.eat_addr - adj < data) + fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"), +@@ -1799,6 +1803,8 @@ pe_print_edata (bfd * abfd, void * vfile) + + /* PR 17512: Handle corrupt PE binaries. */ + if (edt.npt_addr + (edt.num_names * 4) - adj >= datasize ++ /* PR 17512: file: bb68816e. */ ++ || edt.num_names * 4 < edt.num_names + || (data + edt.npt_addr - adj) < data) + fprintf (file, _("\tInvalid Name Pointer Table rva (0x%lx) or entry count (0x%lx)\n"), + (long) edt.npt_addr, +@@ -1890,6 +1896,14 @@ pe_print_pdata (bfd * abfd, void * vfile) + if (datasize == 0) + return TRUE; + ++ /* PR 17512: file: 002-193900-0.004. */ ++ if (datasize < stop) ++ { ++ fprintf (file, _("Virtual size of .pdata section (%ld) larger than real size (%ld)\n"), ++ (long) stop, (long) datasize); ++ return FALSE; ++ } ++ + if (! bfd_malloc_and_get_section (abfd, section, &data)) + { + if (data != NULL) +@@ -1999,7 +2013,11 @@ slurp_symtab (bfd *abfd, sym_cache *psc) + if (storage < 0) + return NULL; + if (storage) +- sy = (asymbol **) bfd_malloc (storage); ++ { ++ sy = (asymbol **) bfd_malloc (storage); ++ if (sy == NULL) ++ return NULL; ++ } + + psc->symcount = bfd_canonicalize_symtab (abfd, sy); + if (psc->symcount < 0) +@@ -2198,7 +2216,7 @@ pe_print_reloc (bfd * abfd, void * vfile) + { + int j; + bfd_vma virtual_address; +- long number, size; ++ unsigned long number, size; + bfd_byte *chunk_end; + + /* The .reloc section is a sequence of blocks, with a header consisting +@@ -2213,7 +2231,7 @@ pe_print_reloc (bfd * abfd, void * vfile) + + fprintf (file, + _("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"), +- (unsigned long) virtual_address, size, (unsigned long) size, number); ++ (unsigned long) virtual_address, size, size, number); + + chunk_end = p + size; + if (chunk_end > end) +@@ -2284,6 +2302,7 @@ rsrc_print_resource_entries (FILE * file, + bfd_vma rva_bias) + { + unsigned long entry, addr, size; ++ bfd_byte * leaf; + + if (data + 8 >= regions->section_end) + return regions->section_end + 1; +@@ -2364,18 +2383,21 @@ rsrc_print_resource_entries (FILE * file, + regions, rva_bias); + } + +- if (regions->section_start + entry + 16 >= regions->section_end) ++ leaf = regions->section_start + entry; ++ ++ if (leaf + 16 >= regions->section_end ++ /* PR 17512: file: 055dff7e. */ ++ || leaf < regions->section_start) + return regions->section_end + 1; + + fprintf (file, _("%03x %*.s Leaf: Addr: %#08lx, Size: %#08lx, Codepage: %d\n"), +- (int) (entry), +- indent, " ", +- addr = (long) bfd_get_32 (abfd, regions->section_start + entry), +- size = (long) bfd_get_32 (abfd, regions->section_start + entry + 4), +- (int) bfd_get_32 (abfd, regions->section_start + entry + 8)); ++ (int) (entry), indent, " ", ++ addr = (long) bfd_get_32 (abfd, leaf), ++ size = (long) bfd_get_32 (abfd, leaf + 4), ++ (int) bfd_get_32 (abfd, leaf + 8)); + + /* Check that the reserved entry is 0. */ +- if (bfd_get_32 (abfd, regions->section_start + entry + 12) != 0 ++ if (bfd_get_32 (abfd, leaf + 12) != 0 + /* And that the data address/size is valid too. */ + || (regions->section_start + (addr - rva_bias) + size > regions->section_end)) + return regions->section_end + 1; +@@ -2526,7 +2548,7 @@ rsrc_print_section (bfd * abfd, void * vfile) + /* If the extra data is all zeros then do not complain. + This is just padding so that the section meets the + page size requirements. */ +- while (data ++ < regions.section_end) ++ while (++ data < regions.section_end) + if (*data != 0) + break; + if (data < regions.section_end) +@@ -2652,7 +2674,10 @@ pe_print_debugdata (bfd * abfd, void * vfile) + if (idd.Type == PE_IMAGE_DEBUG_TYPE_CODEVIEW) + { + char signature[CV_INFO_SIGNATURE_LENGTH * 2 + 1]; +- char buffer[256 + 1]; ++ /* PR 17512: file: 065-29434-0.001:0.1 ++ We need to use a 32-bit aligned buffer ++ to safely read in a codeview record. */ ++ char buffer[256 + 1] ATTRIBUTE_ALIGNED_ALIGNOF (CODEVIEW_INFO); + CODEVIEW_INFO *cvinfo = (CODEVIEW_INFO *) buffer; + + /* The debug entry doesn't have to have to be in a section, +@@ -2922,6 +2947,16 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) + struct external_IMAGE_DEBUG_DIRECTORY *dd = + (struct external_IMAGE_DEBUG_DIRECTORY *)(data + (addr - section->vma)); + ++ /* PR 17512: file: 0f15796a. */ ++ if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size + (addr - section->vma) ++ > bfd_get_section_size (section)) ++ { ++ _bfd_error_handler (_("%B: Data Directory size (%lx) exceeds space left in section (%lx)"), ++ obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size, ++ bfd_get_section_size (section) - (addr - section->vma)); ++ return FALSE; ++ } ++ + for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size + / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++) + { +@@ -2945,8 +2980,16 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) + } + + if (!bfd_set_section_contents (obfd, section, data, 0, section->size)) +- _bfd_error_handler (_("Failed to update file offsets in debug directory")); ++ { ++ _bfd_error_handler (_("Failed to update file offsets in debug directory")); ++ return FALSE; ++ } + } ++ else if (section) ++ { ++ _bfd_error_handler (_("%B: Failed to read debug data section"), obfd); ++ return FALSE; ++ } + } + + return TRUE; +@@ -3228,9 +3271,14 @@ rsrc_parse_entry (bfd * abfd, + if (entry->value.leaf == NULL) + return dataend; + +- addr = bfd_get_32 (abfd, datastart + val); +- size = entry->value.leaf->size = bfd_get_32 (abfd, datastart + val + 4); +- entry->value.leaf->codepage = bfd_get_32 (abfd, datastart + val + 8); ++ data = datastart + val; ++ if (data < datastart || data >= dataend) ++ return dataend; ++ ++ addr = bfd_get_32 (abfd, data); ++ size = entry->value.leaf->size = bfd_get_32 (abfd, data + 4); ++ entry->value.leaf->codepage = bfd_get_32 (abfd, data + 8); ++ /* FIXME: We assume that the reserved field (data + 12) is OK. */ + + entry->value.leaf->data = bfd_malloc (size); + if (entry->value.leaf->data == NULL) +@@ -3560,6 +3608,7 @@ rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b) + #elif defined HAVE_WCHAR_H + { + unsigned int i; ++ + res = 0; + for (i = min (alen, blen); i--; astring += 2, bstring += 2) + { +@@ -4457,6 +4506,8 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) + } + free (tmp_data); + } ++ else ++ result = FALSE; + } + } + #endif +diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c +index 48554d3..e53a353 100644 +--- a/bfd/pei-x86_64.c ++++ b/bfd/pei-x86_64.c +@@ -276,8 +276,9 @@ pex64_xdata_print_uwd_codes (FILE *file, bfd *abfd, + fprintf (file, ", unknown(%u))", info); + break; + default: +- /* Already caught by the previous scan. */ +- abort (); ++ /* PR 17512: file: 2245-7442-0.004. */ ++ fprintf (file, _("Unknown: %x"), PEX64_UNWCODE_CODE (dta[1])); ++ break; + } + if (unexpected) + fprintf (file, " [Unexpected!]"); +@@ -317,17 +318,31 @@ pex64_dump_xdata (FILE *file, bfd *abfd, + bfd_vma vaddr; + bfd_vma end_addr; + bfd_vma addr = rf->rva_UnwindData; ++ bfd_size_type sec_size = xdata_section->rawsize > 0 ? xdata_section->rawsize : xdata_section->size; + struct pex64_unwind_info ui; + + vaddr = xdata_section->vma - pe_data (abfd)->pe_opthdr.ImageBase; + addr -= vaddr; + ++ /* PR 17512: file: 2245-7442-0.004. */ ++ if (addr >= sec_size) ++ { ++ fprintf (file, _("warning: xdata section corrupt\n")); ++ return; ++ } ++ + if (endx) +- end_addr = endx[0] - vaddr; ++ { ++ end_addr = endx[0] - vaddr; ++ /* PR 17512: file: 2245-7442-0.004. */ ++ if (end_addr > sec_size) ++ { ++ fprintf (file, _("warning: xdata section corrupt")); ++ end_addr = sec_size; ++ } ++ } + else +- end_addr = (xdata_section->rawsize != 0 ? +- xdata_section->rawsize : xdata_section->size); +- ++ end_addr = sec_size; + + pex64_get_unwind_info (abfd, &ui, &xdata[addr]); + +@@ -380,7 +395,11 @@ pex64_dump_xdata (FILE *file, bfd *abfd, + ui.FrameRegister == 0 ? "none" + : pex_regs[(unsigned int) ui.FrameRegister]); + +- pex64_xdata_print_uwd_codes (file, abfd, &ui, rf); ++ /* PR 17512: file: 2245-7442-0.004. */ ++ if (ui.CountOfCodes * 2 + ui.rawUnwindCodes > xdata + xdata_section->size) ++ fprintf (file, _("Too many unwind codes (%ld)\n"), (long) ui.CountOfCodes); ++ else ++ pex64_xdata_print_uwd_codes (file, abfd, &ui, rf); + + switch (ui.Flags) + { +@@ -439,23 +458,24 @@ sort_xdata_arr (const void *l, const void *r) + /* Display unwind tables for x86-64. */ + + static bfd_boolean +-pex64_bfd_print_pdata (bfd *abfd, void *vfile) ++pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section) + { + FILE *file = (FILE *) vfile; + bfd_byte *pdata = NULL; + bfd_byte *xdata = NULL; +- asection *pdata_section = bfd_get_section_by_name (abfd, ".pdata"); +- asection *xdata_section; ++ asection *xdata_section = NULL; + bfd_vma xdata_base; + bfd_size_type i; ++ bfd_size_type datasize; + bfd_size_type stop; +- bfd_vma prev_beginaddress = 0; +- bfd_vma prev_unwinddata_rva = 0; ++ bfd_vma prev_beginaddress = (bfd_vma) -1; ++ bfd_vma prev_unwinddata_rva = (bfd_vma) -1; + bfd_vma imagebase; + int onaline = PDATA_ROW_SIZE; + int seen_error = 0; + bfd_vma *xdata_arr = NULL; + int xdata_arr_cnt; ++ bfd_boolean virt_size_is_zero = FALSE; + + /* Sanity checks. */ + if (pdata_section == NULL +@@ -466,12 +486,38 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + stop = pei_section_data (abfd, pdata_section)->virt_size; + if ((stop % onaline) != 0) + fprintf (file, +- _("warning: .pdata section size (%ld) is not a multiple of %d\n"), +- (long) stop, onaline); ++ _("Warning: %s section size (%ld) is not a multiple of %d\n"), ++ pdata_section->name, (long) stop, onaline); ++ ++ datasize = pdata_section->size; ++ if (datasize == 0) ++ { ++ if (stop) ++ fprintf (file, _("Warning: %s section size is zero\n"), ++ pdata_section->name); ++ return TRUE; ++ } ++ ++ /* virt_size might be zero for objects. */ ++ if (stop == 0 && strcmp (abfd->xvec->name, "pe-x86-64") == 0) ++ { ++ stop = (datasize / onaline) * onaline; ++ virt_size_is_zero = TRUE; ++ } ++ else if (datasize < stop) ++ { ++ fprintf (file, ++ _("Warning: %s section size (%ld) is smaller than virtual size (%ld)\n"), ++ pdata_section->name, (unsigned long) datasize, ++ (unsigned long) stop); ++ /* Be sure not to read passed datasize. */ ++ stop = datasize / onaline; ++ } + + /* Display functions table. */ + fprintf (file, +- _("\nThe Function Table (interpreted .pdata section contents)\n")); ++ _("\nThe Function Table (interpreted %s section contents)\n"), ++ pdata_section->name); + + fprintf (file, _("vma:\t\t\tBeginAddress\t EndAddress\t UnwindData\n")); + +@@ -482,7 +528,10 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + xdata_arr = (bfd_vma *) xmalloc (sizeof (bfd_vma) * ((stop / onaline) + 1)); + xdata_arr_cnt = 0; + +- imagebase = pe_data (abfd)->pe_opthdr.ImageBase; ++ if (strcmp (abfd->xvec->name, "pei-x86-64") == 0) ++ imagebase = pe_data (abfd)->pe_opthdr.ImageBase; ++ else ++ imagebase = 0; + + for (i = 0; i < stop; i += onaline) + { +@@ -490,6 +539,7 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + + if (i + PDATA_ROW_SIZE > stop) + break; ++ + pex64_get_runtime_function (abfd, &rf, &pdata[i]); + + if (rf.rva_BeginAddress == 0 && rf.rva_EndAddress == 0 +@@ -528,8 +578,9 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + seen_error = 1; + fprintf (file, " has negative unwind address\n"); + } +- if (rf.rva_UnwindData && !PEX64_IS_RUNTIME_FUNCTION_CHAINED (&rf)) +- xdata_arr[xdata_arr_cnt++] = rf.rva_UnwindData; ++ else if ((rf.rva_UnwindData && !PEX64_IS_RUNTIME_FUNCTION_CHAINED (&rf)) ++ || virt_size_is_zero) ++ xdata_arr[xdata_arr_cnt++] = rf.rva_UnwindData; + } + + if (seen_error) +@@ -545,20 +596,42 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + + /* Find the section containing the unwind data (.xdata). */ + xdata_base = xdata_arr[0]; +- xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".rdata"); +- +- if (!xdata_section) +- xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".data"); ++ /* For sections with long names, first look for the same ++ section name, replacing .pdata by .xdata prefix. */ ++ if (strcmp (pdata_section->name, ".pdata") != 0) ++ { ++ size_t len = strlen (pdata_section->name); ++ char *xdata_name = alloca (len + 1); ++ ++ xdata_name = memcpy (xdata_name, pdata_section->name, len + 1); ++ /* Transform .pdata prefix into .xdata prefix. */ ++ if (len > 1) ++ xdata_name [1] = 'x'; ++ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ++ xdata_name); ++ } ++ /* Second, try the .xdata section itself. */ + if (!xdata_section) + xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".xdata"); +- if (!xdata_section) ++ /* Otherwise, if xdata_base is non zero, search also inside ++ other standard sections. */ ++ if (!xdata_section && xdata_base) ++ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".rdata"); ++ if (!xdata_section && xdata_base) ++ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".data"); ++ if (!xdata_section && xdata_base) + xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".pdata"); +- if (!xdata_section) ++ if (!xdata_section && xdata_base) + xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".text"); ++ /* Transfer xdata section into xdata array. */ + if (!xdata_section + || !bfd_malloc_and_get_section (abfd, xdata_section, &xdata)) + goto done; + ++ /* Avoid "also used "... ouput for single unwind info ++ in object file. */ ++ prev_unwinddata_rva = (bfd_vma) -1; ++ + /* Do dump of pdata related xdata. */ + for (i = 0; i < stop; i += onaline) + { +@@ -566,6 +639,7 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + + if (i + PDATA_ROW_SIZE > stop) + break; ++ + pex64_get_runtime_function (abfd, &rf, &pdata[i]); + + if (rf.rva_BeginAddress == 0 && rf.rva_EndAddress == 0 +@@ -573,7 +647,7 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + /* We are probably into the padding of the section now. */ + break; + if (i == 0) +- fprintf (file, "\nDump of .xdata\n"); ++ fprintf (file, _("\nDump of %s\n"), xdata_section->name); + + fputc (' ', file); + fprintf_vma (file, rf.rva_UnwindData + imagebase); +@@ -596,7 +670,7 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + fprintf_vma (file, rf.rva_EndAddress + imagebase); + fputc ('\n', file); + +- if (rf.rva_UnwindData != 0) ++ if (rf.rva_UnwindData != 0 || virt_size_is_zero) + { + if (PEX64_IS_RUNTIME_FUNCTION_CHAINED (&rf)) + { +@@ -635,6 +709,7 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + identical pointers in the array; advance past all of them. */ + while (p[0] <= rf.rva_UnwindData) + ++p; ++ + if (p[0] == ~((bfd_vma) 0)) + p = NULL; + +@@ -651,6 +726,37 @@ pex64_bfd_print_pdata (bfd *abfd, void *vfile) + return TRUE; + } + ++/* Static counter of number of found pdata sections. */ ++static bfd_boolean pdata_count; ++ ++/* Functionn prototype. */ ++bfd_boolean pex64_bfd_print_pdata (bfd *, void *); ++ ++/* Helper function for bfd_map_over_section. */ ++static void ++pex64_print_all_pdata_sections (bfd *abfd, asection *pdata, void *obj) ++{ ++ if (CONST_STRNEQ (pdata->name, ".pdata")) ++ { ++ if (pex64_bfd_print_pdata_section (abfd, obj, pdata)) ++ pdata_count++; ++ } ++} ++ ++bfd_boolean ++pex64_bfd_print_pdata (bfd *abfd, void *vfile) ++{ ++ asection *pdata_section = bfd_get_section_by_name (abfd, ".pdata"); ++ ++ if (pdata_section) ++ return pex64_bfd_print_pdata_section (abfd, vfile, pdata_section); ++ ++ pdata_count = 0; ++ bfd_map_over_sections (abfd, pex64_print_all_pdata_sections, vfile); ++ return (pdata_count > 0); ++} ++ + #define bfd_pe_print_pdata pex64_bfd_print_pdata ++#define bfd_coff_std_swap_table bfd_coff_pei_swap_table + + #include "coff-x86_64.c" +diff --git a/bfd/peicode.h b/bfd/peicode.h +index 8365353..ab39cd6 100644 +--- a/bfd/peicode.h ++++ b/bfd/peicode.h +@@ -1343,7 +1343,10 @@ pe_bfd_object_p (bfd * abfd) + != (bfd_size_type) opt_hdr_size) + return NULL; + ++ bfd_set_error (bfd_error_no_error); + bfd_coff_swap_aouthdr_in (abfd, opthdr, & internal_a); ++ if (bfd_get_error () != bfd_error_no_error) ++ return NULL; + } + + return coff_real_object_p (abfd, internal_f.f_nscns, &internal_f, +diff --git a/bfd/reloc.c b/bfd/reloc.c +index dc47173..ba73ef7 100644 +--- a/bfd/reloc.c ++++ b/bfd/reloc.c +@@ -437,6 +437,7 @@ bfd_get_reloc_size (reloc_howto_type *howto) + case 3: return 0; + case 4: return 8; + case 8: return 16; ++ case -1: return 2; + case -2: return 4; + default: abort (); + } +@@ -578,7 +579,7 @@ bfd_perform_relocation (bfd *abfd, + { + bfd_vma relocation; + bfd_reloc_status_type flag = bfd_reloc_ok; +- bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd); ++ bfd_size_type octets; + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + asection *reloc_target_output_section; +@@ -592,6 +593,10 @@ bfd_perform_relocation (bfd *abfd, + return bfd_reloc_ok; + } + ++ /* PR 17512: file: 0f67f69d. */ ++ if (howto == NULL) ++ return bfd_reloc_undefined; ++ + /* If we are not producing relocatable output, return an error if + the symbol is not defined. An undefined weak symbol is + considered to have a value of zero (SVR4 ABI, p. 4-27). */ +@@ -613,8 +618,12 @@ bfd_perform_relocation (bfd *abfd, + return cont; + } + +- /* Is the address of the relocation really within the section? */ +- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) ++ /* Is the address of the relocation really within the section? ++ Include the size of the reloc in the test for out of range addresses. ++ PR 17512: file: c146ab8b, 46dff27f, 38e53ebf. */ ++ octets = reloc_entry->address * bfd_octets_per_byte (abfd); ++ if (octets + bfd_get_reloc_size (howto) ++ > bfd_get_section_limit_octets (abfd, input_section)) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the +@@ -964,7 +973,7 @@ bfd_install_relocation (bfd *abfd, + { + bfd_vma relocation; + bfd_reloc_status_type flag = bfd_reloc_ok; +- bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd); ++ bfd_size_type octets; + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + asection *reloc_target_output_section; +@@ -997,7 +1006,9 @@ bfd_install_relocation (bfd *abfd, + } + + /* Is the address of the relocation really within the section? */ +- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) ++ octets = reloc_entry->address * bfd_octets_per_byte (abfd); ++ if (octets + bfd_get_reloc_size (howto) ++ > bfd_get_section_limit_octets (abfd, input_section)) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the +@@ -1332,9 +1343,11 @@ _bfd_final_link_relocate (reloc_howto_type *howto, + bfd_vma addend) + { + bfd_vma relocation; ++ bfd_size_type octets = address * bfd_octets_per_byte (input_bfd); + + /* Sanity check the address. */ +- if (address > bfd_get_section_limit (input_bfd, input_section)) ++ if (octets + bfd_get_reloc_size (howto) ++ > bfd_get_section_limit_octets (input_bfd, input_section)) + return bfd_reloc_outofrange; + + /* This function assumes that we are dealing with a basic relocation +@@ -1389,8 +1402,9 @@ _bfd_relocate_contents (reloc_howto_type *howto, + switch (size) + { + default: +- case 0: + abort (); ++ case 0: ++ return bfd_reloc_ok; + case 1: + x = bfd_get_8 (input_bfd, location); + break; +@@ -1557,8 +1571,9 @@ _bfd_clear_contents (reloc_howto_type *howto, + switch (size) + { + default: +- case 0: + abort (); ++ case 0: ++ return; + case 1: + x = bfd_get_8 (input_bfd, location); + break; +@@ -7655,11 +7670,23 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, + abfd, input_section, * parent); + goto error_return; + ++ case bfd_reloc_notsupported: ++ /* PR ld/17512 ++ This error can result when processing a corrupt binary. ++ Do not abort. Issue an error message instead. */ ++ link_info->callbacks->einfo ++ (_("%X%P: %B(%A): relocation \"%R\" is not supported\n"), ++ abfd, input_section, * parent); ++ goto error_return; ++ + default: +- abort (); ++ /* PR 17512; file: 90c2a92e. ++ Report unexpected results, without aborting. */ ++ link_info->callbacks->einfo ++ (_("%X%P: %B(%A): relocation \"%R\" returns an unrecognized value %x\n"), ++ abfd, input_section, * parent, r); + break; + } +- + } + } + } +diff --git a/bfd/syms.c b/bfd/syms.c +index a1d1d77..02e191d 100644 +--- a/bfd/syms.c ++++ b/bfd/syms.c +@@ -1191,6 +1191,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, + { + nul_fun = stab; + nul_str = str; ++ if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) ++ file_name = NULL; + if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize + && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) + { +@@ -1200,6 +1202,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, + directory_name = file_name; + file_name = ((char *) str + + bfd_get_32 (abfd, stab + STRDXOFF)); ++ if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) ++ file_name = NULL; + } + } + break; +@@ -1207,6 +1211,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, + case N_SOL: + /* The name of an include file. */ + file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); ++ /* PR 17512: file: 0c680a1f. */ ++ /* PR 17512: file: 5da8aec4. */ ++ if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) ++ file_name = NULL; + break; + + case N_FUN: +@@ -1214,6 +1222,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, + function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); + if (function_name == (char *) str) + continue; ++ if (function_name >= (char *) info->strs + strsize) ++ function_name = NULL; + + nul_fun = NULL; + info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF); +@@ -1321,6 +1331,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, + if (val <= offset) + { + file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); ++ if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) ++ file_name = NULL; + *pline = 0; + } + break; +diff --git a/bfd/tekhex.c b/bfd/tekhex.c +index 0328689..5620e85 100644 +--- a/bfd/tekhex.c ++++ b/bfd/tekhex.c +@@ -267,7 +267,7 @@ typedef struct tekhex_data_struct + #define enda(x) (x->vma + x->size) + + static bfd_boolean +-getvalue (char **srcp, bfd_vma *valuep) ++getvalue (char **srcp, bfd_vma *valuep, char * endp) + { + char *src = *srcp; + bfd_vma value = 0; +@@ -279,7 +279,7 @@ getvalue (char **srcp, bfd_vma *valuep) + len = hex_value (*src++); + if (len == 0) + len = 16; +- while (len--) ++ while (len-- && src < endp) + { + if (!ISHEX (*src)) + return FALSE; +@@ -288,11 +288,11 @@ getvalue (char **srcp, bfd_vma *valuep) + + *srcp = src; + *valuep = value; +- return TRUE; ++ return len == -1U; + } + + static bfd_boolean +-getsym (char *dstp, char **srcp, unsigned int *lenp) ++getsym (char *dstp, char **srcp, unsigned int *lenp, char * endp) + { + char *src = *srcp; + unsigned int i; +@@ -304,12 +304,12 @@ getsym (char *dstp, char **srcp, unsigned int *lenp) + len = hex_value (*src++); + if (len == 0) + len = 16; +- for (i = 0; i < len; i++) ++ for (i = 0; i < len && src < endp; i++) + dstp[i] = src[i]; + dstp[i] = 0; + *srcp = src + i; + *lenp = len; +- return TRUE; ++ return i == len; + } + + static struct data_struct * +@@ -354,7 +354,7 @@ insert_byte (bfd *abfd, int value, bfd_vma addr) + how big the data is. */ + + static bfd_boolean +-first_phase (bfd *abfd, int type, char *src) ++first_phase (bfd *abfd, int type, char *src, char * src_end) + { + asection *section, *alt_section; + unsigned int len; +@@ -368,21 +368,21 @@ first_phase (bfd *abfd, int type, char *src) + { + bfd_vma addr; + +- if (!getvalue (&src, &addr)) ++ if (!getvalue (&src, &addr, src_end)) + return FALSE; + +- while (*src) ++ while (*src && src < src_end - 1) + { + insert_byte (abfd, HEX (src), addr); + src += 2; + addr++; + } ++ return TRUE; + } + +- return TRUE; + case '3': + /* Symbol record, read the segment. */ +- if (!getsym (sym, &src, &len)) ++ if (!getsym (sym, &src, &len, src_end)) + return FALSE; + section = bfd_get_section_by_name (abfd, sym); + if (section == NULL) +@@ -397,17 +397,23 @@ first_phase (bfd *abfd, int type, char *src) + return FALSE; + } + alt_section = NULL; +- while (*src) ++ while (src < src_end && *src) + { + switch (*src) + { + case '1': /* Section range. */ + src++; +- if (!getvalue (&src, §ion->vma)) ++ if (!getvalue (&src, §ion->vma, src_end)) + return FALSE; +- if (!getvalue (&src, &val)) ++ if (!getvalue (&src, &val, src_end)) + return FALSE; ++ if (val < section->vma) ++ val = section->vma; + section->size = val - section->vma; ++ /* PR 17512: file: objdump-s-endless-loop.tekhex. ++ Check for overlarge section sizes. */ ++ if (section->size & 0x80000000) ++ return FALSE; + section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; + break; + case '0': +@@ -432,7 +438,7 @@ first_phase (bfd *abfd, int type, char *src) + abfd->flags |= HAS_SYMS; + new_symbol->prev = abfd->tdata.tekhex_data->symbols; + abfd->tdata.tekhex_data->symbols = new_symbol; +- if (!getsym (sym, &src, &len)) ++ if (!getsym (sym, &src, &len, src_end)) + return FALSE; + new_symbol->symbol.name = (const char *) + bfd_alloc (abfd, (bfd_size_type) len + 1); +@@ -480,7 +486,7 @@ first_phase (bfd *abfd, int type, char *src) + new_symbol->symbol.section = alt_section; + } + } +- if (!getvalue (&src, &val)) ++ if (!getvalue (&src, &val, src_end)) + return FALSE; + new_symbol->symbol.value = val - section->vma; + break; +@@ -498,7 +504,7 @@ first_phase (bfd *abfd, int type, char *src) + record. */ + + static bfd_boolean +-pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) ++pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *, char *)) + { + unsigned int chars_on_line; + bfd_boolean is_eof = FALSE; +@@ -539,8 +545,7 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) + + /* Put a null at the end. */ + src[chars_on_line] = 0; +- +- if (!func (abfd, type, src)) ++ if (!func (abfd, type, src, src + chars_on_line)) + return FALSE; + } + +@@ -957,6 +962,7 @@ tekhex_print_symbol (bfd *abfd, + #define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line + #define tekhex_find_line _bfd_nosymbols_find_line + #define tekhex_find_inliner_info _bfd_nosymbols_find_inliner_info ++#define tekhex_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string + #define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define tekhex_read_minisymbols _bfd_generic_read_minisymbols + #define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +diff --git a/bfd/versados.c b/bfd/versados.c +index 42bf36c..fecfdde 100644 +--- a/bfd/versados.c ++++ b/bfd/versados.c +@@ -57,6 +57,7 @@ struct esdid + { + asection *section; /* Ptr to bfd version. */ + unsigned char *contents; /* Used to build image. */ ++ bfd_size_type content_size; /* The size of the contents buffer. */ + int pc; + int relocs; /* Reloc count, valid end of pass 1. */ + int donerel; /* Have relocs been translated. */ +@@ -85,8 +86,8 @@ typedef struct versados_data_struct + tdata_type; + + #define VDATA(abfd) (abfd->tdata.versados_data) +-#define EDATA(abfd, n) (abfd->tdata.versados_data->e[n]) +-#define RDATA(abfd, n) (abfd->tdata.versados_data->rest[n]) ++#define EDATA(abfd, n) (abfd->tdata.versados_data->e[(n) < 16 ? (n) : 0]) ++#define RDATA(abfd, n) (abfd->tdata.versados_data->rest[(n) < 240 ? (n) : 0]) + + struct ext_otr + { +@@ -181,14 +182,22 @@ versados_new_symbol (bfd *abfd, + return n; + } + +-static int ++static bfd_boolean + get_record (bfd *abfd, union ext_any *ptr) + { + if (bfd_bread (&ptr->size, (bfd_size_type) 1, abfd) != 1 + || (bfd_bread ((char *) ptr + 1, (bfd_size_type) ptr->size, abfd) + != ptr->size)) +- return 0; +- return 1; ++ return FALSE; ++ ++ { ++ bfd_size_type amt = ptr->size + 1; ++ ++ if (amt < sizeof (* ptr)) ++ memset ((char *) ptr + amt, 0, sizeof (* ptr) - amt); ++ } ++ ++ return TRUE; + } + + static int +@@ -364,11 +373,19 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass) + | (otr->map[2] << 8) + | (otr->map[3] << 0); + +- struct esdid *esdid = &EDATA (abfd, otr->esdid - 1); +- unsigned char *contents = esdid->contents; +- int need_contents = 0; +- unsigned int dst_idx = esdid->pc; +- ++ struct esdid *esdid; ++ unsigned char *contents; ++ bfd_boolean need_contents = FALSE; ++ unsigned int dst_idx; ++ ++ /* PR 17512: file: ac7da425. */ ++ if (otr->esdid == 0) ++ return; ++ ++ esdid = &EDATA (abfd, otr->esdid - 1); ++ contents = esdid->contents; ++ dst_idx = esdid->pc; ++ + for (shift = ((unsigned long) 1 << 31); shift && srcp < endp; shift >>= 1) + { + if (bits & shift) +@@ -390,8 +407,8 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass) + int val = get_offset (offsetlen, srcp + esdids); + + if (pass == 1) +- need_contents = 1; +- else ++ need_contents = TRUE; ++ else if (contents && dst_idx < esdid->content_size - sizeinwords * 2) + for (j = 0; j < sizeinwords * 2; j++) + { + contents[dst_idx + (sizeinwords * 2) - j - 1] = val; +@@ -413,10 +430,13 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass) + } + else + { +- arelent *n = +- EDATA (abfd, otr->esdid - 1).section->relocation + rn; +- n->address = dst_idx; ++ arelent *n; + ++ /* PR 17512: file: 54f733e0. */ ++ if (EDATA (abfd, otr->esdid - 1).section == NULL) ++ continue; ++ n = EDATA (abfd, otr->esdid - 1).section->relocation + rn; ++ n->address = dst_idx; + n->sym_ptr_ptr = (asymbol **) (size_t) id; + n->addend = 0; + n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1); +@@ -429,31 +449,42 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass) + } + else + { +- need_contents = 1; +- if (dst_idx < esdid->section->size) ++ need_contents = TRUE; ++ ++ if (esdid->section && contents && dst_idx < esdid->content_size - 1) + if (pass == 2) + { + /* Absolute code, comes in 16 bit lumps. */ + contents[dst_idx] = srcp[0]; + contents[dst_idx + 1] = srcp[1]; + } ++ + dst_idx += 2; + srcp += 2; + } + } ++ + EDATA (abfd, otr->esdid - 1).pc = dst_idx; + + if (!contents && need_contents) + { +- bfd_size_type size = esdid->section->size; +- esdid->contents = bfd_alloc (abfd, size); ++ if (esdid->section) ++ { ++ bfd_size_type size; ++ ++ size = esdid->section->size; ++ esdid->contents = bfd_alloc (abfd, size); ++ esdid->content_size = size; ++ } ++ else ++ esdid->contents = NULL; + } + } + + static bfd_boolean + versados_scan (bfd *abfd) + { +- int loop = 1; ++ bfd_boolean loop = TRUE; + int i; + int j; + int nsecs = 0; +@@ -471,13 +502,13 @@ versados_scan (bfd *abfd) + union ext_any any; + + if (!get_record (abfd, &any)) +- return TRUE; ++ return FALSE; + switch (any.header.type) + { + case VHEADER: + break; + case VEND: +- loop = 0; ++ loop = FALSE; + break; + case VESTDEF: + process_esd (abfd, &any.esd, 1); +@@ -504,7 +535,6 @@ versados_scan (bfd *abfd) + { + amt = (bfd_size_type) esdid->relocs * sizeof (arelent); + esdid->section->relocation = bfd_alloc (abfd, amt); +- + esdid->pc = 0; + + if (esdid->contents) +@@ -563,7 +593,7 @@ versados_scan (bfd *abfd) + + VDATA (abfd)->ref_idx = 0; + +- return 1; ++ return TRUE; + } + + /* Check whether an existing file is a versados file. */ +@@ -585,6 +615,13 @@ versados_object_p (bfd *abfd) + return NULL; + } + ++ /* PR 17512: file: 726-2128-0.004. */ ++ if (len < 13) ++ { ++ bfd_set_error (bfd_error_wrong_format); ++ return NULL; ++ } ++ + if (bfd_bread (&ext.type, (bfd_size_type) len, abfd) != len) + { + if (bfd_get_error () != bfd_error_system_call) +@@ -652,12 +689,20 @@ versados_get_section_contents (bfd *abfd, + file_ptr offset, + bfd_size_type count) + { ++ struct esdid *esdid; ++ + if (!versados_pass_2 (abfd)) + return FALSE; + +- memcpy (location, +- EDATA (abfd, section->target_index).contents + offset, +- (size_t) count); ++ esdid = &EDATA (abfd, section->target_index); ++ ++ if (esdid->contents == NULL ++ || offset < 0 ++ || (bfd_size_type) offset > esdid->content_size ++ || offset + count > esdid->content_size) ++ return FALSE; ++ ++ memcpy (location, esdid->contents + offset, (size_t) count); + + return TRUE; + } +@@ -758,6 +803,7 @@ versados_canonicalize_reloc (bfd *abfd, + + versados_pass_2 (abfd); + src = section->relocation; ++ + if (!EDATA (abfd, section->target_index).donerel) + { + EDATA (abfd, section->target_index).donerel = 1; +@@ -773,8 +819,15 @@ versados_canonicalize_reloc (bfd *abfd, + /* Section relative thing. */ + struct esdid *e = &EDATA (abfd, esdid - 1); + +- src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr; ++ /* PR 17512: file:cd92277c. */ ++ if (e->section) ++ src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr; ++ else ++ src[count].sym_ptr_ptr = bfd_und_section_ptr->symbol_ptr_ptr; + } ++ /* PR 17512: file:3757-2936-0.004. */ ++ else if ((unsigned) (esdid - ES_BASE) >= bfd_get_symcount (abfd)) ++ src[count].sym_ptr_ptr = bfd_und_section_ptr->symbol_ptr_ptr; + else + src[count].sym_ptr_ptr = symbols + esdid - ES_BASE; + } +@@ -796,6 +849,7 @@ versados_canonicalize_reloc (bfd *abfd, + #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line + #define versados_find_line _bfd_nosymbols_find_line + #define versados_find_inliner_info _bfd_nosymbols_find_inliner_info ++#define versados_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string + #define versados_make_empty_symbol _bfd_generic_make_empty_symbol + #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define versados_read_minisymbols _bfd_generic_read_minisymbols +diff --git a/bfd/version.h b/bfd/version.h +index c806928..ef95fa0 100644 +--- a/bfd/version.h ++++ b/bfd/version.h +@@ -1,4 +1,4 @@ +-#define BFD_VERSION_DATE 20141223 ++#define BFD_VERSION_DATE 20150622 + #define BFD_VERSION @bfd_version@ + #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ + #define REPORT_BUGS_TO @report_bugs_to@ +diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c +index 5ff5bfd..006928f 100644 +--- a/bfd/vms-alpha.c ++++ b/bfd/vms-alpha.c +@@ -364,18 +364,18 @@ struct vms_section_data_struct + ((struct vms_section_data_struct *)sec->used_by_bfd) + + /* To be called from the debugger. */ +-struct vms_private_data_struct *bfd_vms_get_data (bfd *abfd); ++struct vms_private_data_struct *bfd_vms_get_data (bfd *); + +-static int vms_get_remaining_object_record (bfd *abfd, int read_so_far); +-static bfd_boolean _bfd_vms_slurp_object_records (bfd * abfd); ++static int vms_get_remaining_object_record (bfd *, unsigned int); ++static bfd_boolean _bfd_vms_slurp_object_records (bfd *); + static void alpha_vms_add_fixup_lp (struct bfd_link_info *, bfd *, bfd *); + static void alpha_vms_add_fixup_ca (struct bfd_link_info *, bfd *, bfd *); + static void alpha_vms_add_fixup_qr (struct bfd_link_info *, bfd *, bfd *, + bfd_vma); + static void alpha_vms_add_fixup_lr (struct bfd_link_info *, unsigned int, + bfd_vma); +-static void alpha_vms_add_lw_reloc (struct bfd_link_info *info); +-static void alpha_vms_add_qw_reloc (struct bfd_link_info *info); ++static void alpha_vms_add_lw_reloc (struct bfd_link_info *); ++static void alpha_vms_add_qw_reloc (struct bfd_link_info *); + + struct vector_type + { +@@ -521,6 +521,9 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset) + asection *section; + flagword bfd_flags; + ++ /* PR 17512: file: 3d9e9fe9. */ ++ if (offset >= PRIV (recrd.rec_size)) ++ return FALSE; + eisd = (struct vms_eisd *)(PRIV (recrd.rec) + offset); + rec_size = bfd_getl32 (eisd->eisdsize); + +@@ -788,7 +791,7 @@ _bfd_vms_get_object_record (bfd *abfd) + Return the size of the record or 0 on failure. */ + + static int +-vms_get_remaining_object_record (bfd *abfd, int read_so_far) ++vms_get_remaining_object_record (bfd *abfd, unsigned int read_so_far) + { + unsigned int to_read; + +@@ -824,6 +827,9 @@ vms_get_remaining_object_record (bfd *abfd, int read_so_far) + return 0; + PRIV (recrd.buf_size) = to_read; + } ++ /* PR 17512: file: 025-1974-0.004. */ ++ else if (to_read <= read_so_far) ++ return 0; + + /* Read the remaining record. */ + to_read -= read_so_far; +@@ -854,9 +860,12 @@ _bfd_vms_slurp_ehdr (bfd *abfd) + { + unsigned char *ptr; + unsigned char *vms_rec; ++ unsigned char *end; + int subtype; + + vms_rec = PRIV (recrd.rec); ++ /* PR 17512: file: 62736583. */ ++ end = PRIV (recrd.buf) + PRIV (recrd.buf_size); + + vms_debug2 ((2, "HDR/EMH\n")); + +@@ -868,28 +877,42 @@ _bfd_vms_slurp_ehdr (bfd *abfd) + { + case EMH__C_MHD: + /* Module header. */ ++ if (vms_rec + 21 >= end) ++ goto fail; + PRIV (hdr_data).hdr_b_strlvl = vms_rec[6]; + PRIV (hdr_data).hdr_l_arch1 = bfd_getl32 (vms_rec + 8); + PRIV (hdr_data).hdr_l_arch2 = bfd_getl32 (vms_rec + 12); + PRIV (hdr_data).hdr_l_recsiz = bfd_getl32 (vms_rec + 16); ++ if ((vms_rec + 20 + vms_rec[20] + 1) >= end) ++ goto fail; + PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 20); + ptr = vms_rec + 20 + vms_rec[20] + 1; ++ if ((ptr + *ptr + 1) >= end) ++ goto fail; + PRIV (hdr_data).hdr_t_version =_bfd_vms_save_counted_string (ptr); + ptr += *ptr + 1; ++ if (ptr + 17 >= end) ++ goto fail; + PRIV (hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17); + break; + + case EMH__C_LNM: ++ if (vms_rec + PRIV (recrd.rec_size - 6) > end) ++ goto fail; + PRIV (hdr_data).hdr_c_lnm = + _bfd_vms_save_sized_string (vms_rec, PRIV (recrd.rec_size - 6)); + break; + + case EMH__C_SRC: ++ if (vms_rec + PRIV (recrd.rec_size - 6) > end) ++ goto fail; + PRIV (hdr_data).hdr_c_src = + _bfd_vms_save_sized_string (vms_rec, PRIV (recrd.rec_size - 6)); + break; + + case EMH__C_TTL: ++ if (vms_rec + PRIV (recrd.rec_size - 6) > end) ++ goto fail; + PRIV (hdr_data).hdr_c_ttl = + _bfd_vms_save_sized_string (vms_rec, PRIV (recrd.rec_size - 6)); + break; +@@ -900,6 +923,7 @@ _bfd_vms_slurp_ehdr (bfd *abfd) + break; + + default: ++ fail: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } +@@ -2524,6 +2548,9 @@ alpha_vms_object_p (bfd *abfd) + /* Reset the record pointer. */ + PRIV (recrd.rec) = buf; + ++ /* PR 17512: file: 7d7c57c2. */ ++ if (PRIV (recrd.rec_size) < sizeof (struct vms_eihd)) ++ goto error_ret; + vms_debug2 ((2, "file type is image\n")); + + if (_bfd_vms_slurp_eihd (abfd, &eisd_offset, &eihs_offset) != TRUE) +@@ -9188,6 +9215,9 @@ bfd_vms_get_data (bfd *abfd) + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) + #define alpha_vms_print_symbol vms_print_symbol + #define alpha_vms_get_symbol_info vms_get_symbol_info ++#define alpha_vms_get_symbol_version_string \ ++ _bfd_nosymbols_get_symbol_version_string ++ + #define alpha_vms_read_minisymbols _bfd_generic_read_minisymbols + #define alpha_vms_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + #define alpha_vms_get_lineno _bfd_nosymbols_get_lineno +diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c +index 9522974..7f321ee 100644 +--- a/bfd/xcofflink.c ++++ b/bfd/xcofflink.c +@@ -5738,7 +5738,7 @@ xcoff_reloc_link_order (bfd *output_bfd, + + size = bfd_get_reloc_size (howto); + buf = bfd_zmalloc (size); +- if (buf == NULL) ++ if (buf == NULL && size != 0) + return FALSE; + + rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf); +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index f26c706..5ae64e5 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -1,3 +1,531 @@ ++2015-03-25 Nick Clifton ++ ++ * coffgrok.c: Remove redundant prototypes. ++ ++2015-03-24 Nick Clifton ++ ++ Apply from master: ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * coffgrok.c (do_type): Check for an out of range tag index. ++ Check for integer overflow computing array dimension. ++ (do_define): Likewise. ++ ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * resrc.c (write_rc_messagetable): Tighten check for invalid ++ message lengths. ++ ++ 2015-02-13 Nick Clifton ++ ++ * coffgrok.c (do_define): Add check for type size overflow. ++ * srconv.c (walk_tree_sfile): Check that enough sections are ++ available before parsing. ++ (prescan): Likewise. ++ ++ 2015-02-03 Nick Clifton ++ ++ PR binutils/17512 ++ * objdump.c (display_any_bfd): Fail if archives nest too deeply. ++ ++ 2015-01-27 Nick Clifton ++ ++ PR binutils/17512 ++ * dlltool.c (identify_search_archive): If the last archive was the ++ same as the current archive, terminate the loop. ++ ++ * addr2line.c (slurp_symtab): If the symcount is zero, free the ++ symbol table pointer. ++ ++ * rcparse.y: Add checks to avoid integer divide by zero. ++ * rescoff.c (read_coff_rsrc): Add check on the size of the ++ resource section. ++ (read_coff_res_dir): Add check on the nesting level. ++ Check for resource names overrunning the buffer. ++ * resrc.c (write_rc_messagetable): Update formatting. ++ Add check of 'elen' being zero. ++ ++ 2015-01-23 Nick Clifton ++ ++ * nlmconv.c (powerpc_mangle_relocs): Fix build errors introduced ++ by recent delta, when compiling on for a 32-bit host. ++ ++ 2015-01-21 Nick Clifton ++ ++ PR binutils/17512 ++ * addr2line.c (main): Call bfd_set_error_program_name. ++ * ar.c (main): Likewise. ++ * coffdump.c (main): Likewise. ++ * cxxfilt.c (main): Likewise. ++ * dlltool.c (main): Likewise. ++ * nlmconv.c (main): Likewise. ++ * nm.c (main): Likewise. ++ * objdump.c (main): Likewise. ++ * size.c (main): Likewise. ++ * srconv.c (main): Likewise. ++ * strings.c (main): Likewise. ++ * sysdump.c (main): Likewise. ++ * windmc.c (main): Likewise. ++ * windres.c (main): Likewise. ++ * objcopy.c (main): Likewise. ++ (copy_relocations_in_section): Check for relocs without associated ++ symbol pointers. ++ ++ 2015-01-21 Nick Clifton ++ ++ PR binutils/17512 ++ * coffgrok.c (do_type): Check that computed ref exists. ++ (doit): Add range checks when computing section for scope. ++ ++ 2015-01-08 Nick Clifton ++ ++ PR binutils/17512 ++ * ojcopy.c (copy_object): Free the symbol table if no symbols ++ could be loaded. ++ (copy_file): Use bfd_close_all_done to close files that could not ++ be copied. ++ ++ * sysdump.c (getINT): Fail if reading off the end of the buffer. ++ Replace call to abort with a call to fatal. ++ (getCHARS): Prevetn reading off the end of the buffer. ++ ++ * nlmconv.c (i386_mangle_relocs): Skip relocs without an ++ associated symbol. ++ (powerpc_mangle_relocs): Skip unrecognised relocs. Check address ++ range before applying a reloc. ++ ++ 2015-01-07 Nick Clifton ++ ++ PR binutils/17512 ++ * dlltool.c (scan_obj_file): Break loop if the last archive ++ displayed matches the current archive. ++ ++ * objdump.c (display_any_bfd): Add a depth limit to nested archive ++ display in order to avoid infinite loops. ++ * srconv.c: Replace calls to abort with calls to fatal with an ++ error message. ++ ++ 2015-01-06 Nick Clifton ++ ++ PR binutils/17512 ++ * coffdump.c (dump_coff_section): Check for a symbol being ++ available before printing its name. ++ (main): Check the return value from coff_grok. ++ * coffgrok.c: Reformat and tidy. ++ Add range checks to most functions. ++ (coff_grok): Return NULL if the input bfd is not in a COFF ++ format. ++ * coffgrok.h: Reformat and tidy. ++ (struct coff_section): Change the nrelocs field to unsigned. ++ * srconv.c (main): Check the return value from coff_grok. ++ ++ 2015-01-05 Nick Clifton ++ ++ PR binutils/17512 ++ * nm.c (print_symbol): Add 'is_synthetic' parameter. Use it to ++ help initialize the info.elfinfo field. ++ (print_size_symbols): Add 'synth_count' parameter. Use it to set ++ the is_synthetic parameter when calling print_symbol. ++ (print_symbols): Likewise. ++ (display_rel_file): Pass synth_count to printing function. ++ (display_archive): Break loop if the last archive displayed ++ matches the current archive. ++ * size.c (display_archive): Likewise. ++ ++2015-03-24 Nick Clifton ++ ++ Apply from master: ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (display_debug_loc): Pacify the undefined behaviour ++ sanitizer by simplifying address difference calculation. ++ (struct Frame_Chunk): Change type of cfa_offset to dwarf_vma in ++ order to avoid arithmetic overflows. ++ (frame_display_row): Cast cfa_offset before printing it. ++ (display_debug_frames): Likewise. ++ Check for an unexpected segment size. ++ Chnage type of 'l' local to dwarf_vma and cast it back to an int ++ when printing. ++ (process_cu_tu_index): Tighten check for an invalid ncols value. ++ * readelf.c (process_corefile_note_segment): Check for ++ inote.descdata extending beyond the end of the section. ++ (process_v850_notes): Likewise. ++ ++ 2015-02-13 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (read_leb128): Fix test for shift becoming too large. ++ ++ PR binutils/17531 ++ * dwarf.c (display_debug_aranges): Add check for an excessive ++ ar_length value. ++ (process_cu_tu_index): Check for a row * columns sum being too ++ large. ++ ++ 2015-02-13 Alan Modra ++ ++ * dwarf.c: Formatting, whitespace. ++ (process_debug_info): Style fix. ++ ++ 2015-02-11 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (display_debug_pubnames_worker): Work around compiler ++ bug checking address ranges. ++ (display_debug_frames): Likewise. ++ (display_gdb_index): Likewise. ++ (process_cu_tu_index): Add range check on the ncols value. ++ ++ 2015-02-10 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (eh_addr_size): Use an unsigned type. ++ (size_of_encoded_value): Return an unsigned type. ++ (read_leb128): Break if the shift becomes too big. ++ (process_extended_line_op): Do not read the address if the length ++ is too long. ++ (read_cie): Warn and fail if the pointer size or segment size are ++ too big. ++ * dwarf.h (DWARF2_External_LineInfo): Delete unused and incorrect ++ structure definition. ++ (DWARF2_External_PubNames): Likewise. ++ (DWARF2_External_CompUnit): Likewise. ++ (DWARF2_External_ARange): Likewise. ++ (DWARF2_Internal_LineInfo): Use dwarf_vma type for ++ li_prologue_length. ++ (eh_addr_size): Update prototype. ++ ++ PR binutils/17531 ++ * dwarf.c (process_debug_info): Zero the debug information array ++ since correct initialisation cannot be relied upon. ++ (process_cu_tu_index): Improve range checks. ++ ++ PR binutils/17531 ++ * dwarf.c (display_debug_pubnames_worker): Use dwarf_vma type for ++ offset. ++ ++ 2015-02-06 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (display_debug_frames): Fix range checks to work on ++ 32-bit binaries complied on a 64-bit host. ++ ++ PR binutils/17531 ++ * dwarf.c (xcmalloc): Fail if the arguments are too big. ++ (xcrealloc): Likewise. ++ (xcalloc2): Likewise. ++ * readelf.c (process_mips_specific): Fail if an option has an ++ invalid size. ++ ++ 2015-02-05 Alan Modra ++ ++ PR binutils/17926 ++ * dwarf.c (dwarf_select_sections_by_letters): Don't refer to optarg. ++ ++ 2015-02-04 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (read_and_display_attr_value): Test for a block length ++ being so long that it wraps around to before the start of the block. ++ (process_debug_info): Test for section_begin wrapping around to ++ before the start of the section. ++ (display_gdb_index): Test for num_cus being so large that the end ++ address wraps around to before the start of the section. ++ (process_cu_tu_index): Test for j being so large that the section ++ index pool wraps around to before the start of the section. ++ ++ 2015-02-03 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (process_debug_info): Add range check. ++ (display_debug_pubnames_worker): Likewise. ++ (display_gdb_index): Fix range check. ++ (process_cu_tu_index): Add range check. ++ * readelf.c (get_data): Change parameter types from size_t to ++ bfd_size_type. Add checks for loss of accuracy when casting from ++ bfd_size_type to size_t. ++ (get_dynamic_data): Likewise. ++ (process_section_groups): Limit number of error messages. ++ ++ 2015-01-12 H.J. Lu ++ ++ * dwarf.c (process_debug_info): Properly check abbrev size. ++ ++ 2015-01-12 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (process_debug_info): Check for abbrev_base being larger ++ than the section size. ++ (process_cu_tu_index): Use xcalloc2 to allocate the CU and TU ++ arrays. ++ (xcalloc2): New function. Like xcalloc, but checks for overflow. ++ (display_debug_addr): Use xcalloc to allocate the debug_addr_info ++ array. Check for an address_base that is too large. ++ ++ * dwarf.h (xcalloc2): Prototype. ++ ++ 2015-01-05 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (alloc_num_debug_info_entries): New variable. ++ (process_debug_info): Set it. Use it to avoid displaying ++ attributes for which there is no info. ++ (display_debug_abbrev): Check that the debug_info_entry index is ++ valid before using it. ++ (display_loc_list_dwo): Likewise. ++ (process_cu_tu_index): Add range check for an overlarge dw_sect ++ value. ++ (free_debug_memory): Reset alloc_num_debug_info_entries. ++ ++ 2014-12-22 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (decode_location_expression): Check for an out of range ++ value for a DW_OP_GNU_entry_value expression. ++ (display_debug_lines_raw): Check for a partial ++ .debug_line. section being encountered without a prior, full ++ .debug.line section. ++ (display_debug_lines_decoded): Likewise. Also check for ++ li_line_range being zero. ++ (display_debug_pubnames_worker): Check for an invalid pn_length ++ field. ++ (read_cie): Add range checks. ++ ++ 2014-12-11 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (display_gdb_index): Add more range checks. ++ ++ 2014-12-08 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (display_debug_frames): Check for a negative ++ augmentation data length. ++ (display_gdb_index): Check for invalid offsets. ++ ++ 2014-12-01 H.J. Lu ++ ++ * dwarf.c (process_cu_tu_index): Properly check for an out of ++ range row index. ++ ++ 2014-12-01 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.h (struct dwarf_section): Add user_data field. ++ * dwarf.c (frame_need_space): Check for an over large register ++ number. ++ (display_debug_frames): Check the return value from ++ frame_need_space. Check for a CFA expression that is so long the ++ start address wraps around. ++ (debug_displays): Initialise the user_data field. ++ * objdump.c (load_specific_debug_section): Save the BFD section ++ pointer in the user_data field of the dwarf_section structure. ++ (free_debug_section): Update BFD section data when freeing section ++ contents. ++ * readelf.c (load_specific_debug_section): Initialise the ++ user_data field. ++ ++ 2014-12-01 Nick Clifton ++ ++ PR binutils/17531 ++ * dwarf.c (process_cu_tu_index): Check for an out of range row ++ index. ++ * elfcomm.c (adjust_relative_path): Change name_len parameter to ++ an unsigned long. Check for path length overflow. ++ (process_archive_index_and_symbols): Check for invalid header ++ size. ++ (setup_archive): Add checks for invalid archives. ++ (get_archive_member_name): Add range checks. ++ * elfcomm.h (adjust_relative_path): Update prototyoe. ++ * readelf.c (process_archive): Add range checks. ++ ++ 2014-11-26 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (display_block): Do nothing if the block starts after ++ the end of the buffer. ++ (read_and_display_attr_value): Add range checks. ++ (struct Frame_Chunk): Make the ncols and ra fields unsigned. ++ (frame_need_space): Test for an ncols of zero. ++ (read_cie): Fail if the augmentation data extends off the end of ++ the buffer. ++ (display_debug_frames): Add checks for read_cie failing. Add ++ range checks. ++ ++ 2014-11-21 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (get_encoded_value): Check for an encoded size of 0. ++ (display_debug_lines_raw): Check for an invalid line range value. ++ (display_debug_frames): Check for corrupt augmentation data. ++ ++ 2014-11-19 Jan-Benedict Glaw ++ ++ * dwarf.c (process_extended_line_op): Fix signedness warning. ++ ++ 2014-11-18 Nick Clifton ++ ++ PR binutils/17512 ++ * dwarf.c (get_encoded_value): Warn and return if the encoded ++ value is more than 64-bits long. ++ (SAFE_BYTE_GET): Do not attempt to read more than 64-bits. ++ (process_extended_line_op): Add more range checks. ++ (decode_location_expression): Use the return value from ++ display_block. Add more range checks. ++ (read_debug_line_header): Add range check. ++ (display_debug_lines_raw): Add range checks. ++ (display_debug_frames): Silently skip multiple zero terminators. ++ Add range checks. ++ (process_cu_tu_index): Check for non-existant or empty sections. ++ Use SAFE_BYTE_GET instead of byte_get. ++ ++2015-03-24 Nick Clifton ++ ++ Apply from master: ++ 2015-02-26 Nick Clifton ++ ++ PR binutils/17512 ++ * readelf.c (process_corefile_note_segment): Check for ++ inote.descdata extending beyond the end of the section. ++ (process_v850_notes): Likewise. ++ ++ 2015-02-24 Mike Frysinger ++ ++ PR binutils/17531 ++ * readelf.c (process_symbol_table): Declare chained. Increment it ++ in every loop. Abort when chained is larger than nchains. Move ++ error check outside of chain loop. ++ ++ 2015-02-10 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (dump_relocations): Handle printing offsets which are ++ MIN_INT. ++ (process_corefile_note_segment): Add range check of the namesz ++ field. ++ ++ 2015-02-06 Nick Clifton ++ ++ * readelf.c (process_mips_specific): Fail if an option has an ++ invalid size. ++ ++ 2015-02-03 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (get_data): Change parameter types from size_t to ++ bfd_size_type. Add checks for loss of accuracy when casting from ++ bfd_size_type to size_t. ++ (get_dynamic_data): Likewise. ++ (process_section_groups): Limit number of error messages. ++ ++ 2015-01-05 Nick Clifton ++ ++ * readelf.c (slurp_ia64_unwind_table): Warn if the reloc could not ++ be indentified. ++ (dynamic_section_mips_val): Warn if the timestamp is invalid. ++ (print_mips_got_entry): Add a data_end parameter. Warn if a read ++ would go beyond the end of the data, and return an error value. ++ (process_mips_specific): Do not read options from beyond the end ++ of the section. ++ Correct code to display optional data at the end of an option. ++ Warn if there are too many GOT symbols. ++ Update calls to print_mips_got_entry, and handle error returns. ++ ++ 2014-12-08 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (dump_ia64_unwind): Add range checks. ++ (slurp_ia64_unwind_table): Change to a boolean function. Add ++ range checks. ++ (process_version_sections): Add range checks. ++ (get_symbol_version_string): Add check for missing section ++ headers. ++ ++ 2014-12-03 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (get_machine_flags): Replace call to abort with a ++ warning message and a return value. ++ (get_elf_section_flags): Likewise. ++ (get_symbol_visibility): Likewise. ++ (get_ia64_symbol_other): Likewise. ++ (get_ia64_symbol_other): Likewise. ++ (is_32bit_abs_reloc): Likewise. ++ (apply_relocations): Likewise. ++ (display_arm_attribute): Likewise. ++ ++ 2014-12-01 Nick Clifton ++ ++ PR binutils/17512 ++ * readelf.c (load_specific_debug_section): Initialise the ++ user_data field. ++ ++ 2014-12-01 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (process_archive): Add range checks. ++ ++ 2014-11-28 Alan Modra ++ ++ * readelf.c (get_32bit_elf_symbols): Cast bfd_size_type values to ++ unsigned long for %lx. ++ (get_64bit_elf_symbols, process_section_groups): Likewise. ++ ++ 2014-11-27 Espen Grindhaug ++ Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (get_data): Move excessive length check to earlier on ++ in the function and allow for wraparound in the arithmetic. ++ (get_32bit_elf_symbols): Terminate early if the section size is ++ zero. Check for an invalid sh_entsize. Check for an index ++ section with an invalid size. ++ (get_64bit_elf_symbols): Likewise. ++ (process_section_groups): Check for an invalid sh_entsize. ++ ++ 2014-11-21 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (process_version_sections): Prevent an infinite loop ++ processing corrupt version need data. ++ (process_corefile_note_segment): Handle corrupt notes. ++ ++ 2014-11-18 Nick Clifton ++ ++ PR binutils/17531 ++ * readelf.c (get_unwind_section_word): Skip reloc processing if ++ there are no relocs associated with the section. ++ (decode_tic6x_unwind_bytecode): Warn and return if the stack ++ pointer adjustment falls off the end of the buffer. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2015-01-12 Alan Modra ++ * prdbg.c (print_debugging_info): Don't use void* for function ++ pointer param. ++ * budbg.h (print_debugging_info): Update prototype. ++ ++ 2014-12-18 Mark Wielaard ++ * dwarf.c (read_and_display_attr_value): Change display name of ++ DW_LANG_C11 from (ANSI C11) to (C11). ++ ++ 2014-12-11 Alan Modra ++ * configure.ac: Check for long long and sizes of long long and long. ++ * elfcomm.h (HOST_WIDEST_INT): Test HAVE_LONG_LONG in place of ++ __STDC_VERSION__ and __GNUC__. ++ * strings.c (print_strings): Likewise. ++ * dwarf.c (DWARF_VMA_FMT, DWARF_VMA_FMT_LONG): Likewise. ++ * configure: Regenerate. ++ * config.in: Regenerate. ++ ++ 2014-11-24 Mark Wielaard ++ * dwarf.c (read_and_display_attr_value): Handle DW_LANG_C11, ++ DW_LANG_C_plus_plus_11 and DW_LANG_C_plus_plus_14. ++ + 2014-12-23 Tristan Gingold + + * configure: Regenerate. +diff --git a/binutils/addr2line.c b/binutils/addr2line.c +index f88e745..7cabb8b 100644 +--- a/binutils/addr2line.c ++++ b/binutils/addr2line.c +@@ -140,6 +140,14 @@ slurp_symtab (bfd *abfd) + syms = xmalloc (storage); + symcount = bfd_canonicalize_dynamic_symtab (abfd, syms); + } ++ ++ /* PR 17512: file: 2a1d3b5b. ++ Do not pretend that we have some symbols when we don't. */ ++ if (symcount <= 0) ++ { ++ free (syms); ++ syms = NULL; ++ } + } + + /* These global variables are used to pass information between +@@ -423,6 +431,7 @@ main (int argc, char **argv) + + program_name = *argv; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +diff --git a/binutils/ar.c b/binutils/ar.c +index 117826d..7c3c869 100644 +--- a/binutils/ar.c ++++ b/binutils/ar.c +@@ -691,6 +691,7 @@ main (int argc, char **argv) + + program_name = argv[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + #if BFD_SUPPORTS_PLUGINS + bfd_plugin_set_program_name (program_name); + #endif +diff --git a/binutils/budbg.h b/binutils/budbg.h +index 9753ddf..d018bfc 100644 +--- a/binutils/budbg.h ++++ b/binutils/budbg.h +@@ -29,7 +29,8 @@ extern void *read_debugging_info (bfd *, asymbol **, long, bfd_boolean); + /* Routine used to print generic debugging information. */ + + extern bfd_boolean print_debugging_info +- (FILE *, void *, bfd *, asymbol **, void *, bfd_boolean); ++ (FILE *, void *, bfd *, asymbol **, ++ char * (*) (struct bfd *, const char *, int), bfd_boolean); + + /* Routines used to read and write stabs information. */ + +diff --git a/binutils/coffdump.c b/binutils/coffdump.c +index b4c8415..bf62915 100644 +--- a/binutils/coffdump.c ++++ b/binutils/coffdump.c +@@ -417,21 +417,23 @@ dump_coff_sfile (struct coff_sfile *p) + static void + dump_coff_section (struct coff_section *ptr) + { +- int i; ++ unsigned int i; + + tab (1); +- printf (_("section %s %d %d address %x size %x number %d nrelocs %d"), ++ printf (_("section %s %d %d address %x size %x number %d nrelocs %u"), + ptr->name, ptr->code, ptr->data, ptr->address,ptr->size, + ptr->number, ptr->nrelocs); + nl (); + + for (i = 0; i < ptr->nrelocs; i++) + { ++ struct coff_reloc * r = ptr->relocs + i; + tab (0); + printf ("(%x %s %x)", +- ptr->relocs[i].offset, +- ptr->relocs[i].symbol->name, +- ptr->relocs[i].addend); ++ r->offset, ++ /* PR 17512: file: 0a38fb7c. */ ++ r->symbol == NULL ? _("") : r->symbol->name, ++ r->addend); + nl (); + } + +@@ -498,6 +500,7 @@ main (int ac, char **av) + + program_name = av[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&ac, &av); + +@@ -549,9 +552,11 @@ main (int ac, char **av) + } + + tree = coff_grok (abfd); +- +- coff_dump (tree); +- printf ("\n"); ++ if (tree) ++ { ++ coff_dump (tree); ++ printf ("\n"); ++ } + + return 0; + } +diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c +index f37f266..1317101 100644 +--- a/binutils/coffgrok.c ++++ b/binutils/coffgrok.c +@@ -28,7 +28,6 @@ + #include "sysdep.h" + #include "bfd.h" + #include "libiberty.h" +- + #include "coff/internal.h" + #include "../bfd/libcoff.h" + #include "bucomm.h" +@@ -54,7 +53,7 @@ static long symcount; + #define N(x) ((x)->_n._n_nptr[1]) + + static struct coff_ptr_struct *rawsyms; +-static int rawcount; ++static unsigned int rawcount; + static bfd *abfd; + + #define PTR_SIZE 4 +@@ -66,19 +65,6 @@ static bfd *abfd; + + #define INDEXOF(p) ((struct coff_ptr_struct *)(p)-(rawsyms)) + +-static struct coff_scope *empty_scope (void); +-static struct coff_symbol *empty_symbol (void); +-static void push_scope (int); +-static void pop_scope (void); +-static void do_sections_p1 (struct coff_ofile *); +-static void do_sections_p2 (struct coff_ofile *); +-static struct coff_where *do_where (int); +-static struct coff_line *do_lines (int, char *); +-static struct coff_type *do_type (int); +-static struct coff_visible *do_visible (int); +-static int do_define (int, struct coff_scope *); +-static struct coff_ofile *doit (void); +- + static struct coff_scope * + empty_scope (void) + { +@@ -122,6 +108,9 @@ push_scope (int slink) + static void + pop_scope (void) + { ++ /* PR 17512: file: 809933ac. */ ++ if (top_scope == NULL) ++ fatal (_("Out of context scope change encountered")); + top_scope = top_scope->parent; + } + +@@ -138,10 +127,14 @@ do_sections_p1 (struct coff_ofile *head) + for (idx = 0, section = abfd->sections; section; section = section->next, idx++) + { + long relsize; +- int i = section->target_index; ++ unsigned int i = section->target_index; + arelent **relpp; + long relcount; + ++ /* PR 17512: file: 2d6effca. */ ++ if (i > abfd->section_count) ++ fatal (_("Invalid section target index: %u"), i); ++ + relsize = bfd_get_reloc_upper_bound (abfd, section); + if (relsize < 0) + bfd_fatal (bfd_get_filename (abfd)); +@@ -182,26 +175,51 @@ do_sections_p2 (struct coff_ofile *head) + { + unsigned int j; + ++ /* PR 17512: file: 7c1a36e8. ++ A corrupt COFF binary might have a reloc count but no relocs. ++ Handle this here. */ ++ if (section->relocation == NULL) ++ continue; ++ + for (j = 0; j < section->reloc_count; j++) + { +- int idx; ++ unsigned int idx; + int i = section->target_index; +- struct coff_reloc *r = head->sections[i].relocs + j; ++ struct coff_reloc *r; + arelent *sr = section->relocation + j; ++ ++ if (i > head->nsections) ++ fatal (_("Invalid section target index: %d"), i); ++ /* PR 17512: file: db850ff4. */ ++ if (j >= head->sections[i].nrelocs) ++ fatal (_("Target section has insufficient relocs")); ++ r = head->sections[i].relocs + j; + r->offset = sr->address; + r->addend = sr->addend; + idx = ((coff_symbol_type *) (sr->sym_ptr_ptr[0]))->native - rawsyms; ++ if (idx >= rawcount) ++ { ++ if (rawcount == 0) ++ fatal (_("Symbol index %u encountered when there are no symbols"), idx); ++ non_fatal (_("Invalid symbol index %u encountered"), idx); ++ idx = 0; ++ } + r->symbol = tindex[idx]; + } + } + } + + static struct coff_where * +-do_where (int i) ++do_where (unsigned int i) + { +- struct internal_syment *sym = &rawsyms[i].u.syment; ++ struct internal_syment *sym; + struct coff_where *where = + (struct coff_where *) (xmalloc (sizeof (struct coff_where))); ++ ++ if (i >= rawcount) ++ fatal ("Invalid symbol index: %d\n", i); ++ ++ sym = &rawsyms[i].u.syment; + where->offset = sym->n_value; + + if (sym->n_scnum == -1) +@@ -231,7 +249,16 @@ do_where (int i) + case C_EXTDEF: + case C_LABEL: + where->where = coff_where_memory; +- where->section = &ofile->sections[sym->n_scnum]; ++ /* PR 17512: file: 07a37c40. */ ++ /* PR 17512: file: 0c2eb101. */ ++ if (sym->n_scnum >= ofile->nsections || sym->n_scnum < 0) ++ { ++ non_fatal (_("Invalid section number (%d) encountered"), ++ sym->n_scnum); ++ where->section = ofile->sections; ++ } ++ else ++ where->section = &ofile->sections[sym->n_scnum]; + break; + case C_REG: + case C_REGPARM: +@@ -248,47 +275,61 @@ do_where (int i) + where->where = coff_where_typedef; + break; + default: +- abort (); ++ fatal (_("Unrecognized symbol class: %d"), sym->n_sclass); + break; + } + return where; + } + +-static +-struct coff_line * ++static struct coff_line * + do_lines (int i, char *name ATTRIBUTE_UNUSED) + { + struct coff_line *res = (struct coff_line *) xcalloc (sizeof (struct coff_line), 1); + asection *s; + unsigned int l; + +- /* Find out if this function has any line numbers in the table */ ++ /* Find out if this function has any line numbers in the table. */ + for (s = abfd->sections; s; s = s->next) + { ++ /* PR 17512: file: 07a37c40. ++ A corrupt COFF binary can have a linenumber count in the header ++ but no line number table. This should be reported elsewhere, but ++ do not rely upon this. */ ++ if (s->lineno == NULL) ++ continue; ++ + for (l = 0; l < s->lineno_count; l++) + { + if (s->lineno[l].line_number == 0) + { + if (rawsyms + i == ((coff_symbol_type *) (&(s->lineno[l].u.sym[0])))->native) + { +- /* These lines are for this function - so count them and stick them on */ ++ /* These lines are for this function - so count them and stick them on. */ + int c = 0; + /* Find the linenumber of the top of the function, since coff linenumbers + are relative to the start of the function. */ + int start_line = rawsyms[i + 3].u.auxent.x_sym.x_misc.x_lnsz.x_lnno; + + l++; +- for (c = 0; s->lineno[l + c + 1].line_number; c++) ++ for (c = 0; ++ /* PR 17512: file: c2825452. */ ++ l + c + 1 < s->lineno_count ++ && s->lineno[l + c + 1].line_number; ++ c++) + ; + +- /* Add two extra records, one for the prologue and one for the epilogue */ ++ /* Add two extra records, one for the prologue and one for the epilogue. */ + c += 1; + res->nlines = c; + res->lines = (int *) (xcalloc (sizeof (int), c)); + res->addresses = (int *) (xcalloc (sizeof (int), c)); + res->lines[0] = start_line; + res->addresses[0] = rawsyms[i].u.syment.n_value - s->vma; +- for (c = 0; s->lineno[l + c + 1].line_number; c++) ++ for (c = 0; ++ /* PR 17512: file: c2825452. */ ++ l + c + 1 < s->lineno_count ++ && s->lineno[l + c + 1].line_number; ++ c++) + { + res->lines[c + 1] = s->lineno[l + c].line_number + start_line - 1; + res->addresses[c + 1] = s->lineno[l + c].u.offset; +@@ -301,18 +342,30 @@ do_lines (int i, char *name ATTRIBUTE_UNUSED) + return res; + } + +-static +-struct coff_type * +-do_type (int i) ++static struct coff_type * ++do_type (unsigned int i) + { +- struct internal_syment *sym = &rawsyms[i].u.syment; +- union internal_auxent *aux = &rawsyms[i + 1].u.auxent; +- struct coff_type *res = +- (struct coff_type *) xmalloc (sizeof (struct coff_type)); +- int type = sym->n_type; ++ struct internal_syment *sym; ++ union internal_auxent *aux; ++ struct coff_type *res = (struct coff_type *) xmalloc (sizeof (struct coff_type)); ++ int type; + int which_dt = 0; + int dimind = 0; + ++ if (i >= rawcount) ++ fatal (_("Type entry %u does not have enough symbolic information"), i); ++ ++ if (!rawsyms[i].is_sym) ++ fatal (_("Type entry %u does not refer to a symbol"), i); ++ sym = &rawsyms[i].u.syment; ++ ++ if (sym->n_numaux == 0 || i >= rawcount -1 || rawsyms[i + 1].is_sym) ++ aux = NULL; ++ else ++ aux = &rawsyms[i + 1].u.auxent; ++ ++ type = sym->n_type; ++ + res->type = coff_basic_type; + res->u.basic = type & 0xf; + +@@ -322,28 +375,33 @@ do_type (int i) + case T_VOID: + if (sym->n_numaux && sym->n_sclass == C_STAT) + { +- /* This is probably a section definition */ ++ /* This is probably a section definition. */ + res->type = coff_secdef_type; ++ if (aux == NULL) ++ fatal (_("Section definition needs a section length")); + res->size = aux->x_scn.x_scnlen; ++ ++ /* PR 17512: file: 081c955d. ++ Fill in the asecdef structure as well. */ ++ res->u.asecdef.address = 0; ++ res->u.asecdef.size = 0; + } + else + { + if (type == 0) + { +- /* Don't know what this is, let's make it a simple int */ ++ /* Don't know what this is, let's make it a simple int. */ + res->size = INT_SIZE; + res->u.basic = T_UINT; + } + else + { +- /* Else it could be a function or pointer to void */ ++ /* Else it could be a function or pointer to void. */ + res->size = 0; + } + } + break; + +- +- break; + case T_UCHAR: + case T_CHAR: + res->size = 1; +@@ -370,17 +428,39 @@ do_type (int i) + case T_UNION: + if (sym->n_numaux) + { ++ if (aux == NULL) ++ fatal (_("Aggregate definition needs auxillary information")); ++ + if (aux->x_sym.x_tagndx.p) + { +- /* Referring to a struct defined elsewhere */ ++ unsigned int idx; ++ ++ /* PR 17512: file: e72f3988. */ ++ if (aux->x_sym.x_tagndx.l < 0 || aux->x_sym.x_tagndx.p < rawsyms) ++ { ++ non_fatal (_("Invalid tag index %#lx encountered"), aux->x_sym.x_tagndx.l); ++ idx = 0; ++ } ++ else ++ idx = INDEXOF (aux->x_sym.x_tagndx.p); ++ ++ if (idx >= rawcount) ++ { ++ if (rawcount == 0) ++ fatal (_("Symbol index %u encountered when there are no symbols"), idx); ++ non_fatal (_("Invalid symbol index %u encountered"), idx); ++ idx = 0; ++ } ++ ++ /* Referring to a struct defined elsewhere. */ + res->type = coff_structref_type; +- res->u.astructref.ref = tindex[INDEXOF (aux->x_sym.x_tagndx.p)]; ++ res->u.astructref.ref = tindex[idx]; + res->size = res->u.astructref.ref ? + res->u.astructref.ref->type->size : 0; + } + else + { +- /* A definition of a struct */ ++ /* A definition of a struct. */ + last_struct = res; + res->type = coff_structdef_type; + res->u.astructdef.elements = empty_scope (); +@@ -391,23 +471,34 @@ do_type (int i) + } + else + { +- /* No auxents - it's anonymous */ ++ /* No auxents - it's anonymous. */ + res->type = coff_structref_type; + res->u.astructref.ref = 0; + res->size = 0; + } + break; + case T_ENUM: ++ if (aux == NULL) ++ fatal (_("Enum definition needs auxillary information")); + if (aux->x_sym.x_tagndx.p) + { +- /* Referring to a enum defined elsewhere */ ++ unsigned int idx = INDEXOF (aux->x_sym.x_tagndx.p); ++ ++ /* PR 17512: file: 1ef037c7. */ ++ if (idx >= rawcount) ++ fatal (_("Invalid enum symbol index %u encountered"), idx); ++ /* Referring to a enum defined elsewhere. */ + res->type = coff_enumref_type; +- res->u.aenumref.ref = tindex[INDEXOF (aux->x_sym.x_tagndx.p)]; +- res->size = res->u.aenumref.ref->type->size; ++ res->u.aenumref.ref = tindex[idx]; ++ /* PR 17512: file: b85b67e8. */ ++ if (res->u.aenumref.ref) ++ res->size = res->u.aenumref.ref->type->size; ++ else ++ res->size = 0; + } + else + { +- /* A definition of an enum */ ++ /* A definition of an enum. */ + last_enum = res; + res->type = coff_enumdef_type; + res->u.aenumdef.elements = empty_scope (); +@@ -428,12 +519,27 @@ do_type (int i) + { + struct coff_type *ptr = ((struct coff_type *) + xmalloc (sizeof (struct coff_type))); +- int els = (dimind < DIMNUM +- ? aux->x_sym.x_fcnary.x_ary.x_dimen[dimind] +- : 0); ++ int els; ++ ++ if (aux == NULL) ++ fatal (_("Array definition needs auxillary information")); ++ els = (dimind < DIMNUM ++ ? aux->x_sym.x_fcnary.x_ary.x_dimen[dimind] ++ : 0); ++ + ++dimind; + ptr->type = coff_array_type; +- ptr->size = els * res->size; ++ /* PR 17512: file: ae1971e2. ++ Check for integer overflow. */ ++ { ++ long long a, z; ++ a = els; ++ z = res->size; ++ a *= z; ++ ptr->size = (int) a; ++ if (ptr->size != a) ++ non_fatal (_("Out of range sum for els (%#x) * size (%#x)"), els, res->size); ++ } + ptr->u.array.dim = els; + ptr->u.array.array_of = res; + res = ptr; +@@ -443,6 +549,7 @@ do_type (int i) + { + struct coff_type *ptr = + (struct coff_type *) xmalloc (sizeof (struct coff_type)); ++ + ptr->size = PTR_SIZE; + ptr->type = coff_pointer_type; + ptr->u.pointer.points_to = res; +@@ -453,11 +560,12 @@ do_type (int i) + { + struct coff_type *ptr + = (struct coff_type *) xmalloc (sizeof (struct coff_type)); ++ + ptr->size = 0; + ptr->type = coff_function_type; + ptr->u.function.function_returns = res; + ptr->u.function.parameters = empty_scope (); +- ptr->u.function.lines = do_lines (i, sym->_n._n_nptr[1]); ++ ptr->u.function.lines = do_lines (i, N(sym)); + ptr->u.function.code = 0; + last_function_type = ptr; + res = ptr; +@@ -475,6 +583,7 @@ do_visible (int i) + struct coff_visible *visible = + (struct coff_visible *) (xmalloc (sizeof (struct coff_visible))); + enum coff_vis_type t; ++ + switch (sym->n_sclass) + { + case C_MOS: +@@ -485,11 +594,9 @@ do_visible (int i) + case C_MOE: + t = coff_vis_member_of_enum; + break; +- + case C_REGPARM: + t = coff_vis_regparam; + break; +- + case C_REG: + t = coff_vis_register; + break; +@@ -504,8 +611,6 @@ do_visible (int i) + t = coff_vis_autoparam; + break; + case C_AUTO: +- +- + t = coff_vis_auto; + break; + case C_LABEL: +@@ -524,27 +629,32 @@ do_visible (int i) + t = coff_vis_ext_def; + break; + default: +- abort (); ++ fatal (_("Unrecognised symbol class: %d"), sym->n_sclass); + break; +- + } + visible->type = t; + return visible; + } + ++/* Define a symbol and attach to block B. */ ++ + static int +-do_define (int i, struct coff_scope *b) ++do_define (unsigned int i, struct coff_scope *b) + { + static int symbol_index; +- struct internal_syment *sym = &rawsyms[i].u.syment; +- +- /* Define a symbol and attach to block b */ ++ struct internal_syment *sym; + struct coff_symbol *s = empty_symbol (); + ++ if (b == NULL) ++ fatal (_("ICE: do_define called without a block")); ++ if (i >= rawcount) ++ fatal (_("Out of range symbol index: %u"), i); ++ ++ sym = &rawsyms[i].u.syment; + s->number = ++symbol_index; +- s->name = sym->_n._n_nptr[1]; ++ s->name = N(sym); + s->sfile = cur_sfile; +- /* Glue onto the ofile list */ ++ /* Glue onto the ofile list. */ + if (lofile >= 0) + { + if (ofile->symbol_list_tail) +@@ -552,7 +662,7 @@ do_define (int i, struct coff_scope *b) + else + ofile->symbol_list_head = s; + ofile->symbol_list_tail = s; +- /* And the block list */ ++ /* And the block list. */ + } + if (b->vars_tail) + b->vars_tail->next = s; +@@ -567,21 +677,42 @@ do_define (int i, struct coff_scope *b) + + tindex[i] = s; + +- /* We remember the lowest address in each section for each source file */ +- ++ /* We remember the lowest address in each section for each source file. */ + if (s->where->where == coff_where_memory + && s->type->type == coff_secdef_type) + { +- struct coff_isection *is = cur_sfile->section + s->where->section->number; ++ struct coff_isection *is; + +- if (!is->init) ++ /* PR 17512: file: 4676c97f. */ ++ if (cur_sfile == NULL) ++ non_fatal (_("Section referenced before any file is defined")); ++ else + { +- is->low = s->where->offset; +- is->high = s->where->offset + s->type->size; +- is->init = 1; +- is->parent = s->where->section; +- } ++ is = cur_sfile->section + s->where->section->number; + ++ if (!is->init) ++ { ++ is->low = s->where->offset; ++ /* PR 17512: file: 37e7a80d. ++ Check for integer overflow computing low + size. */ ++ { ++ long long a, z; ++ ++ a = s->where->offset; ++ z = s->type->size; ++ a += z; ++ is->high = (int) a; ++ if (a != is->high) ++ non_fatal (_("Out of range sum for offset (%#x) + size (%#x)"), ++ is->low, s->type->size); ++ } ++ /* PR 17512: file: 37e7a80d. */ ++ if (is->high < s->where->offset) ++ fatal (_("Out of range type size: %u"), s->type->size); ++ is->init = 1; ++ is->parent = s->where->section; ++ } ++ } + } + + if (s->type->type == coff_function_type) +@@ -590,15 +721,14 @@ do_define (int i, struct coff_scope *b) + return i + sym->n_numaux + 1; + } + +- +-static +-struct coff_ofile * ++static struct coff_ofile * + doit (void) + { +- int i; +- int infile = 0; ++ unsigned int i; ++ bfd_boolean infile = FALSE; + struct coff_ofile *head = + (struct coff_ofile *) xmalloc (sizeof (struct coff_ofile)); ++ + ofile = head; + head->source_head = 0; + head->source_tail = 0; +@@ -611,23 +741,25 @@ doit (void) + for (i = 0; i < rawcount;) + { + struct internal_syment *sym = &rawsyms[i].u.syment; ++ + switch (sym->n_sclass) + { + case C_FILE: + { +- /* new source file announced */ ++ /* New source file announced. */ + struct coff_sfile *n = + (struct coff_sfile *) xmalloc (sizeof (struct coff_sfile)); ++ + n->section = (struct coff_isection *) xcalloc (sizeof (struct coff_isection), abfd->section_count + 1); + cur_sfile = n; +- n->name = sym->_n._n_nptr[1]; ++ n->name = N(sym); + n->next = 0; + + if (infile) +- { +- pop_scope (); +- } +- infile = 1; ++ pop_scope (); ++ else ++ infile = TRUE; ++ + push_scope (1); + file_scope = n->scope = top_scope; + +@@ -642,20 +774,29 @@ doit (void) + break; + case C_FCN: + { +- char *name = sym->_n._n_nptr[1]; ++ char *name = N(sym); ++ + if (name[1] == 'b') + { +- /* Function start */ ++ /* Function start. */ + push_scope (0); +- last_function_type->u.function.code = top_scope; +- top_scope->sec = ofile->sections + sym->n_scnum; ++ /* PR 17512: file: 0ef7fbaf. */ ++ if (last_function_type) ++ last_function_type->u.function.code = top_scope; ++ /* PR 17512: file: 22908266. */ ++ if (sym->n_scnum < ofile->nsections && sym->n_scnum >= 0) ++ top_scope->sec = ofile->sections + sym->n_scnum; ++ else ++ top_scope->sec = NULL; + top_scope->offset = sym->n_value; + } + else + { ++ /* PR 17512: file: e92e42e1. */ ++ if (top_scope == NULL) ++ fatal (_("Function start encountered without a top level scope.")); + top_scope->size = sym->n_value - top_scope->offset + 1; + pop_scope (); +- + } + i += sym->n_numaux + 1; + } +@@ -663,17 +804,23 @@ doit (void) + + case C_BLOCK: + { +- char *name = sym->_n._n_nptr[1]; ++ char *name = N(sym); ++ + if (name[1] == 'b') + { +- /* Block start */ ++ /* Block start. */ + push_scope (1); +- top_scope->sec = ofile->sections + sym->n_scnum; ++ /* PR 17512: file: af7e8e83. */ ++ if (sym->n_scnum < ofile->nsections && sym->n_scnum >= 0) ++ top_scope->sec = ofile->sections + sym->n_scnum; ++ else ++ top_scope->sec = NULL; + top_scope->offset = sym->n_value; +- + } + else + { ++ if (top_scope == NULL) ++ fatal (_("Block start encountered without a scope for it.")); + top_scope->size = sym->n_value - top_scope->offset + 1; + pop_scope (); + } +@@ -682,37 +829,50 @@ doit (void) + break; + case C_REGPARM: + case C_ARG: ++ if (last_function_symbol == NULL) ++ fatal (_("Function arguments encountered without a function definition")); + i = do_define (i, last_function_symbol->type->u.function.parameters); + break; + case C_MOS: + case C_MOU: + case C_FIELD: ++ /* PR 17512: file: 43ab21f4. */ ++ if (last_struct == NULL) ++ fatal (_("Structure element encountered without a structure definition")); + i = do_define (i, last_struct->u.astructdef.elements); + break; + case C_MOE: ++ if (last_enum == NULL) ++ fatal (_("Enum element encountered without an enum definition")); + i = do_define (i, last_enum->u.aenumdef.elements); + break; + case C_STRTAG: + case C_ENTAG: + case C_UNTAG: +- /* Various definition */ ++ /* Various definition. */ ++ if (top_scope == NULL) ++ fatal (_("Aggregate defintion encountered without a scope")); + i = do_define (i, top_scope); + break; + case C_EXT: + case C_LABEL: ++ if (file_scope == NULL) ++ fatal (_("Label defintion encountered without a file scope")); + i = do_define (i, file_scope); + break; + case C_STAT: + case C_TPDEF: + case C_AUTO: + case C_REG: ++ if (top_scope == NULL) ++ fatal (_("Variable defintion encountered without a scope")); + i = do_define (i, top_scope); + break; +- default: +- abort (); + case C_EOS: + i += sym->n_numaux + 1; + break; ++ default: ++ fatal (_("Unrecognised symbol class: %d"), sym->n_sclass); + } + } + do_sections_p2 (head); +@@ -725,6 +885,13 @@ coff_grok (bfd *inabfd) + long storage; + struct coff_ofile *p; + abfd = inabfd; ++ ++ if (! bfd_family_coff (abfd)) ++ { ++ non_fatal (_("%s: is not a COFF format file"), bfd_get_filename (abfd)); ++ return NULL; ++ } ++ + storage = bfd_get_symtab_upper_bound (abfd); + + if (storage < 0) +diff --git a/binutils/coffgrok.h b/binutils/coffgrok.h +index 75e0824..830da39 100644 +--- a/binutils/coffgrok.h ++++ b/binutils/coffgrok.h +@@ -19,22 +19,22 @@ + MA 02110-1301, USA. */ + + #define T_NULL 0 +-#define T_VOID 1 /* function argument (only used by compiler) */ +-#define T_CHAR 2 /* character */ +-#define T_SHORT 3 /* short integer */ +-#define T_INT 4 /* integer */ +-#define T_LONG 5 /* long integer */ +-#define T_FLOAT 6 /* floating point */ +-#define T_DOUBLE 7 /* double word */ +-#define T_STRUCT 8 /* structure */ +-#define T_UNION 9 /* union */ +-#define T_ENUM 10 /* enumeration */ +-#define T_MOE 11 /* member of enumeration*/ +-#define T_UCHAR 12 /* unsigned character */ +-#define T_USHORT 13 /* unsigned short */ +-#define T_UINT 14 /* unsigned integer */ +-#define T_ULONG 15 /* unsigned long */ +-#define T_LNGDBL 16 /* long double */ ++#define T_VOID 1 /* Function argument (only used by compiler). */ ++#define T_CHAR 2 /* Character */ ++#define T_SHORT 3 /* Short integer */ ++#define T_INT 4 /* Integer */ ++#define T_LONG 5 /* Long integer */ ++#define T_FLOAT 6 /* Floating point */ ++#define T_DOUBLE 7 /* Double word */ ++#define T_STRUCT 8 /* Structure */ ++#define T_UNION 9 /* Union */ ++#define T_ENUM 10 /* Enumeration */ ++#define T_MOE 11 /* Member of enumeration*/ ++#define T_UCHAR 12 /* Unsigned character */ ++#define T_USHORT 13 /* Unsigned short */ ++#define T_UINT 14 /* Unsigned integer */ ++#define T_ULONG 15 /* Unsigned long */ ++#define T_LNGDBL 16 /* Long double */ + + + struct coff_reloc +@@ -51,7 +51,7 @@ struct coff_section + int data; + int address; + int number; /* 0..n, .text = 0 */ +- int nrelocs; ++ unsigned int nrelocs; + int size; + struct coff_reloc *relocs; + struct bfd_section *bfd_section; +@@ -68,7 +68,8 @@ struct coff_ofile + struct coff_symbol *symbol_list_tail; + }; + +-struct coff_isection { ++struct coff_isection ++{ + int low; + int high; + int init; +@@ -82,145 +83,139 @@ struct coff_sfile + struct coff_sfile *next; + + /* Vector which maps where in each output section +- the input file has it's data */ ++ the input file has it's data. */ + struct coff_isection *section; +- + }; + +- +- struct coff_type ++struct coff_type + { + int size; + enum + { + coff_pointer_type, coff_function_type, coff_array_type, coff_structdef_type, coff_basic_type, + coff_structref_type, coff_enumref_type, coff_enumdef_type, coff_secdef_type +- } type; ++ } type; ++ + union + { + struct +- { ++ { + int address; + int size; + } asecdef; + + struct +- { +- int isstruct; +- struct coff_scope *elements; +- int idx; +- } +- astructdef; ++ { ++ int isstruct; ++ struct coff_scope *elements; ++ int idx; ++ } astructdef; ++ + struct +- { +- struct coff_symbol *ref; +- } astructref; ++ { ++ struct coff_symbol *ref; ++ } astructref; + + struct +- { +- struct coff_scope *elements; +- int idx; +- } aenumdef; ++ { ++ struct coff_scope *elements; ++ int idx; ++ } aenumdef; ++ + struct +- { +- struct coff_symbol *ref; +- } aenumref; ++ { ++ struct coff_symbol *ref; ++ } aenumref; + + struct +- { +- struct coff_type *points_to; +- } pointer; ++ { ++ struct coff_type *points_to; ++ } pointer; ++ + struct +- { +- int dim; +- struct coff_type *array_of; +- } array; ++ { ++ int dim; ++ struct coff_type *array_of; ++ } array; + + struct +- { +- struct coff_type *function_returns; +- struct coff_scope *parameters; +- struct coff_scope *code; +- struct coff_line *lines; +- } function; ++ { ++ struct coff_type * function_returns; ++ struct coff_scope * parameters; ++ struct coff_scope * code; ++ struct coff_line * lines; ++ } function; ++ + int basic; /* One of T_VOID.. T_UINT */ +- } u; ++ } u; ++}; ++ ++struct coff_line ++{ ++ int nlines; ++ int * lines; ++ int * addresses; + }; + ++struct coff_scope ++{ ++ struct coff_section * sec; /* Which section. */ ++ int offset; /* Where. */ ++ int size; /* How big. */ ++ struct coff_scope * parent; /* One up. */ ++ struct coff_scope * next; /* Next along. */ ++ int nvars; ++ struct coff_symbol * vars_head; /* Symbols. */ ++ struct coff_symbol * vars_tail; ++ struct coff_scope * list_head; /* Children. */ ++ struct coff_scope * list_tail; ++}; ++ ++struct coff_visible ++{ ++ enum coff_vis_type ++ { ++ coff_vis_ext_def, ++ coff_vis_ext_ref, ++ coff_vis_int_def, ++ coff_vis_common, ++ coff_vis_auto, ++ coff_vis_register, ++ coff_vis_tag, ++ coff_vis_member_of_struct, ++ coff_vis_member_of_enum, ++ coff_vis_autoparam, ++ coff_vis_regparam, ++ } type; ++}; ++ ++struct coff_where ++{ ++ enum ++ { ++ coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown, ++ coff_where_strtag, coff_where_member_of_struct, ++ coff_where_member_of_enum, coff_where_entag, coff_where_typedef ++ } where; ++ ++ int offset; ++ int bitoffset; ++ int bitsize; ++ struct coff_section *section; ++}; ++ ++struct coff_symbol ++{ ++ char * name; ++ int tag; ++ struct coff_type * type; ++ struct coff_where * where; ++ struct coff_visible * visible; ++ struct coff_symbol * next; ++ struct coff_symbol * next_in_ofile_list; /* For the ofile list. */ ++ int number; ++ int er_number; ++ struct coff_sfile * sfile; ++}; + +- struct coff_line +- { +- int nlines; +- int *lines; +- int *addresses; +- }; +- +- +- struct coff_scope +- { +- struct coff_section *sec; /* What section */ +- int offset; /* where */ +- int size; /* How big */ +- struct coff_scope *parent; /* one up */ +- +- struct coff_scope *next; /*next along */ +- +- int nvars; +- +- struct coff_symbol *vars_head; /* symbols */ +- struct coff_symbol *vars_tail; +- +- struct coff_scope *list_head; /* children */ +- struct coff_scope *list_tail; +- +- }; +- +- +- struct coff_visible +- { +- enum coff_vis_type +- { +- coff_vis_ext_def, +- coff_vis_ext_ref, +- coff_vis_int_def, +- coff_vis_common, +- coff_vis_auto, +- coff_vis_register, +- coff_vis_tag, +- coff_vis_member_of_struct, +- coff_vis_member_of_enum, +- coff_vis_autoparam, +- coff_vis_regparam, +- } type; +- }; +- +- struct coff_where +- { +- enum +- { +- coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown, +- coff_where_strtag, coff_where_member_of_struct, +- coff_where_member_of_enum, coff_where_entag, coff_where_typedef +- +- } where; +- int offset; +- int bitoffset; +- int bitsize; +- struct coff_section *section; +- }; +- +- struct coff_symbol +- { +- char *name; +- int tag; +- struct coff_type *type; +- struct coff_where *where; +- struct coff_visible *visible; +- struct coff_symbol *next; +- struct coff_symbol *next_in_ofile_list; /* For the ofile list */ +- int number; +- int er_number; +- struct coff_sfile *sfile; +- }; +- +-struct coff_ofile *coff_grok (bfd *); ++struct coff_ofile * coff_grok (bfd *); +diff --git a/binutils/config.in b/binutils/config.in +index 076f514..a0ed034 100644 +--- a/binutils/config.in ++++ b/binutils/config.in +@@ -108,6 +108,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_LOCALE_H + ++/* Define to 1 if the system has the type `long long'. */ ++#undef HAVE_LONG_LONG ++ + /* Define if mbstate_t exists in wchar.h. */ + #undef HAVE_MBSTATE_T + +@@ -208,6 +211,12 @@ + /* Define to the version of this package. */ + #undef PACKAGE_VERSION + ++/* The size of `long', as computed by sizeof. */ ++#undef SIZEOF_LONG ++ ++/* The size of `long long', as computed by sizeof. */ ++#undef SIZEOF_LONG_LONG ++ + /* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. +diff --git a/binutils/configure b/binutils/configure +index 7c5b074..be4b81c 100755 +--- a/binutils/configure ++++ b/binutils/configure +@@ -1887,6 +1887,238 @@ $as_echo "$ac_res" >&6; } + + } # ac_fn_c_check_func + ++# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES ++# -------------------------------------------- ++# Tries to find the compile-time value of EXPR in a program that includes ++# INCLUDES, setting VAR accordingly. Returns whether the value could be ++# computed ++ac_fn_c_compute_int () ++{ ++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack ++ if test "$cross_compiling" = yes; then ++ # Depending upon the size, compute the lo and hi bounds. ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++static int test_array [1 - 2 * !(($2) >= 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_lo=0 ac_mid=0 ++ while :; do ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++static int test_array [1 - 2 * !(($2) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_hi=$ac_mid; break ++else ++ as_fn_arith $ac_mid + 1 && ac_lo=$as_val ++ if test $ac_lo -le $ac_mid; then ++ ac_lo= ac_hi= ++ break ++ fi ++ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++static int test_array [1 - 2 * !(($2) < 0)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_hi=-1 ac_mid=-1 ++ while :; do ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++static int test_array [1 - 2 * !(($2) >= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_lo=$ac_mid; break ++else ++ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val ++ if test $ac_mid -le $ac_hi; then ++ ac_lo= ac_hi= ++ break ++ fi ++ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ done ++else ++ ac_lo= ac_hi= ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++# Binary search between lo and hi bounds. ++while test "x$ac_lo" != "x$ac_hi"; do ++ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++static int test_array [1 - 2 * !(($2) <= $ac_mid)]; ++test_array [0] = 0 ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_hi=$ac_mid ++else ++ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++done ++case $ac_lo in #(( ++?*) eval "$3=\$ac_lo"; ac_retval=0 ;; ++'') ac_retval=1 ;; ++esac ++ else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++static long int longval () { return $2; } ++static unsigned long int ulongval () { return $2; } ++#include ++#include ++int ++main () ++{ ++ ++ FILE *f = fopen ("conftest.val", "w"); ++ if (! f) ++ return 1; ++ if (($2) < 0) ++ { ++ long int i = longval (); ++ if (i != ($2)) ++ return 1; ++ fprintf (f, "%ld", i); ++ } ++ else ++ { ++ unsigned long int i = ulongval (); ++ if (i != ($2)) ++ return 1; ++ fprintf (f, "%lu", i); ++ } ++ /* Do not output a trailing newline, as this causes \r\n confusion ++ on some platforms. */ ++ return ferror (f) || fclose (f) != 0; ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ echo >>conftest.val; read $3 &5 ++$as_echo_n "checking for $2... " >&6; } ++if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : ++ $as_echo_n "(cached) " >&6 ++else ++ eval "$3=no" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++if (sizeof ($2)) ++ return 0; ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++if (sizeof (($2))) ++ return 0; ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++else ++ eval "$3=yes" ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++eval ac_res=\$$3 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 ++$as_echo "$ac_res" >&6; } ++ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} ++ ++} # ac_fn_c_check_type ++ + # ac_fn_c_check_decl LINENO SYMBOL VAR + # ------------------------------------ + # Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +@@ -10987,7 +11219,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 10990 "configure" ++#line 11222 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -11093,7 +11325,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11096 "configure" ++#line 11328 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -12567,6 +12799,84 @@ case "${host}" in + esac + + ++# The cast to long int works around a bug in the HP C Compiler ++# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects ++# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. ++# This bug is HP SR number 8606223364. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 ++$as_echo_n "checking size of long... " >&6; } ++if test "${ac_cv_sizeof_long+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : ++ ++else ++ if test "$ac_cv_type_long" = yes; then ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++{ as_fn_set_status 77 ++as_fn_error "cannot compute sizeof (long) ++See \`config.log' for more details." "$LINENO" 5; }; } ++ else ++ ac_cv_sizeof_long=0 ++ fi ++fi ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 ++$as_echo "$ac_cv_sizeof_long" >&6; } ++ ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define SIZEOF_LONG $ac_cv_sizeof_long ++_ACEOF ++ ++ ++ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" ++if test "x$ac_cv_type_long_long" = x""yes; then : ++ ++cat >>confdefs.h <<_ACEOF ++#define HAVE_LONG_LONG 1 ++_ACEOF ++ ++# The cast to long int works around a bug in the HP C Compiler ++# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects ++# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. ++# This bug is HP SR number 8606223364. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 ++$as_echo_n "checking size of long long... " >&6; } ++if test "${ac_cv_sizeof_long_long+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : ++ ++else ++ if test "$ac_cv_type_long_long" = yes; then ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++{ as_fn_set_status 77 ++as_fn_error "cannot compute sizeof (long long) ++See \`config.log' for more details." "$LINENO" 5; }; } ++ else ++ ac_cv_sizeof_long_long=0 ++ fi ++fi ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 ++$as_echo "$ac_cv_sizeof_long_long" >&6; } ++ ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long ++_ACEOF ++ ++ ++fi ++ ++ + for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +diff --git a/binutils/configure.ac b/binutils/configure.ac +index c5aadd8..e9813c5 100644 +--- a/binutils/configure.ac ++++ b/binutils/configure.ac +@@ -124,6 +124,9 @@ case "${host}" in + esac + AC_SUBST(DEMANGLER_NAME) + ++AC_CHECK_SIZEOF([long]) ++AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)]) ++ + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h) + AC_HEADER_SYS_WAIT + ACX_HEADER_STRING +diff --git a/binutils/cxxfilt.c b/binutils/cxxfilt.c +index 157ebe0..391eb29 100644 +--- a/binutils/cxxfilt.c ++++ b/binutils/cxxfilt.c +@@ -176,6 +176,7 @@ main (int argc, char **argv) + + program_name = argv[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +diff --git a/binutils/dlltool.c b/binutils/dlltool.c +index 8b013f0..4d77b02 100644 +--- a/binutils/dlltool.c ++++ b/binutils/dlltool.c +@@ -1699,6 +1699,9 @@ scan_obj_file (const char *filename) + scan_open_obj_file (arfile); + next = bfd_openr_next_archived_file (f, arfile); + bfd_close (arfile); ++ /* PR 17512: file: 58715298. */ ++ if (next == arfile) ++ break; + arfile = next; + } + +@@ -1991,6 +1994,31 @@ assemble_file (const char * source, const char * dest) + run (as_name, cmd); + } + ++static const char * temp_file_to_remove[5]; ++#define TEMP_EXPORT_FILE 0 ++#define TEMP_HEAD_FILE 1 ++#define TEMP_TAIL_FILE 2 ++#define TEMP_HEAD_O_FILE 3 ++#define TEMP_TAIL_O_FILE 4 ++ ++static void ++unlink_temp_files (void) ++{ ++ unsigned i; ++ ++ if (dontdeltemps > 0) ++ return; ++ ++ for (i = 0; i < ARRAY_SIZE (temp_file_to_remove); i++) ++ { ++ if (temp_file_to_remove[i]) ++ { ++ unlink (temp_file_to_remove[i]); ++ temp_file_to_remove[i] = NULL; ++ } ++ } ++} ++ + static void + gen_exp_file (void) + { +@@ -2007,6 +2035,8 @@ gen_exp_file (void) + /* xgettext:c-format */ + fatal (_("Unable to open temporary assembler file: %s"), TMP_ASM); + ++ temp_file_to_remove[TEMP_EXPORT_FILE] = TMP_ASM; ++ + /* xgettext:c-format */ + inform (_("Opened temporary file: %s"), TMP_ASM); + +@@ -2143,7 +2173,6 @@ gen_exp_file (void) + } + } + +- + /* Add to the output file a way of getting to the exported names + without using the import library. */ + if (add_indirect) +@@ -2231,7 +2260,10 @@ gen_exp_file (void) + assemble_file (TMP_ASM, exp_name); + + if (dontdeltemps == 0) +- unlink (TMP_ASM); ++ { ++ temp_file_to_remove[TEMP_EXPORT_FILE] = NULL; ++ unlink (TMP_ASM); ++ } + + inform (_("Generated exports file")); + } +@@ -2936,6 +2968,8 @@ make_head (void) + return NULL; + } + ++ temp_file_to_remove[TEMP_HEAD_FILE] = TMP_HEAD_S; ++ + fprintf (f, "%s IMAGE_IMPORT_DESCRIPTOR\n", ASM_C); + fprintf (f, "\t.section\t.idata$2\n"); + +@@ -2997,6 +3031,7 @@ make_head (void) + fatal (_("failed to open temporary head file: %s: %s"), + TMP_HEAD_O, bfd_get_errmsg ()); + ++ temp_file_to_remove[TEMP_HEAD_O_FILE] = TMP_HEAD_O; + return abfd; + } + +@@ -3012,6 +3047,8 @@ make_delay_head (void) + return NULL; + } + ++ temp_file_to_remove[TEMP_HEAD_FILE] = TMP_HEAD_S; ++ + /* Output the __tailMerge__xxx function */ + fprintf (f, "%s Import trampoline\n", ASM_C); + fprintf (f, "\t.section\t.text\n"); +@@ -3080,6 +3117,7 @@ make_delay_head (void) + fatal (_("failed to open temporary head file: %s: %s"), + TMP_HEAD_O, bfd_get_errmsg ()); + ++ temp_file_to_remove[TEMP_HEAD_O_FILE] = TMP_HEAD_O; + return abfd; + } + +@@ -3095,6 +3133,8 @@ make_tail (void) + return NULL; + } + ++ temp_file_to_remove[TEMP_TAIL_FILE] = TMP_TAIL_S; ++ + if (!no_idata4) + { + fprintf (f, "\t.section\t.idata$4\n"); +@@ -3151,6 +3191,7 @@ make_tail (void) + fatal (_("failed to open temporary tail file: %s: %s"), + TMP_TAIL_O, bfd_get_errmsg ()); + ++ temp_file_to_remove[TEMP_TAIL_O_FILE] = TMP_TAIL_O; + return abfd; + } + +@@ -3176,6 +3217,8 @@ gen_lib_file (int delay) + /* xgettext:c-format */ + inform (_("Creating library file: %s"), imp_name); + ++ xatexit (unlink_temp_files); ++ + bfd_set_format (outarch, bfd_archive); + outarch->has_armap = 1; + outarch->is_thin_archive = 0; +@@ -3245,13 +3288,7 @@ gen_lib_file (int delay) + } + + /* Delete all the temp files. */ +- if (dontdeltemps == 0) +- { +- unlink (TMP_HEAD_O); +- unlink (TMP_HEAD_S); +- unlink (TMP_TAIL_O); +- unlink (TMP_TAIL_S); +- } ++ unlink_temp_files (); + + if (dontdeltemps < 2) + { +@@ -3586,7 +3623,15 @@ identify_search_archive (bfd * abfd, + } + + if (last_arfile != NULL) +- bfd_close (last_arfile); ++ { ++ bfd_close (last_arfile); ++ /* PR 17512: file: 8b2168d4. */ ++ if (last_arfile == arfile) ++ { ++ last_arfile = NULL; ++ break; ++ } ++ } + + last_arfile = arfile; + } +@@ -4041,6 +4086,7 @@ main (int ac, char **av) + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + ++ bfd_set_error_program_name (program_name); + expandargv (&ac, &av); + + while ((c = getopt_long (ac, av, +diff --git a/binutils/dwarf.c b/binutils/dwarf.c +index 84e628a..a04adec 100644 +--- a/binutils/dwarf.c ++++ b/binutils/dwarf.c +@@ -38,12 +38,13 @@ static unsigned int last_pointer_size = 0; + static int warned_about_missing_comp_units = FALSE; + + static unsigned int num_debug_info_entries = 0; ++static unsigned int alloc_num_debug_info_entries = 0; + static debug_info *debug_information = NULL; + /* Special value for num_debug_info_entries to indicate + that the .debug_info section could not be loaded/parsed. */ + #define DEBUG_INFO_UNAVAILABLE (unsigned int) -1 + +-int eh_addr_size; ++unsigned int eh_addr_size; + + int do_debug_info; + int do_debug_abbrevs; +@@ -104,7 +105,7 @@ static void load_cu_tu_indexes (void *file); + #define FLAG_DEBUG_LINES_RAW 1 + #define FLAG_DEBUG_LINES_DECODED 2 + +-static int ++static unsigned int + size_of_encoded_value (int encoding) + { + switch (encoding & 0x7) +@@ -124,7 +125,7 @@ get_encoded_value (unsigned char **pdata, + unsigned char * end) + { + unsigned char * data = * pdata; +- int size = size_of_encoded_value (encoding); ++ unsigned int size = size_of_encoded_value (encoding); + dwarf_vma val; + + if (data + size >= end) +@@ -134,6 +135,22 @@ get_encoded_value (unsigned char **pdata, + return 0; + } + ++ /* PR 17512: file: 002-829853-0.004. */ ++ if (size > 8) ++ { ++ warn (_("Encoded size of %d is too large to read\n"), size); ++ * pdata = end; ++ return 0; ++ } ++ ++ /* PR 17512: file: 1085-5603-0.004. */ ++ if (size == 0) ++ { ++ warn (_("Encoded size of 0 is too small to read\n")); ++ * pdata = end; ++ return 0; ++ } ++ + if (encoding & DW_EH_PE_signed) + val = byte_get_signed (data, size); + else +@@ -146,17 +163,17 @@ get_encoded_value (unsigned char **pdata, + return val; + } + +-#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) +-#ifndef __MINGW32__ +-#define DWARF_VMA_FMT "ll" +-#define DWARF_VMA_FMT_LONG "%16.16llx" ++#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG ++# ifndef __MINGW32__ ++# define DWARF_VMA_FMT "ll" ++# define DWARF_VMA_FMT_LONG "%16.16llx" ++# else ++# define DWARF_VMA_FMT "I64" ++# define DWARF_VMA_FMT_LONG "%016I64x" ++# endif + #else +-#define DWARF_VMA_FMT "I64" +-#define DWARF_VMA_FMT_LONG "%016I64x" +-#endif +-#else +-#define DWARF_VMA_FMT "l" +-#define DWARF_VMA_FMT_LONG "%16.16lx" ++# define DWARF_VMA_FMT "l" ++# define DWARF_VMA_FMT_LONG "%16.16lx" + #endif + + /* Convert a dwarf vma value into a string. Returns a pointer to a static +@@ -264,6 +281,11 @@ read_leb128 (unsigned char *data, + shift += 7; + if ((byte & 0x80) == 0) + break; ++ ++ /* PR 17512: file: 0ca183b8. ++ FIXME: Should we signal this error somehow ? */ ++ if (shift >= sizeof (result) * 8) ++ break; + } + + if (length_return != NULL) +@@ -304,10 +326,10 @@ read_uleb128 (unsigned char * data, + else \ + amount = 0; \ + } \ +- if (amount) \ +- VAL = byte_get ((PTR), amount); \ +- else \ ++ if (amount == 0 || amount > 8) \ + VAL = 0; \ ++ else \ ++ VAL = byte_get ((PTR), amount); \ + } \ + while (0) + +@@ -408,7 +430,7 @@ process_extended_line_op (unsigned char * data, + len = read_uleb128 (data, & bytes_read, end); + data += bytes_read; + +- if (len == 0 || data == end) ++ if (len == 0 || data == end || len > (uintptr_t) (end - data)) + { + warn (_("Badly formed extended line op encountered!\n")); + return bytes_read; +@@ -427,7 +449,15 @@ process_extended_line_op (unsigned char * data, + break; + + case DW_LNE_set_address: +- SAFE_BYTE_GET (adr, data, len - bytes_read - 1, end); ++ /* PR 17512: file: 002-100480-0.004. */ ++ if (len - bytes_read - 1 > 8) ++ { ++ warn (_("Length (%d) of DW_LNE_set_address op is too long\n"), ++ len - bytes_read - 1); ++ adr = 0; ++ } ++ else ++ SAFE_BYTE_GET (adr, data, len - bytes_read - 1, end); + printf (_("set Address to 0x%s\n"), dwarf_vmatoa ("x", adr)); + state_machine_regs.address = adr; + state_machine_regs.op_index = 0; +@@ -449,7 +479,7 @@ process_extended_line_op (unsigned char * data, + printf ("%s\n\n", name); + + if (((unsigned int) (data - orig_data) != len) || data == end) +- warn (_("DW_LNE_define_file: Bad opcode length\n")); ++ warn (_("DW_LNE_define_file: Bad opcode length\n")); + break; + + case DW_LNE_set_discriminator: +@@ -490,68 +520,68 @@ process_extended_line_op (unsigned char * data, + break; + case DW_LNE_HP_source_file_correlation: + { +- unsigned char *edata = data + len - bytes_read - 1; +- +- printf ("DW_LNE_HP_source_file_correlation\n"); +- +- while (data < edata) +- { +- unsigned int opc; +- +- opc = read_uleb128 (data, & bytes_read, edata); +- data += bytes_read; +- +- switch (opc) +- { +- case DW_LNE_HP_SFC_formfeed: +- printf (" DW_LNE_HP_SFC_formfeed\n"); +- break; +- case DW_LNE_HP_SFC_set_listing_line: +- printf (" DW_LNE_HP_SFC_set_listing_line (%s)\n", +- dwarf_vmatoa ("u", +- read_uleb128 (data, & bytes_read, edata))); +- data += bytes_read; +- break; +- case DW_LNE_HP_SFC_associate: +- printf (" DW_LNE_HP_SFC_associate "); +- printf ("(%s", +- dwarf_vmatoa ("u", +- read_uleb128 (data, & bytes_read, edata))); +- data += bytes_read; +- printf (",%s", +- dwarf_vmatoa ("u", +- read_uleb128 (data, & bytes_read, edata))); +- data += bytes_read; +- printf (",%s)\n", +- dwarf_vmatoa ("u", +- read_uleb128 (data, & bytes_read, edata))); +- data += bytes_read; +- break; +- default: +- printf (_(" UNKNOWN DW_LNE_HP_SFC opcode (%u)\n"), opc); +- data = edata; +- break; +- } +- } ++ unsigned char *edata = data + len - bytes_read - 1; ++ ++ printf ("DW_LNE_HP_source_file_correlation\n"); ++ ++ while (data < edata) ++ { ++ unsigned int opc; ++ ++ opc = read_uleb128 (data, & bytes_read, edata); ++ data += bytes_read; ++ ++ switch (opc) ++ { ++ case DW_LNE_HP_SFC_formfeed: ++ printf (" DW_LNE_HP_SFC_formfeed\n"); ++ break; ++ case DW_LNE_HP_SFC_set_listing_line: ++ printf (" DW_LNE_HP_SFC_set_listing_line (%s)\n", ++ dwarf_vmatoa ("u", ++ read_uleb128 (data, & bytes_read, edata))); ++ data += bytes_read; ++ break; ++ case DW_LNE_HP_SFC_associate: ++ printf (" DW_LNE_HP_SFC_associate "); ++ printf ("(%s", ++ dwarf_vmatoa ("u", ++ read_uleb128 (data, & bytes_read, edata))); ++ data += bytes_read; ++ printf (",%s", ++ dwarf_vmatoa ("u", ++ read_uleb128 (data, & bytes_read, edata))); ++ data += bytes_read; ++ printf (",%s)\n", ++ dwarf_vmatoa ("u", ++ read_uleb128 (data, & bytes_read, edata))); ++ data += bytes_read; ++ break; ++ default: ++ printf (_(" UNKNOWN DW_LNE_HP_SFC opcode (%u)\n"), opc); ++ data = edata; ++ break; ++ } ++ } + } + break; + + default: + { +- unsigned int rlen = len - bytes_read - 1; +- +- if (op_code >= DW_LNE_lo_user +- /* The test against DW_LNW_hi_user is redundant due to +- the limited range of the unsigned char data type used +- for op_code. */ +- /*&& op_code <= DW_LNE_hi_user*/) +- printf (_("user defined: ")); +- else +- printf (_("UNKNOWN: ")); +- printf (_("length %d ["), rlen); +- for (; rlen; rlen--) +- printf (" %02x", *data++); +- printf ("]\n"); ++ unsigned int rlen = len - bytes_read - 1; ++ ++ if (op_code >= DW_LNE_lo_user ++ /* The test against DW_LNW_hi_user is redundant due to ++ the limited range of the unsigned char data type used ++ for op_code. */ ++ /*&& op_code <= DW_LNE_hi_user*/) ++ printf (_("user defined: ")); ++ else ++ printf (_("UNKNOWN: ")); ++ printf (_("length %d ["), rlen); ++ for (; rlen; rlen--) ++ printf (" %02x", *data++); ++ printf ("]\n"); + } + break; + } +@@ -628,7 +658,7 @@ fetch_indexed_value (dwarf_vma offset, dwarf_vma bytes) + if (offset + bytes > section->size) + { + warn (_("Offset into section %s too big: %s\n"), +- section->name, dwarf_vmatoa ("x", offset)); ++ section->name, dwarf_vmatoa ("x", offset)); + return ""; + } + +@@ -841,6 +871,8 @@ display_block (unsigned char *data, + dwarf_vma maxlen; + + printf (_(" %s byte block: "), dwarf_vmatoa ("u", length)); ++ if (data > end) ++ return (unsigned char *) end; + + maxlen = (dwarf_vma) (end - data); + length = length > maxlen ? maxlen : length; +@@ -1231,8 +1263,7 @@ decode_location_expression (unsigned char * data, + printf ("DW_OP_implicit_value"); + uvalue = read_uleb128 (data, &bytes_read, end); + data += bytes_read; +- display_block (data, uvalue, end); +- data += uvalue; ++ data = display_block (data, uvalue, end); + break; + + /* GNU extensions. */ +@@ -1245,10 +1276,11 @@ decode_location_expression (unsigned char * data, + break; + case DW_OP_GNU_encoded_addr: + { +- int encoding; ++ int encoding = 0; + dwarf_vma addr; + +- encoding = *data++; ++ if (data < end) ++ encoding = *data++; + addr = get_encoded_value (&data, encoding, section, end); + + printf ("DW_OP_GNU_encoded_addr: fmt:%02x addr:", encoding); +@@ -1281,6 +1313,9 @@ decode_location_expression (unsigned char * data, + case DW_OP_GNU_entry_value: + uvalue = read_uleb128 (data, &bytes_read, end); + data += bytes_read; ++ /* PR 17531: file: 0cc9cd00. */ ++ if (uvalue > (dwarf_vma) (end - data)) ++ uvalue = end - data; + printf ("DW_OP_GNU_entry_value: ("); + if (decode_location_expression (data, pointer_size, offset_size, + dwarf_version, uvalue, +@@ -1288,6 +1323,8 @@ decode_location_expression (unsigned char * data, + need_frame_base = 1; + putchar (')'); + data += uvalue; ++ if (data > end) ++ data = end; + break; + case DW_OP_GNU_const_type: + uvalue = read_uleb128 (data, &bytes_read, end); +@@ -1295,8 +1332,7 @@ decode_location_expression (unsigned char * data, + printf ("DW_OP_GNU_const_type: <0x%s> ", + dwarf_vmatoa ("x", cu_offset + uvalue)); + SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end); +- display_block (data, uvalue, end); +- data += uvalue; ++ data = display_block (data, uvalue, end); + break; + case DW_OP_GNU_regval_type: + uvalue = read_uleb128 (data, &bytes_read, end); +@@ -1331,16 +1367,16 @@ decode_location_expression (unsigned char * data, + printf ("DW_OP_GNU_parameter_ref: <0x%s>", + dwarf_vmatoa ("x", cu_offset + uvalue)); + break; +- case DW_OP_GNU_addr_index: +- uvalue = read_uleb128 (data, &bytes_read, end); +- data += bytes_read; +- printf ("DW_OP_GNU_addr_index <0x%s>", dwarf_vmatoa ("x", uvalue)); +- break; +- case DW_OP_GNU_const_index: +- uvalue = read_uleb128 (data, &bytes_read, end); +- data += bytes_read; +- printf ("DW_OP_GNU_const_index <0x%s>", dwarf_vmatoa ("x", uvalue)); +- break; ++ case DW_OP_GNU_addr_index: ++ uvalue = read_uleb128 (data, &bytes_read, end); ++ data += bytes_read; ++ printf ("DW_OP_GNU_addr_index <0x%s>", dwarf_vmatoa ("x", uvalue)); ++ break; ++ case DW_OP_GNU_const_index: ++ uvalue = read_uleb128 (data, &bytes_read, end); ++ data += bytes_read; ++ printf ("DW_OP_GNU_const_index <0x%s>", dwarf_vmatoa ("x", uvalue)); ++ break; + + /* HP extensions. */ + case DW_OP_HP_is_value: +@@ -1633,8 +1669,18 @@ read_and_display_attr_value (unsigned long attribute, + case DW_FORM_exprloc: + uvalue = read_uleb128 (data, & bytes_read, end); + block_start = data + bytes_read; ++ if (block_start >= end) ++ { ++ warn (_("Block ends prematurely\n")); ++ uvalue = 0; ++ block_start = end; ++ } ++ /* FIXME: Testing "(block_start + uvalue) < block_start" miscompiles with ++ gcc 4.8.3 running on an x86_64 host in 32-bit mode. So we pre-compute ++ block_start + uvalue here. */ ++ data = block_start + uvalue; + /* PR 17512: file: 008-103549-0.001:0.1. */ +- if (block_start + uvalue > end) ++ if (block_start + uvalue > end || data < block_start) + { + warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); + uvalue = end - block_start; +@@ -1648,7 +1694,14 @@ read_and_display_attr_value (unsigned long attribute, + case DW_FORM_block1: + SAFE_BYTE_GET (uvalue, data, 1, end); + block_start = data + 1; +- if (block_start + uvalue > end) ++ if (block_start >= end) ++ { ++ warn (_("Block ends prematurely\n")); ++ uvalue = 0; ++ block_start = end; ++ } ++ data = block_start + uvalue; ++ if (block_start + uvalue > end || data < block_start) + { + warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); + uvalue = end - block_start; +@@ -1662,7 +1715,14 @@ read_and_display_attr_value (unsigned long attribute, + case DW_FORM_block2: + SAFE_BYTE_GET (uvalue, data, 2, end); + block_start = data + 2; +- if (block_start + uvalue > end) ++ if (block_start >= end) ++ { ++ warn (_("Block ends prematurely\n")); ++ uvalue = 0; ++ block_start = end; ++ } ++ data = block_start + uvalue; ++ if (block_start + uvalue > end || data < block_start) + { + warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); + uvalue = end - block_start; +@@ -1676,7 +1736,17 @@ read_and_display_attr_value (unsigned long attribute, + case DW_FORM_block4: + SAFE_BYTE_GET (uvalue, data, 4, end); + block_start = data + 4; +- if (block_start + uvalue > end) ++ /* PR 17512: file: 3371-3907-0.004. */ ++ if (block_start >= end) ++ { ++ warn (_("Block ends prematurely\n")); ++ uvalue = 0; ++ block_start = end; ++ } ++ data = block_start + uvalue; ++ if (block_start + uvalue > end ++ /* PR 17531: file: 5b5f0592. */ ++ || data < block_start) + { + warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); + uvalue = end - block_start; +@@ -1696,14 +1766,14 @@ read_and_display_attr_value (unsigned long attribute, + + case DW_FORM_GNU_str_index: + if (!do_loc) +- { +- const char *suffix = strrchr (section->name, '.'); +- int dwo = (suffix && strcmp (suffix, ".dwo") == 0) ? 1 : 0; +- +- printf (_(" (indexed string: 0x%s): %s"), +- dwarf_vmatoa ("x", uvalue), +- fetch_indexed_string (uvalue, this_set, offset_size, dwo)); +- } ++ { ++ const char *suffix = strrchr (section->name, '.'); ++ int dwo = (suffix && strcmp (suffix, ".dwo") == 0) ? 1 : 0; ++ ++ printf (_(" (indexed string: 0x%s): %s"), ++ dwarf_vmatoa ("x", uvalue), ++ fetch_indexed_string (uvalue, this_set, offset_size, dwo)); ++ } + break; + + case DW_FORM_GNU_strp_alt: +@@ -1731,9 +1801,9 @@ read_and_display_attr_value (unsigned long attribute, + + case DW_FORM_GNU_addr_index: + if (!do_loc) +- printf (_(" (addr_index: 0x%s): %s"), +- dwarf_vmatoa ("x", uvalue), +- fetch_indexed_value (uvalue * pointer_size, pointer_size)); ++ printf (_(" (addr_index: 0x%s): %s"), ++ dwarf_vmatoa ("x", uvalue), ++ fetch_indexed_value (uvalue * pointer_size, pointer_size)); + break; + + default: +@@ -1761,7 +1831,7 @@ read_and_display_attr_value (unsigned long attribute, + case DW_AT_GNU_call_site_data_value: + case DW_AT_GNU_call_site_target: + case DW_AT_GNU_call_site_target_clobbered: +- if ((dwarf_version < 4 ++ if ((dwarf_version < 4 + && (form == DW_FORM_data4 || form == DW_FORM_data8)) + || form == DW_FORM_sec_offset) + { +@@ -1773,15 +1843,15 @@ read_and_display_attr_value (unsigned long attribute, + { + lmax += 1024; + debug_info_p->loc_offsets = (dwarf_vma *) +- xcrealloc (debug_info_p->loc_offsets, +- lmax, sizeof (*debug_info_p->loc_offsets)); ++ xcrealloc (debug_info_p->loc_offsets, ++ lmax, sizeof (*debug_info_p->loc_offsets)); + debug_info_p->have_frame_base = (int *) +- xcrealloc (debug_info_p->have_frame_base, +- lmax, sizeof (*debug_info_p->have_frame_base)); ++ xcrealloc (debug_info_p->have_frame_base, ++ lmax, sizeof (*debug_info_p->have_frame_base)); + debug_info_p->max_loc_offsets = lmax; + } + if (this_set != NULL) +- uvalue += this_set->section_offsets [DW_SECT_LOC]; ++ uvalue += this_set->section_offsets [DW_SECT_LOC]; + debug_info_p->loc_offsets [num] = uvalue; + debug_info_p->have_frame_base [num] = have_frame_base; + debug_info_p->num_loc_offsets++; +@@ -1794,15 +1864,15 @@ read_and_display_attr_value (unsigned long attribute, + break; + + case DW_AT_GNU_addr_base: +- debug_info_p->addr_base = uvalue; ++ debug_info_p->addr_base = uvalue; + break; + + case DW_AT_GNU_ranges_base: +- debug_info_p->ranges_base = uvalue; ++ debug_info_p->ranges_base = uvalue; + break; + + case DW_AT_ranges: +- if ((dwarf_version < 4 ++ if ((dwarf_version < 4 + && (form == DW_FORM_data4 || form == DW_FORM_data8)) + || form == DW_FORM_sec_offset) + { +@@ -1814,8 +1884,8 @@ read_and_display_attr_value (unsigned long attribute, + { + lmax += 1024; + debug_info_p->range_lists = (dwarf_vma *) +- xcrealloc (debug_info_p->range_lists, +- lmax, sizeof (*debug_info_p->range_lists)); ++ xcrealloc (debug_info_p->range_lists, ++ lmax, sizeof (*debug_info_p->range_lists)); + debug_info_p->max_range_lists = lmax; + } + debug_info_p->range_lists [num] = uvalue; +@@ -1887,6 +1957,9 @@ read_and_display_attr_value (unsigned long attribute, + case DW_LANG_Python: printf ("(Python)"); break; + /* DWARF 5 values. */ + case DW_LANG_Go: printf ("(Go)"); break; ++ case DW_LANG_C_plus_plus_11: printf ("(C++11)"); break; ++ case DW_LANG_C11: printf ("(C11)"); break; ++ case DW_LANG_C_plus_plus_14: printf ("(C++14)"); break; + /* MIPS extension. */ + case DW_LANG_Mips_Assembler: printf ("(MIPS assembler)"); break; + /* UPC extension. */ +@@ -2030,7 +2103,7 @@ read_and_display_attr_value (unsigned long attribute, + case DW_AT_GNU_call_site_target: + case DW_AT_GNU_call_site_target_clobbered: + if ((dwarf_version < 4 +- && (form == DW_FORM_data4 || form == DW_FORM_data8)) ++ && (form == DW_FORM_data4 || form == DW_FORM_data8)) + || form == DW_FORM_sec_offset) + printf (_(" (location list)")); + /* Fall through. */ +@@ -2061,7 +2134,7 @@ read_and_display_attr_value (unsigned long attribute, + { + if (form == DW_FORM_ref_sig8 + || form == DW_FORM_GNU_ref_alt) +- break; ++ break; + + if (form == DW_FORM_ref1 + || form == DW_FORM_ref2 +@@ -2070,7 +2143,7 @@ read_and_display_attr_value (unsigned long attribute, + uvalue += cu_offset; + + if (uvalue >= section->size) +- warn (_("Offset %s used as value for DW_AT_import attribute of DIE at offset %lx is too big.\n"), ++ warn (_("Offset %s used as value for DW_AT_import attribute of DIE at offset 0x%lx is too big.\n"), + dwarf_vmatoa ("x", uvalue), + (unsigned long) (orig_data - section->start)); + else +@@ -2163,7 +2236,7 @@ read_and_display_attr (unsigned long attribute, + static int + process_debug_info (struct dwarf_section *section, + void *file, +- enum dwarf_section_display_enum abbrev_sec, ++ enum dwarf_section_display_enum abbrev_sec, + int do_loc, + int do_types) + { +@@ -2204,8 +2277,8 @@ process_debug_info (struct dwarf_section *section, + + /* Negative values are illegal, they may even cause infinite + looping. This can happen if we can't accurately apply +- relocations to an object file. */ +- if ((signed long) length <= 0) ++ relocations to an object file, or if the file is corrupt. */ ++ if ((signed long) length <= 0 || section_begin < start) + { + warn (_("Corrupt unit length (0x%s) found in section %s\n"), + dwarf_vmatoa ("x", length), section->name); +@@ -2221,13 +2294,22 @@ process_debug_info (struct dwarf_section *section, + + /* Then allocate an array to hold the information. */ + debug_information = (debug_info *) cmalloc (num_units, +- sizeof (* debug_information)); ++ sizeof (* debug_information)); + if (debug_information == NULL) + { + error (_("Not enough memory for a debug info array of %u entries\n"), + num_units); ++ alloc_num_debug_info_entries = num_debug_info_entries = 0; + return 0; + } ++ /* PR 17531: file: 92ca3797. ++ We cannot rely upon the debug_information array being initialised ++ before it is used. A corrupt file could easily contain references ++ to a unit for which information has not been made available. So ++ we ensure that the array is zeroed here. */ ++ memset (debug_information, 0, num_units * sizeof (*debug_information)); ++ ++ alloc_num_debug_info_entries = num_units; + } + + if (!do_loc) +@@ -2311,11 +2393,11 @@ process_debug_info (struct dwarf_section *section, + } + + if (do_types) +- { ++ { + SAFE_BYTE_GET64 (hdrptr, &signature_high, &signature_low, end); + hdrptr += 8; + SAFE_BYTE_GET_AND_INC (type_offset, hdrptr, offset_size, end); +- } ++ } + + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0 +@@ -2384,14 +2466,22 @@ process_debug_info (struct dwarf_section *section, + > section->size) + { + warn (_("Debug info is corrupted, length of CU at %s" +- " extends beyond end of section (length = %s)\n"), ++ " extends beyond end of section (length = %s)\n"), + dwarf_vmatoa ("x", cu_offset), + dwarf_vmatoa ("x", compunit.cu_length)); ++ num_units = unit; + break; + } + tags = hdrptr; + start += compunit.cu_length + initial_length_size; + ++ if (start > end) ++ { ++ warn (_("Debug info is corrupt. CU at %s extends beyond end of section"), ++ dwarf_vmatoa ("x", cu_offset)); ++ start = end; ++ } ++ + if (compunit.cu_version != 2 + && compunit.cu_version != 3 + && compunit.cu_version != 4) +@@ -2409,6 +2499,12 @@ process_debug_info (struct dwarf_section *section, + warn (_("Debug info is corrupted, abbrev offset (%lx) is larger than abbrev section size (%lx)\n"), + (unsigned long) compunit.cu_abbrev_offset, + (unsigned long) abbrev_size); ++ /* PR 17531: file:4bcd9ce9. */ ++ else if ((abbrev_base + abbrev_size) ++ > debug_displays [abbrev_sec].section.size) ++ warn (_("Debug info is corrupted, abbrev size (%lx) is larger than abbrev section size (%lx)\n"), ++ (unsigned long) abbrev_base + abbrev_size, ++ (unsigned long) debug_displays [abbrev_sec].section.size); + else + process_abbrev_section + (((unsigned char *) debug_displays [abbrev_sec].section.start +@@ -2508,7 +2604,7 @@ process_debug_info (struct dwarf_section *section, + printf ("\n"); + fflush (stdout); + } +- warn (_("DIE at offset %lx refers to abbreviation number %lu which does not exist\n"), ++ warn (_("DIE at offset 0x%lx refers to abbreviation number %lu which does not exist\n"), + die_offset, abbrev_number); + return 0; + } +@@ -2542,9 +2638,10 @@ process_debug_info (struct dwarf_section *section, + /* Show the offset from where the tag was extracted. */ + printf (" <%lx>", (unsigned long)(tags - section_begin)); + +- arg = debug_information; +- if (debug_information) +- arg += unit; ++ if (debug_information && unit < alloc_num_debug_info_entries) ++ arg = debug_information + unit; ++ else ++ arg = NULL; + + tags = read_and_display_attr (attr->attribute, + attr->form, +@@ -2560,9 +2657,9 @@ process_debug_info (struct dwarf_section *section, + this_set); + } + +- if (entry->children) +- ++level; +- } ++ if (entry->children) ++ ++level; ++ } + } + + /* Set num_debug_info_entries here so that it can be used to check if +@@ -2570,7 +2667,12 @@ process_debug_info (struct dwarf_section *section, + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0 + && ! do_types) +- num_debug_info_entries = num_units; ++ { ++ if (num_units > alloc_num_debug_info_entries) ++ num_debug_info_entries = alloc_num_debug_info_entries; ++ else ++ num_debug_info_entries = num_units; ++ } + + if (!do_loc) + printf ("\n"); +@@ -2607,9 +2709,10 @@ load_debug_info (void * file) + if (load_debug_section (info, file) + && process_debug_info (&debug_displays [info].section, file, abbrev, 1, 0)) + return num_debug_info_entries; +- else if (load_debug_section (info_dwo, file) +- && process_debug_info (&debug_displays [info_dwo].section, file, +- abbrev_dwo, 1, 0)) ++ ++ if (load_debug_section (info_dwo, file) ++ && process_debug_info (&debug_displays [info_dwo].section, file, ++ abbrev_dwo, 1, 0)) + return num_debug_info_entries; + + num_debug_info_entries = DEBUG_INFO_UNAVAILABLE; +@@ -2634,7 +2737,7 @@ read_debug_line_header (struct dwarf_section * section, + + /* Extract information from the Line Number Program Header. + (section 6.2.4 in the Dwarf3 doc). */ +- hdrptr = data; ++ hdrptr = data; + + /* Get and check the length of the block. */ + SAFE_BYTE_GET_AND_INC (linfo->li_length, hdrptr, 4, end); +@@ -2703,18 +2806,27 @@ read_debug_line_header (struct dwarf_section * section, + SAFE_BYTE_GET_AND_INC (linfo->li_opcode_base, hdrptr, 1, end); + + * end_of_sequence = data + linfo->li_length + initial_length_size; ++ /* PR 17512: file:002-117414-0.004. */ ++ if (* end_of_sequence > end) ++ { ++ warn (_("Line length %s extends beyond end of section\n"), ++ dwarf_vmatoa ("u", linfo->li_length)); ++ * end_of_sequence = end; ++ return NULL; ++ } ++ + return hdrptr; + } + + static int + display_debug_lines_raw (struct dwarf_section *section, + unsigned char *data, +- unsigned char *end) ++ unsigned char *end) + { + unsigned char *start = section->start; + + printf (_("Raw dump of debug contents of section %s:\n\n"), +- section->name); ++ section->name); + + while (data < end) + { +@@ -2743,6 +2855,12 @@ display_debug_lines_raw (struct dwarf_section *section, + end_of_sequence = end; + standard_opcodes = NULL; + linfo = saved_linfo; ++ /* PR 17531: file: 0522b371. */ ++ if (linfo.li_line_range == 0) ++ { ++ warn (_("Partial .debug_line. section encountered without a prior full .debug_line section\n")); ++ return 0; ++ } + reset_state_machine (linfo.li_default_is_stmt); + } + else +@@ -2756,7 +2874,7 @@ display_debug_lines_raw (struct dwarf_section *section, + printf (_(" Offset: 0x%lx\n"), (long)(data - start)); + printf (_(" Length: %ld\n"), (long) linfo.li_length); + printf (_(" DWARF Version: %d\n"), linfo.li_version); +- printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length); ++ printf (_(" Prologue Length: %d\n"), (int) linfo.li_prologue_length); + printf (_(" Minimum Instruction Length: %d\n"), linfo.li_min_insn_length); + if (linfo.li_version >= 4) + printf (_(" Maximum Ops per Instruction: %d\n"), linfo.li_max_ops_per_insn); +@@ -2765,11 +2883,25 @@ display_debug_lines_raw (struct dwarf_section *section, + printf (_(" Line Range: %d\n"), linfo.li_line_range); + printf (_(" Opcode Base: %d\n"), linfo.li_opcode_base); + ++ /* PR 17512: file: 1665-6428-0.004. */ ++ if (linfo.li_line_range == 0) ++ { ++ warn (_("Line range of 0 is invalid, using 1 instead\n")); ++ linfo.li_line_range = 1; ++ } ++ + reset_state_machine (linfo.li_default_is_stmt); + + /* Display the contents of the Opcodes table. */ + standard_opcodes = hdrptr; + ++ /* PR 17512: file: 002-417945-0.004. */ ++ if (standard_opcodes + linfo.li_opcode_base >= end) ++ { ++ warn (_("Line Base extends beyond end of section\n")); ++ return 0; ++ } ++ + printf (_("\n Opcodes:\n")); + + for (i = 1; i < linfo.li_opcode_base; i++) +@@ -2785,12 +2917,16 @@ display_debug_lines_raw (struct dwarf_section *section, + printf (_("\n The Directory Table (offset 0x%lx):\n"), + (long)(data - start)); + +- while (*data != 0) ++ while (data < end && *data != 0) + { +- printf (" %d\t%s\n", ++last_dir_entry, data); ++ printf (" %d\t%.*s\n", ++last_dir_entry, (int) (end - data), data); + + data += strnlen ((char *) data, end - data) + 1; + } ++ ++ /* PR 17512: file: 002-132094-0.004. */ ++ if (data >= end - 1) ++ break; + } + + /* Skip the NUL at the end of the table. */ +@@ -2805,7 +2941,7 @@ display_debug_lines_raw (struct dwarf_section *section, + (long)(data - start)); + printf (_(" Entry\tDir\tTime\tSize\tName\n")); + +- while (*data != 0) ++ while (data < end && *data != 0) + { + unsigned char *name; + unsigned int bytes_read; +@@ -2823,7 +2959,7 @@ display_debug_lines_raw (struct dwarf_section *section, + printf ("%s\t", + dwarf_vmatoa ("u", read_uleb128 (data, & bytes_read, end))); + data += bytes_read; +- printf ("%s\n", name); ++ printf ("%.*s\n", (int)(end - name), name); + + if (data == end) + { +@@ -3053,7 +3189,7 @@ display_debug_lines_decoded (struct dwarf_section *section, + static DWARF2_Internal_LineInfo saved_linfo; + + printf (_("Decoded dump of debug contents of section %s:\n\n"), +- section->name); ++ section->name); + + while (data < end) + { +@@ -3071,21 +3207,33 @@ display_debug_lines_decoded (struct dwarf_section *section, + /* Note: the following does not apply to .debug_line.dwo sections. + These are full debug_line sections. */ + && strcmp (section->name, ".debug_line.dwo") != 0) +- { ++ { + /* See comment in display_debug_lines_raw(). */ + end_of_sequence = end; + standard_opcodes = NULL; + linfo = saved_linfo; ++ /* PR 17531: file: 0522b371. */ ++ if (linfo.li_line_range == 0) ++ { ++ warn (_("Partial .debug_line. section encountered without a prior full .debug_line section\n")); ++ return 0; ++ } + reset_state_machine (linfo.li_default_is_stmt); +- } ++ } + else +- { ++ { + unsigned char *hdrptr; + + if ((hdrptr = read_debug_line_header (section, data, end, & linfo, + & end_of_sequence)) == NULL) + return 0; + ++ /* PR 17531: file: 0522b371. */ ++ if (linfo.li_line_range == 0) ++ { ++ warn (_("Line range of 0 is invalid, using 1 instead\n")); ++ linfo.li_line_range = 1; ++ } + reset_state_machine (linfo.li_default_is_stmt); + + /* Save a pointer to the contents of the Opcodes table. */ +@@ -3194,16 +3342,16 @@ display_debug_lines_decoded (struct dwarf_section *section, + + /* This loop iterates through the Dwarf Line Number Program. */ + while (data < end_of_sequence) +- { ++ { + unsigned char op_code; +- int adv; +- unsigned long int uladv; +- unsigned int bytes_read; +- int is_special_opcode = 0; ++ int adv; ++ unsigned long int uladv; ++ unsigned int bytes_read; ++ int is_special_opcode = 0; + +- op_code = *data++; ++ op_code = *data++; + +- if (op_code >= linfo.li_opcode_base) ++ if (op_code >= linfo.li_opcode_base) + { + op_code -= linfo.li_opcode_base; + uladv = (op_code / linfo.li_line_range); +@@ -3223,11 +3371,11 @@ display_debug_lines_decoded (struct dwarf_section *section, + % linfo.li_max_ops_per_insn; + } + +- adv = (op_code % linfo.li_line_range) + linfo.li_line_base; +- state_machine_regs.line += adv; +- is_special_opcode = 1; +- } +- else switch (op_code) ++ adv = (op_code % linfo.li_line_range) + linfo.li_line_base; ++ state_machine_regs.line += adv; ++ is_special_opcode = 1; ++ } ++ else switch (op_code) + { + case DW_LNS_extended_op: + { +@@ -3417,15 +3565,15 @@ display_debug_lines_decoded (struct dwarf_section *section, + break; + } + +- /* Only Special opcodes, DW_LNS_copy and DW_LNE_end_sequence adds a row +- to the DWARF address/line matrix. */ +- if ((is_special_opcode) || (op_code == DW_LNE_end_sequence) ++ /* Only Special opcodes, DW_LNS_copy and DW_LNE_end_sequence adds a row ++ to the DWARF address/line matrix. */ ++ if ((is_special_opcode) || (op_code == DW_LNE_end_sequence) + || (op_code == DW_LNS_copy)) +- { +- const unsigned int MAX_FILENAME_LENGTH = 35; +- char *fileName; +- char *newFileName = NULL; +- size_t fileNameLength; ++ { ++ const unsigned int MAX_FILENAME_LENGTH = 35; ++ char *fileName; ++ char *newFileName = NULL; ++ size_t fileNameLength; + + if (file_table) + fileName = (char *) file_table[state_machine_regs.file - 1].name; +@@ -3434,22 +3582,22 @@ display_debug_lines_decoded (struct dwarf_section *section, + + fileNameLength = strlen (fileName); + +- if ((fileNameLength > MAX_FILENAME_LENGTH) && (!do_wide)) +- { +- newFileName = (char *) xmalloc (MAX_FILENAME_LENGTH + 1); +- /* Truncate file name */ +- strncpy (newFileName, +- fileName + fileNameLength - MAX_FILENAME_LENGTH, +- MAX_FILENAME_LENGTH + 1); +- } +- else +- { +- newFileName = (char *) xmalloc (fileNameLength + 1); +- strncpy (newFileName, fileName, fileNameLength + 1); +- } +- +- if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH)) +- { ++ if ((fileNameLength > MAX_FILENAME_LENGTH) && (!do_wide)) ++ { ++ newFileName = (char *) xmalloc (MAX_FILENAME_LENGTH + 1); ++ /* Truncate file name */ ++ strncpy (newFileName, ++ fileName + fileNameLength - MAX_FILENAME_LENGTH, ++ MAX_FILENAME_LENGTH + 1); ++ } ++ else ++ { ++ newFileName = (char *) xmalloc (fileNameLength + 1); ++ strncpy (newFileName, fileName, fileNameLength + 1); ++ } ++ ++ if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH)) ++ { + if (linfo.li_max_ops_per_insn == 1) + printf ("%-35s %11d %#18" DWARF_VMA_FMT "x\n", + newFileName, state_machine_regs.line, +@@ -3459,9 +3607,9 @@ display_debug_lines_decoded (struct dwarf_section *section, + newFileName, state_machine_regs.line, + state_machine_regs.address, + state_machine_regs.op_index); +- } +- else +- { ++ } ++ else ++ { + if (linfo.li_max_ops_per_insn == 1) + printf ("%s %11d %#18" DWARF_VMA_FMT "x\n", + newFileName, state_machine_regs.line, +@@ -3471,14 +3619,14 @@ display_debug_lines_decoded (struct dwarf_section *section, + newFileName, state_machine_regs.line, + state_machine_regs.address, + state_machine_regs.op_index); +- } ++ } + +- if (op_code == DW_LNE_end_sequence) ++ if (op_code == DW_LNE_end_sequence) + printf ("\n"); + +- free (newFileName); +- } +- } ++ free (newFileName); ++ } ++ } + + if (file_table) + { +@@ -3575,7 +3723,8 @@ display_debug_pubnames_worker (struct dwarf_section *section, + while (start < end) + { + unsigned char *data; +- unsigned long offset; ++ unsigned char *adr; ++ dwarf_vma offset; + unsigned int offset_size, initial_length_size; + + data = start; +@@ -3604,7 +3753,26 @@ display_debug_pubnames_worker (struct dwarf_section *section, + + SAFE_BYTE_GET_AND_INC (names.pn_size, data, offset_size, end); + +- start += names.pn_length + initial_length_size; ++ adr = start + names.pn_length + initial_length_size; ++ /* PR 17531: file: 7615b6b2. */ ++ if ((dwarf_signed_vma) names.pn_length < 0 ++ /* PR 17531: file: a5dbeaa7. */ ++ || adr < start) ++ { ++ warn (_("Negative length for public name: 0x%lx\n"), (long) names.pn_length); ++ start = end; ++ } ++ else ++ start = adr; ++ ++ printf (_(" Length: %ld\n"), ++ (long) names.pn_length); ++ printf (_(" Version: %d\n"), ++ names.pn_version); ++ printf (_(" Offset into .debug_info section: 0x%lx\n"), ++ (unsigned long) names.pn_offset); ++ printf (_(" Size of area in .debug_info section: %ld\n"), ++ (long) names.pn_size); + + if (names.pn_version != 2 && names.pn_version != 3) + { +@@ -3619,15 +3787,6 @@ display_debug_pubnames_worker (struct dwarf_section *section, + continue; + } + +- printf (_(" Length: %ld\n"), +- (long) names.pn_length); +- printf (_(" Version: %d\n"), +- names.pn_version); +- printf (_(" Offset into .debug_info section: 0x%lx\n"), +- (unsigned long) names.pn_offset); +- printf (_(" Size of area in .debug_info section: %ld\n"), +- (long) names.pn_size); +- + if (is_gnu) + printf (_("\n Offset Kind Name\n")); + else +@@ -3645,7 +3804,7 @@ display_debug_pubnames_worker (struct dwarf_section *section, + if (data >= end) + break; + maxprint = (end - data) - 1; +- ++ + if (is_gnu) + { + unsigned int kind_data; +@@ -3665,11 +3824,12 @@ display_debug_pubnames_worker (struct dwarf_section *section, + kind_name = get_gdb_index_symbol_kind_name (kind); + is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (kind_data); + printf (" %-6lx %s,%-10s %.*s\n", +- offset, is_static ? _("s") : _("g"), ++ (unsigned long) offset, is_static ? _("s") : _("g"), + kind_name, (int) maxprint, data); + } + else +- printf (" %-6lx\t%.*s\n", offset, (int) maxprint, data); ++ printf (" %-6lx\t%.*s\n", ++ (unsigned long) offset, (int) maxprint, data); + + data += strnlen ((char *) data, maxprint) + 1; + if (data >= end) +@@ -4109,7 +4269,7 @@ display_debug_macro (struct dwarf_section *section, + } + + printf ("\n"); +- } ++ } + + return 1; + } +@@ -4164,24 +4324,36 @@ display_debug_abbrev (struct dwarf_section *section, + + static void + display_loc_list (struct dwarf_section *section, +- unsigned char **start_ptr, +- int debug_info_entry, +- unsigned long offset, +- unsigned long base_address, +- int has_frame_base) ++ unsigned char **start_ptr, ++ unsigned int debug_info_entry, ++ unsigned long offset, ++ unsigned long base_address, ++ int has_frame_base) + { + unsigned char *start = *start_ptr; + unsigned char *section_end = section->start + section->size; +- unsigned long cu_offset = debug_information [debug_info_entry].cu_offset; +- unsigned int pointer_size = debug_information [debug_info_entry].pointer_size; +- unsigned int offset_size = debug_information [debug_info_entry].offset_size; +- int dwarf_version = debug_information [debug_info_entry].dwarf_version; ++ unsigned long cu_offset; ++ unsigned int pointer_size; ++ unsigned int offset_size; ++ int dwarf_version; + + dwarf_vma begin; + dwarf_vma end; + unsigned short length; + int need_frame_base; + ++ if (debug_info_entry >= num_debug_info_entries) ++ { ++ warn (_("No debug information available for loc lists of entry: %u\n"), ++ debug_info_entry); ++ return; ++ } ++ ++ cu_offset = debug_information [debug_info_entry].cu_offset; ++ pointer_size = debug_information [debug_info_entry].pointer_size; ++ offset_size = debug_information [debug_info_entry].offset_size; ++ dwarf_version = debug_information [debug_info_entry].dwarf_version; ++ + if (pointer_size < 2 || pointer_size > 8) + { + warn (_("Invalid pointer size (%d) in debug info for entry %d\n"), +@@ -4192,72 +4364,72 @@ display_loc_list (struct dwarf_section *section, + while (1) + { + if (start + 2 * pointer_size > section_end) +- { +- warn (_("Location list starting at offset 0x%lx is not terminated.\n"), +- offset); +- break; +- } ++ { ++ warn (_("Location list starting at offset 0x%lx is not terminated.\n"), ++ offset); ++ break; ++ } + + printf (" %8.8lx ", offset + (start - *start_ptr)); + + /* Note: we use sign extension here in order to be sure that we can detect +- the -1 escape value. Sign extension into the top 32 bits of a 32-bit +- address will not affect the values that we display since we always show +- hex values, and always the bottom 32-bits. */ ++ the -1 escape value. Sign extension into the top 32 bits of a 32-bit ++ address will not affect the values that we display since we always show ++ hex values, and always the bottom 32-bits. */ + SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, section_end); + SAFE_BYTE_GET_AND_INC (end, start, pointer_size, section_end); + + if (begin == 0 && end == 0) +- { +- printf (_("\n")); +- break; +- } ++ { ++ printf (_("\n")); ++ break; ++ } + + /* Check base address specifiers. */ + if (begin == (dwarf_vma) -1 && end != (dwarf_vma) -1) +- { +- base_address = end; +- print_dwarf_vma (begin, pointer_size); +- print_dwarf_vma (end, pointer_size); +- printf (_("(base address)\n")); +- continue; +- } ++ { ++ base_address = end; ++ print_dwarf_vma (begin, pointer_size); ++ print_dwarf_vma (end, pointer_size); ++ printf (_("(base address)\n")); ++ continue; ++ } + + if (start + 2 > section_end) +- { +- warn (_("Location list starting at offset 0x%lx is not terminated.\n"), +- offset); +- break; +- } ++ { ++ warn (_("Location list starting at offset 0x%lx is not terminated.\n"), ++ offset); ++ break; ++ } + + SAFE_BYTE_GET_AND_INC (length, start, 2, section_end); + + if (start + length > section_end) +- { +- warn (_("Location list starting at offset 0x%lx is not terminated.\n"), +- offset); +- break; +- } ++ { ++ warn (_("Location list starting at offset 0x%lx is not terminated.\n"), ++ offset); ++ break; ++ } + + print_dwarf_vma (begin + base_address, pointer_size); + print_dwarf_vma (end + base_address, pointer_size); + + putchar ('('); + need_frame_base = decode_location_expression (start, +- pointer_size, +- offset_size, +- dwarf_version, +- length, +- cu_offset, section); ++ pointer_size, ++ offset_size, ++ dwarf_version, ++ length, ++ cu_offset, section); + putchar (')'); + + if (need_frame_base && !has_frame_base) +- printf (_(" [without DW_AT_frame_base]")); ++ printf (_(" [without DW_AT_frame_base]")); + + if (begin == end) +- fputs (_(" (start == end)"), stdout); ++ fputs (_(" (start == end)"), stdout); + else if (begin > end) +- fputs (_(" (start > end)"), stdout); ++ fputs (_(" (start > end)"), stdout); + + putchar ('\n'); + +@@ -4284,23 +4456,35 @@ print_addr_index (unsigned int idx, unsigned int len) + + static void + display_loc_list_dwo (struct dwarf_section *section, +- unsigned char **start_ptr, +- int debug_info_entry, +- unsigned long offset, +- int has_frame_base) ++ unsigned char **start_ptr, ++ unsigned int debug_info_entry, ++ unsigned long offset, ++ int has_frame_base) + { + unsigned char *start = *start_ptr; + unsigned char *section_end = section->start + section->size; +- unsigned long cu_offset = debug_information [debug_info_entry].cu_offset; +- unsigned int pointer_size = debug_information [debug_info_entry].pointer_size; +- unsigned int offset_size = debug_information [debug_info_entry].offset_size; +- int dwarf_version = debug_information [debug_info_entry].dwarf_version; ++ unsigned long cu_offset; ++ unsigned int pointer_size; ++ unsigned int offset_size; ++ int dwarf_version; + int entry_type; + unsigned short length; + int need_frame_base; + unsigned int idx; + unsigned int bytes_read; + ++ if (debug_info_entry >= num_debug_info_entries) ++ { ++ warn (_("No debug information for loc lists of entry: %u\n"), ++ debug_info_entry); ++ return; ++ } ++ ++ cu_offset = debug_information [debug_info_entry].cu_offset; ++ pointer_size = debug_information [debug_info_entry].pointer_size; ++ offset_size = debug_information [debug_info_entry].offset_size; ++ dwarf_version = debug_information [debug_info_entry].dwarf_version; ++ + if (pointer_size < 2 || pointer_size > 8) + { + warn (_("Invalid pointer size (%d) in debug info for entry %d\n"), +@@ -4313,79 +4497,79 @@ display_loc_list_dwo (struct dwarf_section *section, + printf (" %8.8lx ", offset + (start - *start_ptr)); + + if (start >= section_end) +- { +- warn (_("Location list starting at offset 0x%lx is not terminated.\n"), +- offset); +- break; +- } ++ { ++ warn (_("Location list starting at offset 0x%lx is not terminated.\n"), ++ offset); ++ break; ++ } + + SAFE_BYTE_GET_AND_INC (entry_type, start, 1, section_end); + switch (entry_type) +- { +- case 0: /* A terminating entry. */ +- *start_ptr = start; +- printf (_("\n")); +- return; +- case 1: /* A base-address entry. */ +- idx = read_uleb128 (start, &bytes_read, section_end); +- start += bytes_read; +- print_addr_index (idx, 8); +- printf (" "); +- printf (_("(base address selection entry)\n")); +- continue; +- case 2: /* A start/end entry. */ +- idx = read_uleb128 (start, &bytes_read, section_end); +- start += bytes_read; +- print_addr_index (idx, 8); +- idx = read_uleb128 (start, &bytes_read, section_end); +- start += bytes_read; +- print_addr_index (idx, 8); +- break; +- case 3: /* A start/length entry. */ +- idx = read_uleb128 (start, &bytes_read, section_end); +- start += bytes_read; +- print_addr_index (idx, 8); +- SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end); +- printf ("%08x ", idx); +- break; +- case 4: /* An offset pair entry. */ +- SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end); +- printf ("%08x ", idx); +- SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end); +- printf ("%08x ", idx); +- break; +- default: +- warn (_("Unknown location list entry type 0x%x.\n"), entry_type); +- *start_ptr = start; +- return; +- } ++ { ++ case 0: /* A terminating entry. */ ++ *start_ptr = start; ++ printf (_("\n")); ++ return; ++ case 1: /* A base-address entry. */ ++ idx = read_uleb128 (start, &bytes_read, section_end); ++ start += bytes_read; ++ print_addr_index (idx, 8); ++ printf (" "); ++ printf (_("(base address selection entry)\n")); ++ continue; ++ case 2: /* A start/end entry. */ ++ idx = read_uleb128 (start, &bytes_read, section_end); ++ start += bytes_read; ++ print_addr_index (idx, 8); ++ idx = read_uleb128 (start, &bytes_read, section_end); ++ start += bytes_read; ++ print_addr_index (idx, 8); ++ break; ++ case 3: /* A start/length entry. */ ++ idx = read_uleb128 (start, &bytes_read, section_end); ++ start += bytes_read; ++ print_addr_index (idx, 8); ++ SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end); ++ printf ("%08x ", idx); ++ break; ++ case 4: /* An offset pair entry. */ ++ SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end); ++ printf ("%08x ", idx); ++ SAFE_BYTE_GET_AND_INC (idx, start, 4, section_end); ++ printf ("%08x ", idx); ++ break; ++ default: ++ warn (_("Unknown location list entry type 0x%x.\n"), entry_type); ++ *start_ptr = start; ++ return; ++ } + + if (start + 2 > section_end) +- { +- warn (_("Location list starting at offset 0x%lx is not terminated.\n"), +- offset); +- break; +- } ++ { ++ warn (_("Location list starting at offset 0x%lx is not terminated.\n"), ++ offset); ++ break; ++ } + + SAFE_BYTE_GET_AND_INC (length, start, 2, section_end); + if (start + length > section_end) +- { +- warn (_("Location list starting at offset 0x%lx is not terminated.\n"), +- offset); +- break; +- } ++ { ++ warn (_("Location list starting at offset 0x%lx is not terminated.\n"), ++ offset); ++ break; ++ } + + putchar ('('); + need_frame_base = decode_location_expression (start, +- pointer_size, +- offset_size, +- dwarf_version, +- length, +- cu_offset, section); ++ pointer_size, ++ offset_size, ++ dwarf_version, ++ length, ++ cu_offset, section); + putchar (')'); + + if (need_frame_base && !has_frame_base) +- printf (_(" [without DW_AT_frame_base]")); ++ printf (_(" [without DW_AT_frame_base]")); + + putchar ('\n'); + +@@ -4533,11 +4717,11 @@ display_debug_loc (struct dwarf_section *section, void *file) + if (start < next) + warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"), + (unsigned long) (start - section_begin), +- (unsigned long) (next - section_begin)); ++ (unsigned long) offset); + else if (start > next) + warn (_("There is an overlap [0x%lx - 0x%lx] in .debug_loc section.\n"), + (unsigned long) (start - section_begin), +- (unsigned long) (next - section_begin)); ++ (unsigned long) offset); + } + start = next; + +@@ -4548,11 +4732,11 @@ display_debug_loc (struct dwarf_section *section, void *file) + continue; + } + +- if (is_dwo) +- display_loc_list_dwo (section, &start, i, offset, has_frame_base); +- else +- display_loc_list (section, &start, i, offset, base_address, +- has_frame_base); ++ if (is_dwo) ++ display_loc_list_dwo (section, &start, i, offset, has_frame_base); ++ else ++ display_loc_list (section, &start, i, offset, base_address, ++ has_frame_base); + } + } + +@@ -4737,7 +4921,13 @@ display_debug_aranges (struct dwarf_section *section, + if (excess) + addr_ranges += (2 * address_size) - excess; + +- start += arange.ar_length + initial_length_size; ++ hdrptr = start + arange.ar_length + initial_length_size; ++ if (hdrptr < start || hdrptr > end) ++ { ++ error (_("Excessive header length: %lx\n"), (long) arange.ar_length); ++ break; ++ } ++ start = hdrptr; + + while (addr_ranges + 2 * address_size <= start) + { +@@ -4768,7 +4958,7 @@ comp_addr_base (const void * v0, const void * v1) + /* Display the debug_addr section. */ + static int + display_debug_addr (struct dwarf_section *section, +- void *file) ++ void *file) + { + debug_info **debug_addr_info; + unsigned char *entry; +@@ -4791,42 +4981,51 @@ display_debug_addr (struct dwarf_section *section, + + printf (_("Contents of the %s section:\n\n"), section->name); + +- debug_addr_info = (debug_info **) xmalloc ((num_debug_info_entries + 1) +- * sizeof (debug_info *)); ++ /* PR 17531: file: cf38d01b. ++ We use xcalloc because a corrupt file may not have initialised all of the ++ fields in the debug_info structure, which means that the sort below might ++ try to move uninitialised data. */ ++ debug_addr_info = (debug_info **) xcalloc ((num_debug_info_entries + 1), ++ sizeof (debug_info *)); + + count = 0; + for (i = 0; i < num_debug_info_entries; i++) +- { +- if (debug_information [i].addr_base != DEBUG_INFO_UNAVAILABLE) +- debug_addr_info [count++] = &debug_information [i]; +- } ++ if (debug_information [i].addr_base != DEBUG_INFO_UNAVAILABLE) ++ { ++ /* PR 17531: file: cf38d01b. */ ++ if (debug_information[i].addr_base >= section->size) ++ warn (_("Corrupt address base (%lx) found in debug section %u\n"), ++ (unsigned long) debug_information[i].addr_base, i); ++ else ++ debug_addr_info [count++] = debug_information + i; ++ } + + /* Add a sentinel to make iteration convenient. */ + debug_addr_info [count] = (debug_info *) xmalloc (sizeof (debug_info)); + debug_addr_info [count]->addr_base = section->size; +- + qsort (debug_addr_info, count, sizeof (debug_info *), comp_addr_base); ++ + for (i = 0; i < count; i++) + { + unsigned int idx; + unsigned int address_size = debug_addr_info [i]->pointer_size; + + printf (_(" For compilation unit at offset 0x%s:\n"), +- dwarf_vmatoa ("x", debug_addr_info [i]->cu_offset)); ++ dwarf_vmatoa ("x", debug_addr_info [i]->cu_offset)); + + printf (_("\tIndex\tAddress\n")); + entry = section->start + debug_addr_info [i]->addr_base; + end = section->start + debug_addr_info [i + 1]->addr_base; + idx = 0; + while (entry < end) +- { +- dwarf_vma base = byte_get (entry, address_size); +- printf (_("\t%d:\t"), idx); +- print_dwarf_vma (base, address_size); +- printf ("\n"); +- entry += address_size; +- idx++; +- } ++ { ++ dwarf_vma base = byte_get (entry, address_size); ++ printf (_("\t%d:\t"), idx); ++ print_dwarf_vma (base, address_size); ++ printf ("\n"); ++ entry += address_size; ++ idx++; ++ } + } + printf ("\n"); + +@@ -4837,7 +5036,7 @@ display_debug_addr (struct dwarf_section *section, + /* Display the .debug_str_offsets and .debug_str_offsets.dwo sections. */ + static int + display_debug_str_offsets (struct dwarf_section *section, +- void *file ATTRIBUTE_UNUSED) ++ void *file ATTRIBUTE_UNUSED) + { + if (section->size == 0) + { +@@ -4906,7 +5105,7 @@ display_debug_ranges (struct dwarf_section *section, + if (num_range_list == 0) + { + /* This can happen when the file was compiled with -gsplit-debug +- which removes references to range lists from the primary .o file. */ ++ which removes references to range lists from the primary .o file. */ + printf (_("No range lists in .debug_info section.\n")); + return 1; + } +@@ -4959,7 +5158,7 @@ display_debug_ranges (struct dwarf_section *section, + pointer_size, offset); + continue; + } +- ++ + if (dwarf_check != 0 && i > 0) + { + if (start < next) +@@ -5033,7 +5232,7 @@ typedef struct Frame_Chunk + { + struct Frame_Chunk *next; + unsigned char *chunk_start; +- int ncols; ++ unsigned int ncols; + /* DW_CFA_{undefined,same_value,offset,register,unreferenced} */ + short int *col_type; + int *col_offset; +@@ -5043,8 +5242,8 @@ typedef struct Frame_Chunk + dwarf_vma pc_begin; + dwarf_vma pc_range; + int cfa_reg; +- int cfa_offset; +- int ra; ++ dwarf_vma cfa_offset; ++ unsigned int ra; + unsigned char fde_encoding; + unsigned char cfa_exp; + unsigned char ptr_size; +@@ -5059,13 +5258,13 @@ static unsigned int dwarf_regnames_count; + in the frame info. */ + #define DW_CFA_unreferenced (-1) + +-/* Return 0 if not more space is needed, 1 if more space is needed, ++/* Return 0 if no more space is needed, 1 if more space is needed, + -1 for invalid reg. */ + + static int + frame_need_space (Frame_Chunk *fc, unsigned int reg) + { +- int prev = fc->ncols; ++ unsigned int prev = fc->ncols; + + if (reg < (unsigned int) fc->ncols) + return 0; +@@ -5075,10 +5274,25 @@ frame_need_space (Frame_Chunk *fc, unsigned int reg) + return -1; + + fc->ncols = reg + 1; ++ /* PR 17512: file: 10450-2643-0.004. ++ If reg == -1 then this can happen... */ ++ if (fc->ncols == 0) ++ return -1; ++ ++ /* PR 17512: file: 2844a11d. */ ++ if (fc->ncols > 1024) ++ { ++ error (_("Unfeasibly large register number: %u\n"), reg); ++ fc->ncols = 0; ++ /* FIXME: 1024 is an arbitrary limit. Increase it if ++ we ever encounter a valid binary that exceeds it. */ ++ return -1; ++ } ++ + fc->col_type = (short int *) xcrealloc (fc->col_type, fc->ncols, +- sizeof (short int)); ++ sizeof (short int)); + fc->col_offset = (int *) xcrealloc (fc->col_offset, fc->ncols, sizeof (int)); +- /* PR 17512: file:002-10025-0.005. */ ++ /* PR 17512: file:002-10025-0.005. */ + if (fc->col_type == NULL || fc->col_offset == NULL) + { + error (_("Out of memory allocating %u columns in dwarf frame arrays\n"), +@@ -5168,16 +5382,16 @@ init_dwarf_regnames_x86_64 (void) + + static const char *const dwarf_regnames_aarch64[] = + { +- "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", +- "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", ++ "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", ++ "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", + "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", + "x24", "x25", "x26", "x27", "x28", "x29", "x30", "sp", + NULL, "elr", NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +- "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", +- "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", ++ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", ++ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", + "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", + }; +@@ -5233,9 +5447,9 @@ regname (unsigned int regno, int row) + } + + static void +-frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) ++frame_display_row (Frame_Chunk *fc, int *need_col_headers, unsigned int *max_regs) + { +- int r; ++ unsigned int r; + char tmp[100]; + + if (*max_regs < fc->ncols) +@@ -5265,7 +5479,7 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) + if (fc->cfa_exp) + strcpy (tmp, "exp"); + else +- sprintf (tmp, "%s%+d", regname (fc->cfa_reg, 1), fc->cfa_offset); ++ sprintf (tmp, "%s%+d", regname (fc->cfa_reg, 1), (int) fc->cfa_offset); + printf ("%-8s ", tmp); + + for (r = 0; r < fc->ncols; r++) +@@ -5351,7 +5565,20 @@ read_cie (unsigned char *start, unsigned char *end, + if (version >= 4) + { + GET (fc->ptr_size, 1); ++ if (fc->ptr_size < 1 || fc->ptr_size > 8) ++ { ++ warn (_("Invalid pointer size (%d) in CIE data\n"), fc->ptr_size); ++ return end; ++ } ++ + GET (fc->segment_size, 1); ++ /* PR 17512: file: e99d2804. */ ++ if (fc->segment_size > 8 || fc->segment_size + fc->ptr_size > 8) ++ { ++ warn (_("Invalid segment size (%d) in CIE data\n"), fc->segment_size); ++ return end; ++ } ++ + eh_addr_size = fc->ptr_size; + } + else +@@ -5375,15 +5602,32 @@ read_cie (unsigned char *start, unsigned char *end, + augmentation_data_len = LEB (); + augmentation_data = start; + start += augmentation_data_len; ++ /* PR 17512: file: 11042-2589-0.004. */ ++ if (start > end) ++ { ++ warn (_("Augmentation data too long: 0x%lx\n"), augmentation_data_len); ++ return end; ++ } + } + + if (augmentation_data_len) + { +- unsigned char *p, *q; ++ unsigned char *p; ++ unsigned char *q; ++ unsigned char *qend; ++ + p = (unsigned char *) fc->augmentation + 1; + q = augmentation_data; ++ qend = q + augmentation_data_len; + +- while (1) ++ /* PR 17531: file: 015adfaa. */ ++ if (qend < q) ++ { ++ warn (_("Negative augmentation data length: 0x%lx"), augmentation_data_len); ++ augmentation_data_len = 0; ++ } ++ ++ while (p < end && q < augmentation_data + augmentation_data_len) + { + if (*p == 'L') + q++; +@@ -5397,6 +5641,8 @@ read_cie (unsigned char *start, unsigned char *end, + break; + p++; + } ++ /* Note - it is OK if this loop terminates with q < qend. ++ Padding may have been inserted to align the end of the CIE. */ + } + + *p_cie = fc; +@@ -5422,9 +5668,9 @@ display_debug_frames (struct dwarf_section *section, + Frame_Chunk *rs; + int is_eh = strcmp (section->name, ".eh_frame") == 0; + unsigned int length_return; +- int max_regs = 0; ++ unsigned int max_regs = 0; + const char *bad_reg = _("bad register: "); +- int saved_eh_addr_size = eh_addr_size; ++ unsigned int saved_eh_addr_size = eh_addr_size; + + printf (_("Contents of the %s section:\n"), section->name); + +@@ -5451,6 +5697,12 @@ display_debug_frames (struct dwarf_section *section, + { + printf ("\n%08lx ZERO terminator\n\n", + (unsigned long)(saved_start - section_start)); ++ /* Skip any zero terminators that directly follow. ++ A corrupt section size could have loaded a whole ++ slew of zero filled memory bytes. eg ++ PR 17512: file: 070-19381-0.004. */ ++ while (start < end && * start == 0) ++ ++ start; + continue; + } + +@@ -5481,21 +5733,23 @@ display_debug_frames (struct dwarf_section *section, + || (offset_size == 8 && cie_id == DW64_CIE_ID))) + { + int version; +- int mreg; ++ unsigned int mreg; + + start = read_cie (start, end, &cie, &version, + &augmentation_data_len, &augmentation_data); + /* PR 17512: file: 027-135133-0.005. */ + if (cie == NULL) + break; ++ + fc = cie; + fc->next = chunks; + chunks = fc; + fc->chunk_start = saved_start; +- mreg = max_regs - 1; ++ mreg = max_regs > 0 ? max_regs - 1 : 0; + if (mreg < fc->ra) + mreg = fc->ra; +- frame_need_space (fc, mreg); ++ if (frame_need_space (fc, mreg) < 0) ++ break; + if (fc->fde_encoding) + encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); + +@@ -5525,8 +5779,11 @@ display_debug_frames (struct dwarf_section *section, + if (augmentation_data_len) + { + unsigned long i; ++ + printf (" Augmentation data: "); + for (i = 0; i < augmentation_data_len; ++i) ++ /* FIXME: If do_wide is FALSE, then we should ++ add carriage returns at 80 columns... */ + printf (" %02x", augmentation_data[i]); + putchar ('\n'); + } +@@ -5582,17 +5839,27 @@ display_debug_frames (struct dwarf_section *section, + || (off_size == 8 && c_id == DW64_CIE_ID))) + { + int version; +- int mreg; ++ unsigned int mreg; + + read_cie (cie_scan, end, &cie, &version, + &augmentation_data_len, &augmentation_data); ++ /* PR 17512: file: 3450-2098-0.004. */ ++ if (cie == NULL) ++ { ++ warn (_("Failed to read CIE information\n")); ++ break; ++ } + cie->next = forward_refs; + forward_refs = cie; + cie->chunk_start = look_for; +- mreg = max_regs - 1; ++ mreg = max_regs > 0 ? max_regs - 1 : 0; + if (mreg < cie->ra) + mreg = cie->ra; +- frame_need_space (cie, mreg); ++ if (frame_need_space (cie, mreg) < 0) ++ { ++ warn (_("Invalid max register\n")); ++ break; ++ } + if (cie->fde_encoding) + encoded_ptr_size + = size_of_encoded_value (cie->fde_encoding); +@@ -5612,7 +5879,11 @@ display_debug_frames (struct dwarf_section *section, + fc->ncols = 0; + fc->col_type = (short int *) xmalloc (sizeof (short int)); + fc->col_offset = (int *) xmalloc (sizeof (int)); +- frame_need_space (fc, max_regs - 1); ++ if (frame_need_space (fc, max_regs > 0 ? max_regs - 1 : 0) < 0) ++ { ++ warn (_("Invalid max register\n")); ++ break; ++ } + cie = fc; + fc->augmentation = ""; + fc->fde_encoding = 0; +@@ -5635,7 +5906,11 @@ display_debug_frames (struct dwarf_section *section, + fc->cfa_reg = cie->cfa_reg; + fc->cfa_offset = cie->cfa_offset; + fc->ra = cie->ra; +- frame_need_space (fc, max_regs - 1); ++ if (frame_need_space (fc, max_regs > 0 ? max_regs - 1: 0) < 0) ++ { ++ warn (_("Invalid max register\n")); ++ break; ++ } + fc->fde_encoding = cie->fde_encoding; + } + +@@ -5644,7 +5919,15 @@ display_debug_frames (struct dwarf_section *section, + + segment_selector = 0; + if (fc->segment_size) +- SAFE_BYTE_GET_AND_INC (segment_selector, start, fc->segment_size, end); ++ { ++ if (fc->segment_size > sizeof (segment_selector)) ++ { ++ /* PR 17512: file: 9e196b3e. */ ++ warn (_("Probably corrupt segment size: %d - using 4 instead\n"), fc->segment_size); ++ fc->segment_size = 4; ++ } ++ SAFE_BYTE_GET_AND_INC (segment_selector, start, fc->segment_size, end); ++ } + + fc->pc_begin = get_encoded_value (&start, fc->fde_encoding, section, end); + +@@ -5659,6 +5942,15 @@ display_debug_frames (struct dwarf_section *section, + augmentation_data_len = LEB (); + augmentation_data = start; + start += augmentation_data_len; ++ /* PR 17512: file: 722-8446-0.004. */ ++ if (start >= end || ((signed long) augmentation_data_len) < 0) ++ { ++ warn (_("Corrupt augmentation data length: %lx\n"), ++ augmentation_data_len); ++ start = end; ++ augmentation_data = NULL; ++ augmentation_data_len = 0; ++ } + } + + printf ("\n%08lx %s %s FDE cie=%08lx pc=", +@@ -5703,6 +5995,7 @@ display_debug_frames (struct dwarf_section *section, + { + unsigned int reg, op, opa; + unsigned long temp; ++ unsigned char * new_start; + + op = *start++; + opa = op & 0x3f; +@@ -5744,7 +6037,6 @@ display_debug_frames (struct dwarf_section *section, + break; + case DW_CFA_restore_extended: + reg = LEB (); +- frame_need_space (fc, reg); + if (frame_need_space (fc, reg) >= 0) + fc->col_type[reg] = DW_CFA_undefined; + break; +@@ -5774,26 +6066,28 @@ display_debug_frames (struct dwarf_section *section, + break; + case DW_CFA_def_cfa_expression: + temp = LEB (); +- if (start + temp < start) ++ new_start = start + temp; ++ if (new_start < start) + { + warn (_("Corrupt CFA_def expression value: %lu\n"), temp); + start = block_end; + } + else +- start += temp; ++ start = new_start; + break; + case DW_CFA_expression: + case DW_CFA_val_expression: + reg = LEB (); + temp = LEB (); +- if (start + temp < start) ++ new_start = start + temp; ++ if (new_start < start) + { +- /* PR 17512: file:306-192417-0.005. */ ++ /* PR 17512: file:306-192417-0.005. */ + warn (_("Corrupt CFA expression value: %lu\n"), temp); + start = block_end; + } + else +- start += temp; ++ start = new_start; + if (frame_need_space (fc, reg) >= 0) + fc->col_type[reg] = DW_CFA_undefined; + break; +@@ -5832,9 +6126,10 @@ display_debug_frames (struct dwarf_section *section, + + while (start < block_end) + { ++ unsigned char * tmp; + unsigned op, opa; + unsigned long ul, reg, roffs; +- long l; ++ dwarf_vma l; + dwarf_vma ofs; + dwarf_vma vma; + const char *reg_prefix = ""; +@@ -5854,7 +6149,7 @@ display_debug_frames (struct dwarf_section *section, + else + printf (" DW_CFA_advance_loc: %d to %s\n", + opa * fc->code_factor, +- dwarf_vmatoa_1 (NULL, ++ dwarf_vmatoa_1 (NULL, + fc->pc_begin + opa * fc->code_factor, + fc->ptr_size)); + fc->pc_begin += opa * fc->code_factor; +@@ -5893,7 +6188,7 @@ display_debug_frames (struct dwarf_section *section, + break; + + case DW_CFA_set_loc: +- vma = get_encoded_value (&start, fc->fde_encoding, section, end); ++ vma = get_encoded_value (&start, fc->fde_encoding, section, block_end); + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else +@@ -5916,7 +6211,7 @@ display_debug_frames (struct dwarf_section *section, + break; + + case DW_CFA_advance_loc2: +- SAFE_BYTE_GET_AND_INC (ofs, start, 2, end); ++ SAFE_BYTE_GET_AND_INC (ofs, start, 2, block_end); + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else +@@ -5929,7 +6224,7 @@ display_debug_frames (struct dwarf_section *section, + break; + + case DW_CFA_advance_loc4: +- SAFE_BYTE_GET_AND_INC (ofs, start, 4, end); ++ SAFE_BYTE_GET_AND_INC (ofs, start, 4, block_end); + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else +@@ -6038,13 +6333,13 @@ display_debug_frames (struct dwarf_section *section, + if (! do_debug_frames_interp) + printf (" DW_CFA_remember_state\n"); + rs = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk)); +- rs->cfa_offset = fc->cfa_offset; ++ rs->cfa_offset = fc->cfa_offset; + rs->cfa_reg = fc->cfa_reg; + rs->ra = fc->ra; + rs->cfa_exp = fc->cfa_exp; + rs->ncols = fc->ncols; + rs->col_type = (short int *) xcmalloc (rs->ncols, +- sizeof (* rs->col_type)); ++ sizeof (* rs->col_type)); + rs->col_offset = (int *) xcmalloc (rs->ncols, sizeof (* rs->col_offset)); + memcpy (rs->col_type, fc->col_type, rs->ncols * sizeof (* fc->col_type)); + memcpy (rs->col_offset, fc->col_offset, rs->ncols * sizeof (* fc->col_offset)); +@@ -6061,9 +6356,14 @@ display_debug_frames (struct dwarf_section *section, + remembered_state = rs->next; + fc->cfa_offset = rs->cfa_offset; + fc->cfa_reg = rs->cfa_reg; +- fc->ra = rs->ra; +- fc->cfa_exp = rs->cfa_exp; +- frame_need_space (fc, rs->ncols - 1); ++ fc->ra = rs->ra; ++ fc->cfa_exp = rs->cfa_exp; ++ if (frame_need_space (fc, rs->ncols - 1) < 0) ++ { ++ warn (_("Invalid column number in saved frame state\n")); ++ fc->ncols = 0; ++ break; ++ } + memcpy (fc->col_type, rs->col_type, rs->ncols * sizeof (* rs->col_type)); + memcpy (fc->col_offset, rs->col_offset, + rs->ncols * sizeof (* rs->col_offset)); +@@ -6081,7 +6381,7 @@ display_debug_frames (struct dwarf_section *section, + fc->cfa_exp = 0; + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa: %s ofs %d\n", +- regname (fc->cfa_reg, 0), fc->cfa_offset); ++ regname (fc->cfa_reg, 0), (int) fc->cfa_offset); + break; + + case DW_CFA_def_cfa_register: +@@ -6095,7 +6395,7 @@ display_debug_frames (struct dwarf_section *section, + case DW_CFA_def_cfa_offset: + fc->cfa_offset = LEB (); + if (! do_debug_frames_interp) +- printf (" DW_CFA_def_cfa_offset: %d\n", fc->cfa_offset); ++ printf (" DW_CFA_def_cfa_offset: %d\n", (int) fc->cfa_offset); + break; + + case DW_CFA_nop: +@@ -6105,6 +6405,11 @@ display_debug_frames (struct dwarf_section *section, + + case DW_CFA_def_cfa_expression: + ul = LEB (); ++ if (start >= block_end || start + ul > block_end || start + ul < start) ++ { ++ printf (_(" DW_CFA_def_cfa_expression: \n"), ul); ++ break; ++ } + if (! do_debug_frames_interp) + { + printf (" DW_CFA_def_cfa_expression ("); +@@ -6121,6 +6426,14 @@ display_debug_frames (struct dwarf_section *section, + ul = LEB (); + if (reg >= (unsigned int) fc->ncols) + reg_prefix = bad_reg; ++ /* PR 17512: file: 069-133014-0.006. */ ++ /* PR 17512: file: 98c02eb4. */ ++ tmp = start + ul; ++ if (start >= block_end || tmp > block_end || tmp < start) ++ { ++ printf (_(" DW_CFA_expression: \n"), ul); ++ break; ++ } + if (! do_debug_frames_interp || *reg_prefix != '\0') + { + printf (" DW_CFA_expression: %s%s (", +@@ -6131,7 +6444,7 @@ display_debug_frames (struct dwarf_section *section, + } + if (*reg_prefix == '\0') + fc->col_type[reg] = DW_CFA_expression; +- start += ul; ++ start = tmp; + break; + + case DW_CFA_val_expression: +@@ -6139,6 +6452,12 @@ display_debug_frames (struct dwarf_section *section, + ul = LEB (); + if (reg >= (unsigned int) fc->ncols) + reg_prefix = bad_reg; ++ tmp = start + ul; ++ if (start >= block_end || tmp > block_end || tmp < start) ++ { ++ printf (" DW_CFA_val_expression: \n", ul); ++ break; ++ } + if (! do_debug_frames_interp || *reg_prefix != '\0') + { + printf (" DW_CFA_val_expression: %s%s (", +@@ -6149,7 +6468,7 @@ display_debug_frames (struct dwarf_section *section, + } + if (*reg_prefix == '\0') + fc->col_type[reg] = DW_CFA_val_expression; +- start += ul; ++ start = tmp; + break; + + case DW_CFA_offset_extended_sf: +@@ -6160,7 +6479,7 @@ display_debug_frames (struct dwarf_section *section, + if (! do_debug_frames_interp || *reg_prefix != '\0') + printf (" DW_CFA_offset_extended_sf: %s%s at cfa%+ld\n", + reg_prefix, regname (reg, 0), +- l * fc->data_factor); ++ (long)(l * fc->data_factor)); + if (*reg_prefix == '\0') + { + fc->col_type[reg] = DW_CFA_offset; +@@ -6176,7 +6495,7 @@ display_debug_frames (struct dwarf_section *section, + if (! do_debug_frames_interp || *reg_prefix != '\0') + printf (" DW_CFA_val_offset_sf: %s%s at cfa%+ld\n", + reg_prefix, regname (reg, 0), +- l * fc->data_factor); ++ (long)(l * fc->data_factor)); + if (*reg_prefix == '\0') + { + fc->col_type[reg] = DW_CFA_val_offset; +@@ -6191,18 +6510,18 @@ display_debug_frames (struct dwarf_section *section, + fc->cfa_exp = 0; + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa_sf: %s ofs %d\n", +- regname (fc->cfa_reg, 0), fc->cfa_offset); ++ regname (fc->cfa_reg, 0), (int) fc->cfa_offset); + break; + + case DW_CFA_def_cfa_offset_sf: + fc->cfa_offset = SLEB (); +- fc->cfa_offset = fc->cfa_offset * fc->data_factor; ++ fc->cfa_offset *= fc->data_factor; + if (! do_debug_frames_interp) +- printf (" DW_CFA_def_cfa_offset_sf: %d\n", fc->cfa_offset); ++ printf (" DW_CFA_def_cfa_offset_sf: %d\n", (int) fc->cfa_offset); + break; + + case DW_CFA_MIPS_advance_loc8: +- SAFE_BYTE_GET_AND_INC (ofs, start, 8, end); ++ SAFE_BYTE_GET_AND_INC (ofs, start, 8, block_end); + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else +@@ -6233,7 +6552,7 @@ display_debug_frames (struct dwarf_section *section, + if (! do_debug_frames_interp || *reg_prefix != '\0') + printf (" DW_CFA_GNU_negative_offset_extended: %s%s at cfa%+ld\n", + reg_prefix, regname (reg, 0), +- l * fc->data_factor); ++ (long)(l * fc->data_factor)); + if (*reg_prefix == '\0') + { + fc->col_type[reg] = DW_CFA_offset; +@@ -6329,9 +6648,42 @@ display_gdb_index (struct dwarf_section *section, + return 0; + } + ++ /* PR 17531: file: 418d0a8a. */ ++ if (tu_list_offset < cu_list_offset) ++ { ++ warn (_("TU offset (%x) is less than CU offset (%x)\n"), ++ tu_list_offset, cu_list_offset); ++ return 0; ++ } ++ + cu_list_elements = (tu_list_offset - cu_list_offset) / 8; ++ ++ if (address_table_offset < tu_list_offset) ++ { ++ warn (_("Address table offset (%x) is less than TU offset (%x)\n"), ++ address_table_offset, tu_list_offset); ++ return 0; ++ } ++ + tu_list_elements = (address_table_offset - tu_list_offset) / 8; ++ ++ /* PR 17531: file: 18a47d3d. */ ++ if (symbol_table_offset < address_table_offset) ++ { ++ warn (_("Symbol table offset (%xl) is less then Address table offset (%x)\n"), ++ symbol_table_offset, address_table_offset); ++ return 0; ++ } ++ + address_table_size = symbol_table_offset - address_table_offset; ++ ++ if (constant_pool_offset < symbol_table_offset) ++ { ++ warn (_("Constant pool offset (%x) is less than symbol table offset (%x)\n"), ++ constant_pool_offset, symbol_table_offset); ++ return 0; ++ } ++ + symbol_table_slots = (constant_pool_offset - symbol_table_offset) / 8; + + cu_list = start + cu_list_offset; +@@ -6340,6 +6692,12 @@ display_gdb_index (struct dwarf_section *section, + symbol_table = start + symbol_table_offset; + constant_pool = start + constant_pool_offset; + ++ if (address_table + address_table_size * (2 + 8 + 4) > section->start + section->size) ++ { ++ warn (_("Address table extends beyond end of section.\n")); ++ return 0; ++ } ++ + printf (_("\nCU table:\n")); + for (i = 0; i < cu_list_elements; i += 2) + { +@@ -6366,7 +6724,8 @@ display_gdb_index (struct dwarf_section *section, + } + + printf (_("\nAddress table:\n")); +- for (i = 0; i < address_table_size; i += 2 * 8 + 4) ++ for (i = 0; i < address_table_size && i <= address_table_size - (2 * 8 + 4); ++ i += 2 * 8 + 4) + { + uint64_t low = byte_get_little_endian (address_table + i, 8); + uint64_t high = byte_get_little_endian (address_table + i + 8, 8); +@@ -6388,11 +6747,46 @@ display_gdb_index (struct dwarf_section *section, + || cu_vector_offset != 0) + { + unsigned int j; ++ unsigned char * adr; ++ ++ adr = constant_pool + name_offset; ++ /* PR 17531: file: 5b7b07ad. */ ++ if (adr < constant_pool || adr >= section->start + section->size) ++ { ++ printf (_("[%3u] "), i, name_offset); ++ warn (_("Corrupt name offset of 0x%x found for symbol table slot %d\n"), ++ name_offset, i); ++ } ++ else ++ printf ("[%3u] %.*s:", i, ++ (int) (section->size - (constant_pool_offset + name_offset)), ++ constant_pool + name_offset); ++ ++ adr = constant_pool + cu_vector_offset; ++ if (adr < constant_pool || adr >= section->start + section->size - 3) ++ { ++ printf (_("\n"), cu_vector_offset); ++ warn (_("Corrupt CU vector offset of 0x%x found for symbol table slot %d\n"), ++ cu_vector_offset, i); ++ continue; ++ } ++ ++ num_cus = byte_get_little_endian (adr, 4); ++ ++ adr = constant_pool + cu_vector_offset + 4 + num_cus * 4; ++ if (num_cus * 4 < num_cus ++ || adr >= section->start + section->size ++ || adr < constant_pool) ++ { ++ printf ("\n", num_cus); ++ warn (_("Invalid number of CUs (0x%x) for symbol table slot %d\n"), ++ num_cus, i); ++ continue; ++ } + +- printf ("[%3u] %s:", i, constant_pool + name_offset); +- num_cus = byte_get_little_endian (constant_pool + cu_vector_offset, 4); + if (num_cus > 1) + printf ("\n"); ++ + for (j = 0; j < num_cus; ++j) + { + int is_static; +@@ -6491,7 +6885,7 @@ get_DW_SECT_short_name (unsigned int dw_sect) + case DW_SECT_MACRO: + return "macro"; + default: +- break; ++ break; + } + + snprintf (buf, sizeof (buf), "%d", dw_sect); +@@ -6520,15 +6914,38 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + dwarf_vma signature_low; + char buf[64]; + +- version = byte_get (phdr, 4); ++ /* PR 17512: file: 002-168123-0.004. */ ++ if (phdr == NULL) ++ { ++ warn (_("Section %s is empty\n"), section->name); ++ return 0; ++ } ++ /* PR 17512: file: 002-376-0.004. */ ++ if (section->size < 24) ++ { ++ warn (_("Section %s is too small to contain a CU/TU header\n"), ++ section->name); ++ return 0; ++ } ++ ++ SAFE_BYTE_GET (version, phdr, 4, limit); + if (version >= 2) +- ncols = byte_get (phdr + 4, 4); +- nused = byte_get (phdr + 8, 4); +- nslots = byte_get (phdr + 12, 4); ++ SAFE_BYTE_GET (ncols, phdr + 4, 4, limit); ++ SAFE_BYTE_GET (nused, phdr + 8, 4, limit); ++ SAFE_BYTE_GET (nslots, phdr + 12, 4, limit); ++ + phash = phdr + 16; + pindex = phash + nslots * 8; + ppool = pindex + nslots * 4; + ++ /* PR 17531: file: 45d69832. */ ++ if (pindex < phash || ppool < phdr || (pindex == phash && nslots != 0)) ++ { ++ warn (_("Section %s is too small for %d slots\n"), ++ section->name, nslots); ++ return 0; ++ } ++ + if (do_display) + { + printf (_("Contents of the %s section:\n\n"), section->name); +@@ -6539,7 +6956,7 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + printf (_(" Number of slots: %d\n\n"), nslots); + } + +- if (ppool > limit) ++ if (ppool > limit || ppool < phdr) + { + warn (_("Section %s too small for %d hash table entries\n"), + section->name, nslots); +@@ -6555,11 +6972,18 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + unsigned char *shndx_list; + unsigned int shndx; + +- byte_get_64 (phash, &signature_high, &signature_low); ++ SAFE_BYTE_GET64 (phash, &signature_high, &signature_low, limit); + if (signature_high != 0 || signature_low != 0) + { +- j = byte_get (pindex, 4); ++ SAFE_BYTE_GET (j, pindex, 4, limit); + shndx_list = ppool + j * 4; ++ /* PR 17531: file: 705e010d. */ ++ if (shndx_list < ppool) ++ { ++ warn (_("Section index pool located before start of section\n")); ++ return 0; ++ } ++ + if (do_display) + printf (_(" [%3d] Signature: 0x%s Sections: "), + i, dwarf_vmatoa64 (signature_high, signature_low, +@@ -6572,7 +6996,7 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + section->name); + return 0; + } +- shndx = byte_get (shndx_list, 4); ++ SAFE_BYTE_GET (shndx, shndx_list, 4, limit); + if (shndx == 0) + break; + if (do_display) +@@ -6606,6 +7030,14 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + + is_tu_index = strcmp (section->name, ".debug_tu_index") == 0; + ++ /* PR 17531: file: 0dd159bf. ++ Check for wraparound with an overlarge ncols value. */ ++ if (poffsets < ppool || (unsigned int) ((poffsets - ppool) / 4) != ncols) ++ { ++ warn (_("Overlarge number of columns: %x\n"), ncols); ++ return 0; ++ } ++ + if (pend > limit) + { + warn (_("Section %s too small for offset and size tables\n"), +@@ -6624,49 +7056,75 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + if (is_tu_index) + { + tu_count = nused; +- tu_sets = xcmalloc (nused, sizeof (struct cu_tu_set)); ++ tu_sets = xcalloc2 (nused, sizeof (struct cu_tu_set)); + this_set = tu_sets; + } + else + { + cu_count = nused; +- cu_sets = xcmalloc (nused, sizeof (struct cu_tu_set)); ++ cu_sets = xcalloc2 (nused, sizeof (struct cu_tu_set)); + this_set = cu_sets; + } + } ++ + if (do_display) + { + for (j = 0; j < ncols; j++) + { +- dw_sect = byte_get (ppool + j * 4, 4); ++ SAFE_BYTE_GET (dw_sect, ppool + j * 4, 4, limit); + printf (" %8s", get_DW_SECT_short_name (dw_sect)); + } + printf ("\n"); + } ++ + for (i = 0; i < nslots; i++) + { +- byte_get_64 (ph, &signature_high, &signature_low); +- row = byte_get (pi, 4); ++ SAFE_BYTE_GET64 (ph, &signature_high, &signature_low, limit); ++ ++ SAFE_BYTE_GET (row, pi, 4, limit); + if (row != 0) + { ++ /* PR 17531: file: a05f6ab3. */ ++ if (row > nused) ++ { ++ warn (_("Row index (%u) is larger than number of used entries (%u)\n"), ++ row, nused); ++ return 0; ++ } ++ + if (!do_display) + memcpy (&this_set[row - 1].signature, ph, sizeof (uint64_t)); ++ + prow = poffsets + (row - 1) * ncols * 4; ++ /* PR 17531: file: b8ce60a8. */ ++ if (prow < poffsets || prow > limit) ++ { ++ warn (_("Row index (%u) * num columns (%u) > space remaining in section\n"), ++ row, ncols); ++ return 0; ++ } ++ + if (do_display) + printf (_(" [%3d] 0x%s"), + i, dwarf_vmatoa64 (signature_high, signature_low, + buf, sizeof (buf))); + for (j = 0; j < ncols; j++) + { +- val = byte_get (prow + j * 4, 4); ++ SAFE_BYTE_GET (val, prow + j * 4, 4, limit); + if (do_display) + printf (" %8d", val); + else + { +- dw_sect = byte_get (ppool + j * 4, 4); +- this_set [row - 1].section_offsets [dw_sect] = val; ++ SAFE_BYTE_GET (dw_sect, ppool + j * 4, 4, limit); ++ ++ /* PR 17531: file: 10796eb3. */ ++ if (dw_sect >= DW_SECT_MAX) ++ warn (_("Overlarge Dwarf section index detected: %u\n"), dw_sect); ++ else ++ this_set [row - 1].section_offsets [dw_sect] = val; + } + } ++ + if (do_display) + printf ("\n"); + } +@@ -6677,51 +7135,62 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + ph = phash; + pi = pindex; + if (do_display) +- { ++ { + printf ("\n"); + printf (_(" Size table\n")); + printf (" slot %-16s ", + is_tu_index ? _("signature") : _("dwo_id")); +- } ++ } ++ + for (j = 0; j < ncols; j++) + { +- val = byte_get (ppool + j * 4, 4); ++ SAFE_BYTE_GET (val, ppool + j * 4, 4, limit); + if (do_display) + printf (" %8s", get_DW_SECT_short_name (val)); + } ++ + if (do_display) + printf ("\n"); ++ + for (i = 0; i < nslots; i++) + { +- byte_get_64 (ph, &signature_high, &signature_low); +- row = byte_get (pi, 4); ++ SAFE_BYTE_GET64 (ph, &signature_high, &signature_low, limit); ++ ++ SAFE_BYTE_GET (row, pi, 4, limit); + if (row != 0) + { + prow = psizes + (row - 1) * ncols * 4; ++ + if (do_display) + printf (_(" [%3d] 0x%s"), + i, dwarf_vmatoa64 (signature_high, signature_low, + buf, sizeof (buf))); ++ + for (j = 0; j < ncols; j++) + { +- val = byte_get (prow + j * 4, 4); ++ SAFE_BYTE_GET (val, prow + j * 4, 4, limit); + if (do_display) + printf (" %8d", val); + else + { +- dw_sect = byte_get (ppool + j * 4, 4); ++ SAFE_BYTE_GET (dw_sect, ppool + j * 4, 4, limit); ++ if (dw_sect >= DW_SECT_MAX) ++ warn (_("Overlarge Dwarf section index detected: %u\n"), dw_sect); ++ else + this_set [row - 1].section_sizes [dw_sect] = val; + } + } ++ + if (do_display) + printf ("\n"); + } ++ + ph += 8; + pi += 4; + } + } + else if (do_display) +- printf (_(" Unsupported version\n")); ++ printf (_(" Unsupported version (%d)\n"), version); + + if (do_display) + printf ("\n"); +@@ -6792,34 +7261,69 @@ display_debug_not_supported (struct dwarf_section *section, + return 1; + } + ++/* Like malloc, but takes two parameters like calloc. ++ Verifies that the first parameter is not too large. ++ Note: does *not* initialise the allocated memory to zero. */ + void * + cmalloc (size_t nmemb, size_t size) + { + /* Check for overflow. */ + if (nmemb >= ~(size_t) 0 / size) + return NULL; +- else +- return malloc (nmemb * size); ++ ++ return xmalloc (nmemb * size); + } + ++/* Like xmalloc, but takes two parameters like calloc. ++ Verifies that the first parameter is not too large. ++ Note: does *not* initialise the allocated memory to zero. */ + void * + xcmalloc (size_t nmemb, size_t size) + { + /* Check for overflow. */ + if (nmemb >= ~(size_t) 0 / size) +- return NULL; +- else +- return xmalloc (nmemb * size); ++ { ++ fprintf (stderr, ++ _("Attempt to allocate an array with an excessive number of elements: 0x%lx\n"), ++ (long) nmemb); ++ xexit (1); ++ } ++ ++ return xmalloc (nmemb * size); + } + ++/* Like xrealloc, but takes three parameters. ++ Verifies that the second parameter is not too large. ++ Note: does *not* initialise any new memory to zero. */ + void * + xcrealloc (void *ptr, size_t nmemb, size_t size) + { + /* Check for overflow. */ + if (nmemb >= ~(size_t) 0 / size) +- return NULL; +- else +- return xrealloc (ptr, nmemb * size); ++ { ++ fprintf (stderr, ++ _("Attempt to re-allocate an array with an excessive number of elements: 0x%lx\n"), ++ (long) nmemb); ++ xexit (1); ++ } ++ ++ return xrealloc (ptr, nmemb * size); ++} ++ ++/* Like xcalloc, but verifies that the first parameter is not too large. */ ++void * ++xcalloc2 (size_t nmemb, size_t size) ++{ ++ /* Check for overflow. */ ++ if (nmemb >= ~(size_t) 0 / size) ++ { ++ fprintf (stderr, ++ _("Attempt to allocate a zero'ed array with an excessive number of elements: 0x%lx\n"), ++ (long) nmemb); ++ xexit (1); ++ } ++ ++ return xcalloc (nmemb, size); + } + + void +@@ -6847,10 +7351,9 @@ free_debug_memory (void) + free (debug_information [i].range_lists); + } + } +- + free (debug_information); + debug_information = NULL; +- num_debug_info_entries = 0; ++ alloc_num_debug_info_entries = num_debug_info_entries = 0; + } + } + +@@ -6994,7 +7497,7 @@ dwarf_select_sections_by_letters (const char *letters) + break; + + default: +- warn (_("Unrecognized debug option '%s'\n"), optarg); ++ warn (_("Unrecognized debug option '%s'\n"), letters); + break; + } + } +@@ -7023,76 +7526,76 @@ dwarf_select_sections_all (void) + + struct dwarf_section_display debug_displays[] = + { +- { { ".debug_abbrev", ".zdebug_abbrev", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_abbrev", ".zdebug_abbrev", NULL, NULL, 0, 0, 0, NULL }, + display_debug_abbrev, &do_debug_abbrevs, 0 }, +- { { ".debug_aranges", ".zdebug_aranges", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_aranges", ".zdebug_aranges", NULL, NULL, 0, 0, 0, NULL }, + display_debug_aranges, &do_debug_aranges, 1 }, +- { { ".debug_frame", ".zdebug_frame", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_frame", ".zdebug_frame", NULL, NULL, 0, 0, 0, NULL }, + display_debug_frames, &do_debug_frames, 1 }, +- { { ".debug_info", ".zdebug_info", NULL, NULL, 0, 0, abbrev }, ++ { { ".debug_info", ".zdebug_info", NULL, NULL, 0, 0, abbrev, NULL }, + display_debug_info, &do_debug_info, 1 }, +- { { ".debug_line", ".zdebug_line", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_line", ".zdebug_line", NULL, NULL, 0, 0, 0, NULL }, + display_debug_lines, &do_debug_lines, 1 }, +- { { ".debug_pubnames", ".zdebug_pubnames", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_pubnames", ".zdebug_pubnames", NULL, NULL, 0, 0, 0, NULL }, + display_debug_pubnames, &do_debug_pubnames, 0 }, +- { { ".debug_gnu_pubnames", ".zdebug_gnu_pubnames", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_gnu_pubnames", ".zdebug_gnu_pubnames", NULL, NULL, 0, 0, 0, NULL }, + display_debug_gnu_pubnames, &do_debug_pubnames, 0 }, +- { { ".eh_frame", "", NULL, NULL, 0, 0, 0 }, ++ { { ".eh_frame", "", NULL, NULL, 0, 0, 0, NULL }, + display_debug_frames, &do_debug_frames, 1 }, +- { { ".debug_macinfo", ".zdebug_macinfo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_macinfo", ".zdebug_macinfo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_macinfo, &do_debug_macinfo, 0 }, +- { { ".debug_macro", ".zdebug_macro", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_macro", ".zdebug_macro", NULL, NULL, 0, 0, 0, NULL }, + display_debug_macro, &do_debug_macinfo, 1 }, +- { { ".debug_str", ".zdebug_str", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_str", ".zdebug_str", NULL, NULL, 0, 0, 0, NULL }, + display_debug_str, &do_debug_str, 0 }, +- { { ".debug_loc", ".zdebug_loc", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_loc", ".zdebug_loc", NULL, NULL, 0, 0, 0, NULL }, + display_debug_loc, &do_debug_loc, 1 }, +- { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0, 0, NULL }, + display_debug_pubnames, &do_debug_pubtypes, 0 }, +- { { ".debug_gnu_pubtypes", ".zdebug_gnu_pubtypes", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_gnu_pubtypes", ".zdebug_gnu_pubtypes", NULL, NULL, 0, 0, 0, NULL }, + display_debug_gnu_pubnames, &do_debug_pubtypes, 0 }, +- { { ".debug_ranges", ".zdebug_ranges", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_ranges", ".zdebug_ranges", NULL, NULL, 0, 0, 0, NULL }, + display_debug_ranges, &do_debug_ranges, 1 }, +- { { ".debug_static_func", ".zdebug_static_func", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_static_func", ".zdebug_static_func", NULL, NULL, 0, 0, 0, NULL }, + display_debug_not_supported, NULL, 0 }, +- { { ".debug_static_vars", ".zdebug_static_vars", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_static_vars", ".zdebug_static_vars", NULL, NULL, 0, 0, 0, NULL }, + display_debug_not_supported, NULL, 0 }, +- { { ".debug_types", ".zdebug_types", NULL, NULL, 0, 0, abbrev }, ++ { { ".debug_types", ".zdebug_types", NULL, NULL, 0, 0, abbrev, NULL }, + display_debug_types, &do_debug_info, 1 }, +- { { ".debug_weaknames", ".zdebug_weaknames", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_weaknames", ".zdebug_weaknames", NULL, NULL, 0, 0, 0, NULL }, + display_debug_not_supported, NULL, 0 }, +- { { ".gdb_index", "", NULL, NULL, 0, 0, 0 }, ++ { { ".gdb_index", "", NULL, NULL, 0, 0, 0, NULL }, + display_gdb_index, &do_gdb_index, 0 }, +- { { ".trace_info", "", NULL, NULL, 0, 0, trace_abbrev }, ++ { { ".trace_info", "", NULL, NULL, 0, 0, trace_abbrev, NULL }, + display_trace_info, &do_trace_info, 1 }, +- { { ".trace_abbrev", "", NULL, NULL, 0, 0, 0 }, ++ { { ".trace_abbrev", "", NULL, NULL, 0, 0, 0, NULL }, + display_debug_abbrev, &do_trace_abbrevs, 0 }, +- { { ".trace_aranges", "", NULL, NULL, 0, 0, 0 }, ++ { { ".trace_aranges", "", NULL, NULL, 0, 0, 0, NULL }, + display_debug_aranges, &do_trace_aranges, 0 }, +- { { ".debug_info.dwo", ".zdebug_info.dwo", NULL, NULL, 0, 0, abbrev_dwo }, ++ { { ".debug_info.dwo", ".zdebug_info.dwo", NULL, NULL, 0, 0, abbrev_dwo, NULL }, + display_debug_info, &do_debug_info, 1 }, +- { { ".debug_abbrev.dwo", ".zdebug_abbrev.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_abbrev.dwo", ".zdebug_abbrev.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_abbrev, &do_debug_abbrevs, 0 }, +- { { ".debug_types.dwo", ".zdebug_types.dwo", NULL, NULL, 0, 0, abbrev_dwo }, ++ { { ".debug_types.dwo", ".zdebug_types.dwo", NULL, NULL, 0, 0, abbrev_dwo, NULL }, + display_debug_types, &do_debug_info, 1 }, +- { { ".debug_line.dwo", ".zdebug_line.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_line.dwo", ".zdebug_line.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_lines, &do_debug_lines, 1 }, +- { { ".debug_loc.dwo", ".zdebug_loc.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_loc.dwo", ".zdebug_loc.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_loc, &do_debug_loc, 1 }, +- { { ".debug_macro.dwo", ".zdebug_macro.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_macro.dwo", ".zdebug_macro.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_macro, &do_debug_macinfo, 1 }, +- { { ".debug_macinfo.dwo", ".zdebug_macinfo.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_macinfo.dwo", ".zdebug_macinfo.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_macinfo, &do_debug_macinfo, 0 }, +- { { ".debug_str.dwo", ".zdebug_str.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_str.dwo", ".zdebug_str.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_str, &do_debug_str, 1 }, +- { { ".debug_str_offsets", ".zdebug_str_offsets", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_str_offsets", ".zdebug_str_offsets", NULL, NULL, 0, 0, 0, NULL }, + display_debug_str_offsets, NULL, 0 }, +- { { ".debug_str_offsets.dwo", ".zdebug_str_offsets.dwo", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_str_offsets.dwo", ".zdebug_str_offsets.dwo", NULL, NULL, 0, 0, 0, NULL }, + display_debug_str_offsets, NULL, 0 }, +- { { ".debug_addr", ".zdebug_addr", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_addr", ".zdebug_addr", NULL, NULL, 0, 0, 0, NULL }, + display_debug_addr, &do_debug_addr, 1 }, +- { { ".debug_cu_index", "", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_cu_index", "", NULL, NULL, 0, 0, 0, NULL }, + display_cu_index, &do_debug_cu_index, 0 }, +- { { ".debug_tu_index", "", NULL, NULL, 0, 0, 0 }, ++ { { ".debug_tu_index", "", NULL, NULL, 0, 0, 0, NULL }, + display_cu_index, &do_debug_cu_index, 0 }, + }; +diff --git a/binutils/dwarf.h b/binutils/dwarf.h +index 124d9d6..2084a22 100644 +--- a/binutils/dwarf.h ++++ b/binutils/dwarf.h +@@ -25,22 +25,9 @@ typedef unsigned HOST_WIDEST_INT dwarf_size_type; + /* Structure found in the .debug_line section. */ + typedef struct + { +- unsigned char li_length [4]; +- unsigned char li_version [2]; +- unsigned char li_prologue_length [4]; +- unsigned char li_min_insn_length [1]; +- unsigned char li_default_is_stmt [1]; +- unsigned char li_line_base [1]; +- unsigned char li_line_range [1]; +- unsigned char li_opcode_base [1]; +-} +-DWARF2_External_LineInfo; +- +-typedef struct +-{ + dwarf_vma li_length; + unsigned short li_version; +- unsigned int li_prologue_length; ++ dwarf_vma li_prologue_length; + unsigned char li_min_insn_length; + unsigned char li_max_ops_per_insn; + unsigned char li_default_is_stmt; +@@ -53,15 +40,6 @@ DWARF2_Internal_LineInfo; + /* Structure found in .debug_pubnames section. */ + typedef struct + { +- unsigned char pn_length [4]; +- unsigned char pn_version [2]; +- unsigned char pn_offset [4]; +- unsigned char pn_size [4]; +-} +-DWARF2_External_PubNames; +- +-typedef struct +-{ + dwarf_vma pn_length; + unsigned short pn_version; + dwarf_vma pn_offset; +@@ -72,15 +50,6 @@ DWARF2_Internal_PubNames; + /* Structure found in .debug_info section. */ + typedef struct + { +- unsigned char cu_length [4]; +- unsigned char cu_version [2]; +- unsigned char cu_abbrev_offset [4]; +- unsigned char cu_pointer_size [1]; +-} +-DWARF2_External_CompUnit; +- +-typedef struct +-{ + dwarf_vma cu_length; + unsigned short cu_version; + dwarf_vma cu_abbrev_offset; +@@ -88,16 +57,7 @@ typedef struct + } + DWARF2_Internal_CompUnit; + +-typedef struct +-{ +- unsigned char ar_length [4]; +- unsigned char ar_version [2]; +- unsigned char ar_info_offset [4]; +- unsigned char ar_pointer_size [1]; +- unsigned char ar_segment_size [1]; +-} +-DWARF2_External_ARange; +- ++/* Structure found in .debug_aranges section. */ + typedef struct + { + dwarf_vma ar_length; +@@ -164,6 +124,8 @@ struct dwarf_section + dwarf_vma address; + dwarf_size_type size; + enum dwarf_section_display_enum abbrev_sec; ++ /* A spare field for random use. */ ++ void *user_data; + }; + + /* A structure containing the name of a debug section +@@ -205,7 +167,7 @@ typedef struct + } + debug_info; + +-extern int eh_addr_size; ++extern unsigned int eh_addr_size; + + extern int do_debug_info; + extern int do_debug_abbrevs; +@@ -246,10 +208,11 @@ extern void dwarf_select_sections_by_names (const char *); + extern void dwarf_select_sections_by_letters (const char *); + extern void dwarf_select_sections_all (void); + +-unsigned int * find_cu_tu_set (void *, unsigned int); ++extern unsigned int * find_cu_tu_set (void *, unsigned int); + +-void * cmalloc (size_t, size_t); +-void * xcmalloc (size_t, size_t); +-void * xcrealloc (void *, size_t, size_t); ++extern void * cmalloc (size_t, size_t); ++extern void * xcalloc2 (size_t, size_t); ++extern void * xcmalloc (size_t, size_t); ++extern void * xcrealloc (void *, size_t, size_t); + + extern dwarf_vma read_leb128 (unsigned char *, unsigned int *, bfd_boolean, const unsigned char * const); +diff --git a/binutils/elfcomm.c b/binutils/elfcomm.c +index f1502b9..063662a 100644 +--- a/binutils/elfcomm.c ++++ b/binutils/elfcomm.c +@@ -51,7 +51,7 @@ warn (const char *message, ...) + + /* Try to keep warning messages in sync with the program's normal output. */ + fflush (stdout); +- ++ + va_start (args, message); + fprintf (stderr, _("%s: Warning: "), program_name); + vfprintf (stderr, message, args); +@@ -386,10 +386,11 @@ byte_get_64 (unsigned char *field, elf_vma *high, elf_vma *low) + + char * + adjust_relative_path (const char *file_name, const char *name, +- int name_len) ++ unsigned long name_len) + { + char * member_file_name; + const char * base_name = lbasename (file_name); ++ size_t amt; + + /* This is a proxy entry for a thin archive member. + If the extended name table contains an absolute path +@@ -399,7 +400,10 @@ adjust_relative_path (const char *file_name, const char *name, + archive is located. */ + if (IS_ABSOLUTE_PATH (name) || base_name == file_name) + { +- member_file_name = (char *) malloc (name_len + 1); ++ amt = name_len + 1; ++ if (amt == 0) ++ return NULL; ++ member_file_name = (char *) malloc (amt); + if (member_file_name == NULL) + { + error (_("Out of memory\n")); +@@ -413,7 +417,18 @@ adjust_relative_path (const char *file_name, const char *name, + /* Concatenate the path components of the archive file name + to the relative path name from the extended name table. */ + size_t prefix_len = base_name - file_name; +- member_file_name = (char *) malloc (prefix_len + name_len + 1); ++ ++ amt = prefix_len + name_len + 1; ++ /* PR 17531: file: 2896dc8b ++ Catch wraparound. */ ++ if (amt < prefix_len || amt < name_len) ++ { ++ error (_("Abnormal length of thin archive member name: %lx\n"), ++ name_len); ++ return NULL; ++ } ++ ++ member_file_name = (char *) malloc (amt); + if (member_file_name == NULL) + { + error (_("Out of memory\n")); +@@ -445,6 +460,14 @@ process_archive_index_and_symbols (struct archive_info * arch, + unsigned long size; + + size = strtoul (arch->arhdr.ar_size, NULL, 10); ++ /* PR 17531: file: 912bd7de. */ ++ if ((signed long) size < 0) ++ { ++ error (_("%s: invalid archive header size: %ld\n"), ++ arch->file_name, size); ++ return FALSE; ++ } ++ + size = size + (size & 1); + + arch->next_arhdr_offset += sizeof arch->arhdr + size; +@@ -468,7 +491,7 @@ process_archive_index_and_symbols (struct archive_info * arch, + unsigned char * index_buffer; + + assert (sizeof_ar_index <= sizeof integer_buffer); +- ++ + /* Check the size of the archive index. */ + if (size < sizeof_ar_index) + { +@@ -487,9 +510,11 @@ process_archive_index_and_symbols (struct archive_info * arch, + arch->index_num = byte_get_big_endian (integer_buffer, sizeof_ar_index); + size -= sizeof_ar_index; + +- if (size < arch->index_num * sizeof_ar_index) ++ if (size < arch->index_num * sizeof_ar_index ++ /* PR 17531: file: 585515d1. */ ++ || size < arch->index_num) + { +- error (_("%s: the archive index is supposed to have %ld entries of %d bytes, but the size is only %ld\n"), ++ error (_("%s: the archive index is supposed to have 0x%lx entries of %d bytes, but the size is only 0x%lx\n"), + arch->file_name, (long) arch->index_num, sizeof_ar_index, size); + return FALSE; + } +@@ -623,9 +648,25 @@ setup_archive (struct archive_info *arch, const char *file_name, + { + /* This is the archive string table holding long member names. */ + arch->longnames_size = strtoul (arch->arhdr.ar_size, NULL, 10); ++ /* PR 17531: file: 01068045. */ ++ if (arch->longnames_size < 8) ++ { ++ error (_("%s: long name table is too small, (size = %ld)\n"), ++ file_name, arch->longnames_size); ++ return 1; ++ } ++ /* PR 17531: file: 639d6a26. */ ++ if ((signed long) arch->longnames_size < 0) ++ { ++ error (_("%s: long name table is too big, (size = 0x%lx)\n"), ++ file_name, arch->longnames_size); ++ return 1; ++ } ++ + arch->next_arhdr_offset += sizeof arch->arhdr + arch->longnames_size; + +- arch->longnames = (char *) malloc (arch->longnames_size); ++ /* Plus one to allow for a string terminator. */ ++ arch->longnames = (char *) malloc (arch->longnames_size + 1); + if (arch->longnames == NULL) + { + error (_("Out of memory reading long symbol names in archive\n")); +@@ -643,6 +684,8 @@ setup_archive (struct archive_info *arch, const char *file_name, + + if ((arch->longnames_size & 1) != 0) + getc (file); ++ ++ arch->longnames[arch->longnames_size] = 0; + } + + return 0; +@@ -713,23 +756,37 @@ get_archive_member_name (struct archive_info *arch, + error (_("Archive member uses long names, but no longname table found\n")); + return NULL; + } +- ++ + arch->nested_member_origin = 0; + k = j = strtoul (arch->arhdr.ar_name + 1, &endp, 10); + if (arch->is_thin_archive && endp != NULL && * endp == ':') + arch->nested_member_origin = strtoul (endp + 1, NULL, 10); + ++ if (j > arch->longnames_size) ++ { ++ error (_("Found long name index (%ld) beyond end of long name table\n"),j); ++ return NULL; ++ } + while ((j < arch->longnames_size) + && (arch->longnames[j] != '\n') + && (arch->longnames[j] != '\0')) + j++; +- if (arch->longnames[j-1] == '/') ++ if (j > 0 && arch->longnames[j-1] == '/') + j--; ++ if (j > arch->longnames_size) ++ j = arch->longnames_size; + arch->longnames[j] = '\0'; + + if (!arch->is_thin_archive || arch->nested_member_origin == 0) + return arch->longnames + k; + ++ /* PR 17531: file: 2896dc8b. */ ++ if (k >= j) ++ { ++ error (_("Invalid Thin archive member name\n")); ++ return NULL; ++ } ++ + /* This is a proxy for a member of a nested archive. + Find the name of the member in that archive. */ + member_file_name = adjust_relative_path (arch->file_name, +diff --git a/binutils/elfcomm.h b/binutils/elfcomm.h +index f41a8ac..f7f7544 100644 +--- a/binutils/elfcomm.h ++++ b/binutils/elfcomm.h +@@ -29,7 +29,7 @@ + void error (const char *, ...) ATTRIBUTE_PRINTF_1; + void warn (const char *, ...) ATTRIBUTE_PRINTF_1; + +-#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) ++#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG + /* We can't use any bfd types here since readelf may define BFD64 and + objdump may not. */ + #define HOST_WIDEST_INT long long +@@ -77,7 +77,7 @@ struct archive_info + }; + + /* Return the path name for a proxy entry in a thin archive. */ +-extern char *adjust_relative_path (const char *, const char *, int); ++extern char *adjust_relative_path (const char *, const char *, unsigned long); + + /* Read the symbol table and long-name table from an archive. */ + extern int setup_archive (struct archive_info *, const char *, FILE *, +diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c +index 0513f29..fecb110 100644 +--- a/binutils/nlmconv.c ++++ b/binutils/nlmconv.c +@@ -211,6 +211,7 @@ main (int argc, char **argv) + + program_name = argv[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +@@ -1415,6 +1416,9 @@ i386_mangle_relocs (bfd *outbfd, asection *insec, arelent ***relocs_ptr, + bfd_vma addend; + + rel = *relocs++; ++ /* PR 17512: file: 057f89c1. */ ++ if (rel->sym_ptr_ptr == NULL) ++ continue; + sym = *rel->sym_ptr_ptr; + + /* We're moving the relocs from the input section to the output +@@ -1871,7 +1875,7 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, + + toc_howto = bfd_reloc_type_lookup (insec->owner, BFD_RELOC_PPC_TOC16); + if (toc_howto == (reloc_howto_type *) NULL) +- abort (); ++ fatal (_("Unable to locate PPC_TOC16 reloc information")); + + /* If this is the .got section, clear out all the contents beyond + the initial size. We must do this here because copy_sections is +@@ -1910,6 +1914,10 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, + } + } + ++ /* PR 17512: file: 70cfde95. */ ++ if (rel->howto == NULL) ++ continue; ++ + /* We must be able to resolve all PC relative relocs at this + point. If we get a branch to an undefined symbol we build a + stub, since NetWare will resolve undefined symbols into a +@@ -1927,6 +1935,13 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, + { + bfd_vma val; + ++ if (rel->address > contents_size - 4) ++ { ++ non_fatal (_("Out of range relocation: %lx"), ++ (long) rel->address); ++ break; ++ } ++ + assert (rel->howto->size == 2 && rel->howto->pcrel_offset); + val = bfd_get_32 (outbfd, (bfd_byte *) contents + rel->address); + val = ((val &~ rel->howto->dst_mask) +@@ -1976,6 +1991,13 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, + switch (rel->howto->size) + { + case 1: ++ if (rel->address > contents_size - 2) ++ { ++ non_fatal (_("Out of range relocation: %lx"), ++ (long) rel->address); ++ break; ++ } ++ + val = bfd_get_16 (outbfd, + (bfd_byte *) contents + rel->address); + val = ((val &~ rel->howto->dst_mask) +@@ -1991,6 +2013,14 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, + break; + + case 2: ++ /* PR 17512: file: 0455a112. */ ++ if (rel->address > contents_size - 4) ++ { ++ non_fatal (_("Out of range relocation: %lx"), ++ (long) rel->address); ++ break; ++ } ++ + val = bfd_get_32 (outbfd, + (bfd_byte *) contents + rel->address); + val = ((val &~ rel->howto->dst_mask) +@@ -2002,7 +2032,7 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, + break; + + default: +- abort (); ++ fatal (_("Unsupported relocation size: %d"), rel->howto->size); + } + + if (! bfd_is_und_section (bfd_get_section (sym))) +diff --git a/binutils/nm.c b/binutils/nm.c +index ecd147e..ed1ed12 100644 +--- a/binutils/nm.c ++++ b/binutils/nm.c +@@ -806,7 +806,11 @@ get_relocs (bfd *abfd, asection *sec, void *dataarg) + /* Print a single symbol. */ + + static void +-print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) ++print_symbol (bfd * abfd, ++ asymbol * sym, ++ bfd_vma ssize, ++ bfd * archive_bfd, ++ bfd_boolean is_synthetic) + { + symbol_info syminfo; + struct extended_symbol_info info; +@@ -816,12 +820,12 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) + format->print_symbol_filename (archive_bfd, abfd); + + bfd_get_symbol_info (abfd, sym, &syminfo); ++ + info.sinfo = &syminfo; + info.ssize = ssize; +- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) +- info.elfinfo = (elf_symbol_type *) sym; +- else +- info.elfinfo = NULL; ++ /* Synthetic symbols do not have a full elf_symbol_type set of data available. */ ++ info.elfinfo = is_synthetic ? NULL : elf_symbol_from (abfd, sym); ++ + format->print_symbol_info (&info, abfd); + + if (line_numbers) +@@ -941,12 +945,17 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) + /* Print the symbols when sorting by size. */ + + static void +-print_size_symbols (bfd *abfd, bfd_boolean is_dynamic, +- struct size_sym *symsizes, long symcount, +- bfd *archive_bfd) ++print_size_symbols (bfd * abfd, ++ bfd_boolean is_dynamic, ++ struct size_sym * symsizes, ++ long symcount, ++ long synth_count, ++ bfd * archive_bfd) + { + asymbol *store; +- struct size_sym *from, *fromend; ++ struct size_sym *from; ++ struct size_sym *fromend; ++ struct size_sym *fromsynth; + + store = bfd_make_empty_symbol (abfd); + if (store == NULL) +@@ -954,6 +963,8 @@ print_size_symbols (bfd *abfd, bfd_boolean is_dynamic, + + from = symsizes; + fromend = from + symcount; ++ fromsynth = symsizes + (symcount - synth_count); ++ + for (; from < fromend; from++) + { + asymbol *sym; +@@ -962,20 +973,34 @@ print_size_symbols (bfd *abfd, bfd_boolean is_dynamic, + if (sym == NULL) + bfd_fatal (bfd_get_filename (abfd)); + +- print_symbol (abfd, sym, from->size, archive_bfd); ++ print_symbol (abfd, sym, from->size, archive_bfd, from >= fromsynth); + } + } + + +-/* Print the symbols. If ARCHIVE_BFD is non-NULL, it is the archive +- containing ABFD. */ ++/* Print the symbols of ABFD that are held in MINISYMS. ++ ++ If ARCHIVE_BFD is non-NULL, it is the archive containing ABFD. ++ ++ SYMCOUNT is the number of symbols in MINISYMS and SYNTH_COUNT ++ is the number of these that are synthetic. Synthetic symbols, ++ if any are present, always come at the end of the MINISYMS. ++ ++ SIZE is the size of a symbol in MINISYMS. */ + + static void +-print_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, +- unsigned int size, bfd *archive_bfd) ++print_symbols (bfd * abfd, ++ bfd_boolean is_dynamic, ++ void * minisyms, ++ long symcount, ++ long synth_count, ++ unsigned int size, ++ bfd * archive_bfd) + { + asymbol *store; +- bfd_byte *from, *fromend; ++ bfd_byte *from; ++ bfd_byte *fromend; ++ bfd_byte *fromsynth; + + store = bfd_make_empty_symbol (abfd); + if (store == NULL) +@@ -983,6 +1008,8 @@ print_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, + + from = (bfd_byte *) minisyms; + fromend = from + symcount * size; ++ fromsynth = (bfd_byte *) minisyms + ((symcount - synth_count) * size); ++ + for (; from < fromend; from += size) + { + asymbol *sym; +@@ -991,7 +1018,7 @@ print_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, + if (sym == NULL) + bfd_fatal (bfd_get_filename (abfd)); + +- print_symbol (abfd, sym, (bfd_vma) 0, archive_bfd); ++ print_symbol (abfd, sym, (bfd_vma) 0, archive_bfd, from >= fromsynth); + } + } + +@@ -1001,6 +1028,7 @@ static void + display_rel_file (bfd *abfd, bfd *archive_bfd) + { + long symcount; ++ long synth_count = 0; + void *minisyms; + unsigned int size; + struct size_sym *symsizes; +@@ -1031,11 +1059,10 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) + non_fatal (_("%s: no symbols"), bfd_get_filename (abfd)); + return; + } +- ++ + if (show_synthetic && size == sizeof (asymbol *)) + { + asymbol *synthsyms; +- long synth_count; + asymbol **static_syms = NULL; + asymbol **dyn_syms = NULL; + long static_count = 0; +@@ -1061,6 +1088,7 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) + bfd_fatal (bfd_get_filename (abfd)); + } + } ++ + synth_count = bfd_get_synthetic_symtab (abfd, static_count, static_syms, + dyn_count, dyn_syms, &synthsyms); + if (synth_count > 0) +@@ -1106,9 +1134,9 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) + } + + if (! sort_by_size) +- print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd); ++ print_symbols (abfd, dynamic, minisyms, symcount, synth_count, size, archive_bfd); + else +- print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd); ++ print_size_symbols (abfd, dynamic, symsizes, symcount, synth_count, archive_bfd); + + free (minisyms); + free (symsizes); +@@ -1181,6 +1209,8 @@ display_archive (bfd *file) + bfd_close (last_arfile); + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; ++ if (arfile == last_arfile) ++ return; + } + last_arfile = arfile; + } +@@ -1434,7 +1464,6 @@ print_symbol_info_bsd (struct extended_symbol_info *info, bfd *abfd) + print_value (abfd, SYM_SIZE (info)); + else + print_value (abfd, SYM_VALUE (info)); +- + if (print_size && SYM_SIZE (info)) + { + printf (" "); +@@ -1541,6 +1570,7 @@ main (int argc, char **argv) + + program_name = *argv; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + #if BFD_SUPPORTS_PLUGINS + bfd_plugin_set_program_name (program_name); + #endif +diff --git a/binutils/objcopy.c b/binutils/objcopy.c +index 07794cb..da429f5 100644 +--- a/binutils/objcopy.c ++++ b/binutils/objcopy.c +@@ -1776,6 +1776,14 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) + bfd_nonfatal_message (NULL, ibfd, NULL, NULL); + return FALSE; + } ++ /* PR 17512: file: d6323821 ++ If the symbol table could not be loaded do not pretend that we have ++ any symbols. This trips us up later on when we load the relocs. */ ++ if (symcount == 0) ++ { ++ free (isympp); ++ osympp = isympp = NULL; ++ } + + /* BFD mandates that all output sections be created and sizes set before + any output is done. Thus, we traverse all sections multiple times. */ +@@ -2552,7 +2560,11 @@ copy_file (const char *input_filename, const char *output_filename, + if (! copy_object (ibfd, obfd, input_arch)) + status = 1; + +- if (!bfd_close (obfd)) ++ /* PR 17512: file: 0f15796a. ++ If the file could not be copied it may not be in a writeable ++ state. So use bfd_close_all_done to avoid the possibility of ++ writing uninitialised data into the file. */ ++ if (! (status ? bfd_close_all_done (obfd) : bfd_close (obfd))) + { + status = 1; + bfd_nonfatal_message (output_filename, NULL, NULL, NULL); +@@ -2948,9 +2960,13 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg) + + temp_relpp = (arelent **) xmalloc (relsize); + for (i = 0; i < relcount; i++) +- if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr), +- keep_specific_htab)) +- temp_relpp [temp_relcount++] = relpp [i]; ++ { ++ /* PR 17512: file: 9e907e0c. */ ++ if (relpp[i]->sym_ptr_ptr) ++ if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr), ++ keep_specific_htab)) ++ temp_relpp [temp_relcount++] = relpp [i]; ++ } + relcount = temp_relcount; + free (relpp); + relpp = temp_relpp; +@@ -4399,6 +4415,9 @@ main (int argc, char *argv[]) + + create_symbol_htabs (); + ++ if (argv != NULL) ++ bfd_set_error_program_name (argv[0]); ++ + if (is_strip) + strip_main (argc, argv); + else +diff --git a/binutils/objdump.c b/binutils/objdump.c +index da68f39..44107cf 100644 +--- a/binutils/objdump.c ++++ b/binutils/objdump.c +@@ -2265,6 +2265,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, + section->address = bfd_get_section_vma (abfd, sec); + section->size = bfd_get_section_size (sec); + section->start = NULL; ++ section->user_data = sec; + ret = bfd_get_full_section_contents (abfd, sec, §ion->start); + + if (! ret) +@@ -2331,6 +2332,23 @@ free_debug_section (enum dwarf_section_display_enum debug) + if (section->start == NULL) + return; + ++ /* PR 17512: file: 0f67f69d. */ ++ if (section->user_data != NULL) ++ { ++ asection * sec = (asection *) section->user_data; ++ ++ /* If we are freeing contents that are also pointed to by the BFD ++ library's section structure then make sure to update those pointers ++ too. Otherwise, the next time we try to load data for this section ++ we can end up using a stale pointer. */ ++ if (section->start == sec->contents) ++ { ++ sec->contents = NULL; ++ sec->flags &= ~ SEC_IN_MEMORY; ++ sec->compress_status = COMPRESS_SECTION_NONE; ++ } ++ } ++ + free ((char *) section->start); + section->start = NULL; + section->address = 0; +@@ -2766,7 +2784,8 @@ dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED) + + if (!bfd_get_full_section_contents (abfd, section, &data)) + { +- non_fatal (_("Reading section failed")); ++ non_fatal (_("Reading section %s failed because: %s"), ++ section->name, bfd_errmsg (bfd_get_error ())); + return; + } + +@@ -3375,6 +3394,13 @@ display_any_bfd (bfd *file, int level) + + if (level == 0) + printf (_("In archive %s:\n"), bfd_get_filename (file)); ++ else if (level > 100) ++ { ++ /* Prevent corrupted files from spinning us into an ++ infinite loop. 100 is an arbitrary heuristic. */ ++ fatal (_("Archive nesting is too deep")); ++ return; ++ } + else + printf (_("In nested archive %s:\n"), bfd_get_filename (file)); + +@@ -3393,7 +3419,15 @@ display_any_bfd (bfd *file, int level) + display_any_bfd (arfile, level + 1); + + if (last_arfile != NULL) +- bfd_close (last_arfile); ++ { ++ bfd_close (last_arfile); ++ /* PR 17512: file: ac585d01. */ ++ if (arfile == last_arfile) ++ { ++ last_arfile = NULL; ++ break; ++ } ++ } + last_arfile = arfile; + } + +@@ -3446,6 +3480,7 @@ main (int argc, char **argv) + + program_name = *argv; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + START_PROGRESS (program_name, 0); + +diff --git a/binutils/prdbg.c b/binutils/prdbg.c +index fab60a6..b43030b 100644 +--- a/binutils/prdbg.c ++++ b/binutils/prdbg.c +@@ -291,7 +291,8 @@ static const struct debug_write_fns tg_fns = + + bfd_boolean + print_debugging_info (FILE *f, void *dhandle, bfd *abfd, asymbol **syms, +- void *demangler, bfd_boolean as_tags) ++ char * (*demangler) (struct bfd *, const char *, int), ++ bfd_boolean as_tags) + { + struct pr_handle info; + +@@ -302,7 +303,7 @@ print_debugging_info (FILE *f, void *dhandle, bfd *abfd, asymbol **syms, + info.filename = NULL; + info.abfd = abfd; + info.syms = syms; +- info.demangler = (char * (*)(struct bfd *, const char *, int)) demangler; ++ info.demangler = demangler; + + if (as_tags) + { +diff --git a/binutils/rcparse.y b/binutils/rcparse.y +index 2d17909..23bd69f 100644 +--- a/binutils/rcparse.y ++++ b/binutils/rcparse.y +@@ -1887,12 +1887,12 @@ sizednumexpr: + } + | sizednumexpr '/' sizednumexpr + { +- $$.val = $1.val / $3.val; ++ $$.val = $1.val / ($3.val ? $3.val : 1); + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '%' sizednumexpr + { +- $$.val = $1.val % $3.val; ++ $$.val = $1.val % ($3.val ? $3.val : 1); + $$.dword = $1.dword || $3.dword; + } + | sizednumexpr '+' sizednumexpr +@@ -1966,12 +1966,13 @@ sizedposnumexpr: + } + | sizedposnumexpr '/' sizednumexpr + { +- $$.val = $1.val / $3.val; ++ $$.val = $1.val / ($3.val ? $3.val : 1); + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '%' sizednumexpr + { +- $$.val = $1.val % $3.val; ++ /* PR 17512: file: 89105a25. */ ++ $$.val = $1.val % ($3.val ? $3.val : 1); + $$.dword = $1.dword || $3.dword; + } + | sizedposnumexpr '+' sizednumexpr +diff --git a/binutils/readelf.c b/binutils/readelf.c +index 0c00b2f..2f8257a 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -165,7 +165,7 @@ + #endif + + char * program_name = "readelf"; +-static long archive_file_offset; ++static unsigned long archive_file_offset; + static unsigned long archive_file_size; + static bfd_size_type current_file_size; + static unsigned long dynamic_addr; +@@ -299,36 +299,62 @@ print_mode; + } \ + while (0) + +-/* Retrieve NMEMB structures, each SIZE bytes long from FILE starting at OFFSET. ++/* Retrieve NMEMB structures, each SIZE bytes long from FILE starting at OFFSET + ++ the offset of the current archive member, if we are examining an archive. + Put the retrieved data into VAR, if it is not NULL. Otherwise allocate a buffer + using malloc and fill that. In either case return the pointer to the start of + the retrieved data or NULL if something went wrong. If something does go wrong +- emit an error message using REASON as part of the context. */ ++ and REASON is not NULL then emit an error message using REASON as part of the ++ context. */ + + static void * +-get_data (void * var, FILE * file, long offset, size_t size, size_t nmemb, +- const char * reason) ++get_data (void * var, FILE * file, unsigned long offset, bfd_size_type size, ++ bfd_size_type nmemb, const char * reason) + { + void * mvar; ++ bfd_size_type amt = size * nmemb; + + if (size == 0 || nmemb == 0) + return NULL; + +- if (fseek (file, archive_file_offset + offset, SEEK_SET)) ++ /* If the size_t type is smaller than the bfd_size_type, eg because ++ you are building a 32-bit tool on a 64-bit host, then make sure ++ that when the sizes are cast to (size_t) no information is lost. */ ++ if (sizeof (size_t) < sizeof (bfd_size_type) ++ && ( (bfd_size_type) ((size_t) size) != size ++ || (bfd_size_type) ((size_t) nmemb) != nmemb)) + { + if (reason) +- error (_("Unable to seek to 0x%lx for %s\n"), +- (unsigned long) archive_file_offset + offset, reason); ++ error (_("Size truncation prevents reading 0x%llx elements of size 0x%llx for %s\n"), ++ (unsigned long long) nmemb, (unsigned long long) size, reason); ++ return NULL; ++ } ++ ++ /* Check for size overflow. */ ++ if (amt < nmemb) ++ { ++ if (reason) ++ error (_("Size overflow prevents reading 0x%llx elements of size 0x%llx for %s\n"), ++ (unsigned long long) nmemb, (unsigned long long) size, reason); + return NULL; + } + + /* Be kind to memory chekers (eg valgrind, address sanitizer) by not + attempting to allocate memory when the read is bound to fail. */ +- if (offset + archive_file_offset + size * nmemb > current_file_size) ++ if (amt > current_file_size ++ || offset + archive_file_offset + amt > current_file_size) + { + if (reason) +- error (_("Reading 0x%lx bytes extends past end of file for %s\n"), +- (unsigned long) (size * nmemb), reason); ++ error (_("Reading 0x%llx bytes extends past end of file for %s\n"), ++ (unsigned long long) amt, reason); ++ return NULL; ++ } ++ ++ if (fseek (file, archive_file_offset + offset, SEEK_SET)) ++ { ++ if (reason) ++ error (_("Unable to seek to 0x%lx for %s\n"), ++ (unsigned long) archive_file_offset + offset, reason); + return NULL; + } + +@@ -336,26 +362,26 @@ get_data (void * var, FILE * file, long offset, size_t size, size_t nmemb, + if (mvar == NULL) + { + /* Check for overflow. */ +- if (nmemb < (~(size_t) 0 - 1) / size) ++ if (nmemb < (~(bfd_size_type) 0 - 1) / size) + /* + 1 so that we can '\0' terminate invalid string table sections. */ +- mvar = malloc (size * nmemb + 1); ++ mvar = malloc ((size_t) amt + 1); + + if (mvar == NULL) + { + if (reason) +- error (_("Out of memory allocating 0x%lx bytes for %s\n"), +- (unsigned long)(size * nmemb), reason); ++ error (_("Out of memory allocating 0x%llx bytes for %s\n"), ++ (unsigned long long) amt, reason); + return NULL; + } + +- ((char *) mvar)[size * nmemb] = '\0'; ++ ((char *) mvar)[amt] = '\0'; + } + +- if (fread (mvar, size, nmemb, file) != nmemb) ++ if (fread (mvar, (size_t) size, (size_t) nmemb, file) != nmemb) + { + if (reason) +- error (_("Unable to read in 0x%lx bytes of %s\n"), +- (unsigned long)(size * nmemb), reason); ++ error (_("Unable to read in 0x%llx bytes of %s\n"), ++ (unsigned long long) amt, reason); + if (mvar != var) + free (mvar); + return NULL; +@@ -525,7 +551,7 @@ printable_section_name (Elf_Internal_Shdr * sec) + { + if (remaining < 2) + break; +- ++ + * buf ++ = '^'; + * buf ++ = c + 0x40; + remaining -= 2; +@@ -1539,7 +1565,10 @@ dump_relocations (FILE * file, + { + bfd_signed_vma off = rels[i].r_addend; + +- if (off < 0) ++ /* PR 17531: file: 2e63226f. */ ++ if (off == ((bfd_signed_vma) 1) << ((sizeof (bfd_signed_vma) * 8) - 1)) ++ printf (" + %" BFD_VMA_FMT "x", off); ++ else if (off < 0) + printf (" - %" BFD_VMA_FMT "x", - off); + else + printf (" + %" BFD_VMA_FMT "x", off); +@@ -1551,7 +1580,10 @@ dump_relocations (FILE * file, + bfd_signed_vma off = rels[i].r_addend; + + printf ("%*c", is_32bit_elf ? 12 : 20, ' '); +- if (off < 0) ++ /* PR 17531: file: 2e63226f. */ ++ if (off == ((bfd_signed_vma) 1) << ((sizeof (bfd_signed_vma) * 8) - 1)) ++ printf ("%" BFD_VMA_FMT "x", off); ++ else if (off < 0) + printf ("-%" BFD_VMA_FMT "x", - off); + else + printf ("%" BFD_VMA_FMT "x", off); +@@ -2984,7 +3016,7 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) + if (e_flags & EF_SH_FDPIC) + strcat (buf, ", fdpic"); + break; +- ++ + case EM_OR1K: + if (e_flags & EF_OR1K_NODELAY) + strcat (buf, ", no delay"); +@@ -3085,7 +3117,9 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) + strcat (buf, ", abort"); + break; + default: +- abort (); ++ warn (_("Unrecognised IA64 VMS Command Code: %x\n"), ++ e_flags & EF_IA_64_VMS_COMCOD); ++ strcat (buf, ", "); + } + } + break; +@@ -4323,7 +4357,7 @@ process_program_headers (FILE * file) + /* PR binutils/12467. */ + if (elf_header.e_phoff != 0) + warn (_("possibly corrupt ELF header - it has a non-zero program" +- " header offset, but no program headers")); ++ " header offset, but no program headers\n")); + else if (do_segments) + printf (_("\nThere are no program headers in this file.\n")); + return 0; +@@ -4722,10 +4756,18 @@ get_32bit_elf_symbols (FILE * file, + Elf_Internal_Sym * psym; + unsigned int j; + ++ if (section->sh_size == 0) ++ { ++ if (num_syms_return != NULL) ++ * num_syms_return = 0; ++ return NULL; ++ } ++ + /* Run some sanity checks first. */ +- if (section->sh_entsize == 0) ++ if (section->sh_entsize == 0 || section->sh_entsize > section->sh_size) + { +- error (_("sh_entsize is zero\n")); ++ error (_("Section %s has an invalid sh_entsize of 0x%lx\n"), ++ printable_section_name (section), (unsigned long) section->sh_entsize); + goto exit_point; + } + +@@ -4740,7 +4782,10 @@ get_32bit_elf_symbols (FILE * file, + + if (number * sizeof (Elf32_External_Sym) > section->sh_size + 1) + { +- error (_("Invalid sh_entsize\n")); ++ error (_("Size (0x%lx) of section %s is not a multiple of its sh_entsize (0x%lx)\n"), ++ (unsigned long) section->sh_size, ++ printable_section_name (section), ++ (unsigned long) section->sh_entsize); + goto exit_point; + } + +@@ -4760,6 +4805,15 @@ get_32bit_elf_symbols (FILE * file, + _("symbol table section indicies")); + if (shndx == NULL) + goto exit_point; ++ /* PR17531: file: heap-buffer-overflow */ ++ else if (symtab_shndx_hdr->sh_size / sizeof (Elf_External_Sym_Shndx) < number) ++ { ++ error (_("Index section %s has an sh_size of 0x%lx - expected 0x%lx\n"), ++ printable_section_name (symtab_shndx_hdr), ++ (unsigned long) symtab_shndx_hdr->sh_size, ++ (unsigned long) section->sh_size); ++ goto exit_point; ++ } + } + + isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym)); +@@ -4810,17 +4864,27 @@ get_64bit_elf_symbols (FILE * file, + Elf_Internal_Sym * psym; + unsigned int j; + ++ if (section->sh_size == 0) ++ { ++ if (num_syms_return != NULL) ++ * num_syms_return = 0; ++ return NULL; ++ } ++ + /* Run some sanity checks first. */ +- if (section->sh_entsize == 0) ++ if (section->sh_entsize == 0 || section->sh_entsize > section->sh_size) + { +- error (_("sh_entsize is zero\n")); ++ error (_("Section %s has an invalid sh_entsize of 0x%lx\n"), ++ printable_section_name (section), ++ (unsigned long) section->sh_entsize); + goto exit_point; + } + + if (section->sh_size > current_file_size) + { + error (_("Section %s has an invalid sh_size of 0x%lx\n"), +- printable_section_name (section), (unsigned long) section->sh_size); ++ printable_section_name (section), ++ (unsigned long) section->sh_size); + goto exit_point; + } + +@@ -4828,7 +4892,10 @@ get_64bit_elf_symbols (FILE * file, + + if (number * sizeof (Elf64_External_Sym) > section->sh_size + 1) + { +- error (_("Invalid sh_entsize\n")); ++ error (_("Size (0x%lx) of section %s is not a multiple of its sh_entsize (0x%lx)\n"), ++ (unsigned long) section->sh_size, ++ printable_section_name (section), ++ (unsigned long) section->sh_entsize); + goto exit_point; + } + +@@ -4847,6 +4914,14 @@ get_64bit_elf_symbols (FILE * file, + _("symbol table section indicies")); + if (shndx == NULL) + goto exit_point; ++ else if (symtab_shndx_hdr->sh_size / sizeof (Elf_External_Sym_Shndx) < number) ++ { ++ error (_("Index section %s has an sh_size of 0x%lx - expected 0x%lx\n"), ++ printable_section_name (symtab_shndx_hdr), ++ (unsigned long) symtab_shndx_hdr->sh_size, ++ (unsigned long) section->sh_size); ++ goto exit_point; ++ } + } + + isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym)); +@@ -5007,7 +5082,10 @@ get_elf_section_flags (bfd_vma sh_flags) + if (p != buff + field_size + 4) + { + if (size < (10 + 2)) +- abort (); ++ { ++ warn (_("Internal error: not enough buffer room for section flag info")); ++ return _(""); ++ } + size -= 2; + *p++ = ','; + *p++ = ' '; +@@ -5071,7 +5149,10 @@ get_elf_section_flags (bfd_vma sh_flags) + if (p != buff + field_size + 4) + { + if (size < (2 + 1)) +- abort (); ++ { ++ warn (_("Internal error: not enough buffer room for section flag info")); ++ return _(""); ++ } + size -= 2; + *p++ = ','; + *p++ = ' '; +@@ -5086,7 +5167,10 @@ get_elf_section_flags (bfd_vma sh_flags) + if (p != buff + field_size + 4) + { + if (size < (2 + 1)) +- abort (); ++ { ++ warn (_("Internal error: not enough buffer room for section flag info")); ++ return _(""); ++ } + size -= 2; + *p++ = ','; + *p++ = ' '; +@@ -5101,7 +5185,10 @@ get_elf_section_flags (bfd_vma sh_flags) + if (p != buff + field_size + 4) + { + if (size < (2 + 1)) +- abort (); ++ { ++ warn (_("Internal error: not enough buffer room for section flag info")); ++ return _(""); ++ } + size -= 2; + *p++ = ','; + *p++ = ' '; +@@ -5762,6 +5849,16 @@ process_section_groups (FILE * file) + ? strtab + sym->st_name : _(""); + } + ++ /* PR 17531: file: loop. */ ++ if (section->sh_entsize > section->sh_size) ++ { ++ error (_("Section %s has sh_entsize (0x%lx) which is larger than its size (0x%lx)\n"), ++ printable_section_name (section), ++ (unsigned long) section->sh_entsize, ++ (unsigned long) section->sh_size); ++ break; ++ } ++ + start = (unsigned char *) get_data (NULL, file, section->sh_offset, + 1, section->sh_size, + _("section data")); +@@ -6097,7 +6194,8 @@ process_relocs (FILE * file) + offset_from_vma (file, rel_offset, rel_size), + rel_size, + dynamic_symbols, num_dynamic_syms, +- dynamic_strings, dynamic_strings_length, is_rela); ++ dynamic_strings, dynamic_strings_length, ++ is_rela); + } + } + +@@ -6172,7 +6270,8 @@ process_relocs (FILE * file) + } + + dump_relocations (file, rel_offset, rel_size, +- symtab, nsyms, strtab, strtablen, is_rela); ++ symtab, nsyms, strtab, strtablen, ++ is_rela); + if (strtab) + free (strtab); + free (symtab); +@@ -6292,6 +6391,7 @@ dump_ia64_unwind (struct ia64_unw_aux_info * aux) + bfd_vma offset; + const unsigned char * dp; + const unsigned char * head; ++ const unsigned char * end; + const char * procname; + + find_symbol_for_address (aux->symtab, aux->nsyms, aux->strtab, +@@ -6314,6 +6414,18 @@ dump_ia64_unwind (struct ia64_unw_aux_info * aux) + printf ("], info at +0x%lx\n", + (unsigned long) (tp->info.offset - aux->seg_base)); + ++ /* PR 17531: file: 86232b32. */ ++ if (aux->info == NULL) ++ continue; ++ ++ /* PR 17531: file: 0997b4d1. */ ++ if ((ABSADDR (tp->info) - aux->info_addr) >= aux->info_size) ++ { ++ warn (_("Invalid offset %lx in table entry %ld\n"), ++ (long) tp->info.offset, (long) (tp - aux->table)); ++ continue; ++ } ++ + head = aux->info + (ABSADDR (tp->info) - aux->info_addr); + stamp = byte_get ((unsigned char *) head, sizeof (stamp)); + +@@ -6331,7 +6443,11 @@ dump_ia64_unwind (struct ia64_unw_aux_info * aux) + } + + in_body = 0; +- for (dp = head + 8; dp < head + 8 + eh_addr_size * UNW_LENGTH (stamp);) ++ end = head + 8 + eh_addr_size * UNW_LENGTH (stamp); ++ /* PR 17531: file: 16ceda89. */ ++ if (end > aux->info + aux->info_size) ++ end = aux->info + aux->info_size; ++ for (dp = head + 8; dp < end;) + dp = unw_decode (dp, in_body, & in_body); + } + } +@@ -6352,6 +6468,8 @@ slurp_ia64_unwind_table (FILE * file, + Elf_Internal_Sym * sym; + const char * relname; + ++ aux->table_len = 0; ++ + /* First, find the starting address of the segment that includes + this section: */ + +@@ -6383,10 +6501,12 @@ slurp_ia64_unwind_table (FILE * file, + if (!table) + return 0; + ++ aux->table_len = size / (3 * eh_addr_size); + aux->table = (struct ia64_unw_table_entry *) +- xcmalloc (size / (3 * eh_addr_size), sizeof (aux->table[0])); ++ xcmalloc (aux->table_len, sizeof (aux->table[0])); + tep = aux->table; +- for (tp = table; tp < table + size; ++tep) ++ ++ for (tp = table; tp <= table + size - (3 * eh_addr_size); ++tep) + { + tep->start.section = SHN_UNDEF; + tep->end.section = SHN_UNDEF; +@@ -6412,22 +6532,41 @@ slurp_ia64_unwind_table (FILE * file, + + if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, + & rela, & nrelas)) +- return 0; ++ { ++ free (aux->table); ++ aux->table = NULL; ++ aux->table_len = 0; ++ return 0; ++ } + + for (rp = rela; rp < rela + nrelas; ++rp) + { + relname = elf_ia64_reloc_type (get_reloc_type (rp->r_info)); + sym = aux->symtab + get_reloc_symindex (rp->r_info); + ++ /* PR 17531: file: 9fa67536. */ ++ if (relname == NULL) ++ { ++ warn (_("Skipping unknown relocation type: %u\n"), get_reloc_type (rp->r_info)); ++ continue; ++ } ++ + if (! const_strneq (relname, "R_IA64_SEGREL")) + { +- warn (_("Skipping unexpected relocation type %s\n"), relname); ++ warn (_("Skipping unexpected relocation type: %s\n"), relname); + continue; + } + + i = rp->r_offset / (3 * eh_addr_size); + +- switch (rp->r_offset/eh_addr_size % 3) ++ /* PR 17531: file: 5bc8d9bf. */ ++ if (i >= aux->table_len) ++ { ++ warn (_("Skipping reloc with overlarge offset: %lx\n"), i); ++ continue; ++ } ++ ++ switch (rp->r_offset / eh_addr_size % 3) + { + case 0: + aux->table[i].start.section = sym->st_shndx; +@@ -6449,7 +6588,6 @@ slurp_ia64_unwind_table (FILE * file, + free (rela); + } + +- aux->table_len = size / (3 * eh_addr_size); + return 1; + } + +@@ -6587,9 +6725,8 @@ ia64_process_unwind (FILE * file) + (unsigned long) unwsec->sh_offset, + (unsigned long) (unwsec->sh_size / (3 * eh_addr_size))); + +- (void) slurp_ia64_unwind_table (file, & aux, unwsec); +- +- if (aux.table_len > 0) ++ if (slurp_ia64_unwind_table (file, & aux, unwsec) ++ && aux.table_len > 0) + dump_ia64_unwind (& aux); + + if (aux.table) +@@ -7089,6 +7226,13 @@ get_unwind_section_word (struct arm_unw_aux_info * aux, + /* Get the word at the required offset. */ + word = byte_get (arm_sec->data + word_offset, 4); + ++ /* PR 17531: file: id:000001,src:001266+003044,op:splice,rep:128. */ ++ if (arm_sec->rela == NULL) ++ { ++ * wordp = word; ++ return TRUE; ++ } ++ + /* Look through the relocs to find the one that applies to the provided offset. */ + wrapped = FALSE; + for (rp = arm_sec->next_rela; rp != arm_sec->rela + arm_sec->nrelas; rp++) +@@ -7583,7 +7727,14 @@ decode_tic6x_unwind_bytecode (struct arm_unw_aux_info *aux, + if ((buf[i] & 0x80) == 0) + break; + } +- assert (i < sizeof (buf)); ++ /* PR 17531: file: id:000001,src:001906+004739,op:splice,rep:2. */ ++ if (i == sizeof (buf)) ++ { ++ printf ("\n"); ++ warn (_("Corrupt stack pointer adjustment detected\n")); ++ return; ++ } ++ + offset = read_uleb128 (buf, &len, buf + i + 1); + assert (len == i + 1); + offset = offset * 8 + 0x408; +@@ -8021,9 +8172,13 @@ dynamic_section_mips_val (Elf_Internal_Dyn * entry) + + time_t atime = entry->d_un.d_val; + tmp = gmtime (&atime); +- snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", +- tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, +- tmp->tm_hour, tmp->tm_min, tmp->tm_sec); ++ /* PR 17531: file: 6accc532. */ ++ if (tmp == NULL) ++ snprintf (timebuf, sizeof (timebuf), _("")); ++ else ++ snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", ++ tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, ++ tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + printf (_("Time Stamp: %s"), timebuf); + } + break; +@@ -9119,6 +9274,10 @@ process_version_sections (FILE * file) + if (j < ent.vd_cnt) + printf (_(" Version def aux past end of section\n")); + ++ /* PR 17531: file: id:000001,src:000172+005151,op:splice,rep:2. */ ++ if (idx + ent.vd_next <= idx) ++ break; ++ + idx += ent.vd_next; + } + +@@ -9219,8 +9378,14 @@ process_version_sections (FILE * file) + get_ver_flags (aux.vna_flags), aux.vna_other); + + /* Check for overflow. */ +- if (aux.vna_next > (size_t) (endbuf - vstart)) +- break; ++ if (aux.vna_next > (size_t) (endbuf - vstart) ++ || (aux.vna_next == 0 && j < ent.vn_cnt - 1)) ++ { ++ warn (_("Invalid vna_next field of %lx\n"), ++ aux.vna_next); ++ j = ent.vn_cnt; ++ break; ++ } + + isum += aux.vna_next; + vstart += aux.vna_next; +@@ -9440,7 +9605,7 @@ process_version_sections (FILE * file) + _("version def")) == NULL) + { + ivd.vd_next = 0; +- /* PR 17531: file: 046-1082287-0.004. */ ++ /* PR 17531: file: 046-1082287-0.004. */ + ivd.vd_ndx = (data[cnt + j] & VERSYM_VERSION) + 1; + break; + } +@@ -9598,7 +9763,9 @@ get_symbol_visibility (unsigned int visibility) + case STV_INTERNAL: return "INTERNAL"; + case STV_HIDDEN: return "HIDDEN"; + case STV_PROTECTED: return "PROTECTED"; +- default: abort (); ++ default: ++ error (_("Unrecognized visibility value: %u"), visibility); ++ return _(""); + } + } + +@@ -9653,7 +9820,10 @@ get_ia64_symbol_other (unsigned int other) + strcat (res, " RSV"); + break; + default: +- abort (); ++ warn (_("Unrecognized IA64 VMS ST Function type: %d\n"), ++ VMS_ST_FUNC_TYPE (other)); ++ strcat (res, " "); ++ break; + } + break; + default: +@@ -9674,7 +9844,10 @@ get_ia64_symbol_other (unsigned int other) + strcat (res, " LNK"); + break; + default: +- abort (); ++ warn (_("Unrecognized IA64 VMS ST Linkage: %d\n"), ++ VMS_ST_LINKAGE (other)); ++ strcat (res, " "); ++ break; + } + + if (res[0] != 0) +@@ -9774,41 +9947,52 @@ get_symbol_index_type (unsigned int type) + } + + static bfd_vma * +-get_dynamic_data (FILE * file, size_t number, unsigned int ent_size) ++get_dynamic_data (FILE * file, bfd_size_type number, unsigned int ent_size) + { + unsigned char * e_data; + bfd_vma * i_data; + ++ /* If the size_t type is smaller than the bfd_size_type, eg because ++ you are building a 32-bit tool on a 64-bit host, then make sure ++ that when (number) is cast to (size_t) no information is lost. */ ++ if (sizeof (size_t) < sizeof (bfd_size_type) ++ && (bfd_size_type) ((size_t) number) != number) ++ { ++ error (_("Size truncation prevents reading %llu elements of size %u\n"), ++ (unsigned long long) number, ent_size); ++ return NULL; ++ } ++ + /* Be kind to memory chekers (eg valgrind, address sanitizer) by not + attempting to allocate memory when the read is bound to fail. */ + if (ent_size * number > current_file_size) + { +- error (_("Invalid number of dynamic entries: %lu\n"), +- (unsigned long) number); ++ error (_("Invalid number of dynamic entries: %llu\n"), ++ (unsigned long long) number); + return NULL; + } + +- e_data = (unsigned char *) cmalloc (number, ent_size); ++ e_data = (unsigned char *) cmalloc ((size_t) number, ent_size); + if (e_data == NULL) + { +- error (_("Out of memory reading %lu dynamic entries\n"), +- (unsigned long) number); ++ error (_("Out of memory reading %llu dynamic entries\n"), ++ (unsigned long long) number); + return NULL; + } + +- if (fread (e_data, ent_size, number, file) != number) ++ if (fread (e_data, ent_size, (size_t) number, file) != number) + { +- error (_("Unable to read in %lu bytes of dynamic data\n"), +- (unsigned long) (number * ent_size)); ++ error (_("Unable to read in %llu bytes of dynamic data\n"), ++ (unsigned long long) (number * ent_size)); + free (e_data); + return NULL; + } + +- i_data = (bfd_vma *) cmalloc (number, sizeof (*i_data)); ++ i_data = (bfd_vma *) cmalloc ((size_t) number, sizeof (*i_data)); + if (i_data == NULL) + { +- error (_("Out of memory allocating space for %lu dynamic entries\n"), +- (unsigned long) number); ++ error (_("Out of memory allocating space for %llu dynamic entries\n"), ++ (unsigned long long) number); + free (e_data); + return NULL; + } +@@ -10196,7 +10380,8 @@ process_symbol_table (FILE * file) + + vers_data = byte_get (data, 2); + +- is_nobits = (psym->st_shndx < elf_header.e_shnum ++ is_nobits = (section_headers != NULL ++ && psym->st_shndx < elf_header.e_shnum + && section_headers[psym->st_shndx].sh_type + == SHT_NOBITS); + +@@ -10357,6 +10542,7 @@ process_symbol_table (FILE * file) + unsigned long maxlength = 0; + unsigned long nzero_counts = 0; + unsigned long nsyms = 0; ++ unsigned long chained; + + printf (_("\nHistogram for bucket list length (total of %lu buckets):\n"), + (unsigned long) nbuckets); +@@ -10371,20 +10557,22 @@ process_symbol_table (FILE * file) + printf (_(" Length Number %% of total Coverage\n")); + for (hn = 0; hn < nbuckets; ++hn) + { +- for (si = buckets[hn]; si > 0 && si < nchains; si = chains[si]) ++ for (si = buckets[hn], chained = 0; ++ si > 0 && si < nchains && si < nbuckets && chained <= nchains; ++ si = chains[si], ++chained) + { + ++nsyms; + if (maxlength < ++lengths[hn]) + ++maxlength; ++ } + +- /* PR binutils/17531: A corrupt binary could contain broken +- histogram data. Do not go into an infinite loop trying +- to process it. */ +- if (chains[si] == si) +- { +- error (_("histogram chain links to itself\n")); +- break; +- } ++ /* PR binutils/17531: A corrupt binary could contain broken ++ histogram data. Do not go into an infinite loop trying ++ to process it. */ ++ if (chained > nchains) ++ { ++ error (_("histogram chain is corrupt\n")); ++ break; + } + } + +@@ -10839,7 +11027,7 @@ is_32bit_abs_reloc (unsigned int reloc_type) + default: + error (_("Missing knowledge of 32-bit reloc types used in DWARF sections of machine number %d\n"), + elf_header.e_machine); +- abort (); ++ return FALSE; + } + } + +@@ -12105,7 +12293,8 @@ display_arm_attribute (unsigned char * p, + break; + + default: +- abort (); ++ printf (_("\n"), tag); ++ break; + } + return p; + +@@ -13066,10 +13255,12 @@ process_msp430x_specific (FILE * file) + + /* DATA points to the contents of a MIPS GOT that starts at VMA PLTGOT. + Print the Address, Access and Initial fields of an entry at VMA ADDR +- and return the VMA of the next entry. */ ++ and return the VMA of the next entry, or -1 if there was a problem. ++ Does not read from DATA_END or beyond. */ + + static bfd_vma +-print_mips_got_entry (unsigned char * data, bfd_vma pltgot, bfd_vma addr) ++print_mips_got_entry (unsigned char * data, bfd_vma pltgot, bfd_vma addr, ++ unsigned char * data_end) + { + printf (" "); + print_vma (addr, LONG_HEX); +@@ -13084,9 +13275,19 @@ print_mips_got_entry (unsigned char * data, bfd_vma pltgot, bfd_vma addr) + else + { + bfd_vma entry; ++ unsigned char * from = data + addr - pltgot; + +- entry = byte_get (data + addr - pltgot, is_32bit_elf ? 4 : 8); +- print_vma (entry, LONG_HEX); ++ if (from + (is_32bit_elf ? 4 : 8) > data_end) ++ { ++ warn (_("MIPS GOT entry extends beyond the end of available data\n")); ++ printf ("%*s", is_32bit_elf ? 8 : 16, _("")); ++ return (bfd_vma) -1; ++ } ++ else ++ { ++ entry = byte_get (data + addr - pltgot, is_32bit_elf ? 4 : 8); ++ print_vma (entry, LONG_HEX); ++ } + } + return addr + (is_32bit_elf ? 4 : 8); + } +@@ -13448,7 +13649,7 @@ process_mips_specific (FILE * file) + + /* Find the section header so that we get the size. */ + sect = find_section_by_type (SHT_MIPS_OPTIONS); +- /* PR 17533 file: 012-277276-0.004. */ ++ /* PR 17533 file: 012-277276-0.004. */ + if (sect == NULL) + { + error (_("No MIPS_OPTIONS header found\n")); +@@ -13470,7 +13671,7 @@ process_mips_specific (FILE * file) + offset = cnt = 0; + option = iopt; + +- while (offset < sect->sh_size) ++ while (offset <= sect->sh_size - sizeof (* eopt)) + { + Elf_External_Options * eoption; + +@@ -13481,6 +13682,13 @@ process_mips_specific (FILE * file) + option->section = BYTE_GET (eoption->section); + option->info = BYTE_GET (eoption->info); + ++ /* PR 17531: file: ffa0fa3b. */ ++ if (option->size < sizeof (* eopt) ++ || offset + option->size > sect->sh_size) ++ { ++ error (_("Invalid size (%u) for MIPS option\n"), option->size); ++ return 0; ++ } + offset += option->size; + + ++option; +@@ -13491,6 +13699,7 @@ process_mips_specific (FILE * file) + printable_section_name (sect), cnt); + + option = iopt; ++ offset = 0; + + while (cnt-- > 0) + { +@@ -13627,13 +13836,18 @@ process_mips_specific (FILE * file) + + len = sizeof (* eopt); + while (len < option->size) +- if (((char *) option)[len] >= ' ' +- && ((char *) option)[len] < 0x7f) +- printf ("%c", ((char *) option)[len++]); +- else +- printf ("\\%03o", ((char *) option)[len++]); ++ { ++ char datum = * ((char *) eopt + offset + len); ++ ++ if (ISPRINT (datum)) ++ printf ("%c", datum); ++ else ++ printf ("\\%03o", datum); ++ len ++; ++ } + + fputs ("\n", stdout); ++ offset += option->size; + ++option; + } + +@@ -13723,6 +13937,7 @@ process_mips_specific (FILE * file) + bfd_vma ent, local_end, global_end; + size_t i, offset; + unsigned char * data; ++ unsigned char * data_end; + int addr_size; + + ent = pltgot; +@@ -13733,18 +13948,25 @@ process_mips_specific (FILE * file) + if (symtabno < gotsym) + { + error (_("The GOT symbol offset (%lu) is greater than the symbol table size (%lu)\n"), +- (long) gotsym, (long) symtabno); ++ (unsigned long) gotsym, (unsigned long) symtabno); + return 0; + } +- ++ + global_end = local_end + (symtabno - gotsym) * addr_size; +- assert (global_end >= local_end); ++ /* PR 17531: file: 54c91a34. */ ++ if (global_end < local_end) ++ { ++ error (_("Too many GOT symbols: %lu\n"), (unsigned long) symtabno); ++ return 0; ++ } ++ + offset = offset_from_vma (file, pltgot, global_end - pltgot); + data = (unsigned char *) get_data (NULL, file, offset, + global_end - pltgot, 1, + _("Global Offset Table data")); + if (data == NULL) + return 0; ++ data_end = data + (global_end - pltgot); + + printf (_("\nPrimary GOT:\n")); + printf (_(" Canonical gp value: ")); +@@ -13755,14 +13977,18 @@ process_mips_specific (FILE * file) + printf (_(" %*s %10s %*s Purpose\n"), + addr_size * 2, _("Address"), _("Access"), + addr_size * 2, _("Initial")); +- ent = print_mips_got_entry (data, pltgot, ent); ++ ent = print_mips_got_entry (data, pltgot, ent, data_end); + printf (_(" Lazy resolver\n")); ++ if (ent == (bfd_vma) -1) ++ goto got_print_fail; + if (data + && (byte_get (data + ent - pltgot, addr_size) + >> (addr_size * 8 - 1)) != 0) + { +- ent = print_mips_got_entry (data, pltgot, ent); ++ ent = print_mips_got_entry (data, pltgot, ent, data_end); + printf (_(" Module pointer (GNU extension)\n")); ++ if (ent == (bfd_vma) -1) ++ goto got_print_fail; + } + printf ("\n"); + +@@ -13774,8 +14000,10 @@ process_mips_specific (FILE * file) + addr_size * 2, _("Initial")); + while (ent < local_end) + { +- ent = print_mips_got_entry (data, pltgot, ent); ++ ent = print_mips_got_entry (data, pltgot, ent, data_end); + printf ("\n"); ++ if (ent == (bfd_vma) -1) ++ goto got_print_fail; + } + printf ("\n"); + } +@@ -13798,7 +14026,7 @@ process_mips_specific (FILE * file) + + for (i = gotsym; i < symtabno; i++) + { +- ent = print_mips_got_entry (data, pltgot, ent); ++ ent = print_mips_got_entry (data, pltgot, ent, data_end); + printf (" "); + + if (dynamic_symbols == NULL) +@@ -13822,10 +14050,13 @@ process_mips_specific (FILE * file) + (unsigned long) i); + + printf ("\n"); ++ if (ent == (bfd_vma) -1) ++ break; + } + printf ("\n"); + } + ++ got_print_fail: + if (data) + free (data); + } +@@ -14490,7 +14721,7 @@ print_ia64_vms_note (Elf_Internal_Note * pnote) + case NT_VMS_FPMODE: + printf (_(" Floating Point mode: ")); + printf ("0x%016" BFD_VMA_FMT "x\n", +- (bfd_vma)byte_get ((unsigned char *)pnote->descdata, 8)); ++ (bfd_vma) byte_get ((unsigned char *)pnote->descdata, 8)); + break; + case NT_VMS_LINKTIME: + printf (_(" Link time: ")); +@@ -14513,9 +14744,9 @@ print_ia64_vms_note (Elf_Internal_Note * pnote) + ((bfd_int64_t) byte_get ((unsigned char *)pnote->descdata + 8, 8)); + printf (_("\n Link flags : ")); + printf ("0x%016" BFD_VMA_FMT "x\n", +- (bfd_vma)byte_get ((unsigned char *)pnote->descdata + 16, 8)); ++ (bfd_vma) byte_get ((unsigned char *)pnote->descdata + 16, 8)); + printf (_(" Header flags: 0x%08x\n"), +- (unsigned)byte_get ((unsigned char *)pnote->descdata + 24, 4)); ++ (unsigned) byte_get ((unsigned char *)pnote->descdata + 24, 4)); + printf (_(" Image id : %s\n"), pnote->descdata + 32); + break; + #endif +@@ -14600,6 +14831,7 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) + { + Elf_External_Note * pnotes; + Elf_External_Note * external; ++ char * end; + int res = 1; + + if (length <= 0) +@@ -14616,13 +14848,14 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) + (unsigned long) offset, (unsigned long) length); + printf (_(" %-20s %10s\tDescription\n"), _("Owner"), _("Data size")); + +- while ((char *) external < (char *) pnotes + length) ++ end = (char *) pnotes + length; ++ while ((char *) external < end) + { + Elf_Internal_Note inote; + size_t min_notesz; + char *next; + char * temp = NULL; +- size_t data_remaining = ((char *) pnotes + length) - (char *) external; ++ size_t data_remaining = end - (char *) external; + + if (!is_ia64_vms ()) + { +@@ -14640,6 +14873,14 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) + inote.namedata = external->name; + inote.descsz = BYTE_GET (external->descsz); + inote.descdata = inote.namedata + align_power (inote.namesz, 2); ++ /* PR 17531: file: 3443835e. */ ++ if (inote.descdata < (char *) pnotes || inote.descdata > end) ++ { ++ warn (_("Corrupt note: name size is too big: %lx\n"), inote.namesz); ++ inote.descdata = inote.namedata; ++ inote.namesz = 0; ++ } ++ + inote.descpos = offset + (inote.descdata - (char *) pnotes); + next = inote.descdata + align_power (inote.descsz, 2); + } +@@ -14669,6 +14910,9 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) + + if (inote.descdata < (char *) external + min_notesz + || next < (char *) external + min_notesz ++ /* PR binutils/17531: file: id:000000,sig:11,src:006986,op:havoc,rep:4. */ ++ || inote.namedata + inote.namesz < inote.namedata ++ || inote.descdata + inote.descsz < inote.descdata + || data_remaining < (size_t)(next - (char *) external)) + { + warn (_("note with invalid namesz and/or descsz found at offset 0x%lx\n"), +@@ -14687,7 +14931,6 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) + if (inote.namedata[inote.namesz - 1] != '\0') + { + temp = (char *) malloc (inote.namesz + 1); +- + if (temp == NULL) + { + error (_("Out of memory allocating space for inote name\n")); +@@ -15112,11 +15355,11 @@ process_archive (char * file_name, FILE * file, bfd_boolean is_thin_archive) + error (_("%s: unable to dump the index as none was found\n"), file_name); + else + { +- unsigned int i, l; ++ unsigned long i, l; + unsigned long current_pos; + +- printf (_("Index of archive %s: (%ld entries, 0x%lx bytes in the symbol table)\n"), +- file_name, (long) arch.index_num, arch.sym_size); ++ printf (_("Index of archive %s: (%lu entries, 0x%lx bytes in the symbol table)\n"), ++ file_name, (unsigned long) arch.index_num, arch.sym_size); + current_pos = ftell (file); + + for (i = l = 0; i < arch.index_num; i++) +@@ -15147,8 +15390,9 @@ process_archive (char * file_name, FILE * file, bfd_boolean is_thin_archive) + file_name); + break; + } +- printf ("\t%s\n", arch.sym_table + l); +- l += strlen (arch.sym_table + l) + 1; ++ /* PR 17531: file: 0b6630b2. */ ++ printf ("\t%.*s\n", (int) (arch.sym_size - l), arch.sym_table + l); ++ l += strnlen (arch.sym_table + l, arch.sym_size - l) + 1; + } + + if (arch.uses_64bit_indicies) +diff --git a/binutils/rescoff.c b/binutils/rescoff.c +index 607c823..dadc683 100644 +--- a/binutils/rescoff.c ++++ b/binutils/rescoff.c +@@ -142,8 +142,14 @@ read_coff_rsrc (const char *filename, const char *target) + + set_windres_bfd (&wrbfd, abfd, sec, WR_KIND_BFD); + size = bfd_section_size (abfd, sec); +- data = (bfd_byte *) res_alloc (size); ++ /* PR 17512: file: 1b25ba5d ++ The call to get_file_size here may be expensive ++ but there is no other way to determine if the section size ++ is reasonable. */ ++ if (size > (bfd_size_type) get_file_size (filename)) ++ fatal (_("%s: .rsrc section is bigger than the file!"), filename); + ++ data = (bfd_byte *) res_alloc (size); + get_windres_bfd_content (&wrbfd, data, 0, size); + + flaginfo.filename = filename; +@@ -185,6 +191,13 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data, + rc_res_entry **pp; + const struct extern_res_entry *ere; + ++ /* PR 17512: file: 09d80f53. ++ Whilst in theory resources can nest to any level, in practice ++ Microsoft only defines 3 levels. Corrupt files however might ++ claim to use more. */ ++ if (level > 4) ++ overrun (flaginfo, _("Resources nest too deep")); ++ + if ((size_t) (flaginfo->data_end - data) < sizeof (struct extern_res_directory)) + overrun (flaginfo, _("directory")); + +@@ -234,7 +247,12 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data, + re->id.u.n.length = length; + re->id.u.n.name = (unichar *) res_alloc (length * sizeof (unichar)); + for (j = 0; j < length; j++) +- re->id.u.n.name[j] = windres_get_16 (wrbfd, ers + j * 2 + 2, 2); ++ { ++ /* PR 17512: file: 05dc4a16. */ ++ if (length < 0 || ers >= (bfd_byte *) ere || ers + j * 2 + 4 >= (bfd_byte *) ere) ++ overrun (flaginfo, _("resource name")); ++ re->id.u.n.name[j] = windres_get_16 (wrbfd, ers + j * 2 + 2, 2); ++ } + + if (level == 0) + type = &re->id; +diff --git a/binutils/resrc.c b/binutils/resrc.c +index 65f1c11..4126abd 100644 +--- a/binutils/resrc.c ++++ b/binutils/resrc.c +@@ -2923,6 +2923,7 @@ write_rc_messagetable (FILE *e, rc_uint_type length, const bfd_byte *data) + { + int has_error = 0; + const struct bin_messagetable *mt; ++ + fprintf (e, "BEGIN\n"); + + write_rc_datablock (e, length, data, 0, 0, 0); +@@ -2932,53 +2933,68 @@ write_rc_messagetable (FILE *e, rc_uint_type length, const bfd_byte *data) + if (length < BIN_MESSAGETABLE_SIZE) + has_error = 1; + else +- do { +- rc_uint_type m, i; +- mt = (const struct bin_messagetable *) data; +- m = windres_get_32 (&wrtarget, mt->cblocks, length); +- if (length < (BIN_MESSAGETABLE_SIZE + m * BIN_MESSAGETABLE_BLOCK_SIZE)) +- { +- has_error = 1; +- break; +- } +- for (i = 0; i < m; i++) +- { +- rc_uint_type low, high, offset; +- const struct bin_messagetable_item *mti; ++ do ++ { ++ rc_uint_type m, i; ++ ++ mt = (const struct bin_messagetable *) data; ++ m = windres_get_32 (&wrtarget, mt->cblocks, length); ++ ++ if (length < (BIN_MESSAGETABLE_SIZE + m * BIN_MESSAGETABLE_BLOCK_SIZE)) ++ { ++ has_error = 1; ++ break; ++ } ++ for (i = 0; i < m; i++) ++ { ++ rc_uint_type low, high, offset; ++ const struct bin_messagetable_item *mti; ++ ++ low = windres_get_32 (&wrtarget, mt->items[i].lowid, 4); ++ high = windres_get_32 (&wrtarget, mt->items[i].highid, 4); ++ offset = windres_get_32 (&wrtarget, mt->items[i].offset, 4); ++ ++ while (low <= high) ++ { ++ rc_uint_type elen, flags; ++ if ((offset + BIN_MESSAGETABLE_ITEM_SIZE) > length) ++ { ++ has_error = 1; ++ break; ++ } ++ mti = (const struct bin_messagetable_item *) &data[offset]; ++ elen = windres_get_16 (&wrtarget, mti->length, 2); ++ flags = windres_get_16 (&wrtarget, mti->flags, 2); ++ if ((offset + elen) > length) ++ { ++ has_error = 1; ++ break; ++ } ++ wr_printcomment (e, "MessageId = 0x%x", low); ++ wr_printcomment (e, ""); ++ ++ if ((flags & MESSAGE_RESOURCE_UNICODE) == MESSAGE_RESOURCE_UNICODE) ++ { ++ /* PR 17512: file: 5c3232dc. */ ++ if (elen > BIN_MESSAGETABLE_ITEM_SIZE * 2) ++ unicode_print (e, (const unichar *) mti->data, ++ (elen - BIN_MESSAGETABLE_ITEM_SIZE) / 2); ++ } ++ else ++ { ++ if (elen > BIN_MESSAGETABLE_ITEM_SIZE) ++ ascii_print (e, (const char *) mti->data, ++ (elen - BIN_MESSAGETABLE_ITEM_SIZE)); ++ } ++ ++ wr_printcomment (e,""); ++ ++low; ++ offset += elen; ++ } ++ } ++ } ++ while (0); + +- low = windres_get_32 (&wrtarget, mt->items[i].lowid, 4); +- high = windres_get_32 (&wrtarget, mt->items[i].highid, 4); +- offset = windres_get_32 (&wrtarget, mt->items[i].offset, 4); +- while (low <= high) +- { +- rc_uint_type elen, flags; +- if ((offset + BIN_MESSAGETABLE_ITEM_SIZE) > length) +- { +- has_error = 1; +- break; +- } +- mti = (const struct bin_messagetable_item *) &data[offset]; +- elen = windres_get_16 (&wrtarget, mti->length, 2); +- flags = windres_get_16 (&wrtarget, mti->flags, 2); +- if ((offset + elen) > length) +- { +- has_error = 1; +- break; +- } +- wr_printcomment (e, "MessageId = 0x%x", low); +- wr_printcomment (e, ""); +- if ((flags & MESSAGE_RESOURCE_UNICODE) == MESSAGE_RESOURCE_UNICODE) +- unicode_print (e, (const unichar *) mti->data, +- (elen - BIN_MESSAGETABLE_ITEM_SIZE) / 2); +- else +- ascii_print (e, (const char *) mti->data, +- (elen - BIN_MESSAGETABLE_ITEM_SIZE)); +- wr_printcomment (e,""); +- ++low; +- offset += elen; +- } +- } +- } while (0); + if (has_error) + wr_printcomment (e, "Illegal data"); + wr_print_flush (e); +@@ -2995,7 +3011,7 @@ write_rc_datablock (FILE *e, rc_uint_type length, const bfd_byte *data, int has_ + fprintf (e, "BEGIN\n"); + + if (show_comment == -1) +- { ++ { + if (test_rc_datablock_text(length, data)) + { + rc_uint_type i, c; +@@ -3008,7 +3024,7 @@ write_rc_datablock (FILE *e, rc_uint_type length, const bfd_byte *data, int has_ + ; + if (i < length && data[i] == '\n') + ++i, ++c; +- ascii_print (e, (const char *) &data[i - c], c); ++ ascii_print(e, (const char *) &data[i - c], c); + fprintf (e, "\""); + if (i < length) + fprintf (e, "\n"); +diff --git a/binutils/size.c b/binutils/size.c +index e727165..8edd7f9 100644 +--- a/binutils/size.c ++++ b/binutils/size.c +@@ -133,6 +133,7 @@ main (int argc, char **argv) + + program_name = *argv; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +@@ -365,7 +366,14 @@ display_archive (bfd *file) + display_bfd (arfile); + + if (last_arfile != NULL) +- bfd_close (last_arfile); ++ { ++ bfd_close (last_arfile); ++ ++ /* PR 17512: file: a244edbc. */ ++ if (last_arfile == arfile) ++ return; ++ } ++ + last_arfile = arfile; + } + +diff --git a/binutils/srconv.c b/binutils/srconv.c +index 13119b4..1bda313 100644 +--- a/binutils/srconv.c ++++ b/binutils/srconv.c +@@ -167,7 +167,8 @@ checksum (FILE *ffile, unsigned char *ptr, int size, int ccode) + + last = !(ccode & 0xff00); + if (size & 0x7) +- abort (); ++ fatal (_("Checksum failure")); ++ + ptr[0] = ccode | (last ? 0x80 : 0); + ptr[1] = bytes + 1; + +@@ -178,7 +179,7 @@ checksum (FILE *ffile, unsigned char *ptr, int size, int ccode) + ptr[bytes] = ~sum; + if (fwrite (ptr, bytes + 1, 1, ffile) != 1) + /* FIXME: Return error status. */ +- abort (); ++ fatal (_("Failed to write checksum")); + } + + +@@ -218,7 +219,7 @@ writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *ffile) + ptr[byte + 3] = n >> 0; + break; + default: +- abort (); ++ fatal (_("Unsupported integer write size: %d"), size); + } + *idx += size * 8; + } +@@ -304,7 +305,7 @@ wr_tr (void) + + if (fwrite (b, sizeof (b), 1, file) != 1) + /* FIXME: Return error status. */ +- abort (); ++ fatal (_("Failed to write TR block")); + } + + static void +@@ -395,7 +396,8 @@ wr_hd (struct coff_ofile *p) + toolname = "C_H8/300S"; + break; + default: +- abort(); ++ fatal (_("Unrecognized H8300 sub-architecture: %ld"), ++ bfd_get_mach (abfd)); + } + rnames = rname_h8300; + break; +@@ -412,7 +414,7 @@ wr_hd (struct coff_ofile *p) + rnames = rname_sh; + break; + default: +- abort (); ++ fatal (_("Unsupported architecture: %d"), bfd_get_arch (abfd)); + } + + if (! (bfd_get_file_flags(abfd) & EXEC_P)) +@@ -866,7 +868,7 @@ walk_tree_type_1 (struct coff_sfile *sfile, struct coff_symbol *symbol, + break; + + default: +- abort (); ++ fatal (_("Unrecognised type: %d"), type->type); + } + } + +@@ -995,7 +997,7 @@ walk_tree_symbol (struct coff_sfile *sfile, struct coff_section *section ATTRIBU + return; + + default: +- abort (); ++ fatal (_("Unrecognised coff symbol type: %d"), symbol->type->type); + } + + if (symbol->where->where == coff_where_member_of_struct) +@@ -1057,7 +1059,7 @@ walk_tree_symbol (struct coff_sfile *sfile, struct coff_section *section ATTRIBU + break; + + default: +- abort (); ++ fatal (_("Unrecognised coff symbol visibility: %d"), symbol->visible->type); + } + + dsy.dlength = symbol->type->size; +@@ -1083,7 +1085,7 @@ walk_tree_symbol (struct coff_sfile *sfile, struct coff_section *section ATTRIBU + break; + + default: +- abort (); ++ fatal (_("Unrecognised coff symbol location: %d"), symbol->where->where); + } + + switch (symbol->where->where) +@@ -1128,7 +1130,7 @@ walk_tree_symbol (struct coff_sfile *sfile, struct coff_section *section ATTRIBU + break; + + default: +- abort (); ++ fatal (_("Unrecognised coff symbol location: %d"), symbol->where->where); + } + + if (symbol->where->where == coff_where_register) +@@ -1157,7 +1159,7 @@ walk_tree_symbol (struct coff_sfile *sfile, struct coff_section *section ATTRIBU + break; + + default: +- abort (); ++ fatal (_("Unrecognised coff symbol visibility: %d"), symbol->visible->type); + } + + dsy.sfn = 0; +@@ -1202,6 +1204,8 @@ walk_tree_sfile (struct coff_section *section, struct coff_sfile *sfile) + static void + wr_program_structure (struct coff_ofile *p, struct coff_sfile *sfile) + { ++ if (p->nsections < 4) ++ return; + walk_tree_sfile (p->sections + 4, sfile); + } + +@@ -1460,7 +1464,7 @@ wr_cs (void) + + if (fwrite (b, sizeof (b), 1, file) != 1) + /* FIXME: Return error status. */ +- abort (); ++ fatal (_("Failed to write CS struct")); + } + + /* Write out the SC records for a unit. Create an SC +@@ -1703,6 +1707,9 @@ prescan (struct coff_ofile *otree) + struct coff_symbol *s; + struct coff_section *common_section; + ++ if (otree->nsections < 3) ++ return; ++ + /* Find the common section - always section 3. */ + common_section = otree->sections + 3; + +@@ -1772,6 +1779,7 @@ main (int ac, char **av) + + program_name = av[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&ac, &av); + +@@ -1883,10 +1891,12 @@ main (int ac, char **av) + printf ("ids %d %d\n", base1, base2); + + tree = coff_grok (abfd); ++ if (tree) ++ { ++ if (!noprescan) ++ prescan (tree); + +- if (!noprescan) +- prescan (tree); +- +- wr_module (tree); ++ wr_module (tree); ++ } + return 0; + } +diff --git a/binutils/strings.c b/binutils/strings.c +index 2cf046f..224f870 100644 +--- a/binutils/strings.c ++++ b/binutils/strings.c +@@ -164,6 +164,7 @@ main (int argc, char **argv) + + program_name = argv[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +@@ -578,14 +579,14 @@ print_strings (const char *filename, FILE *stream, file_ptr address, + switch (address_radix) + { + case 8: +-#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) ++#ifdef HAVE_LONG_LONG + if (sizeof (start) > sizeof (long)) + { +-#ifndef __MSVCRT__ ++# ifndef __MSVCRT__ + printf ("%7llo ", (unsigned long long) start); +-#else ++# else + printf ("%7I64o ", (unsigned long long) start); +-#endif ++# endif + } + else + #elif !BFD_HOST_64BIT_LONG +@@ -597,14 +598,14 @@ print_strings (const char *filename, FILE *stream, file_ptr address, + break; + + case 10: +-#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) ++#ifdef HAVE_LONG_LONG + if (sizeof (start) > sizeof (long)) + { +-#ifndef __MSVCRT__ ++# ifndef __MSVCRT__ + printf ("%7lld ", (unsigned long long) start); +-#else ++# else + printf ("%7I64d ", (unsigned long long) start); +-#endif ++# endif + } + else + #elif !BFD_HOST_64BIT_LONG +@@ -616,14 +617,14 @@ print_strings (const char *filename, FILE *stream, file_ptr address, + break; + + case 16: +-#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) ++#ifdef HAVE_LONG_LONG + if (sizeof (start) > sizeof (long)) + { +-#ifndef __MSVCRT__ ++# ifndef __MSVCRT__ + printf ("%7llx ", (unsigned long long) start); +-#else ++# else + printf ("%7I64x ", (unsigned long long) start); +-#endif ++# endif + } + else + #elif !BFD_HOST_64BIT_LONG +diff --git a/binutils/sysdump.c b/binutils/sysdump.c +index 5ae324f..b8dfec8 100644 +--- a/binutils/sysdump.c ++++ b/binutils/sysdump.c +@@ -66,6 +66,9 @@ getCHARS (unsigned char *ptr, int *idx, int size, int max) + + if (b == 0) + { ++ /* PR 17512: file: 13caced2. */ ++ if (oc >= max) ++ return _("*corrupt*"); + /* Got to work out the length of the string from self. */ + b = ptr[oc++]; + (*idx) += 8; +@@ -166,7 +169,12 @@ getINT (unsigned char *ptr, int *idx, int size, int max) + int byte = *idx / 8; + + if (byte >= max) +- return 0; ++ { ++ /* PR 17512: file: id:000001,src:000002,op:flip1,pos:45. */ ++ /* Prevent infinite loops re-reading beyond the end of the buffer. */ ++ fatal (_("ICE: getINT: Out of buffer space")); ++ return 0; ++ } + + if (size == -2) + size = addrsize; +@@ -188,7 +196,7 @@ getINT (unsigned char *ptr, int *idx, int size, int max) + n = (ptr[byte + 0] << 24) + (ptr[byte + 1] << 16) + (ptr[byte + 2] << 8) + (ptr[byte + 3]); + break; + default: +- abort (); ++ fatal (_("Unsupported read size: %d"), size); + } + + *idx += size * 8; +@@ -615,6 +623,8 @@ module (void) + do + { + c = getc (file); ++ if (c == EOF) ++ break; + ungetc (c, file); + + c &= 0x7f; +@@ -676,6 +686,7 @@ main (int ac, char **av) + + program_name = av[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&ac, &av); + +diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog +index 2a4185e..0864510 100644 +--- a/binutils/testsuite/ChangeLog ++++ b/binutils/testsuite/ChangeLog +@@ -1,3 +1,15 @@ ++2015-03-11 Jiong Wang ++ ++ * binutils-all/arm/rvct_symbol.s: New testcase. ++ * binutils-all/arm/objdump.exp: Run it. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2014-12-26 Alan Modra ++ * binutils-all/strip-11.d: New test. ++ * binutils-all/objcopy.exp: Run it. ++ + 2014-09-12 Andrew Bennett + + * binutils-all/objcopy.exp: Add mips*-img-elf* target triple. +diff --git a/binutils/testsuite/binutils-all/arm/objdump.exp b/binutils/testsuite/binutils-all/arm/objdump.exp +index 93c44da..272dfee 100644 +--- a/binutils/testsuite/binutils-all/arm/objdump.exp ++++ b/binutils/testsuite/binutils-all/arm/objdump.exp +@@ -86,3 +86,25 @@ if [regexp $want $got] then { + } else { + fail "multiple input files" + } ++ ++if {![binutils_assemble $srcdir/$subdir/rvct_symbol.s tmpdir/rvct_symbol.o]} then { ++ return ++} ++ ++if [is_remote host] { ++ set objfile [remote_download host tmpdir/rvct_symbol.o] ++} else { ++ set objfile tmpdir/rvct_symbol.o ++} ++ ++# Make sure multiple disassemblies come out the same ++ ++set got [binutils_run $OBJDUMP "-D $objfile $objfile"] ++ ++set want "foo.*global_a.*global_b" ++ ++if [regexp $want $got] then { ++ pass "skip rvct symbol" ++} else { ++ fail "skip rvct symbol" ++} +diff --git a/binutils/testsuite/binutils-all/arm/rvct_symbol.s b/binutils/testsuite/binutils-all/arm/rvct_symbol.s +new file mode 100644 +index 0000000..f63240b +--- /dev/null ++++ b/binutils/testsuite/binutils-all/arm/rvct_symbol.s +@@ -0,0 +1,15 @@ ++ .text ++foo: ++__tagsym$$0: ++ add r0, r1, r2 ++ ++ .data ++ .global global_a ++__tagsym$$used0: ++global_a: ++ .word 0xcafedead ++ ++ .global __tagsym$$used1 ++__tagsym$$used1: ++global_b: ++ .word 0xcafecafe +diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp +index 49d466d..3066491 100644 +--- a/binutils/testsuite/binutils-all/objcopy.exp ++++ b/binutils/testsuite/binutils-all/objcopy.exp +@@ -959,6 +959,12 @@ if [is_elf_format] { + && !([istarget "arm*-*-*"] && ![istarget "arm-*-*eabi*"])} { + run_dump_test "strip-10" + } ++ set extra_strip11 "" ++ if { [istarget "sh64*-*"] } { ++ # pr17755 testcase ++ set extra_strip11 { { "as" "--isa=SHmedia --abi=64" } } ++ } ++ run_dump_test "strip-11" $extra_strip11 + + if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } { + # Check to make sure we don't strip a symbol named in relocations. +diff --git a/binutils/testsuite/binutils-all/strip-11.d b/binutils/testsuite/binutils-all/strip-11.d +new file mode 100644 +index 0000000..04c47ab +--- /dev/null ++++ b/binutils/testsuite/binutils-all/strip-11.d +@@ -0,0 +1,12 @@ ++#PROG: strip ++#source: empty.s ++#strip: -g ++#readelf: -S --wide ++#name: strip -g empty file ++ ++#... ++ \[ 0\] +NULL +0+ .* ++#... ++ \[ .\] \.shstrtab +STRTAB +0+ .* ++Key to Flags: ++#pass +diff --git a/binutils/windmc.c b/binutils/windmc.c +index 01785db..9364e20 100644 +--- a/binutils/windmc.c ++++ b/binutils/windmc.c +@@ -952,6 +952,7 @@ main (int argc, char **argv) + + program_name = argv[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +diff --git a/binutils/windres.c b/binutils/windres.c +index 7fa90fc..5750490 100644 +--- a/binutils/windres.c ++++ b/binutils/windres.c +@@ -204,6 +204,7 @@ open_file_search (const char *filename, const char *mode, const char *errmsg, + *real_filename = n; + return e; + } ++ free (n); + + if (errno != ENOENT) + break; +@@ -807,6 +808,7 @@ main (int argc, char **argv) + + program_name = argv[0]; + xmalloc_set_program_name (program_name); ++ bfd_set_error_program_name (program_name); + + expandargv (&argc, &argv); + +diff --git a/gas/ChangeLog b/gas/ChangeLog +index 627940a..8aea852 100644 +--- a/gas/ChangeLog ++++ b/gas/ChangeLog +@@ -1,3 +1,87 @@ ++2015-06-19 Nick Clifton ++ ++ PR gas/18541 ++ * config/tc-arm.c (md_apply_fix): Add support for ADR in thumb ++ mode against a nearby symbol. ++ ++2015-06-17 Renlin Li ++ ++ Applied from master. ++ 2015-04-28 Renlin Li ++ 2015-06-03 Renlin Li ++ ++ * config/tc-arm.c (arm_init_frag): Always emit mapping symbols. ++ ++2015-06-17 Renlin Li ++ ++ Applied from master. ++ 2015-05-05 Renlin Li ++ ++ * config/tc-aarch64.c (aarch64_init_frag): Always generate mapping ++ symbols. ++ ++2015-06-04 Matthew Wahab ++ ++ * config/tc-aarch64.c (mapping_state): Set minimum alignment for code ++ sections. ++ ++2015-05-07 Renlin Li ++ ++ * config/tc-aarch64.c (s_aarch64_inst): Align frag during state ++ transition within executable section. ++ (md_assemble): Likewise. ++ ++2015-04-06 Evandro Menezes ++ ++ * config/tc-aarch64.c: Add support for Samsung Exynos M1. ++ * doc/c-aarch64.texi (-mcpu=): Add "exynos-m1". ++ ++2015-04-06 Evandro Menezes ++ ++ * config/tc-arm.c: Add support for Samsung Exynos M1. ++ * doc/c-arm.texi (-mcpu=): Add "exynos-m1". ++ ++2015-04-04 Alan Modra ++ ++ Apply from master. ++ 2014-12-25 Yaakov Selkowitz ++ PR gas/17753 ++ * config/tc-mep.c (md_begin): Specify types of vararg literals. ++ ++2015-03-20 H.J. Lu ++ ++ Apply patch from master: ++ 2015-03-20 H.J. Lu ++ ++ * config/tc-i386.c (i386_align_code): Limit multi-byte nop ++ instructions to 10 bytes. ++ ++2015-03-11 Matthew Wahab ++ ++ * config/tc-aarch64.c: Add support for Cortex-A72. ++ * doc/c-aarch64.texi (-mcpu=): Add "cortex-a72". ++ ++2015-03-11 Matthew Wahab ++ ++ * config/tc-arm.c: Add support for Cortex-A72. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2015-01-12 Alan Modra ++ * read.c (s_altmacro, s_reloc): Make definition static. ++ ++ 2014-12-12 Alan Modra ++ * config/tc-ppc.h (md_reg_eh_frame_to_debug_frame): Match current ++ gcc behaviour. ++ * config/te-aix.h: New file. ++ * configure.tgt: Use em=aix for powerpc-aix. ++ ++2015-01-28 Matthew Wahab ++ ++ * config/tc-arm.c (parse_ifimm_zero): Accept #0x0 as a synonym for #0, ++ restoring previous behaviour. ++ + 2014-12-23 Tristan Gingold + + * configure: Regenerate. +diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c +index 0e58764..2a94fe0 100644 +--- a/gas/config/tc-aarch64.c ++++ b/gas/config/tc-aarch64.c +@@ -1481,7 +1481,14 @@ mapping_state (enum mstate state) + /* The mapping symbol has already been emitted. + There is nothing else to do. */ + return; +- else if (TRANSITION (MAP_UNDEFINED, MAP_DATA)) ++ ++ if (state == MAP_INSN) ++ /* AArch64 instructions require 4-byte alignment. When emitting ++ instructions into any section, record the appropriate section ++ alignment. */ ++ record_alignment (now_seg, 2); ++ ++ if (TRANSITION (MAP_UNDEFINED, MAP_DATA)) + /* This case will be evaluated later in the next else. */ + return; + else if (TRANSITION (MAP_UNDEFINED, MAP_INSN)) +@@ -1863,8 +1870,14 @@ s_aarch64_inst (int ignored ATTRIBUTE_UNUSED) + return; + } + +- if (!need_pass_2) ++ /* Sections are assumed to start aligned. In text section, there is no ++ MAP_DATA symbol pending. So we only align the address during ++ MAP_DATA --> MAP_INSN transition. ++ For other sections, this is not guaranteed. */ ++ enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate; ++ if (!need_pass_2 && (subseg_text_p (now_seg) && mapstate == MAP_DATA)) + frag_align_code (2, 0); ++ + #ifdef OBJ_ELF + mapping_state (MAP_INSN); + #endif +@@ -5571,6 +5584,14 @@ md_assemble (char *str) + + init_operand_error_report (); + ++ /* Sections are assumed to start aligned. In text section, there is no ++ MAP_DATA symbol pending. So we only align the address during ++ MAP_DATA --> MAP_INSN transition. ++ For other sections, this is not guaranteed. */ ++ enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate; ++ if (!need_pass_2 && (subseg_text_p (now_seg) && mapstate == MAP_DATA)) ++ frag_align_code (2, 0); ++ + saved_cond = inst.cond; + reset_aarch64_instruction (&inst); + inst.cond = saved_cond; +@@ -5900,21 +5921,20 @@ aarch64_init_frag (fragS * fragP, int max_chars) + /* Record a mapping symbol for alignment frags. We will delete this + later if the alignment ends up empty. */ + if (!fragP->tc_frag_data.recorded) ++ fragP->tc_frag_data.recorded = 1; ++ ++ switch (fragP->fr_type) + { +- fragP->tc_frag_data.recorded = 1; +- switch (fragP->fr_type) +- { +- case rs_align: +- case rs_align_test: +- case rs_fill: +- mapping_state_2 (MAP_DATA, max_chars); +- break; +- case rs_align_code: +- mapping_state_2 (MAP_INSN, max_chars); +- break; +- default: +- break; +- } ++ case rs_align: ++ case rs_align_test: ++ case rs_fill: ++ mapping_state_2 (MAP_DATA, max_chars); ++ break; ++ case rs_align_code: ++ mapping_state_2 (MAP_INSN, max_chars); ++ break; ++ default: ++ break; + } + } + +@@ -7184,6 +7204,11 @@ static const struct aarch64_cpu_option_table aarch64_cpus[] = { + AARCH64_FEATURE_CRC), "Cortex-A53"}, + {"cortex-a57", AARCH64_FEATURE(AARCH64_ARCH_V8, + AARCH64_FEATURE_CRC), "Cortex-A57"}, ++ {"cortex-a72", AARCH64_FEATURE (AARCH64_ARCH_V8, ++ AARCH64_FEATURE_CRC), "Cortex-A72"}, ++ {"exynos-m1", AARCH64_FEATURE (AARCH64_ARCH_V8, ++ AARCH64_FEATURE_CRC | AARCH64_FEATURE_CRYPTO), ++ "Samsung Exynos M1"}, + /* The 'xgene-1' name is an older name for 'xgene1', which was used + in earlier releases and is superseded by 'xgene1' in all + tools. */ +diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c +index 5077f87..2ab8bbea 100644 +--- a/gas/config/tc-arm.c ++++ b/gas/config/tc-arm.c +@@ -4959,6 +4959,16 @@ parse_ifimm_zero (char **in) + return FALSE; + + ++*in; ++ ++ /* Accept #0x0 as a synonym for #0. */ ++ if (strncmp (*in, "0x", 2) == 0) ++ { ++ int val; ++ if (parse_immediate (in, &val, 0, 0, TRUE) == FAIL) ++ return FALSE; ++ return TRUE; ++ } ++ + error_code = atof_generic (in, ".", EXP_CHARS, + &generic_floating_point_number); + +@@ -20960,27 +20970,29 @@ arm_init_frag (fragS * fragP, int max_chars ATTRIBUTE_UNUSED) + void + arm_init_frag (fragS * fragP, int max_chars) + { ++ int frag_thumb_mode; + /* If the current ARM vs THUMB mode has not already + been recorded into this frag then do so now. */ + if ((fragP->tc_frag_data.thumb_mode & MODE_RECORDED) == 0) +- { +- fragP->tc_frag_data.thumb_mode = thumb_mode | MODE_RECORDED; ++ fragP->tc_frag_data.thumb_mode = thumb_mode | MODE_RECORDED; + +- /* Record a mapping symbol for alignment frags. We will delete this +- later if the alignment ends up empty. */ +- switch (fragP->fr_type) +- { +- case rs_align: +- case rs_align_test: +- case rs_fill: +- mapping_state_2 (MAP_DATA, max_chars); +- break; +- case rs_align_code: +- mapping_state_2 (thumb_mode ? MAP_THUMB : MAP_ARM, max_chars); +- break; +- default: +- break; +- } ++ frag_thumb_mode = fragP->tc_frag_data.thumb_mode ^ MODE_RECORDED; ++ ++ ++ /* Record a mapping symbol for alignment frags. We will delete this ++ later if the alignment ends up empty. */ ++ switch (fragP->fr_type) ++ { ++ case rs_align: ++ case rs_align_test: ++ case rs_fill: ++ mapping_state_2 (MAP_DATA, max_chars); ++ break; ++ case rs_align_code: ++ mapping_state_2 (frag_thumb_mode ? MAP_THUMB : MAP_ARM, max_chars); ++ break; ++ default: ++ break; + } + } + +@@ -23235,7 +23247,6 @@ tc_gen_reloc (asection *section, fixS *fixp) + case BFD_RELOC_ARM_SBREL32: + case BFD_RELOC_ARM_PREL31: + case BFD_RELOC_ARM_TARGET2: +- case BFD_RELOC_ARM_TLS_LE32: + case BFD_RELOC_ARM_TLS_LDO32: + case BFD_RELOC_ARM_PCREL_CALL: + case BFD_RELOC_ARM_PCREL_JUMP: +@@ -23273,6 +23284,7 @@ tc_gen_reloc (asection *section, fixS *fixp) + + case BFD_RELOC_ARM_TLS_GOTDESC: + case BFD_RELOC_ARM_TLS_GD32: ++ case BFD_RELOC_ARM_TLS_LE32: + case BFD_RELOC_ARM_TLS_IE32: + case BFD_RELOC_ARM_TLS_LDM32: + /* BFD will include the symbol's address in the addend. +@@ -24398,6 +24410,8 @@ static const struct arm_cpu_option_table arm_cpus[] = + "Cortex-A53"), + ARM_CPU_OPT ("cortex-a57", ARM_ARCH_V8A, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8, + "Cortex-A57"), ++ ARM_CPU_OPT ("cortex-a72", ARM_ARCH_V8A, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8, ++ "Cortex-A72"), + ARM_CPU_OPT ("cortex-r4", ARM_ARCH_V7R, FPU_NONE, "Cortex-R4"), + ARM_CPU_OPT ("cortex-r4f", ARM_ARCH_V7R, FPU_ARCH_VFP_V3D16, + "Cortex-R4F"), +@@ -24411,6 +24425,9 @@ static const struct arm_cpu_option_table arm_cpus[] = + ARM_CPU_OPT ("cortex-m1", ARM_ARCH_V6SM, FPU_NONE, "Cortex-M1"), + ARM_CPU_OPT ("cortex-m0", ARM_ARCH_V6SM, FPU_NONE, "Cortex-M0"), + ARM_CPU_OPT ("cortex-m0plus", ARM_ARCH_V6SM, FPU_NONE, "Cortex-M0+"), ++ ARM_CPU_OPT ("exynos-m1", ARM_ARCH_V8A, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8, ++ "Samsung " \ ++ "Exynos M1"), + /* ??? XSCALE is really an architecture. */ + ARM_CPU_OPT ("xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL), + /* ??? iwmmxt is not a processor. */ +diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c +index 6f7a1ae..b757118 100644 +--- a/gas/config/tc-i386.c ++++ b/gas/config/tc-i386.c +@@ -1129,85 +1129,9 @@ i386_align_code (fragS *fragP, int count) + /* nopw %cs:0L(%[re]ax,%[re]ax,1) */ + static const char alt_10[] = + {0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- /* data16 +- nopw %cs:0L(%[re]ax,%[re]ax,1) */ +- static const char alt_long_11[] = +- {0x66, +- 0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- /* data16 +- data16 +- nopw %cs:0L(%[re]ax,%[re]ax,1) */ +- static const char alt_long_12[] = +- {0x66, +- 0x66, +- 0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- /* data16 +- data16 +- data16 +- nopw %cs:0L(%[re]ax,%[re]ax,1) */ +- static const char alt_long_13[] = +- {0x66, +- 0x66, +- 0x66, +- 0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- /* data16 +- data16 +- data16 +- data16 +- nopw %cs:0L(%[re]ax,%[re]ax,1) */ +- static const char alt_long_14[] = +- {0x66, +- 0x66, +- 0x66, +- 0x66, +- 0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- /* data16 +- data16 +- data16 +- data16 +- data16 +- nopw %cs:0L(%[re]ax,%[re]ax,1) */ +- static const char alt_long_15[] = +- {0x66, +- 0x66, +- 0x66, +- 0x66, +- 0x66, +- 0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- /* nopl 0(%[re]ax,%[re]ax,1) +- nopw 0(%[re]ax,%[re]ax,1) */ +- static const char alt_short_11[] = +- {0x0f,0x1f,0x44,0x00,0x00, +- 0x66,0x0f,0x1f,0x44,0x00,0x00}; +- /* nopw 0(%[re]ax,%[re]ax,1) +- nopw 0(%[re]ax,%[re]ax,1) */ +- static const char alt_short_12[] = +- {0x66,0x0f,0x1f,0x44,0x00,0x00, +- 0x66,0x0f,0x1f,0x44,0x00,0x00}; +- /* nopw 0(%[re]ax,%[re]ax,1) +- nopl 0L(%[re]ax) */ +- static const char alt_short_13[] = +- {0x66,0x0f,0x1f,0x44,0x00,0x00, +- 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00}; +- /* nopl 0L(%[re]ax) +- nopl 0L(%[re]ax) */ +- static const char alt_short_14[] = +- {0x0f,0x1f,0x80,0x00,0x00,0x00,0x00, +- 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00}; +- /* nopl 0L(%[re]ax) +- nopl 0L(%[re]ax,%[re]ax,1) */ +- static const char alt_short_15[] = +- {0x0f,0x1f,0x80,0x00,0x00,0x00,0x00, +- 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00}; +- static const char *const alt_short_patt[] = { ++ static const char *const alt_patt[] = { + f32_1, f32_2, alt_3, alt_4, alt_5, alt_6, alt_7, alt_8, +- alt_9, alt_10, alt_short_11, alt_short_12, alt_short_13, +- alt_short_14, alt_short_15 +- }; +- static const char *const alt_long_patt[] = { +- f32_1, f32_2, alt_3, alt_4, alt_5, alt_6, alt_7, alt_8, +- alt_9, alt_10, alt_long_11, alt_long_12, alt_long_13, +- alt_long_14, alt_long_15 ++ alt_9, alt_10 + }; + + /* Only align for at least a positive non-zero boundary. */ +@@ -1219,14 +1143,9 @@ i386_align_code (fragS *fragP, int count) + + 1. For PROCESSOR_I386, PROCESSOR_I486, PROCESSOR_PENTIUM and + PROCESSOR_GENERIC32, f32_patt will be used. +- 2. For PROCESSOR_PENTIUMPRO, PROCESSOR_PENTIUM4, PROCESSOR_NOCONA, +- PROCESSOR_CORE, PROCESSOR_CORE2, PROCESSOR_COREI7, and +- PROCESSOR_GENERIC64, alt_long_patt will be used. +- 3. For PROCESSOR_ATHLON, PROCESSOR_K6, PROCESSOR_K8 and +- PROCESSOR_AMDFAM10, PROCESSOR_BD and PROCESSOR_BT, alt_short_patt +- will be used. +- +- When -mtune= isn't used, alt_long_patt will be used if ++ 2. For the rest, alt_patt will be used. ++ ++ When -mtune= isn't used, alt_patt will be used if + cpu_arch_isa_flags has CpuNop. Otherwise, f32_patt will + be used. + +@@ -1259,7 +1178,7 @@ i386_align_code (fragS *fragP, int count) + /* We use cpu_arch_isa_flags to check if we SHOULD + optimize with nops. */ + if (fragP->tc_frag_data.isa_flags.bitfield.cpunop) +- patt = alt_long_patt; ++ patt = alt_patt; + else + patt = f32_patt; + break; +@@ -1271,15 +1190,13 @@ i386_align_code (fragS *fragP, int count) + case PROCESSOR_L1OM: + case PROCESSOR_K1OM: + case PROCESSOR_GENERIC64: +- patt = alt_long_patt; +- break; + case PROCESSOR_K6: + case PROCESSOR_ATHLON: + case PROCESSOR_K8: + case PROCESSOR_AMDFAM10: + case PROCESSOR_BD: + case PROCESSOR_BT: +- patt = alt_short_patt; ++ patt = alt_patt; + break; + case PROCESSOR_I386: + case PROCESSOR_I486: +@@ -1313,7 +1230,7 @@ i386_align_code (fragS *fragP, int count) + /* We use cpu_arch_isa_flags to check if we CAN optimize + with nops. */ + if (fragP->tc_frag_data.isa_flags.bitfield.cpunop) +- patt = alt_short_patt; ++ patt = alt_patt; + else + patt = f32_patt; + break; +@@ -1326,12 +1243,12 @@ i386_align_code (fragS *fragP, int count) + case PROCESSOR_L1OM: + case PROCESSOR_K1OM: + if (fragP->tc_frag_data.isa_flags.bitfield.cpunop) +- patt = alt_long_patt; ++ patt = alt_patt; + else + patt = f32_patt; + break; + case PROCESSOR_GENERIC64: +- patt = alt_long_patt; ++ patt = alt_patt; + break; + } + } +@@ -1362,15 +1279,15 @@ i386_align_code (fragS *fragP, int count) + } + else + { +- /* Maximum length of an instruction is 15 byte. If the +- padding is greater than 15 bytes and we don't use jump, ++ /* Maximum length of an instruction is 10 byte. If the ++ padding is greater than 10 bytes and we don't use jump, + we have to break it into smaller pieces. */ + int padding = count; +- while (padding > 15) ++ while (padding > 10) + { +- padding -= 15; ++ padding -= 10; + memcpy (fragP->fr_literal + fragP->fr_fix + padding, +- patt [14], 15); ++ patt [9], 10); + } + + if (padding) +diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c +index cb06881..c6b67e1 100644 +--- a/gas/config/tc-mep.c ++++ b/gas/config/tc-mep.c +@@ -486,12 +486,12 @@ md_begin () + mep_cop = mep_config_map[mep_config_index].cpu_flag & EF_MEP_COP_MASK; + + /* Set the machine number and endian. */ +- gas_cgen_cpu_desc = mep_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0, ++ gas_cgen_cpu_desc = mep_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0U, + CGEN_CPU_OPEN_ENDIAN, + target_big_endian + ? CGEN_ENDIAN_BIG + : CGEN_ENDIAN_LITTLE, +- CGEN_CPU_OPEN_ISAS, 0, ++ CGEN_CPU_OPEN_ISAS, (CGEN_BITSET *) 0, + CGEN_CPU_OPEN_END); + mep_cgen_init_asm (gas_cgen_cpu_desc); + +diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h +index 3cd9bf1..d9551c1 100644 +--- a/gas/config/tc-ppc.h ++++ b/gas/config/tc-ppc.h +@@ -267,11 +267,24 @@ extern int ppc_parse_name (const char *, struct expressionS *); + #define md_cleanup() ppc_cleanup () + extern void ppc_cleanup (void); + ++#if (defined TE_AIX5 || defined TE_AIX \ ++ || defined TE_FreeBSD || defined TE_NetBSD || defined TE_LYNX) + /* ppc uses different register numbers between .eh_frame and .debug_frame. + This macro translates the .eh_frame register numbers to .debug_frame + register numbers. */ +-#define md_reg_eh_frame_to_debug_frame(regno) \ +- ((regno) == 70 ? 64 /* cr2 */ : (regno)) ++#define md_reg_eh_frame_to_debug_frame(regno) \ ++ ((regno) == 70 ? 64 /* cr2 */ \ ++ : (regno) == 65 ? 108 /* lr */ \ ++ : (regno) == 66 ? 109 /* ctr */ \ ++ : (regno) >= 68 && (regno) <= 75 ? (regno) + 86 - 68 /* crN */ \ ++ : (regno) == 76 ? 101 /* xer */ \ ++ : (regno) >= 77 && (regno) <= 108 ? (regno) + 1124 - 77 /* vrN */ \ ++ : (regno) == 109 ? 356 /* vrsave */ \ ++ : (regno) == 110 ? 67 /* vscr */ \ ++ : (regno) == 111 ? 99 /* spe_acc */ \ ++ : (regno) == 112 ? 612 /* spefscr */ \ ++ : (regno)) ++#endif + + #define TARGET_USE_CFIPOP 1 + +diff --git a/gas/config/te-aix.h b/gas/config/te-aix.h +new file mode 100644 +index 0000000..b0da4fb +--- /dev/null ++++ b/gas/config/te-aix.h +@@ -0,0 +1,22 @@ ++/* Copyright (C) 2014 Free Software Foundation, Inc. ++ ++ This file is part of GAS, the GNU Assembler. ++ ++ GAS is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as ++ published by the Free Software Foundation; either version 3, ++ or (at your option) any later version. ++ ++ GAS is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ++ the GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with GAS; see the file COPYING. If not, write to the Free ++ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA ++ 02110-1301, USA. */ ++ ++#define TE_AIX ++ ++#include "obj-format.h" +diff --git a/gas/configure.tgt b/gas/configure.tgt +index d07d445..9abc768 100644 +--- a/gas/configure.tgt ++++ b/gas/configure.tgt +@@ -372,7 +372,7 @@ case ${generic_target} in + ppc-*-winnt*) fmt=coff em=pe ;; + ppc-*-aix5.[01]) fmt=coff em=aix5 ;; + ppc-*-aix[5-9].*) fmt=coff em=aix5 ;; +- ppc-*-aix*) fmt=coff ;; ++ ppc-*-aix*) fmt=coff em=aix ;; + ppc-*-beos*) fmt=coff ;; + ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; + ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; +diff --git a/gas/doc/c-aarch64.texi b/gas/doc/c-aarch64.texi +index 8fbae06..2aaed67 100644 +--- a/gas/doc/c-aarch64.texi ++++ b/gas/doc/c-aarch64.texi +@@ -57,6 +57,8 @@ message if an attempt is made to assemble an instruction which will not execute + on the target processor. The following processor names are recognized: + @code{cortex-a53}, + @code{cortex-a57}, ++@code{cortex-a72}, ++@code{exynos-m1}, + @code{xgene1}, + and + @code{xgene2}. +diff --git a/gas/doc/c-arm.texi b/gas/doc/c-arm.texi +index 7bcce94..7a3bf85 100644 +--- a/gas/doc/c-arm.texi ++++ b/gas/doc/c-arm.texi +@@ -129,6 +129,7 @@ recognized: + @code{cortex-m0}, + @code{cortex-m0plus}, + @code{ep9312} (ARM920 with Cirrus Maverick coprocessor), ++@code{exynos-m1}, + @code{i80200} (Intel XScale processor) + @code{iwmmxt} (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor) + and +diff --git a/gas/read.c b/gas/read.c +index 9fd0335..6e441da 100644 +--- a/gas/read.c ++++ b/gas/read.c +@@ -1578,7 +1578,7 @@ s_align_ptwo (int arg) + + /* Switch in and out of alternate macro mode. */ + +-void ++static void + s_altmacro (int on) + { + demand_empty_rest_of_line (); +@@ -3983,7 +3983,7 @@ s_rva (int size) + + /* .reloc offset, reloc_name, symbol+addend. */ + +-void ++static void + s_reloc (int ignore ATTRIBUTE_UNUSED) + { + char *stop = NULL; +diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog +index d53d518..173630b 100644 +--- a/gas/testsuite/ChangeLog ++++ b/gas/testsuite/ChangeLog +@@ -1,3 +1,135 @@ ++2015-06-19 Nick Clifton ++ ++ PR gas/18481 ++ * gas/arm/tls.s: Add tests of the tpoff pseudo with a local ++ symbol. ++ * gas/arm/tls.d: Update expected output. ++ ++2015-06-17 Renlin Li ++ ++ Applied from master. ++ 2015-04-28 Renlin Li ++ ++ * gas/arm/thumb2_vpool_be.d: Adjust the desired output. ++ * gas/arm/vldconst_be.d: Likewise. ++ ++2015-06-17 Renlin Li ++ ++ Applied from master. ++ 2015-05-05 Renlin Li ++ ++ * gas/aarch64/mapping_5.d: New. ++ * gas/aarch64/mapping_5.s: New. ++ * gas/aarch64/mapping_6.d: New. ++ * gas/aarch64/mapping_6.s: New. ++ ++2015-06-16 Matthew Wahab ++ ++ Applied from master. ++ 2015-06-16 Matthew Wahab ++ ++ * sysreg.d: Add id_mmfr4_el1, update expected output. ++ * sysreg.s: Add id_mmfr4_el1. ++ ++2015-06-04 Matthew Wahab ++ ++ * gas/aarch64/codealign.d: Add test for code section alignment. ++ * gas/aarch64/codealign.s: New file. ++ ++2015-05-14 Peter Bergner ++ ++ Applied from master. ++ 2015-05-14 Peter Bergner ++ ++ * gas/ppc/power4.d: Add a slbia test. ++ * gas/ppc/power4.s: Likewise. ++ * gas/ppc/power6.d: Add slbia and tlbie tests. ++ * gas/ppc/power6.s: Likewise. ++ * gas/ppc/power7.d: Remove wait tests. Add a tlbie test. ++ * gas/ppc/power7.s: Likewise. ++ ++2015-05-07 Renlin Li ++ ++ Applied from master. ++ 2015-03-10 Renlin Li ++ ++ * gas/aarch64/ldst-reg-uns-imm.d: Adjust expected output. ++ * gas/aarch64/ldst-reg-unscaled-imm.d: Likewise. ++ * gas/aarch64/reloc-insn.d: Likewise. ++ ++2015-04-28 Peter Bergner ++ ++ Applied from master. ++ 2015-04-27 Peter Bergner ++ ++ * gas/ppc/a2.s: Fixup test case due to dcbt/dcbtst embedded operand ++ ordering change. ++ * gas/ppc/a2.d: Likewise. ++ * gas/ppc/476.d: Likewise. ++ * gas/ppc/booke.s: Remove invalid 3 operand dcbt tests. ++ * gas/ppc/booke.d: Likewise. ++ * gas/ppc/power7.s: Remove lbarx, lharx, stbcx., sthcx., waitrsv ++ and waitimpl tests. ++ * gas/ppc/power7.d: Likewise. ++ ++2015-03-20 H.J. Lu ++ ++ Apply patch from master: ++ 2015-03-20 H.J. Lu ++ ++ * gas/i386/i386.exp: Don't run nops-1-bdver1, nops-1-bdver2, ++ nops-1-bdver3, nops-1-bdver4, nops-1-btver1 nops-1-btver2, ++ x86-64-nops-1-nocona, x86-64-nops-1-bdver1, x86-64-nops-1-bdver2, ++ x86-64-nops-1-bdver3, x86-64-nops-1-bdver4, x86-64-nops-1-btver1 ++ nor x86-64-nops-1-btver2. ++ * gas/i386/nops-1-core2.d: Updated. ++ * gas/i386/nops-1-k8.d: Likewise. ++ * gas/i386/nops-4a-i686.d: Likewise. ++ * gas/i386/nops-5-i686.d: Likewise. ++ * gas/i386/nops-5.d: Likewise. ++ * gas/i386/nops-6.d: Likewise. ++ * gas/i386/x86-64-nops-1-core2.d: Likewise. ++ * gas/i386/x86-64-nops-1-g64.d: Likewise. ++ * gas/i386/x86-64-nops-1-k8.d: Likewise. ++ * gas/i386/x86-64-nops-1.d: Likewise. ++ * gas/i386/x86-64-nops-2.d: Likewise. ++ * gas/i386/x86-64-nops-3.d: Likewise. ++ * gas/i386/x86-64-nops-4-core2.d: Likewise. ++ * gas/i386/x86-64-nops-4-k8.d: Likewise. ++ * gas/i386/x86-64-nops-4.d: Likewise. ++ * gas/i386/x86-64-nops-5-k8.d: Likewise. ++ * gas/i386/x86-64-nops-5.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-1.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-2.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-3.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-4.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-5.d: Likewise. ++ * gas/i386/nops-1-bdver1.d: Removed. ++ * gas/i386/nops-1-bdver2.d: Likewise. ++ * gas/i386/nops-1-bdver3.d: Likewise. ++ * gas/i386/nops-1-bdver4.d: Likewise. ++ * gas/i386/nops-1-btver1.d: Likewise. ++ * gas/i386/nops-1-btver2.d: Likewise. ++ * gas/i386/x86-64-nops-1-bdver1.d: Likewise. ++ * gas/i386/x86-64-nops-1-bdver2.d: Likewise. ++ * gas/i386/x86-64-nops-1-bdver3.d: Likewise. ++ * gas/i386/x86-64-nops-1-bdver4.d: Likewise. ++ * gas/i386/x86-64-nops-1-btver1.d: Likewise. ++ * gas/i386/x86-64-nops-1-btver2.d: Likewise. ++ * gas/i386/x86-64-nops-1-nocona.d: Likewise. ++ * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. ++ ++2015-01-28 Matthew Fortune ++ ++ * gas/arm/ual-vcmp.s: Add vcmp, vcmpe with #0x0 operand. ++ * gas/ual/vcmp.d: Update expected output. ++ * gas/ual/vcmp-zero-bad.l: Likewise ++ + 2014-12-19 Matthew Fortune + + * gas/mips/r6-64.s: Remove .align directives from LDPC +diff --git a/gas/testsuite/gas/aarch64/codealign.d b/gas/testsuite/gas/aarch64/codealign.d +new file mode 100644 +index 0000000..8e75c87 +--- /dev/null ++++ b/gas/testsuite/gas/aarch64/codealign.d +@@ -0,0 +1,16 @@ ++#objdump: --section-headers ++# Minimum code alignment should be set. ++# This test is only valid on ELF based ports. ++#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* ++ ++.*: +file format.*aarch64.* ++ ++Sections: ++Idx Name Size VMA LMA File off Algn ++ 0 \.text .* .* .* .* 2\*\*2 ++ .*CODE.* ++ 1 \.data .* .* .* .* 2\*\*0 ++ .*DATA.* ++ 2 \.bss .* .* .* .* 2\*\*0 ++.* ++ +diff --git a/gas/testsuite/gas/aarch64/codealign.s b/gas/testsuite/gas/aarch64/codealign.s +new file mode 100644 +index 0000000..b80a6d9 +--- /dev/null ++++ b/gas/testsuite/gas/aarch64/codealign.s +@@ -0,0 +1,2 @@ ++.text ++ nop +diff --git a/gas/testsuite/gas/aarch64/ldst-reg-uns-imm.d b/gas/testsuite/gas/aarch64/ldst-reg-uns-imm.d +index caaea07..be9fd60 100644 +--- a/gas/testsuite/gas/aarch64/ldst-reg-uns-imm.d ++++ b/gas/testsuite/gas/aarch64/ldst-reg-uns-imm.d +@@ -5,8 +5,8 @@ + Disassembly of section \.text: + + 0000000000000000 <.*>: +- 0: 3c1003e7 str b7, \[sp,#-256\] +- 4: 3c1553e7 str b7, \[sp,#-171\] ++ 0: 3c1003e7 stur b7, \[sp,#-256\] ++ 4: 3c1553e7 stur b7, \[sp,#-171\] + 8: 3d0003e7 str b7, \[sp\] + c: 3d0003e7 str b7, \[sp\] + 10: 3d000be7 str b7, \[sp,#2\] +@@ -16,52 +16,52 @@ Disassembly of section \.text: + 20: 3d0157e7 str b7, \[sp,#85\] + 24: 3d03ffe7 str b7, \[sp,#255\] + 28: 3d3fffe7 str b7, \[sp,#4095\] +- 2c: 7c1003e7 str h7, \[sp,#-256\] +- 30: 7c1553e7 str h7, \[sp,#-171\] ++ 2c: 7c1003e7 stur h7, \[sp,#-256\] ++ 30: 7c1553e7 stur h7, \[sp,#-171\] + 34: 7d0003e7 str h7, \[sp\] + 38: 7d0003e7 str h7, \[sp\] + 3c: 7d0007e7 str h7, \[sp,#2\] + 40: 7d000be7 str h7, \[sp,#4\] + 44: 7d0013e7 str h7, \[sp,#8\] + 48: 7d0023e7 str h7, \[sp,#16\] +- 4c: 7c0553e7 str h7, \[sp,#85\] +- 50: 7c0ff3e7 str h7, \[sp,#255\] ++ 4c: 7c0553e7 stur h7, \[sp,#85\] ++ 50: 7c0ff3e7 stur h7, \[sp,#255\] + 54: 7d3fffe7 str h7, \[sp,#8190\] +- 58: bc1003e7 str s7, \[sp,#-256\] +- 5c: bc1553e7 str s7, \[sp,#-171\] ++ 58: bc1003e7 stur s7, \[sp,#-256\] ++ 5c: bc1553e7 stur s7, \[sp,#-171\] + 60: bd0003e7 str s7, \[sp\] + 64: bd0003e7 str s7, \[sp\] +- 68: bc0023e7 str s7, \[sp,#2\] ++ 68: bc0023e7 stur s7, \[sp,#2\] + 6c: bd0007e7 str s7, \[sp,#4\] + 70: bd000be7 str s7, \[sp,#8\] + 74: bd0013e7 str s7, \[sp,#16\] +- 78: bc0553e7 str s7, \[sp,#85\] +- 7c: bc0ff3e7 str s7, \[sp,#255\] ++ 78: bc0553e7 stur s7, \[sp,#85\] ++ 7c: bc0ff3e7 stur s7, \[sp,#255\] + 80: bd3fffe7 str s7, \[sp,#16380\] +- 84: fc1003e7 str d7, \[sp,#-256\] +- 88: fc1553e7 str d7, \[sp,#-171\] ++ 84: fc1003e7 stur d7, \[sp,#-256\] ++ 88: fc1553e7 stur d7, \[sp,#-171\] + 8c: fd0003e7 str d7, \[sp\] + 90: fd0003e7 str d7, \[sp\] +- 94: fc0023e7 str d7, \[sp,#2\] +- 98: fc0043e7 str d7, \[sp,#4\] ++ 94: fc0023e7 stur d7, \[sp,#2\] ++ 98: fc0043e7 stur d7, \[sp,#4\] + 9c: fd0007e7 str d7, \[sp,#8\] + a0: fd000be7 str d7, \[sp,#16\] +- a4: fc0553e7 str d7, \[sp,#85\] +- a8: fc0ff3e7 str d7, \[sp,#255\] ++ a4: fc0553e7 stur d7, \[sp,#85\] ++ a8: fc0ff3e7 stur d7, \[sp,#255\] + ac: fd3fffe7 str d7, \[sp,#32760\] +- b0: 3c9003e7 str q7, \[sp,#-256\] +- b4: 3c9553e7 str q7, \[sp,#-171\] ++ b0: 3c9003e7 stur q7, \[sp,#-256\] ++ b4: 3c9553e7 stur q7, \[sp,#-171\] + b8: 3d8003e7 str q7, \[sp\] + bc: 3d8003e7 str q7, \[sp\] +- c0: 3c8023e7 str q7, \[sp,#2\] +- c4: 3c8043e7 str q7, \[sp,#4\] +- c8: 3c8083e7 str q7, \[sp,#8\] ++ c0: 3c8023e7 stur q7, \[sp,#2\] ++ c4: 3c8043e7 stur q7, \[sp,#4\] ++ c8: 3c8083e7 stur q7, \[sp,#8\] + cc: 3d8007e7 str q7, \[sp,#16\] +- d0: 3c8553e7 str q7, \[sp,#85\] +- d4: 3c8ff3e7 str q7, \[sp,#255\] ++ d0: 3c8553e7 stur q7, \[sp,#85\] ++ d4: 3c8ff3e7 stur q7, \[sp,#255\] + d8: 3dbfffe7 str q7, \[sp,#65520\] +- dc: 3c5003e7 ldr b7, \[sp,#-256\] +- e0: 3c5553e7 ldr b7, \[sp,#-171\] ++ dc: 3c5003e7 ldur b7, \[sp,#-256\] ++ e0: 3c5553e7 ldur b7, \[sp,#-171\] + e4: 3d4003e7 ldr b7, \[sp\] + e8: 3d4003e7 ldr b7, \[sp\] + ec: 3d400be7 ldr b7, \[sp,#2\] +@@ -71,52 +71,52 @@ Disassembly of section \.text: + fc: 3d4157e7 ldr b7, \[sp,#85\] + 100: 3d43ffe7 ldr b7, \[sp,#255\] + 104: 3d7fffe7 ldr b7, \[sp,#4095\] +- 108: 7c5003e7 ldr h7, \[sp,#-256\] +- 10c: 7c5553e7 ldr h7, \[sp,#-171\] ++ 108: 7c5003e7 ldur h7, \[sp,#-256\] ++ 10c: 7c5553e7 ldur h7, \[sp,#-171\] + 110: 7d4003e7 ldr h7, \[sp\] + 114: 7d4003e7 ldr h7, \[sp\] + 118: 7d4007e7 ldr h7, \[sp,#2\] + 11c: 7d400be7 ldr h7, \[sp,#4\] + 120: 7d4013e7 ldr h7, \[sp,#8\] + 124: 7d4023e7 ldr h7, \[sp,#16\] +- 128: 7c4553e7 ldr h7, \[sp,#85\] +- 12c: 7c4ff3e7 ldr h7, \[sp,#255\] ++ 128: 7c4553e7 ldur h7, \[sp,#85\] ++ 12c: 7c4ff3e7 ldur h7, \[sp,#255\] + 130: 7d7fffe7 ldr h7, \[sp,#8190\] +- 134: bc5003e7 ldr s7, \[sp,#-256\] +- 138: bc5553e7 ldr s7, \[sp,#-171\] ++ 134: bc5003e7 ldur s7, \[sp,#-256\] ++ 138: bc5553e7 ldur s7, \[sp,#-171\] + 13c: bd4003e7 ldr s7, \[sp\] + 140: bd4003e7 ldr s7, \[sp\] +- 144: bc4023e7 ldr s7, \[sp,#2\] ++ 144: bc4023e7 ldur s7, \[sp,#2\] + 148: bd4007e7 ldr s7, \[sp,#4\] + 14c: bd400be7 ldr s7, \[sp,#8\] + 150: bd4013e7 ldr s7, \[sp,#16\] +- 154: bc4553e7 ldr s7, \[sp,#85\] +- 158: bc4ff3e7 ldr s7, \[sp,#255\] ++ 154: bc4553e7 ldur s7, \[sp,#85\] ++ 158: bc4ff3e7 ldur s7, \[sp,#255\] + 15c: bd7fffe7 ldr s7, \[sp,#16380\] +- 160: fc5003e7 ldr d7, \[sp,#-256\] +- 164: fc5553e7 ldr d7, \[sp,#-171\] ++ 160: fc5003e7 ldur d7, \[sp,#-256\] ++ 164: fc5553e7 ldur d7, \[sp,#-171\] + 168: fd4003e7 ldr d7, \[sp\] + 16c: fd4003e7 ldr d7, \[sp\] +- 170: fc4023e7 ldr d7, \[sp,#2\] +- 174: fc4043e7 ldr d7, \[sp,#4\] ++ 170: fc4023e7 ldur d7, \[sp,#2\] ++ 174: fc4043e7 ldur d7, \[sp,#4\] + 178: fd4007e7 ldr d7, \[sp,#8\] + 17c: fd400be7 ldr d7, \[sp,#16\] +- 180: fc4553e7 ldr d7, \[sp,#85\] +- 184: fc4ff3e7 ldr d7, \[sp,#255\] ++ 180: fc4553e7 ldur d7, \[sp,#85\] ++ 184: fc4ff3e7 ldur d7, \[sp,#255\] + 188: fd7fffe7 ldr d7, \[sp,#32760\] +- 18c: 3cd003e7 ldr q7, \[sp,#-256\] +- 190: 3cd553e7 ldr q7, \[sp,#-171\] ++ 18c: 3cd003e7 ldur q7, \[sp,#-256\] ++ 190: 3cd553e7 ldur q7, \[sp,#-171\] + 194: 3dc003e7 ldr q7, \[sp\] + 198: 3dc003e7 ldr q7, \[sp\] +- 19c: 3cc023e7 ldr q7, \[sp,#2\] +- 1a0: 3cc043e7 ldr q7, \[sp,#4\] +- 1a4: 3cc083e7 ldr q7, \[sp,#8\] ++ 19c: 3cc023e7 ldur q7, \[sp,#2\] ++ 1a0: 3cc043e7 ldur q7, \[sp,#4\] ++ 1a4: 3cc083e7 ldur q7, \[sp,#8\] + 1a8: 3dc007e7 ldr q7, \[sp,#16\] +- 1ac: 3cc553e7 ldr q7, \[sp,#85\] +- 1b0: 3ccff3e7 ldr q7, \[sp,#255\] ++ 1ac: 3cc553e7 ldur q7, \[sp,#85\] ++ 1b0: 3ccff3e7 ldur q7, \[sp,#255\] + 1b4: 3dffffe7 ldr q7, \[sp,#65520\] +- 1b8: 381003e7 strb w7, \[sp,#-256\] +- 1bc: 381553e7 strb w7, \[sp,#-171\] ++ 1b8: 381003e7 sturb w7, \[sp,#-256\] ++ 1bc: 381553e7 sturb w7, \[sp,#-171\] + 1c0: 390003e7 strb w7, \[sp\] + 1c4: 390003e7 strb w7, \[sp\] + 1c8: 39000be7 strb w7, \[sp,#2\] +@@ -126,41 +126,41 @@ Disassembly of section \.text: + 1d8: 390157e7 strb w7, \[sp,#85\] + 1dc: 3903ffe7 strb w7, \[sp,#255\] + 1e0: 393fffe7 strb w7, \[sp,#4095\] +- 1e4: 781003e7 strh w7, \[sp,#-256\] +- 1e8: 781553e7 strh w7, \[sp,#-171\] ++ 1e4: 781003e7 sturh w7, \[sp,#-256\] ++ 1e8: 781553e7 sturh w7, \[sp,#-171\] + 1ec: 790003e7 strh w7, \[sp\] + 1f0: 790003e7 strh w7, \[sp\] + 1f4: 790007e7 strh w7, \[sp,#2\] + 1f8: 79000be7 strh w7, \[sp,#4\] + 1fc: 790013e7 strh w7, \[sp,#8\] + 200: 790023e7 strh w7, \[sp,#16\] +- 204: 780553e7 strh w7, \[sp,#85\] +- 208: 780ff3e7 strh w7, \[sp,#255\] ++ 204: 780553e7 sturh w7, \[sp,#85\] ++ 208: 780ff3e7 sturh w7, \[sp,#255\] + 20c: 793fffe7 strh w7, \[sp,#8190\] +- 210: b81003e7 str w7, \[sp,#-256\] +- 214: b81553e7 str w7, \[sp,#-171\] ++ 210: b81003e7 stur w7, \[sp,#-256\] ++ 214: b81553e7 stur w7, \[sp,#-171\] + 218: b90003e7 str w7, \[sp\] + 21c: b90003e7 str w7, \[sp\] +- 220: b80023e7 str w7, \[sp,#2\] ++ 220: b80023e7 stur w7, \[sp,#2\] + 224: b90007e7 str w7, \[sp,#4\] + 228: b9000be7 str w7, \[sp,#8\] + 22c: b90013e7 str w7, \[sp,#16\] +- 230: b80553e7 str w7, \[sp,#85\] +- 234: b80ff3e7 str w7, \[sp,#255\] ++ 230: b80553e7 stur w7, \[sp,#85\] ++ 234: b80ff3e7 stur w7, \[sp,#255\] + 238: b93fffe7 str w7, \[sp,#16380\] +- 23c: f81003e7 str x7, \[sp,#-256\] +- 240: f81553e7 str x7, \[sp,#-171\] ++ 23c: f81003e7 stur x7, \[sp,#-256\] ++ 240: f81553e7 stur x7, \[sp,#-171\] + 244: f90003e7 str x7, \[sp\] + 248: f90003e7 str x7, \[sp\] +- 24c: f80023e7 str x7, \[sp,#2\] +- 250: f80043e7 str x7, \[sp,#4\] ++ 24c: f80023e7 stur x7, \[sp,#2\] ++ 250: f80043e7 stur x7, \[sp,#4\] + 254: f90007e7 str x7, \[sp,#8\] + 258: f9000be7 str x7, \[sp,#16\] +- 25c: f80553e7 str x7, \[sp,#85\] +- 260: f80ff3e7 str x7, \[sp,#255\] ++ 25c: f80553e7 stur x7, \[sp,#85\] ++ 260: f80ff3e7 stur x7, \[sp,#255\] + 264: f93fffe7 str x7, \[sp,#32760\] +- 268: 385003e7 ldrb w7, \[sp,#-256\] +- 26c: 385553e7 ldrb w7, \[sp,#-171\] ++ 268: 385003e7 ldurb w7, \[sp,#-256\] ++ 26c: 385553e7 ldurb w7, \[sp,#-171\] + 270: 394003e7 ldrb w7, \[sp\] + 274: 394003e7 ldrb w7, \[sp\] + 278: 39400be7 ldrb w7, \[sp,#2\] +@@ -170,41 +170,41 @@ Disassembly of section \.text: + 288: 394157e7 ldrb w7, \[sp,#85\] + 28c: 3943ffe7 ldrb w7, \[sp,#255\] + 290: 397fffe7 ldrb w7, \[sp,#4095\] +- 294: 785003e7 ldrh w7, \[sp,#-256\] +- 298: 785553e7 ldrh w7, \[sp,#-171\] ++ 294: 785003e7 ldurh w7, \[sp,#-256\] ++ 298: 785553e7 ldurh w7, \[sp,#-171\] + 29c: 794003e7 ldrh w7, \[sp\] + 2a0: 794003e7 ldrh w7, \[sp\] + 2a4: 794007e7 ldrh w7, \[sp,#2\] + 2a8: 79400be7 ldrh w7, \[sp,#4\] + 2ac: 794013e7 ldrh w7, \[sp,#8\] + 2b0: 794023e7 ldrh w7, \[sp,#16\] +- 2b4: 784553e7 ldrh w7, \[sp,#85\] +- 2b8: 784ff3e7 ldrh w7, \[sp,#255\] ++ 2b4: 784553e7 ldurh w7, \[sp,#85\] ++ 2b8: 784ff3e7 ldurh w7, \[sp,#255\] + 2bc: 797fffe7 ldrh w7, \[sp,#8190\] +- 2c0: b85003e7 ldr w7, \[sp,#-256\] +- 2c4: b85553e7 ldr w7, \[sp,#-171\] ++ 2c0: b85003e7 ldur w7, \[sp,#-256\] ++ 2c4: b85553e7 ldur w7, \[sp,#-171\] + 2c8: b94003e7 ldr w7, \[sp\] + 2cc: b94003e7 ldr w7, \[sp\] +- 2d0: b84023e7 ldr w7, \[sp,#2\] ++ 2d0: b84023e7 ldur w7, \[sp,#2\] + 2d4: b94007e7 ldr w7, \[sp,#4\] + 2d8: b9400be7 ldr w7, \[sp,#8\] + 2dc: b94013e7 ldr w7, \[sp,#16\] +- 2e0: b84553e7 ldr w7, \[sp,#85\] +- 2e4: b84ff3e7 ldr w7, \[sp,#255\] ++ 2e0: b84553e7 ldur w7, \[sp,#85\] ++ 2e4: b84ff3e7 ldur w7, \[sp,#255\] + 2e8: b97fffe7 ldr w7, \[sp,#16380\] +- 2ec: f85003e7 ldr x7, \[sp,#-256\] +- 2f0: f85553e7 ldr x7, \[sp,#-171\] ++ 2ec: f85003e7 ldur x7, \[sp,#-256\] ++ 2f0: f85553e7 ldur x7, \[sp,#-171\] + 2f4: f94003e7 ldr x7, \[sp\] + 2f8: f94003e7 ldr x7, \[sp\] +- 2fc: f84023e7 ldr x7, \[sp,#2\] +- 300: f84043e7 ldr x7, \[sp,#4\] ++ 2fc: f84023e7 ldur x7, \[sp,#2\] ++ 300: f84043e7 ldur x7, \[sp,#4\] + 304: f94007e7 ldr x7, \[sp,#8\] + 308: f9400be7 ldr x7, \[sp,#16\] +- 30c: f84553e7 ldr x7, \[sp,#85\] +- 310: f84ff3e7 ldr x7, \[sp,#255\] ++ 30c: f84553e7 ldur x7, \[sp,#85\] ++ 310: f84ff3e7 ldur x7, \[sp,#255\] + 314: f97fffe7 ldr x7, \[sp,#32760\] +- 318: 389003e7 ldrsb x7, \[sp,#-256\] +- 31c: 389553e7 ldrsb x7, \[sp,#-171\] ++ 318: 389003e7 ldursb x7, \[sp,#-256\] ++ 31c: 389553e7 ldursb x7, \[sp,#-171\] + 320: 398003e7 ldrsb x7, \[sp\] + 324: 398003e7 ldrsb x7, \[sp\] + 328: 39800be7 ldrsb x7, \[sp,#2\] +@@ -214,30 +214,30 @@ Disassembly of section \.text: + 338: 398157e7 ldrsb x7, \[sp,#85\] + 33c: 3983ffe7 ldrsb x7, \[sp,#255\] + 340: 39bfffe7 ldrsb x7, \[sp,#4095\] +- 344: 789003e7 ldrsh x7, \[sp,#-256\] +- 348: 789553e7 ldrsh x7, \[sp,#-171\] ++ 344: 789003e7 ldursh x7, \[sp,#-256\] ++ 348: 789553e7 ldursh x7, \[sp,#-171\] + 34c: 798003e7 ldrsh x7, \[sp\] + 350: 798003e7 ldrsh x7, \[sp\] + 354: 798007e7 ldrsh x7, \[sp,#2\] + 358: 79800be7 ldrsh x7, \[sp,#4\] + 35c: 798013e7 ldrsh x7, \[sp,#8\] + 360: 798023e7 ldrsh x7, \[sp,#16\] +- 364: 788553e7 ldrsh x7, \[sp,#85\] +- 368: 788ff3e7 ldrsh x7, \[sp,#255\] ++ 364: 788553e7 ldursh x7, \[sp,#85\] ++ 368: 788ff3e7 ldursh x7, \[sp,#255\] + 36c: 79bfffe7 ldrsh x7, \[sp,#8190\] +- 370: b89003e7 ldrsw x7, \[sp,#-256\] +- 374: b89553e7 ldrsw x7, \[sp,#-171\] ++ 370: b89003e7 ldursw x7, \[sp,#-256\] ++ 374: b89553e7 ldursw x7, \[sp,#-171\] + 378: b98003e7 ldrsw x7, \[sp\] + 37c: b98003e7 ldrsw x7, \[sp\] +- 380: b88023e7 ldrsw x7, \[sp,#2\] ++ 380: b88023e7 ldursw x7, \[sp,#2\] + 384: b98007e7 ldrsw x7, \[sp,#4\] + 388: b9800be7 ldrsw x7, \[sp,#8\] + 38c: b98013e7 ldrsw x7, \[sp,#16\] +- 390: b88553e7 ldrsw x7, \[sp,#85\] +- 394: b88ff3e7 ldrsw x7, \[sp,#255\] ++ 390: b88553e7 ldursw x7, \[sp,#85\] ++ 394: b88ff3e7 ldursw x7, \[sp,#255\] + 398: b9bfffe7 ldrsw x7, \[sp,#16380\] +- 39c: 38d003e7 ldrsb w7, \[sp,#-256\] +- 3a0: 38d553e7 ldrsb w7, \[sp,#-171\] ++ 39c: 38d003e7 ldursb w7, \[sp,#-256\] ++ 3a0: 38d553e7 ldursb w7, \[sp,#-171\] + 3a4: 39c003e7 ldrsb w7, \[sp\] + 3a8: 39c003e7 ldrsb w7, \[sp\] + 3ac: 39c00be7 ldrsb w7, \[sp,#2\] +@@ -247,14 +247,14 @@ Disassembly of section \.text: + 3bc: 39c157e7 ldrsb w7, \[sp,#85\] + 3c0: 39c3ffe7 ldrsb w7, \[sp,#255\] + 3c4: 39ffffe7 ldrsb w7, \[sp,#4095\] +- 3c8: 78d003e7 ldrsh w7, \[sp,#-256\] +- 3cc: 78d553e7 ldrsh w7, \[sp,#-171\] ++ 3c8: 78d003e7 ldursh w7, \[sp,#-256\] ++ 3cc: 78d553e7 ldursh w7, \[sp,#-171\] + 3d0: 79c003e7 ldrsh w7, \[sp\] + 3d4: 79c003e7 ldrsh w7, \[sp\] + 3d8: 79c007e7 ldrsh w7, \[sp,#2\] + 3dc: 79c00be7 ldrsh w7, \[sp,#4\] + 3e0: 79c013e7 ldrsh w7, \[sp,#8\] + 3e4: 79c023e7 ldrsh w7, \[sp,#16\] +- 3e8: 78c553e7 ldrsh w7, \[sp,#85\] +- 3ec: 78cff3e7 ldrsh w7, \[sp,#255\] ++ 3e8: 78c553e7 ldursh w7, \[sp,#85\] ++ 3ec: 78cff3e7 ldursh w7, \[sp,#255\] + 3f0: 79ffffe7 ldrsh w7, \[sp,#8190\] +diff --git a/gas/testsuite/gas/aarch64/ldst-reg-unscaled-imm.d b/gas/testsuite/gas/aarch64/ldst-reg-unscaled-imm.d +index 39dba7b..03358e9 100644 +--- a/gas/testsuite/gas/aarch64/ldst-reg-unscaled-imm.d ++++ b/gas/testsuite/gas/aarch64/ldst-reg-unscaled-imm.d +@@ -5,8 +5,8 @@ + Disassembly of section \.text: + + 0000000000000000 <.*>: +- 0: 3c1003e7 str b7, \[sp,#-256\] +- 4: 3c1553e7 str b7, \[sp,#-171\] ++ 0: 3c1003e7 stur b7, \[sp,#-256\] ++ 4: 3c1553e7 stur b7, \[sp,#-171\] + 8: 3c0003e7 stur b7, \[sp\] + c: 3c0003e7 stur b7, \[sp\] + 10: 3c0023e7 stur b7, \[sp,#2\] +@@ -15,48 +15,48 @@ Disassembly of section \.text: + 1c: 3c0103e7 stur b7, \[sp,#16\] + 20: 3c0553e7 stur b7, \[sp,#85\] + 24: 3c0ff3e7 stur b7, \[sp,#255\] +- 28: 7c1003e7 str h7, \[sp,#-256\] +- 2c: 7c1553e7 str h7, \[sp,#-171\] ++ 28: 7c1003e7 stur h7, \[sp,#-256\] ++ 2c: 7c1553e7 stur h7, \[sp,#-171\] + 30: 7c0003e7 stur h7, \[sp\] + 34: 7c0003e7 stur h7, \[sp\] + 38: 7c0023e7 stur h7, \[sp,#2\] + 3c: 7c0043e7 stur h7, \[sp,#4\] + 40: 7c0083e7 stur h7, \[sp,#8\] + 44: 7c0103e7 stur h7, \[sp,#16\] +- 48: 7c0553e7 str h7, \[sp,#85\] +- 4c: 7c0ff3e7 str h7, \[sp,#255\] +- 50: bc1003e7 str s7, \[sp,#-256\] +- 54: bc1553e7 str s7, \[sp,#-171\] ++ 48: 7c0553e7 stur h7, \[sp,#85\] ++ 4c: 7c0ff3e7 stur h7, \[sp,#255\] ++ 50: bc1003e7 stur s7, \[sp,#-256\] ++ 54: bc1553e7 stur s7, \[sp,#-171\] + 58: bc0003e7 stur s7, \[sp\] + 5c: bc0003e7 stur s7, \[sp\] +- 60: bc0023e7 str s7, \[sp,#2\] ++ 60: bc0023e7 stur s7, \[sp,#2\] + 64: bc0043e7 stur s7, \[sp,#4\] + 68: bc0083e7 stur s7, \[sp,#8\] + 6c: bc0103e7 stur s7, \[sp,#16\] +- 70: bc0553e7 str s7, \[sp,#85\] +- 74: bc0ff3e7 str s7, \[sp,#255\] +- 78: fc1003e7 str d7, \[sp,#-256\] +- 7c: fc1553e7 str d7, \[sp,#-171\] ++ 70: bc0553e7 stur s7, \[sp,#85\] ++ 74: bc0ff3e7 stur s7, \[sp,#255\] ++ 78: fc1003e7 stur d7, \[sp,#-256\] ++ 7c: fc1553e7 stur d7, \[sp,#-171\] + 80: fc0003e7 stur d7, \[sp\] + 84: fc0003e7 stur d7, \[sp\] +- 88: fc0023e7 str d7, \[sp,#2\] +- 8c: fc0043e7 str d7, \[sp,#4\] ++ 88: fc0023e7 stur d7, \[sp,#2\] ++ 8c: fc0043e7 stur d7, \[sp,#4\] + 90: fc0083e7 stur d7, \[sp,#8\] + 94: fc0103e7 stur d7, \[sp,#16\] +- 98: fc0553e7 str d7, \[sp,#85\] +- 9c: fc0ff3e7 str d7, \[sp,#255\] +- a0: 3c9003e7 str q7, \[sp,#-256\] +- a4: 3c9553e7 str q7, \[sp,#-171\] ++ 98: fc0553e7 stur d7, \[sp,#85\] ++ 9c: fc0ff3e7 stur d7, \[sp,#255\] ++ a0: 3c9003e7 stur q7, \[sp,#-256\] ++ a4: 3c9553e7 stur q7, \[sp,#-171\] + a8: 3c8003e7 stur q7, \[sp\] + ac: 3c8003e7 stur q7, \[sp\] +- b0: 3c8023e7 str q7, \[sp,#2\] +- b4: 3c8043e7 str q7, \[sp,#4\] +- b8: 3c8083e7 str q7, \[sp,#8\] ++ b0: 3c8023e7 stur q7, \[sp,#2\] ++ b4: 3c8043e7 stur q7, \[sp,#4\] ++ b8: 3c8083e7 stur q7, \[sp,#8\] + bc: 3c8103e7 stur q7, \[sp,#16\] +- c0: 3c8553e7 str q7, \[sp,#85\] +- c4: 3c8ff3e7 str q7, \[sp,#255\] +- c8: 3c5003e7 ldr b7, \[sp,#-256\] +- cc: 3c5553e7 ldr b7, \[sp,#-171\] ++ c0: 3c8553e7 stur q7, \[sp,#85\] ++ c4: 3c8ff3e7 stur q7, \[sp,#255\] ++ c8: 3c5003e7 ldur b7, \[sp,#-256\] ++ cc: 3c5553e7 ldur b7, \[sp,#-171\] + d0: 3c4003e7 ldur b7, \[sp\] + d4: 3c4003e7 ldur b7, \[sp\] + d8: 3c4023e7 ldur b7, \[sp,#2\] +@@ -65,48 +65,48 @@ Disassembly of section \.text: + e4: 3c4103e7 ldur b7, \[sp,#16\] + e8: 3c4553e7 ldur b7, \[sp,#85\] + ec: 3c4ff3e7 ldur b7, \[sp,#255\] +- f0: 7c5003e7 ldr h7, \[sp,#-256\] +- f4: 7c5553e7 ldr h7, \[sp,#-171\] ++ f0: 7c5003e7 ldur h7, \[sp,#-256\] ++ f4: 7c5553e7 ldur h7, \[sp,#-171\] + f8: 7c4003e7 ldur h7, \[sp\] + fc: 7c4003e7 ldur h7, \[sp\] + 100: 7c4023e7 ldur h7, \[sp,#2\] + 104: 7c4043e7 ldur h7, \[sp,#4\] + 108: 7c4083e7 ldur h7, \[sp,#8\] + 10c: 7c4103e7 ldur h7, \[sp,#16\] +- 110: 7c4553e7 ldr h7, \[sp,#85\] +- 114: 7c4ff3e7 ldr h7, \[sp,#255\] +- 118: bc5003e7 ldr s7, \[sp,#-256\] +- 11c: bc5553e7 ldr s7, \[sp,#-171\] ++ 110: 7c4553e7 ldur h7, \[sp,#85\] ++ 114: 7c4ff3e7 ldur h7, \[sp,#255\] ++ 118: bc5003e7 ldur s7, \[sp,#-256\] ++ 11c: bc5553e7 ldur s7, \[sp,#-171\] + 120: bc4003e7 ldur s7, \[sp\] + 124: bc4003e7 ldur s7, \[sp\] +- 128: bc4023e7 ldr s7, \[sp,#2\] ++ 128: bc4023e7 ldur s7, \[sp,#2\] + 12c: bc4043e7 ldur s7, \[sp,#4\] + 130: bc4083e7 ldur s7, \[sp,#8\] + 134: bc4103e7 ldur s7, \[sp,#16\] +- 138: bc4553e7 ldr s7, \[sp,#85\] +- 13c: bc4ff3e7 ldr s7, \[sp,#255\] +- 140: fc5003e7 ldr d7, \[sp,#-256\] +- 144: fc5553e7 ldr d7, \[sp,#-171\] ++ 138: bc4553e7 ldur s7, \[sp,#85\] ++ 13c: bc4ff3e7 ldur s7, \[sp,#255\] ++ 140: fc5003e7 ldur d7, \[sp,#-256\] ++ 144: fc5553e7 ldur d7, \[sp,#-171\] + 148: fc4003e7 ldur d7, \[sp\] + 14c: fc4003e7 ldur d7, \[sp\] +- 150: fc4023e7 ldr d7, \[sp,#2\] +- 154: fc4043e7 ldr d7, \[sp,#4\] ++ 150: fc4023e7 ldur d7, \[sp,#2\] ++ 154: fc4043e7 ldur d7, \[sp,#4\] + 158: fc4083e7 ldur d7, \[sp,#8\] + 15c: fc4103e7 ldur d7, \[sp,#16\] +- 160: fc4553e7 ldr d7, \[sp,#85\] +- 164: fc4ff3e7 ldr d7, \[sp,#255\] +- 168: 3cd003e7 ldr q7, \[sp,#-256\] +- 16c: 3cd553e7 ldr q7, \[sp,#-171\] ++ 160: fc4553e7 ldur d7, \[sp,#85\] ++ 164: fc4ff3e7 ldur d7, \[sp,#255\] ++ 168: 3cd003e7 ldur q7, \[sp,#-256\] ++ 16c: 3cd553e7 ldur q7, \[sp,#-171\] + 170: 3cc003e7 ldur q7, \[sp\] + 174: 3cc003e7 ldur q7, \[sp\] +- 178: 3cc023e7 ldr q7, \[sp,#2\] +- 17c: 3cc043e7 ldr q7, \[sp,#4\] +- 180: 3cc083e7 ldr q7, \[sp,#8\] ++ 178: 3cc023e7 ldur q7, \[sp,#2\] ++ 17c: 3cc043e7 ldur q7, \[sp,#4\] ++ 180: 3cc083e7 ldur q7, \[sp,#8\] + 184: 3cc103e7 ldur q7, \[sp,#16\] +- 188: 3cc553e7 ldr q7, \[sp,#85\] +- 18c: 3ccff3e7 ldr q7, \[sp,#255\] +- 190: 381003e7 strb w7, \[sp,#-256\] +- 194: 381553e7 strb w7, \[sp,#-171\] ++ 188: 3cc553e7 ldur q7, \[sp,#85\] ++ 18c: 3ccff3e7 ldur q7, \[sp,#255\] ++ 190: 381003e7 sturb w7, \[sp,#-256\] ++ 194: 381553e7 sturb w7, \[sp,#-171\] + 198: 380003e7 sturb w7, \[sp\] + 19c: 380003e7 sturb w7, \[sp\] + 1a0: 380023e7 sturb w7, \[sp,#2\] +@@ -115,38 +115,38 @@ Disassembly of section \.text: + 1ac: 380103e7 sturb w7, \[sp,#16\] + 1b0: 380553e7 sturb w7, \[sp,#85\] + 1b4: 380ff3e7 sturb w7, \[sp,#255\] +- 1b8: 781003e7 strh w7, \[sp,#-256\] +- 1bc: 781553e7 strh w7, \[sp,#-171\] ++ 1b8: 781003e7 sturh w7, \[sp,#-256\] ++ 1bc: 781553e7 sturh w7, \[sp,#-171\] + 1c0: 780003e7 sturh w7, \[sp\] + 1c4: 780003e7 sturh w7, \[sp\] + 1c8: 780023e7 sturh w7, \[sp,#2\] + 1cc: 780043e7 sturh w7, \[sp,#4\] + 1d0: 780083e7 sturh w7, \[sp,#8\] + 1d4: 780103e7 sturh w7, \[sp,#16\] +- 1d8: 780553e7 strh w7, \[sp,#85\] +- 1dc: 780ff3e7 strh w7, \[sp,#255\] +- 1e0: b81003e7 str w7, \[sp,#-256\] +- 1e4: b81553e7 str w7, \[sp,#-171\] ++ 1d8: 780553e7 sturh w7, \[sp,#85\] ++ 1dc: 780ff3e7 sturh w7, \[sp,#255\] ++ 1e0: b81003e7 stur w7, \[sp,#-256\] ++ 1e4: b81553e7 stur w7, \[sp,#-171\] + 1e8: b80003e7 stur w7, \[sp\] + 1ec: b80003e7 stur w7, \[sp\] +- 1f0: b80023e7 str w7, \[sp,#2\] ++ 1f0: b80023e7 stur w7, \[sp,#2\] + 1f4: b80043e7 stur w7, \[sp,#4\] + 1f8: b80083e7 stur w7, \[sp,#8\] + 1fc: b80103e7 stur w7, \[sp,#16\] +- 200: b80553e7 str w7, \[sp,#85\] +- 204: b80ff3e7 str w7, \[sp,#255\] +- 208: f81003e7 str x7, \[sp,#-256\] +- 20c: f81553e7 str x7, \[sp,#-171\] ++ 200: b80553e7 stur w7, \[sp,#85\] ++ 204: b80ff3e7 stur w7, \[sp,#255\] ++ 208: f81003e7 stur x7, \[sp,#-256\] ++ 20c: f81553e7 stur x7, \[sp,#-171\] + 210: f80003e7 stur x7, \[sp\] + 214: f80003e7 stur x7, \[sp\] +- 218: f80023e7 str x7, \[sp,#2\] +- 21c: f80043e7 str x7, \[sp,#4\] ++ 218: f80023e7 stur x7, \[sp,#2\] ++ 21c: f80043e7 stur x7, \[sp,#4\] + 220: f80083e7 stur x7, \[sp,#8\] + 224: f80103e7 stur x7, \[sp,#16\] +- 228: f80553e7 str x7, \[sp,#85\] +- 22c: f80ff3e7 str x7, \[sp,#255\] +- 230: 385003e7 ldrb w7, \[sp,#-256\] +- 234: 385553e7 ldrb w7, \[sp,#-171\] ++ 228: f80553e7 stur x7, \[sp,#85\] ++ 22c: f80ff3e7 stur x7, \[sp,#255\] ++ 230: 385003e7 ldurb w7, \[sp,#-256\] ++ 234: 385553e7 ldurb w7, \[sp,#-171\] + 238: 384003e7 ldurb w7, \[sp\] + 23c: 384003e7 ldurb w7, \[sp\] + 240: 384023e7 ldurb w7, \[sp,#2\] +@@ -155,38 +155,38 @@ Disassembly of section \.text: + 24c: 384103e7 ldurb w7, \[sp,#16\] + 250: 384553e7 ldurb w7, \[sp,#85\] + 254: 384ff3e7 ldurb w7, \[sp,#255\] +- 258: 785003e7 ldrh w7, \[sp,#-256\] +- 25c: 785553e7 ldrh w7, \[sp,#-171\] ++ 258: 785003e7 ldurh w7, \[sp,#-256\] ++ 25c: 785553e7 ldurh w7, \[sp,#-171\] + 260: 784003e7 ldurh w7, \[sp\] + 264: 784003e7 ldurh w7, \[sp\] + 268: 784023e7 ldurh w7, \[sp,#2\] + 26c: 784043e7 ldurh w7, \[sp,#4\] + 270: 784083e7 ldurh w7, \[sp,#8\] + 274: 784103e7 ldurh w7, \[sp,#16\] +- 278: 784553e7 ldrh w7, \[sp,#85\] +- 27c: 784ff3e7 ldrh w7, \[sp,#255\] +- 280: b85003e7 ldr w7, \[sp,#-256\] +- 284: b85553e7 ldr w7, \[sp,#-171\] ++ 278: 784553e7 ldurh w7, \[sp,#85\] ++ 27c: 784ff3e7 ldurh w7, \[sp,#255\] ++ 280: b85003e7 ldur w7, \[sp,#-256\] ++ 284: b85553e7 ldur w7, \[sp,#-171\] + 288: b84003e7 ldur w7, \[sp\] + 28c: b84003e7 ldur w7, \[sp\] +- 290: b84023e7 ldr w7, \[sp,#2\] ++ 290: b84023e7 ldur w7, \[sp,#2\] + 294: b84043e7 ldur w7, \[sp,#4\] + 298: b84083e7 ldur w7, \[sp,#8\] + 29c: b84103e7 ldur w7, \[sp,#16\] +- 2a0: b84553e7 ldr w7, \[sp,#85\] +- 2a4: b84ff3e7 ldr w7, \[sp,#255\] +- 2a8: f85003e7 ldr x7, \[sp,#-256\] +- 2ac: f85553e7 ldr x7, \[sp,#-171\] ++ 2a0: b84553e7 ldur w7, \[sp,#85\] ++ 2a4: b84ff3e7 ldur w7, \[sp,#255\] ++ 2a8: f85003e7 ldur x7, \[sp,#-256\] ++ 2ac: f85553e7 ldur x7, \[sp,#-171\] + 2b0: f84003e7 ldur x7, \[sp\] + 2b4: f84003e7 ldur x7, \[sp\] +- 2b8: f84023e7 ldr x7, \[sp,#2\] +- 2bc: f84043e7 ldr x7, \[sp,#4\] ++ 2b8: f84023e7 ldur x7, \[sp,#2\] ++ 2bc: f84043e7 ldur x7, \[sp,#4\] + 2c0: f84083e7 ldur x7, \[sp,#8\] + 2c4: f84103e7 ldur x7, \[sp,#16\] +- 2c8: f84553e7 ldr x7, \[sp,#85\] +- 2cc: f84ff3e7 ldr x7, \[sp,#255\] +- 2d0: 389003e7 ldrsb x7, \[sp,#-256\] +- 2d4: 389553e7 ldrsb x7, \[sp,#-171\] ++ 2c8: f84553e7 ldur x7, \[sp,#85\] ++ 2cc: f84ff3e7 ldur x7, \[sp,#255\] ++ 2d0: 389003e7 ldursb x7, \[sp,#-256\] ++ 2d4: 389553e7 ldursb x7, \[sp,#-171\] + 2d8: 388003e7 ldursb x7, \[sp\] + 2dc: 388003e7 ldursb x7, \[sp\] + 2e0: 388023e7 ldursb x7, \[sp,#2\] +@@ -195,28 +195,28 @@ Disassembly of section \.text: + 2ec: 388103e7 ldursb x7, \[sp,#16\] + 2f0: 388553e7 ldursb x7, \[sp,#85\] + 2f4: 388ff3e7 ldursb x7, \[sp,#255\] +- 2f8: 789003e7 ldrsh x7, \[sp,#-256\] +- 2fc: 789553e7 ldrsh x7, \[sp,#-171\] ++ 2f8: 789003e7 ldursh x7, \[sp,#-256\] ++ 2fc: 789553e7 ldursh x7, \[sp,#-171\] + 300: 788003e7 ldursh x7, \[sp\] + 304: 788003e7 ldursh x7, \[sp\] + 308: 788023e7 ldursh x7, \[sp,#2\] + 30c: 788043e7 ldursh x7, \[sp,#4\] + 310: 788083e7 ldursh x7, \[sp,#8\] + 314: 788103e7 ldursh x7, \[sp,#16\] +- 318: 788553e7 ldrsh x7, \[sp,#85\] +- 31c: 788ff3e7 ldrsh x7, \[sp,#255\] +- 320: b89003e7 ldrsw x7, \[sp,#-256\] +- 324: b89553e7 ldrsw x7, \[sp,#-171\] ++ 318: 788553e7 ldursh x7, \[sp,#85\] ++ 31c: 788ff3e7 ldursh x7, \[sp,#255\] ++ 320: b89003e7 ldursw x7, \[sp,#-256\] ++ 324: b89553e7 ldursw x7, \[sp,#-171\] + 328: b88003e7 ldursw x7, \[sp\] + 32c: b88003e7 ldursw x7, \[sp\] +- 330: b88023e7 ldrsw x7, \[sp,#2\] ++ 330: b88023e7 ldursw x7, \[sp,#2\] + 334: b88043e7 ldursw x7, \[sp,#4\] + 338: b88083e7 ldursw x7, \[sp,#8\] + 33c: b88103e7 ldursw x7, \[sp,#16\] +- 340: b88553e7 ldrsw x7, \[sp,#85\] +- 344: b88ff3e7 ldrsw x7, \[sp,#255\] +- 348: 38d003e7 ldrsb w7, \[sp,#-256\] +- 34c: 38d553e7 ldrsb w7, \[sp,#-171\] ++ 340: b88553e7 ldursw x7, \[sp,#85\] ++ 344: b88ff3e7 ldursw x7, \[sp,#255\] ++ 348: 38d003e7 ldursb w7, \[sp,#-256\] ++ 34c: 38d553e7 ldursb w7, \[sp,#-171\] + 350: 38c003e7 ldursb w7, \[sp\] + 354: 38c003e7 ldursb w7, \[sp\] + 358: 38c023e7 ldursb w7, \[sp,#2\] +@@ -225,13 +225,13 @@ Disassembly of section \.text: + 364: 38c103e7 ldursb w7, \[sp,#16\] + 368: 38c553e7 ldursb w7, \[sp,#85\] + 36c: 38cff3e7 ldursb w7, \[sp,#255\] +- 370: 78d003e7 ldrsh w7, \[sp,#-256\] +- 374: 78d553e7 ldrsh w7, \[sp,#-171\] ++ 370: 78d003e7 ldursh w7, \[sp,#-256\] ++ 374: 78d553e7 ldursh w7, \[sp,#-171\] + 378: 78c003e7 ldursh w7, \[sp\] + 37c: 78c003e7 ldursh w7, \[sp\] + 380: 78c023e7 ldursh w7, \[sp,#2\] + 384: 78c043e7 ldursh w7, \[sp,#4\] + 388: 78c083e7 ldursh w7, \[sp,#8\] + 38c: 78c103e7 ldursh w7, \[sp,#16\] +- 390: 78c553e7 ldrsh w7, \[sp,#85\] +- 394: 78cff3e7 ldrsh w7, \[sp,#255\] ++ 390: 78c553e7 ldursh w7, \[sp,#85\] ++ 394: 78cff3e7 ldursh w7, \[sp,#255\] +diff --git a/gas/testsuite/gas/aarch64/mapping_5.d b/gas/testsuite/gas/aarch64/mapping_5.d +new file mode 100644 +index 0000000..8a85038 +--- /dev/null ++++ b/gas/testsuite/gas/aarch64/mapping_5.d +@@ -0,0 +1,14 @@ ++#objdump: --syms --special-syms ++#name: AArch64 Mapping Symbols Test 5 ++ ++.*: +file format.*aarch64.* ++ ++SYMBOL TABLE: ++[0]+00 l d .text [0]+00 .text ++[0]+00 l d .data [0]+00 .data ++[0]+00 l d .bss [0]+00 .bss ++[0]+00 l .text [0]+00 \$x ++[0]+04 l .text [0]+00 \$d ++[0]+08 l .text [0]+00 \$x ++[0]+10 l .text [0]+00 \$d ++[0]+14 l .text [0]+00 \$x +diff --git a/gas/testsuite/gas/aarch64/mapping_5.s b/gas/testsuite/gas/aarch64/mapping_5.s +new file mode 100644 +index 0000000..2cb95ed +--- /dev/null ++++ b/gas/testsuite/gas/aarch64/mapping_5.s +@@ -0,0 +1,5 @@ ++ .text ++ nop ++ .long 0 ++ .align 4 ++ .word 0x12345678 +diff --git a/gas/testsuite/gas/aarch64/mapping_6.d b/gas/testsuite/gas/aarch64/mapping_6.d +new file mode 100644 +index 0000000..df6bdaa +--- /dev/null ++++ b/gas/testsuite/gas/aarch64/mapping_6.d +@@ -0,0 +1,15 @@ ++#objdump: --syms --special-syms ++#name: AArch64 Mapping Symbols Test 6 ++ ++.*: +file format.*aarch64.* ++ ++SYMBOL TABLE: ++[0]+00 l d .text [0]+00 .text ++[0]+00 l d .data [0]+00 .data ++[0]+00 l d .bss [0]+00 .bss ++[0]+00 l .text [0]+00 \$x ++[0]+04 l .text [0]+00 \$d ++[0]+10 l .text [0]+00 \$d ++[0]+14 l .text [0]+00 \$x ++[0]+09 l .text [0]+00 \$d ++[0]+0c l .text [0]+00 \$x +diff --git a/gas/testsuite/gas/aarch64/mapping_6.s b/gas/testsuite/gas/aarch64/mapping_6.s +new file mode 100644 +index 0000000..4e0e2c5 +--- /dev/null ++++ b/gas/testsuite/gas/aarch64/mapping_6.s +@@ -0,0 +1,6 @@ ++ .text ++ nop ++ .long 0 ++ .byte 1 ++ .align 4 ++ .word 0x12345678 +diff --git a/gas/testsuite/gas/aarch64/reloc-insn.d b/gas/testsuite/gas/aarch64/reloc-insn.d +index afcccc7..a9aa097 100644 +--- a/gas/testsuite/gas/aarch64/reloc-insn.d ++++ b/gas/testsuite/gas/aarch64/reloc-insn.d +@@ -139,7 +139,7 @@ Disassembly of section \.text: + 160: d41fffe1 svc #0xffff + 164: f8500420 ldr x0, \[x1\],#-256 + 168: f8500c20 ldr x0, \[x1,#-256\]! +- 16c: f8500020 ldr x0, \[x1,#-256\] ++ 16c: f8500020 ldur x0, \[x1,#-256\] + 170: f97ffc20 ldr x0, \[x1,#32760\] + 174: 79400000 ldrh w0, \[x0\] + 174: R_AARCH64_LDST16_ABS_LO12_NC \.text\+0x194 +diff --git a/gas/testsuite/gas/aarch64/sysreg.d b/gas/testsuite/gas/aarch64/sysreg.d +index 7795b4d..157340c 100644 +--- a/gas/testsuite/gas/aarch64/sysreg.d ++++ b/gas/testsuite/gas/aarch64/sysreg.d +@@ -17,14 +17,15 @@ Disassembly of section \.text: + 24: d53801a0 mrs x0, id_mmfr1_el1 + 28: d53801c0 mrs x0, id_mmfr2_el1 + 2c: d53801e0 mrs x0, id_mmfr3_el1 +- 30: d5380200 mrs x0, id_isar0_el1 +- 34: d5380220 mrs x0, id_isar1_el1 +- 38: d5380240 mrs x0, id_isar2_el1 +- 3c: d5380260 mrs x0, id_isar3_el1 +- 40: d5380280 mrs x0, id_isar4_el1 +- 44: d53802a0 mrs x0, id_isar5_el1 +- 48: d538cc00 mrs x0, s3_0_c12_c12_0 +- 4c: d5384600 mrs x0, s3_0_c4_c6_0 +- 50: d5184600 msr s3_0_c4_c6_0, x0 +- 54: d5310300 mrs x0, s2_1_c0_c3_0 +- 58: d5110300 msr s2_1_c0_c3_0, x0 ++ 30: d53802c0 mrs x0, id_mmfr4_el1 ++ 34: d5380200 mrs x0, id_isar0_el1 ++ 38: d5380220 mrs x0, id_isar1_el1 ++ 3c: d5380240 mrs x0, id_isar2_el1 ++ 40: d5380260 mrs x0, id_isar3_el1 ++ 44: d5380280 mrs x0, id_isar4_el1 ++ 48: d53802a0 mrs x0, id_isar5_el1 ++ 4c: d538cc00 mrs x0, s3_0_c12_c12_0 ++ 50: d5384600 mrs x0, s3_0_c4_c6_0 ++ 54: d5184600 msr s3_0_c4_c6_0, x0 ++ 58: d5310300 mrs x0, s2_1_c0_c3_0 ++ 5c: d5110300 msr s2_1_c0_c3_0, x0 +diff --git a/gas/testsuite/gas/aarch64/sysreg.s b/gas/testsuite/gas/aarch64/sysreg.s +index b7e5ff6..8974674 100644 +--- a/gas/testsuite/gas/aarch64/sysreg.s ++++ b/gas/testsuite/gas/aarch64/sysreg.s +@@ -16,6 +16,7 @@ + mrs x0, id_mmfr1_el1 + mrs x0, id_mmfr2_el1 + mrs x0, id_mmfr3_el1 ++ mrs x0, id_mmfr4_el1 + mrs x0, id_isar0_el1 + mrs x0, id_isar1_el1 + mrs x0, id_isar2_el1 +diff --git a/gas/testsuite/gas/arm/thumb2_vpool_be.d b/gas/testsuite/gas/arm/thumb2_vpool_be.d +index 816cddc..15aafa5 100644 +--- a/gas/testsuite/gas/arm/thumb2_vpool_be.d ++++ b/gas/testsuite/gas/arm/thumb2_vpool_be.d +@@ -125,8 +125,7 @@ Disassembly of section .text: + 000001c8 0ff00fff .word 0x0ff00fff + 000001cc f0000000 .word 0xf0000000 + 000001d0 ed9f 1b01 vldr d1, \[pc, #4\] ; 000001d8 +-000001d4 0000 movs r0, r0 +-000001d6 0000 movs r0, r0 ++000001d4 00000000 .word 0x00000000 + 000001d8 0000fff0 .word 0x0000fff0 + 000001dc 00000000 .word 0x00000000 + 000001e0 f101 0000 add.w r0, r1, #0 +@@ -150,8 +149,7 @@ Disassembly of section .text: + 00000228 eddf 7a03 vldr s15, \[pc, #12\] ; 00000238 + 0000022c eddf 0b14 vldr d16, \[pc, #80\] ; 00000280 + 00000230 eddf 1b15 vldr d17, \[pc, #84\] ; 00000288 +-00000234 0000 movs r0, r0 +-00000236 0000 movs r0, r0 ++00000234 00000000 .word 0x00000000 + 00000238 0000fff0 .word 0x0000fff0 + 0000023c 00000000 .word 0x00000000 + 00000240 ff000000 .word 0xff000000 +diff --git a/gas/testsuite/gas/arm/tls.d b/gas/testsuite/gas/arm/tls.d +index 727f8e4..4d7e724 100644 +--- a/gas/testsuite/gas/arm/tls.d ++++ b/gas/testsuite/gas/arm/tls.d +@@ -47,3 +47,21 @@ Disassembly of section .text: + 3c: R_ARM_TLS_LE32 td + 40: 00000017 .word 0x00000017 + 40: R_ARM_TLS_GOTDESC te ++0+44 : ++ 44: fffffff4 .word 0xfffffff4 ++ 44: R_ARM_TLS_LE32 tbase ++ 48: fffffff8 .word 0xfffffff8 ++ 48: R_ARM_TLS_LE32 tbase ++ 4c: fffffffc .word 0xfffffffc ++ 4c: R_ARM_TLS_LE32 tbase ++ 50: 00000000 .word 0x00000000 ++ 50: R_ARM_TLS_LE32 tbase ++ 54: 00000004 .word 0x00000004 ++ 54: R_ARM_TLS_LE32 tbase ++ 58: 00000008 .word 0x00000008 ++ 58: R_ARM_TLS_LE32 tbase ++ 5c: 0000000c .word 0x0000000c ++ 5c: R_ARM_TLS_LE32 tbase ++ 60: 00000000 .word 0x00000000 ++ 60: R_ARM_TLS_LE32 tbase ++#pass +diff --git a/gas/testsuite/gas/arm/tls.s b/gas/testsuite/gas/arm/tls.s +index 96a25f5..346ac98 100644 +--- a/gas/testsuite/gas/arm/tls.s ++++ b/gas/testsuite/gas/arm/tls.s +@@ -36,3 +36,26 @@ thumb_fn: + .word tc(gottpoff) + (. - 1b - 8) + .word td(tpoff) + 1: .word te(tlsdesc) + (. - 2b + 1) ++ ++ @ PR 18481 ++ .text ++foo: ++ .word tbase(tpoff)-12 ++ .word tbase(tpoff)-8 ++ .word tbase(tpoff)-4 ++ .word tbase(tpoff)+0 ++ .word tbase(tpoff)+4 ++ .word tbase(tpoff)+8 ++ .word tbase(tpoff)+12 ++ .word tbase(tpoff) ++ ++ .section .tdata,"awT",%progbits ++tbase = . + 12 ++ .word -12 ++ .word -8 ++ .word -4 ++ .word 0 ++ .word 4 ++ .word 8 ++ .word 12 ++ .word 0 +diff --git a/gas/testsuite/gas/arm/ual-vcmp.d b/gas/testsuite/gas/arm/ual-vcmp.d +index 2e9fb3d..5b1b6ce 100644 +--- a/gas/testsuite/gas/arm/ual-vcmp.d ++++ b/gas/testsuite/gas/arm/ual-vcmp.d +@@ -14,11 +14,15 @@ Disassembly of section .text: + 0+014 <[^>]*> eeb53a40 vcmp.f32 s6, #0.0 + 0+018 <[^>]*> eef53ac0 vcmpe.f32 s7, #0.0 + 0+01c <[^>]*> eeb54ac0 vcmpe.f32 s8, #0.0 +-0+020 <[^>]*> eeb50b40 vcmp.f64 d0, #0.0 +-0+024 <[^>]*> eeb51b40 vcmp.f64 d1, #0.0 +-0+028 <[^>]*> eeb52bc0 vcmpe.f64 d2, #0.0 +-0+02c <[^>]*> eeb53bc0 vcmpe.f64 d3, #0.0 +-0+030 <[^>]*> eeb54b40 vcmp.f64 d4, #0.0 +-0+034 <[^>]*> eeb55b40 vcmp.f64 d5, #0.0 +-0+038 <[^>]*> eeb56bc0 vcmpe.f64 d6, #0.0 +-0+03c <[^>]*> eeb57bc0 vcmpe.f64 d7, #0.0 +\ No newline at end of file ++0+020 <[^>]*> eef54a40 vcmp.f32 s9, #0.0 ++0+024 <[^>]*> eeb55ac0 vcmpe.f32 s10, #0.0 ++0+028 <[^>]*> eeb50b40 vcmp.f64 d0, #0.0 ++0+02c <[^>]*> eeb51b40 vcmp.f64 d1, #0.0 ++0+030 <[^>]*> eeb52bc0 vcmpe.f64 d2, #0.0 ++0+034 <[^>]*> eeb53bc0 vcmpe.f64 d3, #0.0 ++0+038 <[^>]*> eeb54b40 vcmp.f64 d4, #0.0 ++0+03c <[^>]*> eeb55b40 vcmp.f64 d5, #0.0 ++0+040 <[^>]*> eeb56bc0 vcmpe.f64 d6, #0.0 ++0+044 <[^>]*> eeb57bc0 vcmpe.f64 d7, #0.0 ++0+048 <[^>]*> eeb58b40 vcmp.f64 d8, #0.0 ++0+04c <[^>]*> eeb59bc0 vcmpe.f64 d9, #0.0 +\ No newline at end of file +diff --git a/gas/testsuite/gas/arm/ual-vcmp.s b/gas/testsuite/gas/arm/ual-vcmp.s +index 79efa4e..1b9ffa6 100644 +--- a/gas/testsuite/gas/arm/ual-vcmp.s ++++ b/gas/testsuite/gas/arm/ual-vcmp.s +@@ -10,6 +10,8 @@ vcmp.f32 s5, #0.0e2 + vcmp.f32 s6, #0e-3 + vcmpe.f32 s7, #0.0000 + vcmpe.f32 s8, #.0 ++vcmp.f32 s9, #0x0 ++vcmpe.f32 s10, #0x0 + + vcmp.f64 d0, #0.0 + vcmp.f64 d1, #0 +@@ -19,3 +21,5 @@ vcmp.f64 d4, #0.0e5 + vcmp.f64 d5, #0e-2 + vcmpe.f64 d6, #0.00 + vcmpe.f64 d7, #.0 ++vcmp.f64 d8, #0x0 ++vcmpe.f64 d9, #0x0 +diff --git a/gas/testsuite/gas/arm/vcmp-zero-bad.l b/gas/testsuite/gas/arm/vcmp-zero-bad.l +index 975d02b..bce8e4a 100644 +--- a/gas/testsuite/gas/arm/vcmp-zero-bad.l ++++ b/gas/testsuite/gas/arm/vcmp-zero-bad.l +@@ -4,5 +4,5 @@ + [^:]*:7: Error: only floating point zero is allowed as immediate value -- `vcmpe.f32 s3,5' + [^:]*:8: Error: only floating point zero is allowed as immediate value -- `vcmpe.f32 s4,#-0.0' + [^:]*:10: Error: only floating point zero is allowed as immediate value -- `vcmp.f64 d0,#-1' +-[^:]*:11: Error: garbage following instruction -- `vcmpe.f64 d3,#0x35' ++[^:]*:11: Error: only floating point zero is allowed as immediate value -- `vcmpe.f64 d3,#0x35' + [^:]*:12: Error: only floating point zero is allowed as immediate value -- `vcmpe.f64 d4,0xf' +diff --git a/gas/testsuite/gas/arm/vldconst_be.d b/gas/testsuite/gas/arm/vldconst_be.d +index cf3dbf9..f99371b 100644 +--- a/gas/testsuite/gas/arm/vldconst_be.d ++++ b/gas/testsuite/gas/arm/vldconst_be.d +@@ -236,7 +236,7 @@ Disassembly of section .text: + 00000388 0000fff0 .word 0x0000fff0 + 0000038c 00000000 .word 0x00000000 + 00000390 ed9f1b00 vldr d1, \[pc\] ; 00000398 +-00000394 00000000 andeq r0, r0, r0 ++00000394 00000000 .word 0x00000000 + 00000398 0000fff0 .word 0x0000fff0 + 0000039c 00000000 .word 0x00000000 + 000003a0 e2810000 add r0, r1, #0 +@@ -260,7 +260,7 @@ Disassembly of section .text: + 000003e8 eddf7a02 vldr s15, \[pc, #8\] ; 000003f8 + 000003ec eddf0b13 vldr d16, \[pc, #76\] ; 00000440 + 000003f0 eddf1b14 vldr d17, \[pc, #80\] ; 00000448 +-000003f4 00000000 andeq r0, r0, r0 ++000003f4 00000000 .word 0x00000000 + 000003f8 0000fff0 .word 0x0000fff0 + 000003fc 00000000 .word 0x00000000 + 00000400 ff000000 .word 0xff000000 +diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp +index 31547db..db4a00f 100644 +--- a/gas/testsuite/gas/i386/i386.exp ++++ b/gas/testsuite/gas/i386/i386.exp +@@ -102,12 +102,6 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] + run_dump_test "nops-1-i686" + run_dump_test "nops-1-k8" + run_dump_test "nops-1-core2" +- run_dump_test "nops-1-bdver1" +- run_dump_test "nops-1-bdver2" +- run_dump_test "nops-1-bdver3" +- run_dump_test "nops-1-bdver4" +- run_dump_test "nops-1-btver1" +- run_dump_test "nops-1-btver2" + run_dump_test "nops-2" + run_dump_test "nops-2-i386" + run_dump_test "nops-2-core2" +@@ -483,15 +477,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t + run_dump_test "x86-64-nops-1" + run_dump_test "x86-64-nops-1-g64" + run_dump_test "x86-64-nops-1-k8" +- run_dump_test "x86-64-nops-1-nocona" + run_dump_test "x86-64-nops-1-core2" + run_dump_test "x86-64-nops-1-pentium" +- run_dump_test "x86-64-nops-1-bdver1" +- run_dump_test "x86-64-nops-1-bdver2" +- run_dump_test "x86-64-nops-1-bdver3" +- run_dump_test "x86-64-nops-1-bdver4" +- run_dump_test "x86-64-nops-1-btver1" +- run_dump_test "x86-64-nops-1-btver2" + run_dump_test "x86-64-nops-2" + run_dump_test "x86-64-nops-3" + run_dump_test "x86-64-nops-4" +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d +index a174c7d..6921926 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d +@@ -9,25 +9,29 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop +@@ -35,7 +39,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d +index b79ccc1..308cc6f 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d +@@ -8,154 +8,154 @@ + Disassembly of section .text: + + 0+ : +-[ ]*0:[ ]+90[ ]+nop[ ]* +-[ ]*1:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) +-[ ]*8:[ ]+0f 1f 84 00 00 00 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : +-[ ]*10:[ ]+90[ ]+nop[ ]* +-[ ]*11:[ ]+90[ ]+nop[ ]* +-[ ]*12:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) +-[ ]*19:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : +-[ ]*20:[ ]+90[ ]+nop[ ]* +-[ ]*21:[ ]+90[ ]+nop[ ]* +-[ ]*22:[ ]+90[ ]+nop[ ]* +-[ ]*23:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) +-[ ]*29:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : +-[ ]*30:[ ]+90[ ]+nop[ ]* +-[ ]*31:[ ]+90[ ]+nop[ ]* +-[ ]*32:[ ]+90[ ]+nop[ ]* +-[ ]*33:[ ]+90[ ]+nop[ ]* +-[ ]*34:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) +-[ ]*3a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : +-[ ]*40:[ ]+90[ ]+nop[ ]* +-[ ]*41:[ ]+90[ ]+nop[ ]* +-[ ]*42:[ ]+90[ ]+nop[ ]* +-[ ]*43:[ ]+90[ ]+nop[ ]* +-[ ]*44:[ ]+90[ ]+nop[ ]* +-[ ]*45:[ ]+0f 1f 44 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) +-[ ]*4a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : +-[ ]*50:[ ]+90[ ]+nop[ ]* +-[ ]*51:[ ]+90[ ]+nop[ ]* +-[ ]*52:[ ]+90[ ]+nop[ ]* +-[ ]*53:[ ]+90[ ]+nop[ ]* +-[ ]*54:[ ]+90[ ]+nop[ ]* +-[ ]*55:[ ]+90[ ]+nop[ ]* +-[ ]*56:[ ]+66 2e 0f 1f 84 00 00 00 00 00[ ]+nopw[ ]+%cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : +-[ ]*60:[ ]+90[ ]+nop[ ]* +-[ ]*61:[ ]+90[ ]+nop[ ]* +-[ ]*62:[ ]+90[ ]+nop[ ]* +-[ ]*63:[ ]+90[ ]+nop[ ]* +-[ ]*64:[ ]+90[ ]+nop[ ]* +-[ ]*65:[ ]+90[ ]+nop[ ]* +-[ ]*66:[ ]+90[ ]+nop[ ]* +-[ ]*67:[ ]+66 0f 1f 84 00 00 00 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) + + 0+70 : +-[ ]*70:[ ]+90[ ]+nop[ ]* +-[ ]*71:[ ]+90[ ]+nop[ ]* +-[ ]*72:[ ]+90[ ]+nop[ ]* +-[ ]*73:[ ]+90[ ]+nop[ ]* +-[ ]*74:[ ]+90[ ]+nop[ ]* +-[ ]*75:[ ]+90[ ]+nop[ ]* +-[ ]*76:[ ]+90[ ]+nop[ ]* +-[ ]*77:[ ]+90[ ]+nop[ ]* +-[ ]*78:[ ]+0f 1f 84 00 00 00 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + + 0+80 : +-[ ]*80:[ ]+90[ ]+nop[ ]* +-[ ]*81:[ ]+90[ ]+nop[ ]* +-[ ]*82:[ ]+90[ ]+nop[ ]* +-[ ]*83:[ ]+90[ ]+nop[ ]* +-[ ]*84:[ ]+90[ ]+nop[ ]* +-[ ]*85:[ ]+90[ ]+nop[ ]* +-[ ]*86:[ ]+90[ ]+nop[ ]* +-[ ]*87:[ ]+90[ ]+nop[ ]* +-[ ]*88:[ ]+90[ ]+nop[ ]* +-[ ]*89:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) + + 0+90 : +-[ ]*90:[ ]+90[ ]+nop[ ]* +-[ ]*91:[ ]+90[ ]+nop[ ]* +-[ ]*92:[ ]+90[ ]+nop[ ]* +-[ ]*93:[ ]+90[ ]+nop[ ]* +-[ ]*94:[ ]+90[ ]+nop[ ]* +-[ ]*95:[ ]+90[ ]+nop[ ]* +-[ ]*96:[ ]+90[ ]+nop[ ]* +-[ ]*97:[ ]+90[ ]+nop[ ]* +-[ ]*98:[ ]+90[ ]+nop[ ]* +-[ ]*99:[ ]+90[ ]+nop[ ]* +-[ ]*9a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) + + 0+a0 : +-[ ]*a0:[ ]+90[ ]+nop[ ]* +-[ ]*a1:[ ]+90[ ]+nop[ ]* +-[ ]*a2:[ ]+90[ ]+nop[ ]* +-[ ]*a3:[ ]+90[ ]+nop[ ]* +-[ ]*a4:[ ]+90[ ]+nop[ ]* +-[ ]*a5:[ ]+90[ ]+nop[ ]* +-[ ]*a6:[ ]+90[ ]+nop[ ]* +-[ ]*a7:[ ]+90[ ]+nop[ ]* +-[ ]*a8:[ ]+90[ ]+nop[ ]* +-[ ]*a9:[ ]+90[ ]+nop[ ]* +-[ ]*aa:[ ]+90[ ]+nop[ ]* +-[ ]*ab:[ ]+0f 1f 44 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + + 0+b0 : +-[ ]*b0:[ ]+90[ ]+nop[ ]* +-[ ]*b1:[ ]+90[ ]+nop[ ]* +-[ ]*b2:[ ]+90[ ]+nop[ ]* +-[ ]*b3:[ ]+90[ ]+nop[ ]* +-[ ]*b4:[ ]+90[ ]+nop[ ]* +-[ ]*b5:[ ]+90[ ]+nop[ ]* +-[ ]*b6:[ ]+90[ ]+nop[ ]* +-[ ]*b7:[ ]+90[ ]+nop[ ]* +-[ ]*b8:[ ]+90[ ]+nop[ ]* +-[ ]*b9:[ ]+90[ ]+nop[ ]* +-[ ]*ba:[ ]+90[ ]+nop[ ]* +-[ ]*bb:[ ]+90[ ]+nop[ ]* +-[ ]*bc:[ ]+0f 1f 40 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) + + 0+c0 : +-[ ]*c0:[ ]+90[ ]+nop[ ]* +-[ ]*c1:[ ]+90[ ]+nop[ ]* +-[ ]*c2:[ ]+90[ ]+nop[ ]* +-[ ]*c3:[ ]+90[ ]+nop[ ]* +-[ ]*c4:[ ]+90[ ]+nop[ ]* +-[ ]*c5:[ ]+90[ ]+nop[ ]* +-[ ]*c6:[ ]+90[ ]+nop[ ]* +-[ ]*c7:[ ]+90[ ]+nop[ ]* +-[ ]*c8:[ ]+90[ ]+nop[ ]* +-[ ]*c9:[ ]+90[ ]+nop[ ]* +-[ ]*ca:[ ]+90[ ]+nop[ ]* +-[ ]*cb:[ ]+90[ ]+nop[ ]* +-[ ]*cc:[ ]+90[ ]+nop[ ]* +-[ ]*cd:[ ]+0f 1f 00[ ]+nopl[ ]+\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) + + 0+d0 : +-[ ]*d0:[ ]+90[ ]+nop[ ]* +-[ ]*d1:[ ]+90[ ]+nop[ ]* +-[ ]*d2:[ ]+90[ ]+nop[ ]* +-[ ]*d3:[ ]+90[ ]+nop[ ]* +-[ ]*d4:[ ]+90[ ]+nop[ ]* +-[ ]*d5:[ ]+90[ ]+nop[ ]* +-[ ]*d6:[ ]+90[ ]+nop[ ]* +-[ ]*d7:[ ]+90[ ]+nop[ ]* +-[ ]*d8:[ ]+90[ ]+nop[ ]* +-[ ]*d9:[ ]+90[ ]+nop[ ]* +-[ ]*da:[ ]+90[ ]+nop[ ]* +-[ ]*db:[ ]+90[ ]+nop[ ]* +-[ ]*dc:[ ]+90[ ]+nop[ ]* +-[ ]*dd:[ ]+90[ ]+nop[ ]* +-[ ]*de:[ ]+66 90[ ]+xchg[ ]+%ax,%ax ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax + #pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-nocona.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-nocona.d +deleted file mode 100644 +index dbd6f7a..0000000 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1-nocona.d ++++ /dev/null +@@ -1,156 +0,0 @@ +-#source: ../nops-1.s +-#as: -mtune=nocona +-#objdump: -drw +-#name: x86-64 (ILP32) -mtune=nocona nops 1 +- +-.*: +file format .* +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1.d +index 772fd3e..9ccce52 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-1.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-1.d +@@ -9,25 +9,29 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop +@@ -35,7 +39,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-2.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-2.d +index 551ceca..4f97c6c 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-2.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-2.d +@@ -9,29 +9,34 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +@@ -39,7 +44,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-3.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-3.d +index f59cd8a..11a4a21 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-3.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-3.d +@@ -10,8 +10,10 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 89 c3 mov %eax,%ebx +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d +index 02a8a63..ab67ba8 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d +@@ -10,29 +10,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -40,8 +44,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -50,8 +55,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -61,8 +67,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -73,8 +80,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -86,8 +94,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -100,8 +109,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -115,8 +125,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -131,8 +142,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -148,8 +159,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -166,8 +177,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -185,8 +196,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -205,6 +216,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d +index a00424f..aaddd5f 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d +@@ -10,37 +10,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) + [ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -48,10 +44,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -60,10 +55,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -73,9 +67,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -86,9 +80,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -100,9 +94,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -115,9 +109,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -131,9 +125,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -148,9 +142,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -166,9 +159,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -185,9 +177,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) + [ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -205,9 +196,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax + [ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -226,7 +216,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-4.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-4.d +index 1419098..07054a7 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-4.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-4.d +@@ -10,29 +10,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -40,8 +44,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -50,8 +55,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -61,8 +67,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -73,8 +80,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -86,8 +94,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -100,8 +109,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -115,8 +125,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -131,8 +142,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -148,8 +159,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -166,8 +177,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -185,8 +196,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -205,6 +216,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d +index 9044e99..f77bdcc 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d +@@ -29,19 +29,23 @@ Disassembly of section .text: + + 0+40 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+70 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -50,13 +54,13 @@ Disassembly of section .text: + + 0+90 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+b0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -65,10 +69,11 @@ Disassembly of section .text: + + 0+c0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+d0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-nops-5.d b/gas/testsuite/gas/i386/ilp32/x86-64-nops-5.d +index d1ec2c5..65537b4 100644 +--- a/gas/testsuite/gas/i386/ilp32/x86-64-nops-5.d ++++ b/gas/testsuite/gas/i386/ilp32/x86-64-nops-5.d +@@ -28,19 +28,23 @@ Disassembly of section .text: + + 0+40 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+70 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -49,13 +53,13 @@ Disassembly of section .text: + + 0+90 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+b0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -64,10 +68,11 @@ Disassembly of section .text: + + 0+c0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+d0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/nops-1-bdver1.d b/gas/testsuite/gas/i386/nops-1-bdver1.d +deleted file mode 100644 +index 32c9cef..0000000 +--- a/gas/testsuite/gas/i386/nops-1-bdver1.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver1 +-#source: nops-1.s +-#objdump: -drw +-#name: i386 -mtune=bdver1 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/nops-1-bdver2.d b/gas/testsuite/gas/i386/nops-1-bdver2.d +deleted file mode 100644 +index d33d6b7..0000000 +--- a/gas/testsuite/gas/i386/nops-1-bdver2.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver2 +-#source: nops-1.s +-#objdump: -drw +-#name: i386 -mtune=bdver2 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/nops-1-bdver3.d b/gas/testsuite/gas/i386/nops-1-bdver3.d +deleted file mode 100644 +index 1ed927f..0000000 +--- a/gas/testsuite/gas/i386/nops-1-bdver3.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver3 +-#source: nops-1.s +-#objdump: -drw +-#name: i386 -mtune=bdver3 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/nops-1-bdver4.d b/gas/testsuite/gas/i386/nops-1-bdver4.d +deleted file mode 100644 +index ad3bf98..0000000 +--- a/gas/testsuite/gas/i386/nops-1-bdver4.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver4 +-#source: nops-1.s +-#objdump: -drw +-#name: i386 -mtune=bdver4 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/nops-1-btver1.d b/gas/testsuite/gas/i386/nops-1-btver1.d +deleted file mode 100644 +index 4bc5fc5..0000000 +--- a/gas/testsuite/gas/i386/nops-1-btver1.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=btver1 +-#source: nops-1.s +-#objdump: -drw +-#name: i386 -mtune=btver1 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/nops-1-btver2.d b/gas/testsuite/gas/i386/nops-1-btver2.d +deleted file mode 100644 +index 7e88b61..0000000 +--- a/gas/testsuite/gas/i386/nops-1-btver2.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=btver2 +-#source: nops-1.s +-#objdump: -drw +-#name: i386 -mtune=btver2 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/nops-1-core2.d b/gas/testsuite/gas/i386/nops-1-core2.d +index f9e2d43..a5f0ba0 100644 +--- a/gas/testsuite/gas/i386/nops-1-core2.d ++++ b/gas/testsuite/gas/i386/nops-1-core2.d +@@ -10,25 +10,29 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop +@@ -36,7 +40,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/nops-1-k8.d b/gas/testsuite/gas/i386/nops-1-k8.d +index 1a73052..b2f7260 100644 +--- a/gas/testsuite/gas/i386/nops-1-k8.d ++++ b/gas/testsuite/gas/i386/nops-1-k8.d +@@ -8,154 +8,154 @@ + Disassembly of section .text: + + 0+ : +-[ ]*0:[ ]+90[ ]+nop[ ]* +-[ ]*1:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%eax\) +-[ ]*8:[ ]+0f 1f 84 00 00 00 00 00[ ]+nopl[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+10 : +-[ ]*10:[ ]+90[ ]+nop[ ]* +-[ ]*11:[ ]+90[ ]+nop[ ]* +-[ ]*12:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%eax\) +-[ ]*19:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%eax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+20 : +-[ ]*20:[ ]+90[ ]+nop[ ]* +-[ ]*21:[ ]+90[ ]+nop[ ]* +-[ ]*22:[ ]+90[ ]+nop[ ]* +-[ ]*23:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%eax,%eax,1\) +-[ ]*29:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%eax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+30 : +-[ ]*30:[ ]+90[ ]+nop[ ]* +-[ ]*31:[ ]+90[ ]+nop[ ]* +-[ ]*32:[ ]+90[ ]+nop[ ]* +-[ ]*33:[ ]+90[ ]+nop[ ]* +-[ ]*34:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%eax,%eax,1\) +-[ ]*3a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+40 : +-[ ]*40:[ ]+90[ ]+nop[ ]* +-[ ]*41:[ ]+90[ ]+nop[ ]* +-[ ]*42:[ ]+90[ ]+nop[ ]* +-[ ]*43:[ ]+90[ ]+nop[ ]* +-[ ]*44:[ ]+90[ ]+nop[ ]* +-[ ]*45:[ ]+0f 1f 44 00 00[ ]+nopl[ ]+0x0\(%eax,%eax,1\) +-[ ]*4a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+50 : +-[ ]*50:[ ]+90[ ]+nop[ ]* +-[ ]*51:[ ]+90[ ]+nop[ ]* +-[ ]*52:[ ]+90[ ]+nop[ ]* +-[ ]*53:[ ]+90[ ]+nop[ ]* +-[ ]*54:[ ]+90[ ]+nop[ ]* +-[ ]*55:[ ]+90[ ]+nop[ ]* +-[ ]*56:[ ]+66 2e 0f 1f 84 00 00 00 00 00[ ]+nopw[ ]+%cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+60 : +-[ ]*60:[ ]+90[ ]+nop[ ]* +-[ ]*61:[ ]+90[ ]+nop[ ]* +-[ ]*62:[ ]+90[ ]+nop[ ]* +-[ ]*63:[ ]+90[ ]+nop[ ]* +-[ ]*64:[ ]+90[ ]+nop[ ]* +-[ ]*65:[ ]+90[ ]+nop[ ]* +-[ ]*66:[ ]+90[ ]+nop[ ]* +-[ ]*67:[ ]+66 0f 1f 84 00 00 00 00 00[ ]+nopw[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) + + 0+70 : +-[ ]*70:[ ]+90[ ]+nop[ ]* +-[ ]*71:[ ]+90[ ]+nop[ ]* +-[ ]*72:[ ]+90[ ]+nop[ ]* +-[ ]*73:[ ]+90[ ]+nop[ ]* +-[ ]*74:[ ]+90[ ]+nop[ ]* +-[ ]*75:[ ]+90[ ]+nop[ ]* +-[ ]*76:[ ]+90[ ]+nop[ ]* +-[ ]*77:[ ]+90[ ]+nop[ ]* +-[ ]*78:[ ]+0f 1f 84 00 00 00 00 00[ ]+nopl[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) + + 0+80 : +-[ ]*80:[ ]+90[ ]+nop[ ]* +-[ ]*81:[ ]+90[ ]+nop[ ]* +-[ ]*82:[ ]+90[ ]+nop[ ]* +-[ ]*83:[ ]+90[ ]+nop[ ]* +-[ ]*84:[ ]+90[ ]+nop[ ]* +-[ ]*85:[ ]+90[ ]+nop[ ]* +-[ ]*86:[ ]+90[ ]+nop[ ]* +-[ ]*87:[ ]+90[ ]+nop[ ]* +-[ ]*88:[ ]+90[ ]+nop[ ]* +-[ ]*89:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%eax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) + + 0+90 : +-[ ]*90:[ ]+90[ ]+nop[ ]* +-[ ]*91:[ ]+90[ ]+nop[ ]* +-[ ]*92:[ ]+90[ ]+nop[ ]* +-[ ]*93:[ ]+90[ ]+nop[ ]* +-[ ]*94:[ ]+90[ ]+nop[ ]* +-[ ]*95:[ ]+90[ ]+nop[ ]* +-[ ]*96:[ ]+90[ ]+nop[ ]* +-[ ]*97:[ ]+90[ ]+nop[ ]* +-[ ]*98:[ ]+90[ ]+nop[ ]* +-[ ]*99:[ ]+90[ ]+nop[ ]* +-[ ]*9a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) + + 0+a0 : +-[ ]*a0:[ ]+90[ ]+nop[ ]* +-[ ]*a1:[ ]+90[ ]+nop[ ]* +-[ ]*a2:[ ]+90[ ]+nop[ ]* +-[ ]*a3:[ ]+90[ ]+nop[ ]* +-[ ]*a4:[ ]+90[ ]+nop[ ]* +-[ ]*a5:[ ]+90[ ]+nop[ ]* +-[ ]*a6:[ ]+90[ ]+nop[ ]* +-[ ]*a7:[ ]+90[ ]+nop[ ]* +-[ ]*a8:[ ]+90[ ]+nop[ ]* +-[ ]*a9:[ ]+90[ ]+nop[ ]* +-[ ]*aa:[ ]+90[ ]+nop[ ]* +-[ ]*ab:[ ]+0f 1f 44 00 00[ ]+nopl[ ]+0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) + + 0+b0 : +-[ ]*b0:[ ]+90[ ]+nop[ ]* +-[ ]*b1:[ ]+90[ ]+nop[ ]* +-[ ]*b2:[ ]+90[ ]+nop[ ]* +-[ ]*b3:[ ]+90[ ]+nop[ ]* +-[ ]*b4:[ ]+90[ ]+nop[ ]* +-[ ]*b5:[ ]+90[ ]+nop[ ]* +-[ ]*b6:[ ]+90[ ]+nop[ ]* +-[ ]*b7:[ ]+90[ ]+nop[ ]* +-[ ]*b8:[ ]+90[ ]+nop[ ]* +-[ ]*b9:[ ]+90[ ]+nop[ ]* +-[ ]*ba:[ ]+90[ ]+nop[ ]* +-[ ]*bb:[ ]+90[ ]+nop[ ]* +-[ ]*bc:[ ]+0f 1f 40 00[ ]+nopl[ ]+0x0\(%eax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) + + 0+c0 : +-[ ]*c0:[ ]+90[ ]+nop[ ]* +-[ ]*c1:[ ]+90[ ]+nop[ ]* +-[ ]*c2:[ ]+90[ ]+nop[ ]* +-[ ]*c3:[ ]+90[ ]+nop[ ]* +-[ ]*c4:[ ]+90[ ]+nop[ ]* +-[ ]*c5:[ ]+90[ ]+nop[ ]* +-[ ]*c6:[ ]+90[ ]+nop[ ]* +-[ ]*c7:[ ]+90[ ]+nop[ ]* +-[ ]*c8:[ ]+90[ ]+nop[ ]* +-[ ]*c9:[ ]+90[ ]+nop[ ]* +-[ ]*ca:[ ]+90[ ]+nop[ ]* +-[ ]*cb:[ ]+90[ ]+nop[ ]* +-[ ]*cc:[ ]+90[ ]+nop[ ]* +-[ ]*cd:[ ]+0f 1f 00[ ]+nopl[ ]+\(%eax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) + + 0+d0 : +-[ ]*d0:[ ]+90[ ]+nop[ ]* +-[ ]*d1:[ ]+90[ ]+nop[ ]* +-[ ]*d2:[ ]+90[ ]+nop[ ]* +-[ ]*d3:[ ]+90[ ]+nop[ ]* +-[ ]*d4:[ ]+90[ ]+nop[ ]* +-[ ]*d5:[ ]+90[ ]+nop[ ]* +-[ ]*d6:[ ]+90[ ]+nop[ ]* +-[ ]*d7:[ ]+90[ ]+nop[ ]* +-[ ]*d8:[ ]+90[ ]+nop[ ]* +-[ ]*d9:[ ]+90[ ]+nop[ ]* +-[ ]*da:[ ]+90[ ]+nop[ ]* +-[ ]*db:[ ]+90[ ]+nop[ ]* +-[ ]*dc:[ ]+90[ ]+nop[ ]* +-[ ]*dd:[ ]+90[ ]+nop[ ]* +-[ ]*de:[ ]+66 90[ ]+xchg[ ]+%ax,%ax ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax + #pass +diff --git a/gas/testsuite/gas/i386/nops-4a-i686.d b/gas/testsuite/gas/i386/nops-4a-i686.d +index 14d88d4..898139f 100644 +--- a/gas/testsuite/gas/i386/nops-4a-i686.d ++++ b/gas/testsuite/gas/i386/nops-4a-i686.d +@@ -10,29 +10,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -40,8 +44,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -50,8 +55,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -61,8 +67,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -73,8 +80,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -86,8 +94,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -100,8 +109,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -115,8 +125,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -131,8 +142,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -148,8 +159,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -166,8 +177,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -185,8 +196,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -205,6 +216,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/nops-5-i686.d b/gas/testsuite/gas/i386/nops-5-i686.d +index b018441..b348cba 100644 +--- a/gas/testsuite/gas/i386/nops-5-i686.d ++++ b/gas/testsuite/gas/i386/nops-5-i686.d +@@ -29,19 +29,23 @@ Disassembly of section .text: + + 0+40 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+70 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -50,13 +54,13 @@ Disassembly of section .text: + + 0+90 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+b0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -65,10 +69,11 @@ Disassembly of section .text: + + 0+c0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+d0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/nops-5.d b/gas/testsuite/gas/i386/nops-5.d +index ff30708..d596e00 100644 +--- a/gas/testsuite/gas/i386/nops-5.d ++++ b/gas/testsuite/gas/i386/nops-5.d +@@ -27,19 +27,23 @@ Disassembly of section .text: + + 0+40 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+70 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -48,13 +52,13 @@ Disassembly of section .text: + + 0+90 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+b0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -63,10 +67,11 @@ Disassembly of section .text: + + 0+c0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%eax,%eax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + + 0+d0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/nops-6.d b/gas/testsuite/gas/i386/nops-6.d +index 6b45d31..81be6af 100644 +--- a/gas/testsuite/gas/i386/nops-6.d ++++ b/gas/testsuite/gas/i386/nops-6.d +@@ -12,6 +12,6 @@ Disassembly of section .text: + + 0+10 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%eax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%eax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%eax,%eax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-bdver1.d b/gas/testsuite/gas/i386/x86-64-nops-1-bdver1.d +deleted file mode 100644 +index a2e62bd..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-bdver1.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver1 +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=bdver1 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-bdver2.d b/gas/testsuite/gas/i386/x86-64-nops-1-bdver2.d +deleted file mode 100644 +index 99c3213..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-bdver2.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver2 +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=bdver2 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-bdver3.d b/gas/testsuite/gas/i386/x86-64-nops-1-bdver3.d +deleted file mode 100644 +index f0eead1..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-bdver3.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver3 +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=bdver3 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-bdver4.d b/gas/testsuite/gas/i386/x86-64-nops-1-bdver4.d +deleted file mode 100644 +index 25d5b05..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-bdver4.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=bdver4 +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=bdver4 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-btver1.d b/gas/testsuite/gas/i386/x86-64-nops-1-btver1.d +deleted file mode 100644 +index a8f0295..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-btver1.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=btver1 +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=btver1 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-btver2.d b/gas/testsuite/gas/i386/x86-64-nops-1-btver2.d +deleted file mode 100644 +index 8474dca..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-btver2.d ++++ /dev/null +@@ -1,162 +0,0 @@ +-#as: -mtune=btver2 +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=btver2 nops 1 +- +-.*: +file format .* +- +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-core2.d b/gas/testsuite/gas/i386/x86-64-nops-1-core2.d +index 9240669..33df7d4 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-core2.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-1-core2.d +@@ -10,25 +10,29 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop +@@ -36,7 +40,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-g64.d b/gas/testsuite/gas/i386/x86-64-nops-1-g64.d +index f197486..bc69f99 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-g64.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-1-g64.d +@@ -10,25 +10,29 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop +@@ -36,7 +40,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-k8.d b/gas/testsuite/gas/i386/x86-64-nops-1-k8.d +index c9d8028..44beb3e 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-k8.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-1-k8.d +@@ -8,154 +8,154 @@ + Disassembly of section .text: + + 0+ : +-[ ]*0:[ ]+90[ ]+nop[ ]* +-[ ]*1:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) +-[ ]*8:[ ]+0f 1f 84 00 00 00 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : +-[ ]*10:[ ]+90[ ]+nop[ ]* +-[ ]*11:[ ]+90[ ]+nop[ ]* +-[ ]*12:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) +-[ ]*19:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : +-[ ]*20:[ ]+90[ ]+nop[ ]* +-[ ]*21:[ ]+90[ ]+nop[ ]* +-[ ]*22:[ ]+90[ ]+nop[ ]* +-[ ]*23:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) +-[ ]*29:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : +-[ ]*30:[ ]+90[ ]+nop[ ]* +-[ ]*31:[ ]+90[ ]+nop[ ]* +-[ ]*32:[ ]+90[ ]+nop[ ]* +-[ ]*33:[ ]+90[ ]+nop[ ]* +-[ ]*34:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) +-[ ]*3a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : +-[ ]*40:[ ]+90[ ]+nop[ ]* +-[ ]*41:[ ]+90[ ]+nop[ ]* +-[ ]*42:[ ]+90[ ]+nop[ ]* +-[ ]*43:[ ]+90[ ]+nop[ ]* +-[ ]*44:[ ]+90[ ]+nop[ ]* +-[ ]*45:[ ]+0f 1f 44 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) +-[ ]*4a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : +-[ ]*50:[ ]+90[ ]+nop[ ]* +-[ ]*51:[ ]+90[ ]+nop[ ]* +-[ ]*52:[ ]+90[ ]+nop[ ]* +-[ ]*53:[ ]+90[ ]+nop[ ]* +-[ ]*54:[ ]+90[ ]+nop[ ]* +-[ ]*55:[ ]+90[ ]+nop[ ]* +-[ ]*56:[ ]+66 2e 0f 1f 84 00 00 00 00 00[ ]+nopw[ ]+%cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : +-[ ]*60:[ ]+90[ ]+nop[ ]* +-[ ]*61:[ ]+90[ ]+nop[ ]* +-[ ]*62:[ ]+90[ ]+nop[ ]* +-[ ]*63:[ ]+90[ ]+nop[ ]* +-[ ]*64:[ ]+90[ ]+nop[ ]* +-[ ]*65:[ ]+90[ ]+nop[ ]* +-[ ]*66:[ ]+90[ ]+nop[ ]* +-[ ]*67:[ ]+66 0f 1f 84 00 00 00 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) + + 0+70 : +-[ ]*70:[ ]+90[ ]+nop[ ]* +-[ ]*71:[ ]+90[ ]+nop[ ]* +-[ ]*72:[ ]+90[ ]+nop[ ]* +-[ ]*73:[ ]+90[ ]+nop[ ]* +-[ ]*74:[ ]+90[ ]+nop[ ]* +-[ ]*75:[ ]+90[ ]+nop[ ]* +-[ ]*76:[ ]+90[ ]+nop[ ]* +-[ ]*77:[ ]+90[ ]+nop[ ]* +-[ ]*78:[ ]+0f 1f 84 00 00 00 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + + 0+80 : +-[ ]*80:[ ]+90[ ]+nop[ ]* +-[ ]*81:[ ]+90[ ]+nop[ ]* +-[ ]*82:[ ]+90[ ]+nop[ ]* +-[ ]*83:[ ]+90[ ]+nop[ ]* +-[ ]*84:[ ]+90[ ]+nop[ ]* +-[ ]*85:[ ]+90[ ]+nop[ ]* +-[ ]*86:[ ]+90[ ]+nop[ ]* +-[ ]*87:[ ]+90[ ]+nop[ ]* +-[ ]*88:[ ]+90[ ]+nop[ ]* +-[ ]*89:[ ]+0f 1f 80 00 00 00 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) + + 0+90 : +-[ ]*90:[ ]+90[ ]+nop[ ]* +-[ ]*91:[ ]+90[ ]+nop[ ]* +-[ ]*92:[ ]+90[ ]+nop[ ]* +-[ ]*93:[ ]+90[ ]+nop[ ]* +-[ ]*94:[ ]+90[ ]+nop[ ]* +-[ ]*95:[ ]+90[ ]+nop[ ]* +-[ ]*96:[ ]+90[ ]+nop[ ]* +-[ ]*97:[ ]+90[ ]+nop[ ]* +-[ ]*98:[ ]+90[ ]+nop[ ]* +-[ ]*99:[ ]+90[ ]+nop[ ]* +-[ ]*9a:[ ]+66 0f 1f 44 00 00[ ]+nopw[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) + + 0+a0 : +-[ ]*a0:[ ]+90[ ]+nop[ ]* +-[ ]*a1:[ ]+90[ ]+nop[ ]* +-[ ]*a2:[ ]+90[ ]+nop[ ]* +-[ ]*a3:[ ]+90[ ]+nop[ ]* +-[ ]*a4:[ ]+90[ ]+nop[ ]* +-[ ]*a5:[ ]+90[ ]+nop[ ]* +-[ ]*a6:[ ]+90[ ]+nop[ ]* +-[ ]*a7:[ ]+90[ ]+nop[ ]* +-[ ]*a8:[ ]+90[ ]+nop[ ]* +-[ ]*a9:[ ]+90[ ]+nop[ ]* +-[ ]*aa:[ ]+90[ ]+nop[ ]* +-[ ]*ab:[ ]+0f 1f 44 00 00[ ]+nopl[ ]+0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + + 0+b0 : +-[ ]*b0:[ ]+90[ ]+nop[ ]* +-[ ]*b1:[ ]+90[ ]+nop[ ]* +-[ ]*b2:[ ]+90[ ]+nop[ ]* +-[ ]*b3:[ ]+90[ ]+nop[ ]* +-[ ]*b4:[ ]+90[ ]+nop[ ]* +-[ ]*b5:[ ]+90[ ]+nop[ ]* +-[ ]*b6:[ ]+90[ ]+nop[ ]* +-[ ]*b7:[ ]+90[ ]+nop[ ]* +-[ ]*b8:[ ]+90[ ]+nop[ ]* +-[ ]*b9:[ ]+90[ ]+nop[ ]* +-[ ]*ba:[ ]+90[ ]+nop[ ]* +-[ ]*bb:[ ]+90[ ]+nop[ ]* +-[ ]*bc:[ ]+0f 1f 40 00[ ]+nopl[ ]+0x0\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) + + 0+c0 : +-[ ]*c0:[ ]+90[ ]+nop[ ]* +-[ ]*c1:[ ]+90[ ]+nop[ ]* +-[ ]*c2:[ ]+90[ ]+nop[ ]* +-[ ]*c3:[ ]+90[ ]+nop[ ]* +-[ ]*c4:[ ]+90[ ]+nop[ ]* +-[ ]*c5:[ ]+90[ ]+nop[ ]* +-[ ]*c6:[ ]+90[ ]+nop[ ]* +-[ ]*c7:[ ]+90[ ]+nop[ ]* +-[ ]*c8:[ ]+90[ ]+nop[ ]* +-[ ]*c9:[ ]+90[ ]+nop[ ]* +-[ ]*ca:[ ]+90[ ]+nop[ ]* +-[ ]*cb:[ ]+90[ ]+nop[ ]* +-[ ]*cc:[ ]+90[ ]+nop[ ]* +-[ ]*cd:[ ]+0f 1f 00[ ]+nopl[ ]+\(%rax\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) + + 0+d0 : +-[ ]*d0:[ ]+90[ ]+nop[ ]* +-[ ]*d1:[ ]+90[ ]+nop[ ]* +-[ ]*d2:[ ]+90[ ]+nop[ ]* +-[ ]*d3:[ ]+90[ ]+nop[ ]* +-[ ]*d4:[ ]+90[ ]+nop[ ]* +-[ ]*d5:[ ]+90[ ]+nop[ ]* +-[ ]*d6:[ ]+90[ ]+nop[ ]* +-[ ]*d7:[ ]+90[ ]+nop[ ]* +-[ ]*d8:[ ]+90[ ]+nop[ ]* +-[ ]*d9:[ ]+90[ ]+nop[ ]* +-[ ]*da:[ ]+90[ ]+nop[ ]* +-[ ]*db:[ ]+90[ ]+nop[ ]* +-[ ]*dc:[ ]+90[ ]+nop[ ]* +-[ ]*dd:[ ]+90[ ]+nop[ ]* +-[ ]*de:[ ]+66 90[ ]+xchg[ ]+%ax,%ax ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1-nocona.d b/gas/testsuite/gas/i386/x86-64-nops-1-nocona.d +deleted file mode 100644 +index d5cdd4c..0000000 +--- a/gas/testsuite/gas/i386/x86-64-nops-1-nocona.d ++++ /dev/null +@@ -1,156 +0,0 @@ +-#as: -mtune=nocona +-#source: nops-1.s +-#objdump: -drw +-#name: x86-64 -mtune=nocona nops 1 +- +-.*: +file format .* +- +-Disassembly of section .text: +- +-0+ : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+10 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+20 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+30 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+40 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+50 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +- +-0+60 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+70 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+80 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +- +-0+90 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +- +-0+a0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +- +-0+b0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +- +-0+c0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +- +-0+d0 : +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-#pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-1.d b/gas/testsuite/gas/i386/x86-64-nops-1.d +index 9b53ab2..8bc9639 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-1.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-1.d +@@ -9,25 +9,29 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop +@@ -35,7 +39,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/x86-64-nops-2.d b/gas/testsuite/gas/i386/x86-64-nops-2.d +index 1fdd4f8..9d7f11a 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-2.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-2.d +@@ -10,29 +10,34 @@ Disassembly of section .text: + + 0+ : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+10 : + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+30 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 90 nop +@@ -40,7 +45,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop +diff --git a/gas/testsuite/gas/i386/x86-64-nops-3.d b/gas/testsuite/gas/i386/x86-64-nops-3.d +index 08f6d22..bbf9545 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-3.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-3.d +@@ -11,8 +11,10 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 89 c3 mov %eax,%ebx +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-4-core2.d b/gas/testsuite/gas/i386/x86-64-nops-4-core2.d +index f9143bf..7971488 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-4-core2.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-4-core2.d +@@ -11,29 +11,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -41,8 +45,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -51,8 +56,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -62,8 +68,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -74,8 +81,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -87,8 +95,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -101,8 +110,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -116,8 +126,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -132,8 +143,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -149,8 +160,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -167,8 +178,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -186,8 +197,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -206,6 +217,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-4-k8.d b/gas/testsuite/gas/i386/x86-64-nops-4-k8.d +index b1145fc..7d4b5d3 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-4-k8.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-4-k8.d +@@ -10,37 +10,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) + [ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -48,10 +44,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -60,10 +55,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -73,9 +67,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -86,9 +80,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -100,9 +94,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -115,9 +109,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -131,9 +125,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -148,9 +142,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -166,9 +159,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -185,9 +177,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) + [ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -205,9 +196,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax + [ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -226,7 +216,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-4.d b/gas/testsuite/gas/i386/x86-64-nops-4.d +index 8c20c7f..f5fa793 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-4.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-4.d +@@ -11,29 +11,33 @@ Disassembly of section .text: + 0+ : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+20 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+40 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 90 nop +@@ -41,8 +45,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -51,8 +56,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -62,8 +68,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + [ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) + + 0+e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -74,8 +81,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+100 : + [ ]*[a-f0-9]+: 90 nop +@@ -87,8 +95,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+120 : + [ ]*[a-f0-9]+: 90 nop +@@ -101,8 +110,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+140 : + [ ]*[a-f0-9]+: 90 nop +@@ -116,8 +126,9 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 90 nop ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+160 : + [ ]*[a-f0-9]+: 90 nop +@@ -132,8 +143,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+180 : + [ ]*[a-f0-9]+: 90 nop +@@ -149,8 +160,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1a0 : + [ ]*[a-f0-9]+: 90 nop +@@ -167,8 +178,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1c0 : + [ ]*[a-f0-9]+: 90 nop +@@ -186,8 +197,8 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 90 xchg %ax,%ax +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+1e0 : + [ ]*[a-f0-9]+: 90 nop +@@ -206,6 +217,6 @@ Disassembly of section .text: + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop + [ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 90 nop +-[ ]*[a-f0-9]+: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-5-k8.d b/gas/testsuite/gas/i386/x86-64-nops-5-k8.d +index add71bf..c9a8834 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-5-k8.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-5-k8.d +@@ -30,19 +30,23 @@ Disassembly of section .text: + + 0+40 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+70 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -51,13 +55,13 @@ Disassembly of section .text: + + 0+90 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+b0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -66,10 +70,11 @@ Disassembly of section .text: + + 0+c0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+d0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/i386/x86-64-nops-5.d b/gas/testsuite/gas/i386/x86-64-nops-5.d +index 664b010..06892f5 100644 +--- a/gas/testsuite/gas/i386/x86-64-nops-5.d ++++ b/gas/testsuite/gas/i386/x86-64-nops-5.d +@@ -29,19 +29,23 @@ Disassembly of section .text: + + 0+40 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+50 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+60 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+70 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+80 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -50,13 +54,13 @@ Disassembly of section .text: + + 0+90 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+a0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+b0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +@@ -65,10 +69,11 @@ Disassembly of section .text: + + 0+c0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + + 0+d0 : + [ ]*[a-f0-9]+: 0f be f0 movsbl %al,%esi +-[ ]*[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) +-[ ]*[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\) ++[ ]*[a-f0-9]+: 0f 1f 00 nopl \(%rax\) ++[ ]*[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + #pass +diff --git a/gas/testsuite/gas/ppc/476.d b/gas/testsuite/gas/ppc/476.d +index e59e2e9..253323c 100644 +--- a/gas/testsuite/gas/ppc/476.d ++++ b/gas/testsuite/gas/ppc/476.d +@@ -90,13 +90,13 @@ Disassembly of section \.text: + 140: (7c 06 3b ac|ac 3b 06 7c) dcbi r6,r7 + 144: (7c 85 33 0c|0c 33 85 7c) dcblc 4,r5,r6 + 148: (7c 06 38 6c|6c 38 06 7c) dcbst r6,r7 +- 14c: (7c c0 2a 2c|2c 2a c0 7c) dcbt 0,r5,6 ++ 14c: (7c 05 32 2c|2c 32 05 7c) dcbt r5,r6 + 150: (7c 05 32 2c|2c 32 05 7c) dcbt r5,r6 +- 154: (7c c8 2a 2c|2c 2a c8 7c) dcbt r8,r5,6 ++ 154: (7d 05 32 2c|2c 32 05 7d) dcbt 8,r5,r6 + 158: (7c e8 49 4c|4c 49 e8 7c) dcbtls 7,r8,r9 +- 15c: (7c e0 31 ec|ec 31 e0 7c) dcbtst 0,r6,7 ++ 15c: (7c 06 39 ec|ec 39 06 7c) dcbtst r6,r7 + 160: (7c 06 39 ec|ec 39 06 7c) dcbtst r6,r7 +- 164: (7c e9 31 ec|ec 31 e9 7c) dcbtst r9,r6,7 ++ 164: (7d 26 39 ec|ec 39 26 7d) dcbtst 9,r6,r7 + 168: (7d 4b 61 0c|0c 61 4b 7d) dcbtstls 10,r11,r12 + 16c: (7c 01 17 ec|ec 17 01 7c) dcbz r1,r2 + 170: (7c 05 37 ec|ec 37 05 7c) dcbz r5,r6 +diff --git a/gas/testsuite/gas/ppc/a2.d b/gas/testsuite/gas/ppc/a2.d +index a743402..700c665 100644 +--- a/gas/testsuite/gas/ppc/a2.d ++++ b/gas/testsuite/gas/ppc/a2.d +@@ -117,12 +117,12 @@ Disassembly of section \.text: + 164: (7c 0a 58 6c|6c 58 0a 7c) dcbst r10,r11 + 168: (7c 0a 58 7e|7e 58 0a 7c) dcbstep r10,r11 + 16c: (7c 0a 5a 2c|2c 5a 0a 7c) dcbt r10,r11 +- 170: (7c 2a 5a 2c|2c 5a 2a 7c) dcbt r10,r11,1 ++ 170: (7c 2a 5a 2c|2c 5a 2a 7c) dcbt 1,r10,r11 + 174: (7d 4b 62 7e|7e 62 4b 7d) dcbtep r10,r11,r12 + 178: (7c 0a 59 4c|4c 59 0a 7c) dcbtls r10,r11 + 17c: (7c 2a 59 4c|4c 59 2a 7c) dcbtls 1,r10,r11 + 180: (7c 0a 59 ec|ec 59 0a 7c) dcbtst r10,r11 +- 184: (7c 2a 59 ec|ec 59 2a 7c) dcbtst r10,r11,1 ++ 184: (7c 2a 59 ec|ec 59 2a 7c) dcbtst 1,r10,r11 + 188: (7d 4b 61 fe|fe 61 4b 7d) dcbtstep r10,r11,r12 + 18c: (7c 0a 59 0c|0c 59 0a 7c) dcbtstls r10,r11 + 190: (7c 2a 59 0c|0c 59 2a 7c) dcbtstls 1,r10,r11 +diff --git a/gas/testsuite/gas/ppc/a2.s b/gas/testsuite/gas/ppc/a2.s +index bcab185..7d0ddc7 100644 +--- a/gas/testsuite/gas/ppc/a2.s ++++ b/gas/testsuite/gas/ppc/a2.s +@@ -91,13 +91,13 @@ start: + dcblc 1,10,11 + dcbst 10,11 + dcbstep 10,11 +- dcbt 10,11,0 +- dcbt 10,11,1 ++ dcbt 0,10,11 ++ dcbt 1,10,11 + dcbtep 10,11,12 + dcbtls 0,10,11 + dcbtls 1,10,11 +- dcbtst 10,11,0 +- dcbtst 10,11,1 ++ dcbtst 0,10,11 ++ dcbtst 1,10,11 + dcbtstep 10,11,12 + dcbtstls 0,10,11 + dcbtstls 1,10,11 +diff --git a/gas/testsuite/gas/ppc/booke.d b/gas/testsuite/gas/ppc/booke.d +index c427141..26bbdce 100644 +--- a/gas/testsuite/gas/ppc/booke.d ++++ b/gas/testsuite/gas/ppc/booke.d +@@ -39,5 +39,3 @@ Disassembly of section \.text: + 6c: (7c 17 43 a6|a6 43 17 7c) mtsprg 7,r0 + 70: (7c 17 43 a6|a6 43 17 7c) mtsprg 7,r0 + 74: (7c 05 32 2c|2c 32 05 7c) dcbt r5,r6 +- 78: (7c 05 32 2c|2c 32 05 7c) dcbt r5,r6 +- 7c: (7d 05 32 2c|2c 32 05 7d) dcbt 8,r5,r6 +diff --git a/gas/testsuite/gas/ppc/booke.s b/gas/testsuite/gas/ppc/booke.s +index 3947c61..7c8b1ff 100644 +--- a/gas/testsuite/gas/ppc/booke.s ++++ b/gas/testsuite/gas/ppc/booke.s +@@ -38,5 +38,3 @@ branch_target_2: + mtsprg7 0 + + dcbt 5,6 +- dcbt 0,5,6 +- dcbt 8,5,6 +diff --git a/gas/testsuite/gas/ppc/power4.d b/gas/testsuite/gas/ppc/power4.d +index fa495a1..cd71245 100644 +--- a/gas/testsuite/gas/ppc/power4.d ++++ b/gas/testsuite/gas/ppc/power4.d +@@ -10,7 +10,7 @@ start address 0x0+ + + Sections: + Idx Name +Size +VMA +LMA +File off +Algn +- +0 \.text +0+c8 +0+ +0+ +.* ++ +0 \.text +0+cc +0+ +0+ +.* + +CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE + +1 \.data +0+20 +0+ +0+ +.* + +CONTENTS, ALLOC, LOAD, DATA +@@ -98,3 +98,4 @@ Disassembly of section \.text: + .*: (f8 40 00 12|12 00 40 f8) stq r2,16\(0\) + .*: (f8 05 00 12|12 00 05 f8) stq r0,16\(r5\) + .*: (f8 45 00 12|12 00 45 f8) stq r2,16\(r5\) ++.*: (7c 00 03 e4|e4 03 00 7c) slbia +diff --git a/gas/testsuite/gas/ppc/power4.s b/gas/testsuite/gas/ppc/power4.s +index 7a60f04..49423a1 100644 +--- a/gas/testsuite/gas/ppc/power4.s ++++ b/gas/testsuite/gas/ppc/power4.s +@@ -71,6 +71,7 @@ dsym1: + stq 2,16(0) + stq 0,16(5) + stq 2,16(5) ++ slbia + + .section ".data" + usym0: .llong 0xcafebabe +diff --git a/gas/testsuite/gas/ppc/power6.d b/gas/testsuite/gas/ppc/power6.d +index e214501..9ba0687 100644 +--- a/gas/testsuite/gas/ppc/power6.d ++++ b/gas/testsuite/gas/ppc/power6.d +@@ -71,4 +71,10 @@ Disassembly of section \.text: + f4: (7d 4b 60 94|94 60 4b 7d) addg6s r10,r11,r12 + f8: (60 21 00 00|00 00 21 60) ori r1,r1,0 + fc: (60 21 00 00|00 00 21 60) ori r1,r1,0 ++.*: (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 20 52 64|64 52 20 7c) tlbie r10,1 + #pass +diff --git a/gas/testsuite/gas/ppc/power6.s b/gas/testsuite/gas/ppc/power6.s +index 21bd66e..d460fba 100644 +--- a/gas/testsuite/gas/ppc/power6.s ++++ b/gas/testsuite/gas/ppc/power6.s +@@ -66,3 +66,9 @@ start: + addg6s 10,11,12 + ori 1,1,0 + .p2align 4,,15 ++ slbia ++ slbia 0 ++ slbia 7 ++ tlbie 10 ++ tlbie 10,0 ++ tlbie 10,1 +diff --git a/gas/testsuite/gas/ppc/power7.d b/gas/testsuite/gas/ppc/power7.d +index 602da4b..a2e6df4 100644 +--- a/gas/testsuite/gas/ppc/power7.d ++++ b/gas/testsuite/gas/ppc/power7.d +@@ -7,118 +7,105 @@ + Disassembly of section \.text: + + 0+00 : +- 0: (7c 64 2e 98|98 2e 64 7c) lxvd2x vs3,r4,r5 +- 4: (7d 64 2e 99|99 2e 64 7d) lxvd2x vs43,r4,r5 +- 8: (7c 64 2f 98|98 2f 64 7c) stxvd2x vs3,r4,r5 +- c: (7d 64 2f 99|99 2f 64 7d) stxvd2x vs43,r4,r5 +- 10: (f0 64 28 50|50 28 64 f0) xxmrghd vs3,vs4,vs5 +- 14: (f1 6c 68 57|57 68 6c f1) xxmrghd vs43,vs44,vs45 +- 18: (f0 64 2b 50|50 2b 64 f0) xxmrgld vs3,vs4,vs5 +- 1c: (f1 6c 6b 57|57 6b 6c f1) xxmrgld vs43,vs44,vs45 +- 20: (f0 64 28 50|50 28 64 f0) xxmrghd vs3,vs4,vs5 +- 24: (f1 6c 68 57|57 68 6c f1) xxmrghd vs43,vs44,vs45 +- 28: (f0 64 2b 50|50 2b 64 f0) xxmrgld vs3,vs4,vs5 +- 2c: (f1 6c 6b 57|57 6b 6c f1) xxmrgld vs43,vs44,vs45 +- 30: (f0 64 29 50|50 29 64 f0) xxpermdi vs3,vs4,vs5,1 +- 34: (f1 6c 69 57|57 69 6c f1) xxpermdi vs43,vs44,vs45,1 +- 38: (f0 64 2a 50|50 2a 64 f0) xxpermdi vs3,vs4,vs5,2 +- 3c: (f1 6c 6a 57|57 6a 6c f1) xxpermdi vs43,vs44,vs45,2 +- 40: (f0 64 27 80|80 27 64 f0) xvmovdp vs3,vs4 +- 44: (f1 6c 67 87|87 67 6c f1) xvmovdp vs43,vs44 +- 48: (f0 64 27 80|80 27 64 f0) xvmovdp vs3,vs4 +- 4c: (f1 6c 67 87|87 67 6c f1) xvmovdp vs43,vs44 +- 50: (f0 64 2f 80|80 2f 64 f0) xvcpsgndp vs3,vs4,vs5 +- 54: (f1 6c 6f 87|87 6f 6c f1) xvcpsgndp vs43,vs44,vs45 +- 58: (7c 00 00 7c|7c 00 00 7c) wait +- 5c: (7c 00 00 7c|7c 00 00 7c) wait +- 60: (7c 20 00 7c|7c 00 20 7c) waitrsv +- 64: (7c 20 00 7c|7c 00 20 7c) waitrsv +- 68: (7c 40 00 7c|7c 00 40 7c) waitimpl +- 6c: (7c 40 00 7c|7c 00 40 7c) waitimpl +- 70: (4c 00 03 24|24 03 00 4c) doze +- 74: (4c 00 03 64|64 03 00 4c) nap +- 78: (4c 00 03 a4|a4 03 00 4c) sleep +- 7c: (4c 00 03 e4|e4 03 00 4c) rvwinkle +- 80: (7c 83 01 34|34 01 83 7c) prtyw r3,r4 +- 84: (7d cd 01 74|74 01 cd 7d) prtyd r13,r14 +- 88: (7d 5c 02 a6|a6 02 5c 7d) mfcfar r10 +- 8c: (7d 7c 03 a6|a6 03 7c 7d) mtcfar r11 +- 90: (7c 83 2b f8|f8 2b 83 7c) cmpb r3,r4,r5 +- 94: (7d 4b 66 2a|2a 66 4b 7d) lwzcix r10,r11,r12 +- 98: (ee 11 90 04|04 90 11 ee) dadd f16,f17,f18 +- 9c: (fe 96 c0 04|04 c0 96 fe) daddq f20,f22,f24 +- a0: (7c 60 06 6c|6c 06 60 7c) dss 3 +- a4: (7e 00 06 6c|6c 06 00 7e) dssall +- a8: (7c 25 22 ac|ac 22 25 7c) dst r5,r4,1 +- ac: (7e 08 3a ac|ac 3a 08 7e) dstt r8,r7,0 +- b0: (7c 65 32 ec|ec 32 65 7c) dstst r5,r6,3 +- b4: (7e 44 2a ec|ec 2a 44 7e) dststt r4,r5,2 +- b8: (7d 4b 63 56|56 63 4b 7d) divwe r10,r11,r12 +- bc: (7d 6c 6b 57|57 6b 6c 7d) divwe\. r11,r12,r13 +- c0: (7d 8d 77 56|56 77 8d 7d) divweo r12,r13,r14 +- c4: (7d ae 7f 57|57 7f ae 7d) divweo\. r13,r14,r15 +- c8: (7d 4b 63 16|16 63 4b 7d) divweu r10,r11,r12 +- cc: (7d 6c 6b 17|17 6b 6c 7d) divweu\. r11,r12,r13 +- d0: (7d 8d 77 16|16 77 8d 7d) divweuo r12,r13,r14 +- d4: (7d ae 7f 17|17 7f ae 7d) divweuo\. r13,r14,r15 +- d8: (7e 27 d9 f8|f8 d9 27 7e) bpermd r7,r17,r27 +- dc: (7e 8a 02 f4|f4 02 8a 7e) popcntw r10,r20 +- e0: (7e 8a 03 f4|f4 03 8a 7e) popcntd r10,r20 +- e4: (7e 95 b4 28|28 b4 95 7e) ldbrx r20,r21,r22 +- e8: (7e 95 b5 28|28 b5 95 7e) stdbrx r20,r21,r22 +- ec: (7d 40 56 ee|ee 56 40 7d) lfiwzx f10,0,r10 +- f0: (7d 49 56 ee|ee 56 49 7d) lfiwzx f10,r9,r10 +- f4: (ec 80 2e 9c|9c 2e 80 ec) fcfids f4,f5 +- f8: (ec 80 2e 9d|9d 2e 80 ec) fcfids\. f4,f5 +- fc: (ec 80 2f 9c|9c 2f 80 ec) fcfidus f4,f5 +- 100: (ec 80 2f 9d|9d 2f 80 ec) fcfidus\. f4,f5 +- 104: (fc 80 29 1c|1c 29 80 fc) fctiwu f4,f5 +- 108: (fc 80 29 1d|1d 29 80 fc) fctiwu\. f4,f5 +- 10c: (fc 80 29 1e|1e 29 80 fc) fctiwuz f4,f5 +- 110: (fc 80 29 1f|1f 29 80 fc) fctiwuz\. f4,f5 +- 114: (fc 80 2f 5c|5c 2f 80 fc) fctidu f4,f5 +- 118: (fc 80 2f 5d|5d 2f 80 fc) fctidu\. f4,f5 +- 11c: (fc 80 2f 5e|5e 2f 80 fc) fctiduz f4,f5 +- 120: (fc 80 2f 5f|5f 2f 80 fc) fctiduz\. f4,f5 +- 124: (fc 80 2f 9c|9c 2f 80 fc) fcfidu f4,f5 +- 128: (fc 80 2f 9d|9d 2f 80 fc) fcfidu\. f4,f5 +- 12c: (fc 0a 59 00|00 59 0a fc) ftdiv cr0,f10,f11 +- 130: (ff 8a 59 00|00 59 8a ff) ftdiv cr7,f10,f11 +- 134: (fc 00 51 40|40 51 00 fc) ftsqrt cr0,f10 +- 138: (ff 80 51 40|40 51 80 ff) ftsqrt cr7,f10 +- 13c: (7e 08 4a 2c|2c 4a 08 7e) dcbtt r8,r9 +- 140: (7e 08 49 ec|ec 49 08 7e) dcbtstt r8,r9 +- 144: (ed 40 66 44|44 66 40 ed) dcffix f10,f12 +- 148: (ee 80 b6 45|45 b6 80 ee) dcffix\. f20,f22 +- 14c: (7d 4b 60 68|68 60 4b 7d) lbarx r10,r11,r12 +- 150: (7d 4b 60 68|68 60 4b 7d) lbarx r10,r11,r12 +- 154: (7d 4b 60 69|69 60 4b 7d) lbarx r10,r11,r12,1 +- 158: (7e 95 b0 e8|e8 b0 95 7e) lharx r20,r21,r22 +- 15c: (7e 95 b0 e8|e8 b0 95 7e) lharx r20,r21,r22 +- 160: (7e 95 b0 e9|e9 b0 95 7e) lharx r20,r21,r22,1 +- 164: (7d 4b 65 6d|6d 65 4b 7d) stbcx\. r10,r11,r12 +- 168: (7d 4b 65 ad|ad 65 4b 7d) sthcx\. r10,r11,r12 +- 16c: (fd c0 78 30|30 78 c0 fd) fre f14,f15 +- 170: (fd c0 78 31|31 78 c0 fd) fre\. f14,f15 +- 174: (ed c0 78 30|30 78 c0 ed) fres f14,f15 +- 178: (ed c0 78 31|31 78 c0 ed) fres\. f14,f15 +- 17c: (fd c0 78 34|34 78 c0 fd) frsqrte f14,f15 +- 180: (fd c0 78 35|35 78 c0 fd) frsqrte\. f14,f15 +- 184: (ed c0 78 34|34 78 c0 ed) frsqrtes f14,f15 +- 188: (ed c0 78 35|35 78 c0 ed) frsqrtes\. f14,f15 +- 18c: (7c 43 27 1e|1e 27 43 7c) isel r2,r3,r4,28 +- 190: (60 42 00 00|00 00 42 60) ori r2,r2,0 +- 194: (60 00 00 00|00 00 00 60) nop +- 198: (60 00 00 00|00 00 00 60) nop +- 19c: (60 42 00 00|00 00 42 60) ori r2,r2,0 +- 1a0: (7f 7b db 78|78 db 7b 7f) yield +- 1a4: (7f 7b db 78|78 db 7b 7f) yield +- 1a8: (7f bd eb 78|78 eb bd 7f) mdoio +- 1ac: (7f bd eb 78|78 eb bd 7f) mdoio +- 1b0: (7f de f3 78|78 f3 de 7f) mdoom +- 1b4: (7f de f3 78|78 f3 de 7f) mdoom +- 1b8: (7d 40 e2 a6|a6 e2 40 7d) mfppr r10 +- 1bc: (7d 62 e2 a6|a6 e2 62 7d) mfppr32 r11 +- 1c0: (7d 80 e3 a6|a6 e3 80 7d) mtppr r12 +- 1c4: (7d a2 e3 a6|a6 e3 a2 7d) mtppr32 r13 ++.*: (7c 64 2e 98|98 2e 64 7c) lxvd2x vs3,r4,r5 ++.*: (7d 64 2e 99|99 2e 64 7d) lxvd2x vs43,r4,r5 ++.*: (7c 64 2f 98|98 2f 64 7c) stxvd2x vs3,r4,r5 ++.*: (7d 64 2f 99|99 2f 64 7d) stxvd2x vs43,r4,r5 ++.*: (f0 64 28 50|50 28 64 f0) xxmrghd vs3,vs4,vs5 ++.*: (f1 6c 68 57|57 68 6c f1) xxmrghd vs43,vs44,vs45 ++.*: (f0 64 2b 50|50 2b 64 f0) xxmrgld vs3,vs4,vs5 ++.*: (f1 6c 6b 57|57 6b 6c f1) xxmrgld vs43,vs44,vs45 ++.*: (f0 64 28 50|50 28 64 f0) xxmrghd vs3,vs4,vs5 ++.*: (f1 6c 68 57|57 68 6c f1) xxmrghd vs43,vs44,vs45 ++.*: (f0 64 2b 50|50 2b 64 f0) xxmrgld vs3,vs4,vs5 ++.*: (f1 6c 6b 57|57 6b 6c f1) xxmrgld vs43,vs44,vs45 ++.*: (f0 64 29 50|50 29 64 f0) xxpermdi vs3,vs4,vs5,1 ++.*: (f1 6c 69 57|57 69 6c f1) xxpermdi vs43,vs44,vs45,1 ++.*: (f0 64 2a 50|50 2a 64 f0) xxpermdi vs3,vs4,vs5,2 ++.*: (f1 6c 6a 57|57 6a 6c f1) xxpermdi vs43,vs44,vs45,2 ++.*: (f0 64 27 80|80 27 64 f0) xvmovdp vs3,vs4 ++.*: (f1 6c 67 87|87 67 6c f1) xvmovdp vs43,vs44 ++.*: (f0 64 27 80|80 27 64 f0) xvmovdp vs3,vs4 ++.*: (f1 6c 67 87|87 67 6c f1) xvmovdp vs43,vs44 ++.*: (f0 64 2f 80|80 2f 64 f0) xvcpsgndp vs3,vs4,vs5 ++.*: (f1 6c 6f 87|87 6f 6c f1) xvcpsgndp vs43,vs44,vs45 ++.*: (4c 00 03 24|24 03 00 4c) doze ++.*: (4c 00 03 64|64 03 00 4c) nap ++.*: (4c 00 03 a4|a4 03 00 4c) sleep ++.*: (4c 00 03 e4|e4 03 00 4c) rvwinkle ++.*: (7c 83 01 34|34 01 83 7c) prtyw r3,r4 ++.*: (7d cd 01 74|74 01 cd 7d) prtyd r13,r14 ++.*: (7d 5c 02 a6|a6 02 5c 7d) mfcfar r10 ++.*: (7d 7c 03 a6|a6 03 7c 7d) mtcfar r11 ++.*: (7c 83 2b f8|f8 2b 83 7c) cmpb r3,r4,r5 ++.*: (7d 4b 66 2a|2a 66 4b 7d) lwzcix r10,r11,r12 ++.*: (ee 11 90 04|04 90 11 ee) dadd f16,f17,f18 ++.*: (fe 96 c0 04|04 c0 96 fe) daddq f20,f22,f24 ++.*: (7c 60 06 6c|6c 06 60 7c) dss 3 ++.*: (7e 00 06 6c|6c 06 00 7e) dssall ++.*: (7c 25 22 ac|ac 22 25 7c) dst r5,r4,1 ++.*: (7e 08 3a ac|ac 3a 08 7e) dstt r8,r7,0 ++.*: (7c 65 32 ec|ec 32 65 7c) dstst r5,r6,3 ++.*: (7e 44 2a ec|ec 2a 44 7e) dststt r4,r5,2 ++.*: (7d 4b 63 56|56 63 4b 7d) divwe r10,r11,r12 ++.*: (7d 6c 6b 57|57 6b 6c 7d) divwe\. r11,r12,r13 ++.*: (7d 8d 77 56|56 77 8d 7d) divweo r12,r13,r14 ++.*: (7d ae 7f 57|57 7f ae 7d) divweo\. r13,r14,r15 ++.*: (7d 4b 63 16|16 63 4b 7d) divweu r10,r11,r12 ++.*: (7d 6c 6b 17|17 6b 6c 7d) divweu\. r11,r12,r13 ++.*: (7d 8d 77 16|16 77 8d 7d) divweuo r12,r13,r14 ++.*: (7d ae 7f 17|17 7f ae 7d) divweuo\. r13,r14,r15 ++.*: (7e 27 d9 f8|f8 d9 27 7e) bpermd r7,r17,r27 ++.*: (7e 8a 02 f4|f4 02 8a 7e) popcntw r10,r20 ++.*: (7e 8a 03 f4|f4 03 8a 7e) popcntd r10,r20 ++.*: (7e 95 b4 28|28 b4 95 7e) ldbrx r20,r21,r22 ++.*: (7e 95 b5 28|28 b5 95 7e) stdbrx r20,r21,r22 ++.*: (7d 40 56 ee|ee 56 40 7d) lfiwzx f10,0,r10 ++.*: (7d 49 56 ee|ee 56 49 7d) lfiwzx f10,r9,r10 ++.*: (ec 80 2e 9c|9c 2e 80 ec) fcfids f4,f5 ++.*: (ec 80 2e 9d|9d 2e 80 ec) fcfids\. f4,f5 ++.*: (ec 80 2f 9c|9c 2f 80 ec) fcfidus f4,f5 ++.*: (ec 80 2f 9d|9d 2f 80 ec) fcfidus\. f4,f5 ++.*: (fc 80 29 1c|1c 29 80 fc) fctiwu f4,f5 ++.*: (fc 80 29 1d|1d 29 80 fc) fctiwu\. f4,f5 ++.*: (fc 80 29 1e|1e 29 80 fc) fctiwuz f4,f5 ++.*: (fc 80 29 1f|1f 29 80 fc) fctiwuz\. f4,f5 ++.*: (fc 80 2f 5c|5c 2f 80 fc) fctidu f4,f5 ++.*: (fc 80 2f 5d|5d 2f 80 fc) fctidu\. f4,f5 ++.*: (fc 80 2f 5e|5e 2f 80 fc) fctiduz f4,f5 ++.*: (fc 80 2f 5f|5f 2f 80 fc) fctiduz\. f4,f5 ++.*: (fc 80 2f 9c|9c 2f 80 fc) fcfidu f4,f5 ++.*: (fc 80 2f 9d|9d 2f 80 fc) fcfidu\. f4,f5 ++.*: (fc 0a 59 00|00 59 0a fc) ftdiv cr0,f10,f11 ++.*: (ff 8a 59 00|00 59 8a ff) ftdiv cr7,f10,f11 ++.*: (fc 00 51 40|40 51 00 fc) ftsqrt cr0,f10 ++.*: (ff 80 51 40|40 51 80 ff) ftsqrt cr7,f10 ++.*: (7e 08 4a 2c|2c 4a 08 7e) dcbtt r8,r9 ++.*: (7e 08 49 ec|ec 49 08 7e) dcbtstt r8,r9 ++.*: (ed 40 66 44|44 66 40 ed) dcffix f10,f12 ++.*: (ee 80 b6 45|45 b6 80 ee) dcffix\. f20,f22 ++.*: (fd c0 78 30|30 78 c0 fd) fre f14,f15 ++.*: (fd c0 78 31|31 78 c0 fd) fre\. f14,f15 ++.*: (ed c0 78 30|30 78 c0 ed) fres f14,f15 ++.*: (ed c0 78 31|31 78 c0 ed) fres\. f14,f15 ++.*: (fd c0 78 34|34 78 c0 fd) frsqrte f14,f15 ++.*: (fd c0 78 35|35 78 c0 fd) frsqrte\. f14,f15 ++.*: (ed c0 78 34|34 78 c0 ed) frsqrtes f14,f15 ++.*: (ed c0 78 35|35 78 c0 ed) frsqrtes\. f14,f15 ++.*: (7c 43 27 1e|1e 27 43 7c) isel r2,r3,r4,28 ++.*: (7f 7b db 78|78 db 7b 7f) yield ++.*: (7f 7b db 78|78 db 7b 7f) yield ++.*: (60 42 00 00|00 00 42 60) ori r2,r2,0 ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 42 00 00|00 00 42 60) ori r2,r2,0 ++.*: (7f bd eb 78|78 eb bd 7f) mdoio ++.*: (7f bd eb 78|78 eb bd 7f) mdoio ++.*: (7f de f3 78|78 f3 de 7f) mdoom ++.*: (7f de f3 78|78 f3 de 7f) mdoom ++.*: (7d 40 e2 a6|a6 e2 40 7d) mfppr r10 ++.*: (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 + #pass +diff --git a/gas/testsuite/gas/ppc/power7.s b/gas/testsuite/gas/ppc/power7.s +index 46518d4..b811112 100644 +--- a/gas/testsuite/gas/ppc/power7.s ++++ b/gas/testsuite/gas/ppc/power7.s +@@ -22,12 +22,6 @@ power7: + xvcpsgndp 43,44,44 + xvcpsgndp 3,4,5 + xvcpsgndp 43,44,45 +- wait +- wait 0 +- waitrsv +- wait 1 +- waitimpl +- wait 2 + doze + nap + sleep +@@ -83,14 +77,6 @@ power7: + dcbtstt 8,9 + dcffix 10,12 + dcffix. 20,22 +- lbarx 10,11,12 +- lbarx 10,11,12,0 +- lbarx 10,11,12,1 +- lharx 20,21,22 +- lharx 20,21,22,0 +- lharx 20,21,22,1 +- stbcx. 10,11,12 +- sthcx. 10,11,12 + fre 14,15 + fre. 14,15 + fres 14,15 +@@ -100,10 +86,10 @@ power7: + frsqrtes 14,15 + frsqrtes. 14,15 + isel 2,3,4,28 +- ori 2,2,0 +- .p2align 4,,15 + yield + or 27,27,27 ++ ori 2,2,0 ++ .p2align 4,,15 + mdoio + or 29,29,29 + mdoom +@@ -112,3 +98,4 @@ power7: + mfppr32 11 + mtppr 12 + mtppr32 13 ++ tlbie 10,11 +diff --git a/gold/ChangeLog b/gold/ChangeLog +index 2220da2..a86b79c 100644 +--- a/gold/ChangeLog ++++ b/gold/ChangeLog +@@ -1,3 +1,101 @@ ++2015-06-05 Alan Modra ++ ++ Apply from master ++ 2015-05-16 Alan Modra ++ * reloc.cc (Sized_relobj_file::find_functions): Use function_location. ++ * powerpc.cc (Target_powerpc::do_calls_non_split): New function. ++ (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants. ++ (lis_0): Rename from lis_0_0. ++ ++ 2015-04-28 Alan Modra ++ * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather ++ than unsigned int for find_global_entry result temp. Compare ++ against invalid_address. ++ (Target_powerpc::do_plt_address_for_global): Likewise. ++ (Target_powerpc::Relocate::relocate): Likewise. Don't assert ++ on plt call stub existence for debug info. Do assert for plt ++ and global entry stub existence if an alloc section. ++ ++ 2015-04-28 Alan Modra ++ * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert ++ on missing global entry stub due to bogus debug info. ++ ++ 2015-03-24 Alan Modra ++ PR 18147 ++ * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report ++ relocation errors for branches to strong undefined symbols. ++ ++2015-03-18 Alan Modra ++ ++ Apply from master ++ 2015-02-24 Alan Modra ++ PR 18010 ++ * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always ++ complain if value is not a multiple of four. ++ (Target_powerpc::Relocate::relocate): Correct handling of ++ R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64. ++ ++ 2015-02-18 Alan Modra ++ PR 17954 ++ * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default ++ visibility. ++ ++2015-02-22 H.J. Lu ++ ++ Cherry-pick from master ++ 2015-02-21 H.J. Lu ++ ++ * configure.ac (default_size): Set to 32 for x32. ++ * configure: Regenerated. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master ++ 2015-01-29 Alan Modra ++ * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD ++ and GOT_TLSGD to LE optimization. ++ ++ 2015-01-22 Alan Modra ++ * powerpc.cc (Target_powerpc::Scan::local ): Correct ++ condition for need of ifunc plt entry. ++ (Target_powerpc::Scan::global ): Likewise. ++ ++ 2014-12-22 Cary Coutant ++ * powerpc.cc (Target_powerpc::relocate): Fix overflow check. ++ ++2015-01-06 H.J. Lu ++ Cary Coutant ++ ++ PR gold/17729 ++ * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32. ++ (DEFAULT_TARGET_X32): Set for x32. ++ * x86_64.cc (cmp_insn_32): New. ++ (lea_r10_insn_32): Likewise. ++ (lea_r11_insn_32): Likewise. ++ (cmp_insn_64): Likewise. ++ (lea_r10_insn_64): Likewise. ++ (lea_r11_insn_64): Likewise. ++ (Target_x86_64::do_calls_non_split): Handle x32. ++ * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh. ++ (check_DATA): Add split_x32 files. ++ (split_x32_[1234n].o): New targets. ++ (split_x32_[124]): New targets. ++ (split_x32_[1234r].stdout): New targets. ++ * testsuite/split_x32.sh: New file. ++ * testsuite/split_x32_1.s: Likewise. ++ * testsuite/split_x32_2.s: Likewise. ++ * testsuite/split_x32_3.s: Likewise. ++ * testsuite/split_x32_4.s: Likewise. ++ * testsuite/split_x32_n.s: Likewise. ++ * configure: Regenerated. ++ * testsuite/Makefile.in: Likewise. ++ ++2015-01-06 H.J. Lu ++ ++ PR gold/17809 ++ * x86_64.cc (Target_x86_64::Relocate::tls_ie_to_le): Handle ++ x32. ++ + 2014-12-04 Alan Modra + + * Powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore +diff --git a/gold/configure b/gold/configure +index 7d7b849..3427074 100755 +--- a/gold/configure ++++ b/gold/configure +@@ -688,6 +688,8 @@ DEFAULT_TARGET_MIPS_FALSE + DEFAULT_TARGET_MIPS_TRUE + DEFAULT_TARGET_TILEGX_FALSE + DEFAULT_TARGET_TILEGX_TRUE ++DEFAULT_TARGET_X32_FALSE ++DEFAULT_TARGET_X32_TRUE + DEFAULT_TARGET_X86_64_FALSE + DEFAULT_TARGET_X86_64_TRUE + DEFAULT_TARGET_SPARC_FALSE +@@ -3475,7 +3477,20 @@ else + DEFAULT_TARGET_SPARC_FALSE= + fi + +- if test "$targ_obj" = "x86_64"; then ++ target_x86_64=no ++ target_x32=no ++ if test "$targ_obj" = "x86_64"; then ++ case "$target" in ++ x86_64*-linux-gnux32) ++ target_x32=yes ++ default_size=32 ++ ;; ++ *) ++ target_x86_64=yes ++ ;; ++ esac ++ fi ++ if test "$target_x86_64" = "yes"; then + DEFAULT_TARGET_X86_64_TRUE= + DEFAULT_TARGET_X86_64_FALSE='#' + else +@@ -3483,6 +3498,14 @@ else + DEFAULT_TARGET_X86_64_FALSE= + fi + ++ if test "$target_x32" = "yes"; then ++ DEFAULT_TARGET_X32_TRUE= ++ DEFAULT_TARGET_X32_FALSE='#' ++else ++ DEFAULT_TARGET_X32_TRUE='#' ++ DEFAULT_TARGET_X32_FALSE= ++fi ++ + if test "$targ_obj" = "tilegx"; then + DEFAULT_TARGET_TILEGX_TRUE= + DEFAULT_TARGET_TILEGX_FALSE='#' +@@ -7811,6 +7834,10 @@ if test -z "${DEFAULT_TARGET_X86_64_TRUE}" && test -z "${DEFAULT_TARGET_X86_64_F + as_fn_error "conditional \"DEFAULT_TARGET_X86_64\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${DEFAULT_TARGET_X32_TRUE}" && test -z "${DEFAULT_TARGET_X32_FALSE}"; then ++ as_fn_error "conditional \"DEFAULT_TARGET_X32\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${DEFAULT_TARGET_TILEGX_TRUE}" && test -z "${DEFAULT_TARGET_TILEGX_FALSE}"; then + as_fn_error "conditional \"DEFAULT_TARGET_TILEGX\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 +diff --git a/gold/configure.ac b/gold/configure.ac +index 0478011..e0ac1df 100644 +--- a/gold/configure.ac ++++ b/gold/configure.ac +@@ -204,7 +204,21 @@ for targ in $target $canon_targets; do + AM_CONDITIONAL(DEFAULT_TARGET_I386, test "$targ_obj" = "i386") + AM_CONDITIONAL(DEFAULT_TARGET_POWERPC, test "$targ_obj" = "powerpc") + AM_CONDITIONAL(DEFAULT_TARGET_SPARC, test "$targ_obj" = "sparc") +- AM_CONDITIONAL(DEFAULT_TARGET_X86_64, test "$targ_obj" = "x86_64") ++ target_x86_64=no ++ target_x32=no ++ if test "$targ_obj" = "x86_64"; then ++ case "$target" in ++ x86_64*-linux-gnux32) ++ target_x32=yes ++ default_size=32 ++ ;; ++ *) ++ target_x86_64=yes ++ ;; ++ esac ++ fi ++ AM_CONDITIONAL(DEFAULT_TARGET_X86_64, test "$target_x86_64" = "yes") ++ AM_CONDITIONAL(DEFAULT_TARGET_X32, test "$target_x32" = "yes") + AM_CONDITIONAL(DEFAULT_TARGET_TILEGX, test "$targ_obj" = "tilegx") + AM_CONDITIONAL(DEFAULT_TARGET_MIPS, test "$targ_obj" = "mips") + DEFAULT_TARGET=${targ_obj} +diff --git a/gold/powerpc.cc b/gold/powerpc.cc +index 0450937..a27d3bd 100644 +--- a/gold/powerpc.cc ++++ b/gold/powerpc.cc +@@ -604,6 +604,13 @@ class Target_powerpc : public Sized_target + do_can_check_for_function_pointers() const + { return true; } + ++ // Adjust -fsplit-stack code which calls non-split-stack code. ++ void ++ do_calls_non_split(Relobj* object, unsigned int shndx, ++ section_offset_type fnoffset, section_size_type fnsize, ++ unsigned char* view, section_size_type view_size, ++ std::string* from, std::string* to) const; ++ + // Relocate a section. + void + relocate_section(const Relocate_info*, +@@ -1626,7 +1633,7 @@ public: + addr16_ds(unsigned char* view, Address value, Overflow_check overflow) + { + Status stat = This::template rela<16,16>(view, 0, 0xfffc, value, overflow); +- if (overflow != CHECK_NONE && (value & 3) != 0) ++ if ((value & 3) != 0) + stat = STATUS_OVERFLOW; + return stat; + } +@@ -3089,14 +3096,15 @@ static const uint32_t addi_0_12 = 0x380c0000; + static const uint32_t addi_2_2 = 0x38420000; + static const uint32_t addi_3_3 = 0x38630000; + static const uint32_t addi_11_11 = 0x396b0000; ++static const uint32_t addi_12_1 = 0x39810000; + static const uint32_t addi_12_12 = 0x398c0000; + static const uint32_t addis_0_2 = 0x3c020000; + static const uint32_t addis_0_13 = 0x3c0d0000; +-static const uint32_t addis_3_2 = 0x3c620000; +-static const uint32_t addis_3_13 = 0x3c6d0000; ++static const uint32_t addis_2_12 = 0x3c4c0000; + static const uint32_t addis_11_2 = 0x3d620000; + static const uint32_t addis_11_11 = 0x3d6b0000; + static const uint32_t addis_11_30 = 0x3d7e0000; ++static const uint32_t addis_12_1 = 0x3d810000; + static const uint32_t addis_12_2 = 0x3d820000; + static const uint32_t addis_12_12 = 0x3d8c0000; + static const uint32_t b = 0x48000000; +@@ -3104,6 +3112,7 @@ static const uint32_t bcl_20_31 = 0x429f0005; + static const uint32_t bctr = 0x4e800420; + static const uint32_t blr = 0x4e800020; + static const uint32_t bnectr_p4 = 0x4ce20420; ++static const uint32_t cmpld_7_12_0 = 0x7fac0040; + static const uint32_t cmpldi_2_0 = 0x28220000; + static const uint32_t cror_15_15_15 = 0x4def7b82; + static const uint32_t cror_31_31_31 = 0x4ffffb82; +@@ -3120,7 +3129,7 @@ static const uint32_t ld_12_12 = 0xe98c0000; + static const uint32_t lfd_0_1 = 0xc8010000; + static const uint32_t li_0_0 = 0x38000000; + static const uint32_t li_12_0 = 0x39800000; +-static const uint32_t lis_0_0 = 0x3c000000; ++static const uint32_t lis_0 = 0x3c000000; + static const uint32_t lis_11 = 0x3d600000; + static const uint32_t lis_12 = 0x3d800000; + static const uint32_t lvx_0_12_0 = 0x7c0c00ce; +@@ -4534,7 +4543,7 @@ Output_data_glink::do_write(Output_file* of) + } + else + { +- write_insn(p, lis_0_0 + hi(indx)), p += 4; ++ write_insn(p, lis_0 + hi(indx)), p += 4; + write_insn(p, ori_0_0_0 + l(indx)), p += 4; + } + } +@@ -5584,8 +5593,8 @@ Target_powerpc::Scan::local( + + if (!parameters->options().output_is_position_independent()) + { +- if ((size == 32 && is_ifunc) +- || (size == 64 && target->abiversion() >= 2)) ++ if (is_ifunc ++ && (size == 32 || target->abiversion() >= 2)) + got->add_local_plt(object, r_sym, GOT_TYPE_STANDARD); + else + got->add_local(object, r_sym, GOT_TYPE_STANDARD); +@@ -6032,8 +6041,8 @@ Target_powerpc::Scan::global( + got = target->got_section(symtab, layout); + if (gsym->final_value_is_known()) + { +- if ((size == 32 && is_ifunc) +- || (size == 64 && target->abiversion() >= 2)) ++ if (is_ifunc ++ && (size == 32 || target->abiversion() >= 2)) + got->add_global_plt(gsym, GOT_TYPE_STANDARD); + else + got->add_global(gsym, GOT_TYPE_STANDARD); +@@ -6393,6 +6402,113 @@ Target_powerpc::do_function_location( + } + } + ++// FNOFFSET in section SHNDX in OBJECT is the start of a function ++// compiled with -fsplit-stack. The function calls non-split-stack ++// code. Change the function to ensure it has enough stack space to ++// call some random function. ++ ++template ++void ++Target_powerpc::do_calls_non_split( ++ Relobj* object, ++ unsigned int shndx, ++ section_offset_type fnoffset, ++ section_size_type fnsize, ++ unsigned char* view, ++ section_size_type view_size, ++ std::string* from, ++ std::string* to) const ++{ ++ // 32-bit not supported. ++ if (size == 32) ++ { ++ // warn ++ Target::do_calls_non_split(object, shndx, fnoffset, fnsize, ++ view, view_size, from, to); ++ return; ++ } ++ ++ // The function always starts with ++ // ld %r0,-0x7000-64(%r13) # tcbhead_t.__private_ss ++ // addis %r12,%r1,-allocate@ha ++ // addi %r12,%r12,-allocate@l ++ // cmpld %r12,%r0 ++ // but note that the addis or addi may be replaced with a nop ++ ++ unsigned char *entry = view + fnoffset; ++ uint32_t insn = elfcpp::Swap<32, big_endian>::readval(entry); ++ ++ if ((insn & 0xffff0000) == addis_2_12) ++ { ++ /* Skip ELFv2 global entry code. */ ++ entry += 8; ++ insn = elfcpp::Swap<32, big_endian>::readval(entry); ++ } ++ ++ unsigned char *pinsn = entry; ++ bool ok = false; ++ const uint32_t ld_private_ss = 0xe80d8fc0; ++ if (insn == ld_private_ss) ++ { ++ int32_t allocate = 0; ++ while (1) ++ { ++ pinsn += 4; ++ insn = elfcpp::Swap<32, big_endian>::readval(pinsn); ++ if ((insn & 0xffff0000) == addis_12_1) ++ allocate += (insn & 0xffff) << 16; ++ else if ((insn & 0xffff0000) == addi_12_1 ++ || (insn & 0xffff0000) == addi_12_12) ++ allocate += ((insn & 0xffff) ^ 0x8000) - 0x8000; ++ else if (insn != nop) ++ break; ++ } ++ if (insn == cmpld_7_12_0 && pinsn == entry + 12) ++ { ++ int extra = parameters->options().split_stack_adjust_size(); ++ allocate -= extra; ++ if (allocate >= 0 || extra < 0) ++ { ++ object->error(_("split-stack stack size overflow at " ++ "section %u offset %0zx"), ++ shndx, static_cast(fnoffset)); ++ return; ++ } ++ pinsn = entry + 4; ++ insn = addis_12_1 | (((allocate + 0x8000) >> 16) & 0xffff); ++ if (insn != addis_12_1) ++ { ++ elfcpp::Swap<32, big_endian>::writeval(pinsn, insn); ++ pinsn += 4; ++ insn = addi_12_12 | (allocate & 0xffff); ++ if (insn != addi_12_12) ++ { ++ elfcpp::Swap<32, big_endian>::writeval(pinsn, insn); ++ pinsn += 4; ++ } ++ } ++ else ++ { ++ insn = addi_12_1 | (allocate & 0xffff); ++ elfcpp::Swap<32, big_endian>::writeval(pinsn, insn); ++ pinsn += 4; ++ } ++ if (pinsn != entry + 12) ++ elfcpp::Swap<32, big_endian>::writeval(pinsn, nop); ++ ++ ok = true; ++ } ++ } ++ ++ if (!ok) ++ { ++ if (!object->has_no_split_stack()) ++ object->error(_("failed to match split-stack sequence at " ++ "section %u offset %0zx"), ++ shndx, static_cast(fnoffset)); ++ } ++} ++ + // Scan relocations for a section. + + template +@@ -6466,6 +6582,7 @@ class Global_symbol_visitor_opd + && symobj->get_opd_discard(sym->value())) + { + sym->set_undefined(); ++ sym->set_visibility(elfcpp::STV_DEFAULT); + sym->set_is_defined_in_discarded_section(); + sym->set_symtab_index(-1U); + } +@@ -6748,9 +6865,12 @@ Target_powerpc::Relocate::relocate( + && !parameters->options().output_is_position_independent() + && !is_branch_reloc(r_type)) + { +- unsigned int off = target->glink_section()->find_global_entry(gsym); +- gold_assert(off != (unsigned int)-1); +- value = target->glink_section()->global_entry_address() + off; ++ Address off = target->glink_section()->find_global_entry(gsym); ++ if (off != invalid_address) ++ { ++ value = target->glink_section()->global_entry_address() + off; ++ has_stub_value = true; ++ } + } + else + { +@@ -6762,18 +6882,26 @@ Target_powerpc::Relocate::relocate( + if (target->stub_tables().size() != 0) + stub_table = target->stub_tables()[0]; + } +- gold_assert(stub_table != NULL); +- Address off; +- if (gsym != NULL) +- off = stub_table->find_plt_call_entry(object, gsym, r_type, +- rela.get_r_addend()); +- else +- off = stub_table->find_plt_call_entry(object, r_sym, r_type, +- rela.get_r_addend()); +- gold_assert(off != invalid_address); +- value = stub_table->stub_address() + off; ++ if (stub_table != NULL) ++ { ++ Address off; ++ if (gsym != NULL) ++ off = stub_table->find_plt_call_entry(object, gsym, r_type, ++ rela.get_r_addend()); ++ else ++ off = stub_table->find_plt_call_entry(object, r_sym, r_type, ++ rela.get_r_addend()); ++ if (off != invalid_address) ++ { ++ value = stub_table->stub_address() + off; ++ has_stub_value = true; ++ } ++ } + } +- has_stub_value = true; ++ // We don't care too much about bogus debug references to ++ // non-local functions, but otherwise there had better be a plt ++ // call stub or global entry stub as appropriate. ++ gold_assert(has_stub_value || !(os->flags() & elfcpp::SHF_ALLOC)); + } + + if (r_type == elfcpp::R_POWERPC_GOT16 +@@ -6921,9 +7049,12 @@ Target_powerpc::Relocate::relocate( + || r_type == elfcpp::R_POWERPC_GOT_TLSGD16_LO) + { + Insn* iview = reinterpret_cast(view - 2 * big_endian); +- Insn insn = addis_3_13; ++ Insn insn = elfcpp::Swap<32, big_endian>::readval(iview); ++ insn &= (1 << 26) - (1 << 21); // extract rt + if (size == 32) +- insn = addis_3_2; ++ insn |= addis_0_2; ++ else ++ insn |= addis_0_13; + elfcpp::Swap<32, big_endian>::writeval(iview, insn); + r_type = elfcpp::R_POWERPC_TPREL16_HA; + value = psymval->value(object, rela.get_r_addend()); +@@ -6956,9 +7087,12 @@ Target_powerpc::Relocate::relocate( + || r_type == elfcpp::R_POWERPC_GOT_TLSLD16_LO) + { + Insn* iview = reinterpret_cast(view - 2 * big_endian); +- Insn insn = addis_3_13; ++ Insn insn = elfcpp::Swap<32, big_endian>::readval(iview); ++ insn &= (1 << 26) - (1 << 21); // extract rt + if (size == 32) +- insn = addis_3_2; ++ insn |= addis_0_2; ++ else ++ insn |= addis_0_13; + elfcpp::Swap<32, big_endian>::writeval(iview, insn); + r_type = elfcpp::R_POWERPC_TPREL16_HA; + value = dtp_offset; +@@ -7452,7 +7586,6 @@ Target_powerpc::Relocate::relocate( + Insn* iview = reinterpret_cast(view - 2 * big_endian); + Insn insn = elfcpp::Swap<32, big_endian>::readval(iview); + +- overflow = Reloc::CHECK_SIGNED; + if ((insn & (0x3f << 26)) == 10u << 26 /* cmpli */) + overflow = Reloc::CHECK_BITFIELD; + else if (overflow == Reloc::CHECK_LOW_INSN +@@ -7463,6 +7596,8 @@ Target_powerpc::Relocate::relocate( + || (insn & (0x3f << 26)) == 25u << 26 /* oris */ + || (insn & (0x3f << 26)) == 27u << 26 /* xoris */)) + overflow = Reloc::CHECK_UNSIGNED; ++ else ++ overflow = Reloc::CHECK_SIGNED; + } + + typename Powerpc_relocate_functions::Status status +@@ -7512,8 +7647,11 @@ Target_powerpc::Relocate::relocate( + + case elfcpp::R_POWERPC_GOT_DTPREL16: + case elfcpp::R_POWERPC_GOT_DTPREL16_LO: ++ case elfcpp::R_POWERPC_GOT_TPREL16: ++ case elfcpp::R_POWERPC_GOT_TPREL16_LO: + if (size == 64) + { ++ // On ppc64 these are all ds form + status = Reloc::addr16_ds(view, value, overflow); + break; + } +@@ -7526,7 +7664,6 @@ Target_powerpc::Relocate::relocate( + case elfcpp::R_POWERPC_DTPREL16: + case elfcpp::R_POWERPC_GOT_TLSGD16: + case elfcpp::R_POWERPC_GOT_TLSLD16: +- case elfcpp::R_POWERPC_GOT_TPREL16: + case elfcpp::R_POWERPC_ADDR16_LO: + case elfcpp::R_POWERPC_REL16_LO: + case elfcpp::R_PPC64_TOC16_LO: +@@ -7536,7 +7673,6 @@ Target_powerpc::Relocate::relocate( + case elfcpp::R_POWERPC_DTPREL16_LO: + case elfcpp::R_POWERPC_GOT_TLSGD16_LO: + case elfcpp::R_POWERPC_GOT_TLSLD16_LO: +- case elfcpp::R_POWERPC_GOT_TPREL16_LO: + status = Reloc::addr16(view, value, overflow); + break; + +@@ -7706,7 +7842,7 @@ Target_powerpc::Relocate::relocate( + if (status != Powerpc_relocate_functions::STATUS_OK + && (has_stub_value + || !(gsym != NULL +- && gsym->is_weak_undefined() ++ && gsym->is_undefined() + && is_branch_reloc(r_type)))) + { + gold_error_at_location(relinfo, relnum, rela.get_r_offset(), +@@ -8142,8 +8278,8 @@ Target_powerpc::do_dynsym_value(const Symbol* gsym) const + } + else if (this->abiversion() >= 2) + { +- unsigned int off = this->glink_section()->find_global_entry(gsym); +- if (off != (unsigned int)-1) ++ Address off = this->glink_section()->find_global_entry(gsym); ++ if (off != invalid_address) + return this->glink_section()->global_entry_address() + off; + } + gold_unreachable(); +@@ -8192,8 +8328,8 @@ Target_powerpc::do_plt_address_for_global( + } + else if (this->abiversion() >= 2) + { +- unsigned int off = this->glink_section()->find_global_entry(gsym); +- if (off != (unsigned int)-1) ++ Address off = this->glink_section()->find_global_entry(gsym); ++ if (off != invalid_address) + return this->glink_section()->global_entry_address() + off; + } + gold_unreachable(); +diff --git a/gold/reloc.cc b/gold/reloc.cc +index 115ab37..b353d44 100644 +--- a/gold/reloc.cc ++++ b/gold/reloc.cc +@@ -1415,13 +1415,21 @@ Sized_relobj_file::find_functions( + continue; + + bool is_ordinary; +- unsigned int sym_shndx = this->adjust_sym_shndx(i, isym.get_st_shndx(), +- &is_ordinary); +- if (!is_ordinary || sym_shndx != shndx) ++ Symbol_location loc; ++ loc.shndx = this->adjust_sym_shndx(i, isym.get_st_shndx(), ++ &is_ordinary); ++ if (!is_ordinary) ++ continue; ++ ++ loc.object = this; ++ loc.offset = isym.get_st_value(); ++ parameters->target().function_location(&loc); ++ ++ if (loc.shndx != shndx) + continue; + + section_offset_type value = +- convert_to_section_size_type(isym.get_st_value()); ++ convert_to_section_size_type(loc.offset); + section_size_type fnsize = + convert_to_section_size_type(isym.get_st_size()); + +diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am +index 35cd013..e015a3d 100644 +--- a/gold/testsuite/Makefile.am ++++ b/gold/testsuite/Makefile.am +@@ -2483,6 +2483,43 @@ MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \ + + endif DEFAULT_TARGET_X86_64 + ++if DEFAULT_TARGET_X32 ++ ++check_SCRIPTS += split_x32.sh ++check_DATA += split_x32_1.stdout split_x32_2.stdout \ ++ split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout ++SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 ++split_x32_1.o: split_x32_1.s ++ $(TEST_AS) -o $@ $< ++split_x32_2.o: split_x32_2.s ++ $(TEST_AS) -o $@ $< ++split_x32_3.o: split_x32_3.s ++ $(TEST_AS) -o $@ $< ++split_x32_4.o: split_x32_4.s ++ $(TEST_AS) -o $@ $< ++split_x32_n.o: split_x32_n.s ++ $(TEST_AS) -o $@ $< ++split_x32_1: split_x32_1.o split_x32_n.o ../ld-new ++ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o ++split_x32_1.stdout: split_x32_1 ++ $(TEST_OBJDUMP) -d $< > $@ ++split_x32_2: split_x32_2.o split_x32_n.o ../ld-new ++ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o ++split_x32_2.stdout: split_x32_2 ++ $(TEST_OBJDUMP) -d $< > $@ ++split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new ++ ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0 ++split_x32_4: split_x32_4.o split_x32_n.o ../ld-new ++ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o ++split_x32_4.stdout: split_x32_4 ++ $(TEST_OBJDUMP) -d $< > $@ ++split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new ++ ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0 ++MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \ ++ split_x32_4 split_x32_r ++ ++endif DEFAULT_TARGET_X32 ++ + if DEFAULT_TARGET_ARM + + check_SCRIPTS += arm_abs_global.sh +diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in +index 8fbb644..befef5f 100644 +--- a/gold/testsuite/Makefile.in ++++ b/gold/testsuite/Makefile.in +@@ -623,6 +623,13 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_83 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ + @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4 split_x86_64_r + ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_84 = split_x32.sh ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_85 = split_x32_1.stdout split_x32_2.stdout \ ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout ++ ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_86 = split_x32_1 split_x32_2 split_x32_3 \ ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_4 split_x32_r ++ + + # ARM1176 workaround test. + +@@ -635,7 +642,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + # Check Thumb to Thumb farcall veneers + + # Check Thumb to ARM farcall veneers +-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_84 = arm_abs_global.sh \ ++@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = arm_abs_global.sh \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_in_range.sh \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_v4bx.sh \ +@@ -649,7 +656,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.sh \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.sh \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.sh +-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_85 = arm_abs_global.stdout \ ++@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = arm_abs_global.stdout \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range.stdout \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range.stdout \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range.stdout \ +@@ -694,7 +701,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m.stdout \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.stdout \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t.stdout +-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_86 = arm_abs_global \ ++@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = arm_abs_global \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range \ +@@ -737,10 +744,10 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm \ + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t +-@DEFAULT_TARGET_X86_64_TRUE@am__append_87 = *.dwo *.dwp +-@DEFAULT_TARGET_X86_64_TRUE@am__append_88 = dwp_test_1.sh \ ++@DEFAULT_TARGET_X86_64_TRUE@am__append_90 = *.dwo *.dwp ++@DEFAULT_TARGET_X86_64_TRUE@am__append_91 = dwp_test_1.sh \ + @DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.sh +-@DEFAULT_TARGET_X86_64_TRUE@am__append_89 = dwp_test_1.stdout \ ++@DEFAULT_TARGET_X86_64_TRUE@am__append_92 = dwp_test_1.stdout \ + @DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.stdout + subdir = testsuite + DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +@@ -2224,7 +2231,8 @@ MOSTLYCLEANFILES = *.so *.syms *.stdout $(am__append_4) \ + $(am__append_41) $(am__append_47) $(am__append_63) \ + $(am__append_66) $(am__append_69) $(am__append_72) \ + $(am__append_74) $(am__append_77) $(am__append_80) \ +- $(am__append_83) $(am__append_86) $(am__append_87) ++ $(am__append_83) $(am__append_86) $(am__append_89) \ ++ $(am__append_90) + + # We will add to these later, for each individual test. Note + # that we add each test under check_SCRIPTS or check_PROGRAMS; +@@ -2233,13 +2241,13 @@ check_SCRIPTS = $(am__append_2) $(am__append_34) $(am__append_38) \ + $(am__append_42) $(am__append_45) $(am__append_61) \ + $(am__append_64) $(am__append_67) $(am__append_70) \ + $(am__append_75) $(am__append_78) $(am__append_81) \ +- $(am__append_84) $(am__append_88) ++ $(am__append_84) $(am__append_87) $(am__append_91) + check_DATA = $(am__append_3) $(am__append_27) $(am__append_29) \ + $(am__append_35) $(am__append_39) $(am__append_43) \ + $(am__append_46) $(am__append_62) $(am__append_65) \ + $(am__append_68) $(am__append_71) $(am__append_76) \ + $(am__append_79) $(am__append_82) $(am__append_85) \ +- $(am__append_89) ++ $(am__append_88) $(am__append_92) + BUILT_SOURCES = $(am__append_25) + TESTS = $(check_SCRIPTS) $(check_PROGRAMS) + +@@ -2736,6 +2744,7 @@ LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) + @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o + @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 + @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 + all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am +@@ -4166,6 +4175,8 @@ split_i386.sh.log: split_i386.sh + @p='split_i386.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) + split_x86_64.sh.log: split_x86_64.sh + @p='split_x86_64.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) ++split_x32.sh.log: split_x32.sh ++ @p='split_x32.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) + arm_abs_global.sh.log: arm_abs_global.sh + @p='arm_abs_global.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) + arm_branch_in_range.sh.log: arm_branch_in_range.sh +@@ -5777,6 +5788,32 @@ uninstall-am: + @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -d $< > $@ + @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new + @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0 ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_1.o: split_x32_1.s ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_2.o: split_x32_2.s ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_3.o: split_x32_3.s ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_4.o: split_x32_4.s ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_n.o: split_x32_n.s ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_1: split_x32_1.o split_x32_n.o ../ld-new ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_1.stdout: split_x32_1 ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -d $< > $@ ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_2: split_x32_2.o split_x32_n.o ../ld-new ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_2.stdout: split_x32_2 ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -d $< > $@ ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0 ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_4: split_x32_4.o split_x32_n.o ../ld-new ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_4.stdout: split_x32_4 ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -d $< > $@ ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new ++@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0 + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_abs_lib.o: arm_abs_lib.s + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv7-a -o $@ $< + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@libarm_abs.so: arm_abs_lib.o ../ld-new +diff --git a/gold/testsuite/split_x32.sh b/gold/testsuite/split_x32.sh +new file mode 100755 +index 0000000..0bc0cf3 +--- /dev/null ++++ b/gold/testsuite/split_x32.sh +@@ -0,0 +1,55 @@ ++#!/bin/sh ++ ++# split_x32.sh -- test -fstack-split for x32 ++ ++# Copyright (C) 2014 Free Software Foundation, Inc. ++# Written by Ian Lance Taylor . ++# Modified by H.J. Lu . ++ ++# This file is part of gold. ++ ++# 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. ++ ++match() ++{ ++ if ! egrep "$1" "$2" >/dev/null 2>&1; then ++ echo 1>&2 "could not find '$1' in $2" ++ exit 1 ++ fi ++} ++ ++nomatch() ++{ ++ if egrep "$1" "$2" >/dev/null 2>&1; then ++ echo 1>&2 "found unexpected '$1' in $2" ++ exit 1 ++ fi ++} ++ ++match 'cmp.*+%fs:[^,]*,%esp' split_x32_1.stdout ++match 'callq.*__morestack>?$' split_x32_1.stdout ++match 'lea.*-0x200\(%rsp\),' split_x32_1.stdout ++ ++match 'stc' split_x32_2.stdout ++match 'callq.*__morestack_non_split>?$' split_x32_2.stdout ++nomatch 'callq.*__morestack>?$' split_x32_2.stdout ++match 'lea.*-0x4200\(%rsp\),' split_x32_2.stdout ++ ++match 'failed to match' split_x32_3.stdout ++ ++match 'callq.*__morestack>?$' split_x32_4.stdout ++ ++match 'cannot mix' split_x32_r.stdout +diff --git a/gold/testsuite/split_x32_1.s b/gold/testsuite/split_x32_1.s +new file mode 100644 +index 0000000..b78936e +--- /dev/null ++++ b/gold/testsuite/split_x32_1.s +@@ -0,0 +1,33 @@ ++# split_x32_1.s: x32 specific test case for -fsplit-stack. ++ ++ .text ++ ++ .global fn1 ++ .type fn1,@function ++fn1: ++ cmp %fs:0x40,%esp ++ jae 1f ++ callq __morestack ++ retq ++1: ++ callq fn2 ++ retq ++ ++ .size fn1,. - fn1 ++ ++ .global fn2 ++ .type fn2,@function ++fn2: ++ lea -0x200(%rsp),%r10d ++ cmp %fs:0x40,%r10d ++ jae 1f ++ callq __morestack ++ retq ++1: ++ callq fn1 ++ retq ++ ++ .size fn2,. - fn2 ++ ++ .section .note.GNU-stack,"",@progbits ++ .section .note.GNU-split-stack,"",@progbits +diff --git a/gold/testsuite/split_x32_2.s b/gold/testsuite/split_x32_2.s +new file mode 100644 +index 0000000..b789afd +--- /dev/null ++++ b/gold/testsuite/split_x32_2.s +@@ -0,0 +1,33 @@ ++# split_x32_2.s: x32 specific, -fsplit-stack calling non-split ++ ++ .text ++ ++ .global fn1 ++ .type fn1,@function ++fn1: ++ cmp %fs:0x40,%esp ++ jae 1f ++ callq __morestack ++ retq ++1: ++ callq fn3 ++ retq ++ ++ .size fn1,. - fn1 ++ ++ .global fn2 ++ .type fn2,@function ++fn2: ++ lea -0x200(%rsp),%r10d ++ cmp %fs:0x40,%r10d ++ jae 1f ++ callq __morestack ++ retq ++1: ++ callq fn3 ++ retq ++ ++ .size fn2,. - fn2 ++ ++ .section .note.GNU-stack,"",@progbits ++ .section .note.GNU-split-stack,"",@progbits +diff --git a/gold/testsuite/split_x32_3.s b/gold/testsuite/split_x32_3.s +new file mode 100644 +index 0000000..d7b09bd +--- /dev/null ++++ b/gold/testsuite/split_x32_3.s +@@ -0,0 +1,22 @@ ++# split_x32_3.s: x32 specific, adjustment failure ++ ++ .text ++ ++ .global fn1 ++ .type fn1,@function ++fn1: ++ push %rbp ++ mov %esp,%ebp ++ cmp %fs:0x40,%esp ++ jae 1f ++ callq __morestack ++ retq ++1: ++ callq fn3 ++ leaveq ++ retq ++ ++ .size fn1,. - fn1 ++ ++ .section .note.GNU-stack,"",@progbits ++ .section .note.GNU-split-stack,"",@progbits +diff --git a/gold/testsuite/split_x32_4.s b/gold/testsuite/split_x32_4.s +new file mode 100644 +index 0000000..1f4eece +--- /dev/null ++++ b/gold/testsuite/split_x32_4.s +@@ -0,0 +1,23 @@ ++# split_x32_4.s: x32 specific, permitted adjustment failure ++ ++ .text ++ ++ .global fn1 ++ .type fn1,@function ++fn1: ++ push %rbp ++ mov %esp,%ebp ++ cmp %fs:0x40,%esp ++ jae 1f ++ callq __morestack ++ retq ++1: ++ callq fn3 ++ leaveq ++ retq ++ ++ .size fn1,. - fn1 ++ ++ .section .note.GNU-stack,"",@progbits ++ .section .note.GNU-split-stack,"",@progbits ++ .section .note.GNU-no-split-stack,"",@progbits +diff --git a/gold/testsuite/split_x32_n.s b/gold/testsuite/split_x32_n.s +new file mode 100644 +index 0000000..54c0db6 +--- /dev/null ++++ b/gold/testsuite/split_x32_n.s +@@ -0,0 +1,12 @@ ++# split_x32_n.s: x32 specific, -fsplit-stack calling non-split ++ ++ .text ++ ++ .global fn3 ++ .type fn3,@function ++fn3: ++ retq ++ ++ .size fn3,. - fn3 ++ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gold/x86_64.cc b/gold/x86_64.cc +index f58c843..10c75a2 100644 +--- a/gold/x86_64.cc ++++ b/gold/x86_64.cc +@@ -4100,6 +4100,8 @@ Target_x86_64::Relocate::tls_ie_to_le( + // movq + if (op1 == 0x4c) + view[-3] = 0x49; ++ else if (size == 32 && op1 == 0x44) ++ view[-3] = 0x41; + view[-2] = 0xc7; + view[-1] = 0xc0 | reg; + } +@@ -4108,6 +4110,8 @@ Target_x86_64::Relocate::tls_ie_to_le( + // Special handling for %rsp. + if (op1 == 0x4c) + view[-3] = 0x49; ++ else if (size == 32 && op1 == 0x44) ++ view[-3] = 0x41; + view[-2] = 0x81; + view[-1] = 0xc0 | reg; + } +@@ -4116,6 +4120,8 @@ Target_x86_64::Relocate::tls_ie_to_le( + // addq + if (op1 == 0x4c) + view[-3] = 0x4d; ++ else if (size == 32 && op1 == 0x44) ++ view[-3] = 0x45; + view[-2] = 0x8d; + view[-1] = 0x80 | reg | (reg << 3); + } +@@ -4457,6 +4463,14 @@ Target_x86_64::do_ehframe_datarel_base() const + // code. We have to change the function so that it always ensures + // that it has enough stack space to run some random function. + ++static const unsigned char cmp_insn_32[] = { 0x64, 0x3b, 0x24, 0x25 }; ++static const unsigned char lea_r10_insn_32[] = { 0x44, 0x8d, 0x94, 0x24 }; ++static const unsigned char lea_r11_insn_32[] = { 0x44, 0x8d, 0x9c, 0x24 }; ++ ++static const unsigned char cmp_insn_64[] = { 0x64, 0x48, 0x3b, 0x24, 0x25 }; ++static const unsigned char lea_r10_insn_64[] = { 0x4c, 0x8d, 0x94, 0x24 }; ++static const unsigned char lea_r11_insn_64[] = { 0x4c, 0x8d, 0x9c, 0x24 }; ++ + template + void + Target_x86_64::do_calls_non_split(Relobj* object, unsigned int shndx, +@@ -4467,25 +4481,40 @@ Target_x86_64::do_calls_non_split(Relobj* object, unsigned int shndx, + std::string* from, + std::string* to) const + { ++ const char* const cmp_insn = reinterpret_cast ++ (size == 32 ? cmp_insn_32 : cmp_insn_64); ++ const char* const lea_r10_insn = reinterpret_cast ++ (size == 32 ? lea_r10_insn_32 : lea_r10_insn_64); ++ const char* const lea_r11_insn = reinterpret_cast ++ (size == 32 ? lea_r11_insn_32 : lea_r11_insn_64); ++ ++ const size_t cmp_insn_len = ++ (size == 32 ? sizeof(cmp_insn_32) : sizeof(cmp_insn_64)); ++ const size_t lea_r10_insn_len = ++ (size == 32 ? sizeof(lea_r10_insn_32) : sizeof(lea_r10_insn_64)); ++ const size_t lea_r11_insn_len = ++ (size == 32 ? sizeof(lea_r11_insn_32) : sizeof(lea_r11_insn_64)); ++ const size_t nop_len = (size == 32 ? 7 : 8); ++ + // The function starts with a comparison of the stack pointer and a + // field in the TCB. This is followed by a jump. + + // cmp %fs:NN,%rsp +- if (this->match_view(view, view_size, fnoffset, "\x64\x48\x3b\x24\x25", 5) +- && fnsize > 9) ++ if (this->match_view(view, view_size, fnoffset, cmp_insn, cmp_insn_len) ++ && fnsize > nop_len + 1) + { + // We will call __morestack if the carry flag is set after this + // comparison. We turn the comparison into an stc instruction + // and some nops. + view[fnoffset] = '\xf9'; +- this->set_view_to_nop(view, view_size, fnoffset + 1, 8); ++ this->set_view_to_nop(view, view_size, fnoffset + 1, nop_len); + } + // lea NN(%rsp),%r10 + // lea NN(%rsp),%r11 + else if ((this->match_view(view, view_size, fnoffset, +- "\x4c\x8d\x94\x24", 4) ++ lea_r10_insn, lea_r10_insn_len) + || this->match_view(view, view_size, fnoffset, +- "\x4c\x8d\x9c\x24", 4)) ++ lea_r11_insn, lea_r11_insn_len)) + && fnsize > 8) + { + // This is loading an offset from the stack pointer for a +diff --git a/include/ChangeLog b/include/ChangeLog +index 43e06f7..ef698f6 100644 +--- a/include/ChangeLog ++++ b/include/ChangeLog +@@ -1,3 +1,14 @@ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2014-12-23 Alan Modra ++ * bfdlink.h (struct bfd_link_hash_entry): Comment non_ir_ref. Add ++ linker_def. ++ ++ 2014-11-24 Mark Wielaard ++ * dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and ++ DW_LANG_C_plus_plus_14. ++ + 2014-11-18 Igor Zamyatin + + * bfdlink.h (struct bfd_link_info): Add bndplt. +diff --git a/include/bfdlink.h b/include/bfdlink.h +index f3181ba..48c91da 100644 +--- a/include/bfdlink.h ++++ b/include/bfdlink.h +@@ -91,8 +91,14 @@ struct bfd_link_hash_entry + /* Type of this entry. */ + ENUM_BITFIELD (bfd_link_hash_type) type : 8; + ++ /* Symbol is referenced in a normal object file, as distict from a LTO ++ IR object file. */ + unsigned int non_ir_ref : 1; + ++ /* Symbol is a built-in define. These will be overridden by PROVIDE ++ in a linker script. */ ++ unsigned int linker_def : 1; ++ + /* A union of information depending upon the type. */ + union + { +diff --git a/include/dwarf2.h b/include/dwarf2.h +index 120e2c1..ca440dd 100644 +--- a/include/dwarf2.h ++++ b/include/dwarf2.h +@@ -309,6 +309,10 @@ enum dwarf_source_language + /* DWARF 5. */ + DW_LANG_Go = 0x0016, + ++ DW_LANG_C_plus_plus_11 = 0x001a, /* dwarf5.20141029.pdf DRAFT */ ++ DW_LANG_C11 = 0x001d, ++ DW_LANG_C_plus_plus_14 = 0x0021, ++ + DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */ + DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */ + +diff --git a/ld/ChangeLog b/ld/ChangeLog +index 3a6e3c3..1f34f5e 100644 +--- a/ld/ChangeLog ++++ b/ld/ChangeLog +@@ -1,3 +1,44 @@ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2015-01-20 Andrew Burgess ++ * ldlang.c (print_assignment): Only evaluate the expression for a ++ PROVIDE'd assignment when the destination is being defined. ++ Display a special message for PROVIDE'd symbols that are not being ++ provided. ++ ++ 2015-01-19 Alan Modra ++ PR 17165 ++ * ldlang.c (lang_process): Run lang_common before lang_gc_sections. ++ ++ 2014-12-24 Alan Modra ++ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude ++ shared libraries in loop looking for .eh_frame sections. ++ Similarly for build-id loop. ++ ++ 2014-12-23 Alan Modra ++ * ldexp.c (exp_fold_tree_1 ): Test linker_def. ++ ++ 2014-12-23 Alan Modra ++ * ldexp.c (exp_fold_tree_1 ): Leave bfd_link_hash_common ++ symbols alone. ++ ++ 2014-12-23 Alan Modra ++ * ldexp.c (update_definedness): Correct logic setting by_object. ++ ++ 2014-12-23 Alan Modra ++ * ldexp.c (struct definedness_hash_entry, definedness_table) ++ (definedness_newfunc, symbol_defined, update_definedness): Move ++ and rename from.. ++ * ldlang.h (struct lang_definedness_hash_entry): ..here,.. ++ * ldlang.c (lang_definedness_table, lang_definedness_newfunc) ++ (lang_symbol_defined, lang_update_definedness): ..and here. ++ * ldexp.c (ldexp_init, ldexp_finish): New functions, extracted from.. ++ * ldlang.c (lang_init, lang_finish): ..here. ++ * ldexp.h (ldexp_init, ldexp_finish): Declare. ++ * ldlang.h (lang_symbol_defined, lang_update_definedness): Delete. ++ * ldmain.c (main): Call ldexp_init and ldexp_finish. ++ + 2014-12-23 Tristan Gingold + + * configure: Regenerate. +diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em +index 137446f..36dee8e 100644 +--- a/ld/emultempl/elf32.em ++++ b/ld/emultempl/elf32.em +@@ -1015,7 +1015,8 @@ gld${EMULATION_NAME}_after_open (void) + /* Find an ELF input. */ + for (abfd = link_info.input_bfds; + abfd != (bfd *) NULL; abfd = abfd->link.next) +- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) ++ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour ++ && bfd_count_sections (abfd) != 0) + break; + + /* PR 10555: If there are no ELF input files do not try to +@@ -1053,6 +1054,8 @@ gld${EMULATION_NAME}_after_open (void) + + for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next) + { ++ if (bfd_count_sections (abfd) == 0) ++ continue; + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + elfbfd = abfd; + if (!warn_eh_frame) +diff --git a/ld/ldexp.c b/ld/ldexp.c +index 5c4f8dd..b4af893 100644 +--- a/ld/ldexp.c ++++ b/ld/ldexp.c +@@ -48,6 +48,19 @@ segment_type *segments; + + struct ldexp_control expld; + ++/* This structure records symbols for which we need to keep track of ++ definedness for use in the DEFINED () test. */ ++ ++struct definedness_hash_entry ++{ ++ struct bfd_hash_entry root; ++ unsigned int by_object : 1; ++ unsigned int by_script : 1; ++ unsigned int iteration : 1; ++}; ++ ++static struct bfd_hash_table definedness_table; ++ + /* Print the string representation of the given token. Surround it + with spaces if INFIX_P is TRUE. */ + +@@ -244,6 +257,64 @@ new_rel_from_abs (bfd_vma value) + expld.result.section = s; + } + ++/* New-function for the definedness hash table. */ ++ ++static struct bfd_hash_entry * ++definedness_newfunc (struct bfd_hash_entry *entry, ++ struct bfd_hash_table *table ATTRIBUTE_UNUSED, ++ const char *name ATTRIBUTE_UNUSED) ++{ ++ struct definedness_hash_entry *ret = (struct definedness_hash_entry *) entry; ++ ++ if (ret == NULL) ++ ret = (struct definedness_hash_entry *) ++ bfd_hash_allocate (table, sizeof (struct definedness_hash_entry)); ++ ++ if (ret == NULL) ++ einfo (_("%P%F: bfd_hash_allocate failed creating symbol %s\n"), name); ++ ++ ret->by_object = 0; ++ ret->by_script = 0; ++ ret->iteration = 0; ++ return &ret->root; ++} ++ ++/* Called during processing of linker script script expressions. ++ For symbols assigned in a linker script, return a struct describing ++ where the symbol is defined relative to the current expression, ++ otherwise return NULL. */ ++ ++static struct definedness_hash_entry * ++symbol_defined (const char *name) ++{ ++ return ((struct definedness_hash_entry *) ++ bfd_hash_lookup (&definedness_table, name, FALSE, FALSE)); ++} ++ ++/* Update the definedness state of NAME. */ ++ ++static void ++update_definedness (const char *name, struct bfd_link_hash_entry *h) ++{ ++ struct definedness_hash_entry *defentry ++ = (struct definedness_hash_entry *) ++ bfd_hash_lookup (&definedness_table, name, TRUE, FALSE); ++ ++ if (defentry == NULL) ++ einfo (_("%P%F: bfd_hash_lookup failed creating symbol %s\n"), name); ++ ++ /* If the symbol was already defined, and not by a script, then it ++ must be defined by an object file or by the linker target code. */ ++ if (!defentry->by_script ++ && (h->type == bfd_link_hash_defined ++ || h->type == bfd_link_hash_defweak ++ || h->type == bfd_link_hash_common)) ++ defentry->by_object = 1; ++ ++ defentry->by_script = 1; ++ defentry->iteration = lang_statement_iteration; ++} ++ + static void + fold_unary (etree_type *tree) + { +@@ -578,7 +649,7 @@ fold_name (etree_type *tree) + if (expld.phase != lang_first_phase_enum) + { + struct bfd_link_hash_entry *h; +- struct lang_definedness_hash_entry *def; ++ struct definedness_hash_entry *def; + + h = bfd_wrapped_link_hash_lookup (link_info.output_bfd, + &link_info, +@@ -588,7 +659,7 @@ fold_name (etree_type *tree) + && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak + || h->type == bfd_link_hash_common) +- && ((def = lang_symbol_defined (tree->name.name)) == NULL ++ && ((def = symbol_defined (tree->name.name)) == NULL + || def->by_object + || def->iteration == (lang_statement_iteration & 1))); + } +@@ -601,7 +672,7 @@ fold_name (etree_type *tree) + /* Self-assignment is only allowed for absolute symbols + defined in a linker script. */ + struct bfd_link_hash_entry *h; +- struct lang_definedness_hash_entry *def; ++ struct definedness_hash_entry *def; + + h = bfd_wrapped_link_hash_lookup (link_info.output_bfd, + &link_info, +@@ -611,7 +682,7 @@ fold_name (etree_type *tree) + && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak) + && h->u.def.section == bfd_abs_section_ptr +- && (def = lang_symbol_defined (tree->name.name)) != NULL ++ && (def = symbol_defined (tree->name.name)) != NULL + && def->iteration == (lang_statement_iteration & 1))) + expld.assign_name = NULL; + } +@@ -817,11 +888,11 @@ static bfd_boolean + is_sym_value (const etree_type *tree, bfd_vma val) + { + struct bfd_link_hash_entry *h; +- struct lang_definedness_hash_entry *def; ++ struct definedness_hash_entry *def; + + return (tree->type.node_class == etree_name + && tree->type.node_code == NAME +- && (def = lang_symbol_defined (tree->name.name)) != NULL ++ && (def = symbol_defined (tree->name.name)) != NULL + && def->by_script + && def->iteration == (lang_statement_iteration & 1) + && (h = bfd_wrapped_link_hash_lookup (link_info.output_bfd, +@@ -999,15 +1070,13 @@ exp_fold_tree_1 (etree_type *tree) + h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst, + FALSE, FALSE, TRUE); + if (h == NULL +- || (h->type != bfd_link_hash_new +- && h->type != bfd_link_hash_undefined +- && h->type != bfd_link_hash_common +- && !(h->type == bfd_link_hash_defined +- && (h->u.def.section->flags +- & SEC_LINKER_CREATED) != 0))) ++ || !(h->type == bfd_link_hash_new ++ || h->type == bfd_link_hash_undefined ++ || h->linker_def)) + { +- /* Do nothing. The symbol was never referenced, or was +- defined by some object. */ ++ /* Do nothing. The symbol was never referenced, or ++ was defined in some object file. Undefined weak ++ symbols stay undefined. */ + break; + } + } +@@ -1041,7 +1110,7 @@ exp_fold_tree_1 (etree_type *tree) + + /* FIXME: Should we worry if the symbol is already + defined? */ +- lang_update_definedness (tree->assign.dst, h); ++ update_definedness (tree->assign.dst, h); + h->type = bfd_link_hash_defined; + h->u.def.value = expld.result.value; + if (expld.result.section == NULL) +@@ -1470,3 +1539,21 @@ align_n (bfd_vma value, bfd_vma align) + value = (value + align - 1) / align; + return value * align; + } ++ ++void ++ldexp_init (void) ++{ ++ /* The value "13" is ad-hoc, somewhat related to the expected number of ++ assignments in a linker script. */ ++ if (!bfd_hash_table_init_n (&definedness_table, ++ definedness_newfunc, ++ sizeof (struct definedness_hash_entry), ++ 13)) ++ einfo (_("%P%F: can not create hash table: %E\n")); ++} ++ ++void ++ldexp_finish (void) ++{ ++ bfd_hash_table_free (&definedness_table); ++} +diff --git a/ld/ldexp.h b/ld/ldexp.h +index 6a02b39..fa0dada 100644 +--- a/ld/ldexp.h ++++ b/ld/ldexp.h +@@ -221,5 +221,7 @@ fill_type *exp_get_fill + (etree_type *, fill_type *, char *); + bfd_vma exp_get_abs_int + (etree_type *, int, char *); ++void ldexp_init (void); ++void ldexp_finish (void); + + #endif +diff --git a/ld/ldlang.c b/ld/ldlang.c +index c4da07f..2433acf 100644 +--- a/ld/ldlang.c ++++ b/ld/ldlang.c +@@ -64,7 +64,6 @@ static bfd_vma print_dot; + static lang_input_statement_type *first_file; + static const char *current_target; + static lang_statement_list_type statement_list; +-static struct bfd_hash_table lang_definedness_table; + static lang_statement_list_type *stat_save[10]; + static lang_statement_list_type **stat_save_ptr = &stat_save[0]; + static struct unique_sections *unique_section_list; +@@ -73,8 +72,6 @@ static struct asneeded_minfo *asneeded_list_head; + /* Forward declarations. */ + static void exp_init_os (etree_type *); + static lang_input_statement_type *lookup_name (const char *); +-static struct bfd_hash_entry *lang_definedness_newfunc +- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); + static void insert_undefined (const char *); + static bfd_boolean sort_def_symbol (struct bfd_link_hash_entry *, void *); + static void print_statement (lang_statement_union_type *, +@@ -1241,14 +1238,6 @@ lang_init (void) + + abs_output_section->bfd_section = bfd_abs_section_ptr; + +- /* The value "13" is ad-hoc, somewhat related to the expected number of +- assignments in a linker script. */ +- if (!bfd_hash_table_init_n (&lang_definedness_table, +- lang_definedness_newfunc, +- sizeof (struct lang_definedness_hash_entry), +- 13)) +- einfo (_("%P%F: can not create hash table: %E\n")); +- + asneeded_list_head = NULL; + asneeded_list_tail = &asneeded_list_head; + } +@@ -1256,7 +1245,6 @@ lang_init (void) + void + lang_finish (void) + { +- bfd_hash_table_free (&lang_definedness_table); + output_section_statement_table_free (); + } + +@@ -3365,65 +3353,6 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode) + einfo ("%F"); + } + +-/* New-function for the definedness hash table. */ +- +-static struct bfd_hash_entry * +-lang_definedness_newfunc (struct bfd_hash_entry *entry, +- struct bfd_hash_table *table ATTRIBUTE_UNUSED, +- const char *name ATTRIBUTE_UNUSED) +-{ +- struct lang_definedness_hash_entry *ret +- = (struct lang_definedness_hash_entry *) entry; +- +- if (ret == NULL) +- ret = (struct lang_definedness_hash_entry *) +- bfd_hash_allocate (table, sizeof (struct lang_definedness_hash_entry)); +- +- if (ret == NULL) +- einfo (_("%P%F: bfd_hash_allocate failed creating symbol %s\n"), name); +- +- ret->by_object = 0; +- ret->by_script = 0; +- ret->iteration = 0; +- return &ret->root; +-} +- +-/* Called during processing of linker script script expressions. +- For symbols assigned in a linker script, return a struct describing +- where the symbol is defined relative to the current expression, +- otherwise return NULL. */ +- +-struct lang_definedness_hash_entry * +-lang_symbol_defined (const char *name) +-{ +- return ((struct lang_definedness_hash_entry *) +- bfd_hash_lookup (&lang_definedness_table, name, FALSE, FALSE)); +-} +- +-/* Update the definedness state of NAME. */ +- +-void +-lang_update_definedness (const char *name, struct bfd_link_hash_entry *h) +-{ +- struct lang_definedness_hash_entry *defentry +- = (struct lang_definedness_hash_entry *) +- bfd_hash_lookup (&lang_definedness_table, name, TRUE, FALSE); +- +- if (defentry == NULL) +- einfo (_("%P%F: bfd_hash_lookup failed creating symbol %s\n"), name); +- +- /* If the symbol was already defined, and not by a script, then it +- must be defined by an object file. */ +- if (!defentry->by_script +- && h->type != bfd_link_hash_undefined +- && h->type != bfd_link_hash_common +- && h->type != bfd_link_hash_new) +- defentry->by_object = 1; +- +- defentry->by_script = 1; +- defentry->iteration = lang_statement_iteration; +-} +- + /* Add the supplied name to the symbol table as an undefined reference. + This is a two step process as the symbol table doesn't even exist at + the time the ld command line is processed. First we put the name +@@ -4054,7 +3983,12 @@ print_assignment (lang_assignment_statement_type *assignment, + osec = output_section->bfd_section; + if (osec == NULL) + osec = bfd_abs_section_ptr; +- exp_fold_tree (tree, osec, &print_dot); ++ ++ if (assignment->exp->type.node_class != etree_provide) ++ exp_fold_tree (tree, osec, &print_dot); ++ else ++ expld.result.valid_p = FALSE; ++ + if (expld.result.valid_p) + { + bfd_vma value; +@@ -4092,7 +4026,10 @@ print_assignment (lang_assignment_statement_type *assignment, + } + else + { +- minfo ("*undef* "); ++ if (assignment->exp->type.node_class == etree_provide) ++ minfo ("[!provide]"); ++ else ++ minfo ("*undef* "); + #ifdef BFD64 + minfo (" "); + #endif +@@ -6772,12 +6709,12 @@ lang_process (void) + lang_do_assignments (lang_mark_phase_enum); + expld.phase = lang_first_phase_enum; + +- /* Remove unreferenced sections if asked to. */ +- lang_gc_sections (); +- + /* Size up the common data. */ + lang_common (); + ++ /* Remove unreferenced sections if asked to. */ ++ lang_gc_sections (); ++ + /* Update wild statements. */ + update_wild_statements (statement_list.head); + +diff --git a/ld/ldlang.h b/ld/ldlang.h +index 5f6faae..87409cf 100644 +--- a/ld/ldlang.h ++++ b/ld/ldlang.h +@@ -470,17 +470,6 @@ struct unique_sections + const char *name; + }; + +-/* This structure records symbols for which we need to keep track of +- definedness for use in the DEFINED () test. */ +- +-struct lang_definedness_hash_entry +-{ +- struct bfd_hash_entry root; +- unsigned int by_object : 1; +- unsigned int by_script : 1; +- unsigned int iteration : 1; +-}; +- + /* Used by place_orphan to keep track of orphan sections and statements. */ + + struct orphan_save +@@ -683,10 +672,6 @@ extern void lang_add_unique + (const char *); + extern const char *lang_get_output_target + (void); +-extern struct lang_definedness_hash_entry *lang_symbol_defined (const char *); +-extern void lang_update_definedness +- (const char *, struct bfd_link_hash_entry *); +- + extern void add_excluded_libs (const char *); + extern bfd_boolean load_symbols + (lang_input_statement_type *, lang_statement_list_type *); +diff --git a/ld/ldmain.c b/ld/ldmain.c +index bc24957..818d108 100644 +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -297,6 +297,7 @@ main (int argc, char **argv) + config.maxpagesize = bfd_emul_get_maxpagesize (default_target); + config.commonpagesize = bfd_emul_get_commonpagesize (default_target); + lang_init (); ++ ldexp_init (); + ldemul_before_parse (); + lang_has_input_file = FALSE; + parse_args (argc, argv); +@@ -440,6 +441,7 @@ main (int argc, char **argv) + fprintf (stderr, "lookup = %p val %lx\n", h, h ? h->u.def.value : 1); + } + #endif ++ ldexp_finish (); + lang_finish (); + + /* Even if we're producing relocatable output, some non-fatal errors should +diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog +index f0344fd..7291a52 100644 +--- a/ld/testsuite/ChangeLog ++++ b/ld/testsuite/ChangeLog +@@ -1,3 +1,169 @@ ++2015-06-17 Renlin Li ++ ++ Applied from master. ++ 2015-04-29 Renlin Li ++ ++ * ld-arm/ifunc-10.dd: Adjust the desired output. ++ * ld-arm/ifunc-2.dd: Likewise. ++ ++2015-05-05 Jiong Wang ++ ++ Apply from master: ++ ++ 2015-04-24 Jiong. Wang ++ ++ * ld-aarch64/pcrel.s: New testcase. ++ * ld-aarch64/pcrel_pic_defiend_local.d: New expect file. ++ * ld-aarch64/pcrel_pic_undefined.d: Ditto. ++ * ld-aarch64/aarch64-elf.exp: Run them. ++ ++2015-04-10 Alan Modra ++ ++ Revert 2015-03-06 H.J. Lu ++ PR ld/pr15228 ++ PR ld/pr17709 ++ * ld-i386/i386.exp (i386tests): Remove test for PR ld/17709. ++ * ld-i386/pr17709-nacl.rd: Delete. ++ * ld-i386/pr17709.rd: Likewise. ++ * ld-i386/pr17709a.s: Likewise. ++ * ld-i386/pr17709b.s: Likewise. ++ * ld-i386/protected3.d: Updated. ++ * ld-i386/protected3.s: Likewise. ++ * ld-x86-64/pr17709-nacl.rd: Delete. ++ * ld-x86-64/pr17709.rd: Likewise. ++ * ld-x86-64/pr17709a.s: Likewise. ++ * ld-x86-64/pr17709b.s: Likewise. ++ * ld-x86-64/protected3.d: Updated. ++ * ld-x86-64/protected3.s: Likewise. ++ * ld-x86-64/x86-64.exp (x86_64tests): Remove test for PR ld/17709. ++ ++2015-03-26 Tejas Belagod ++ ++ * ld-aarch64/farcall-back-be.d: New. ++ ++2015-03-18 Alan Modra ++ ++ Apply from master ++ 2015-03-11 Alan Modra ++ * ld-powerpc/tls32.s: Add GOT pointer setup. ++ * ld-powerpc/tls32.d: Update. ++ * ld-powerpc/tls32.g: Update. ++ * ld-powerpc/tls32.t: Update. ++ * ld-powerpc/tlsexe.d: Update. ++ * ld-powerpc/tlsexe32.d: Update. ++ * ld-powerpc/tlsexe32.g: Update. ++ * ld-powerpc/tlsexe32.r: Update. ++ * ld-powerpc/tlsexetoc.d: Update. ++ * ld-powerpc/tlsso32.d: Update. ++ * ld-powerpc/tlsso32.g: Update. ++ * ld-powerpc/tlsso32.r: Update. ++ ++2015-03-06 H.J. Lu ++ ++ Backport from master ++ 2015-03-05 H.J. Lu ++ ++ PR ld/pr15228 ++ PR ld/pr17709 ++ * ld-i386/i386.exp (i386tests): Add a test for PR ld/17709. ++ * ld-i386/pr17709-nacl.rd: New file. ++ * ld-i386/pr17709.rd: Likewise. ++ * ld-i386/pr17709a.s: Likewise. ++ * ld-i386/pr17709b.s: Likewise. ++ * ld-i386/protected3.d: Updated. ++ * ld-i386/protected3.s: Likewise. ++ * ld-x86-64/pr17709-nacl.rd: New file. ++ * ld-x86-64/pr17709.rd: Likewise. ++ * ld-x86-64/pr17709a.s: Likewise. ++ * ld-x86-64/pr17709b.s: Likewise. ++ * ld-x86-64/protected3.d: Updated. ++ * ld-x86-64/protected3.s: Likewise. ++ * ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709. ++ ++2015-02-11 Alan Modra ++ ++ Apply from master. ++ 2015-01-29 Alan Modra ++ * ld-powerpc/tlsld.d, * ld-powerpc/tlsld.s: New test. ++ * ld-powerpc/tlsld32.d, * ld-powerpc/tlsld32.s: New test. ++ * ld-powerpc/powerpc.exp: Run them. ++ ++ 2015-01-20 Andrew Burgess ++ * ld-scripts/provide-4-map.d: Update expected output. ++ * ld-scripts/provide-5-map.d: Likewise. ++ ++ 2015-01-20 Andrew Burgess ++ * ld-scripts/provide-4.d: New file. ++ * ld-scripts/provide-4-map.d: New file. ++ * ld-scripts/provide-4.t: New file. ++ * ld-scripts/provide-5.d: New file. ++ * ld-scripts/provide-5.s: New file. ++ * ld-scripts/provide-5-map.d: New file. ++ * ld-scripts/provide-5.t: New file. ++ * ld-scripts/provide.exp: Run the provide-4.d and provide-5.d ++ tests. ++ ++ 2015-01-20 Andrew Burgess ++ * ld-scripts/overlay-size.d: Add 'map' option. ++ * ld-scripts/overlay-size.exp: Remove manual check of mapfile. ++ * lib/ld-lib.exp (run_dump_test): Add support for new 'map' ++ option, checking linker mapfile output. ++ ++ 2015-01-19 Alan Modra ++ * ld-gc/pr14265.d, ++ * ld-cris/tls-gc-68.d, ++ * ld-cris/tls-gc-69.d, ++ * ld-cris/tls-gc-70.d, ++ * ld-cris/tls-gc-71.d, ++ * ld-cris/tls-gc-75.d, ++ * ld-cris/tls-gc-76.d, ++ * ld-cris/tls-gc-79.d, ++ * ld-mmix/bpo-10.d, ++ * ld-mmix/bpo-11.d: Update. ++ ++ 2014-12-23 Alan Modra ++ * ld-powerpc/sdabase.s, ++ * ld-powerpc/sdabase.t, ++ * ld-powerpc/sdabase.d: New test. ++ * ld-powerpc/sdabase2.t, ++ * ld-powerpc/sdabase2.d: New test. ++ * ld-powerpc/powerpc.exp: Run them. ++ ++ 2014-12-23 Alan Modra ++ * ld-elf/endsym.s, *ld-elf/endsym.d: New test. ++ ++ 2014-12-04 Alan Modra ++ * ld-powerpc/vxworks-relax.rd: Update for reloc sorting. ++ * ld-powerpc/vxworks-relax-2.rd: Likewise. ++ * ld-sh/sh64/reldl32.rd: Likewise. ++ * ld-sh/sh64/reldl64.rd: Likewise. ++ ++2015-01-22 Thomas Preud'homme ++ ++ Backport from mainline ++ 2015-01-13 Thomas Preud'homme ++ ++ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND ++ to check if a symbol should be bound symbolically. ++ ++2015-01-11 H.J. Lu ++ ++ PR ld/17827 ++ * ld-x86-64/pr17689.out: Updated. ++ * ld-x86-64/pr17689b.S: Likewise. ++ ++ * ld-x86-64/pr17827.rd: New file. ++ ++ * ld-x86-64/x86-64.exp: Run PR ld/17827 test. ++ ++2015-01-05 H.J. Lu ++ ++ PR ld/17773 ++ * ld-elf/binutils.exp (binutils_test): Add an optional ++ readelf_options. Replace -l with $readelf_options. Add a ++ gap test. ++ * ld/testsuite/ld-elf/gap.s: New file. ++ + 2014-12-19 Matthew Fortune + + * ld-mips-elf/attr-gnu-4-00.d: Relax check for ISA extension. +diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp +index a75e070..7a24e52 100644 +--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp ++++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp +@@ -104,6 +104,10 @@ run_dump_test "emit-relocs-local-addend" + # test addend correctness when -r specified. + run_dump_test "local-addend-r" + ++# test error handling on pcrel relocation for shared libraries. ++run_dump_test "pcrel_pic_undefined" ++run_dump_test "pcrel_pic_defined_local" ++ + run_dump_test "limit-b" + run_dump_test "limit-bl" + run_dump_test "farcall-section" +@@ -175,6 +179,7 @@ run_dump_test "ifunc-21" + run_dump_test "ifunc-22" + + run_dump_test "relasz" ++run_dump_test "relocs-257-symbolic-func" + + set aarch64elflinktests { + {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s} +diff --git a/ld/testsuite/ld-aarch64/farcall-back-be.d b/ld/testsuite/ld-aarch64/farcall-back-be.d +new file mode 100644 +index 0000000..80992aa +--- /dev/null ++++ b/ld/testsuite/ld-aarch64/farcall-back-be.d +@@ -0,0 +1,74 @@ ++#name: aarch64-farcall-back-be ++#source: farcall-back.s ++#as: ++#ld: -Ttext 0x1000 --section-start .foo=0x100000000 ++#objdump: -dr ++#target: aarch64_be-*-* ++#... ++ ++Disassembly of section .text: ++ ++0000000000001000 <_start>: ++ 1000: 14000413 b 204c <__bar1_veneer> ++ 1004: 94000412 bl 204c <__bar1_veneer> ++ 1008: 14000407 b 2024 <__bar2_veneer> ++ 100c: 94000406 bl 2024 <__bar2_veneer> ++ 1010: 14000409 b 2034 <__bar3_veneer> ++ 1014: 94000408 bl 2034 <__bar3_veneer> ++ 1018: d65f03c0 ret ++ ... ++ ++000000000000201c <_back>: ++ 201c: d65f03c0 ret ++ ++[ \t]+2020:[ \t]+14000013[ \t]+b[ \t]+206c <__bar1_veneer\+0x20> ++0000000000002024 <__bar2_veneer>: ++ 2024: f07ffff0 adrp x16, 100001000 ++ 2028: 91002210 add x16, x16, #0x8 ++ 202c: d61f0200 br x16 ++ 2030: 00000000 .inst 0x00000000 ; undefined ++ ++0000000000002034 <__bar3_veneer>: ++ 2034: 58000090 ldr x16, 2044 <__bar3_veneer\+0x10> ++ 2038: 10000011 adr x17, 2038 <__bar3_veneer\+0x4> ++ 203c: 8b110210 add x16, x16, x17 ++ 2040: d61f0200 br x16 ++ 2044: 00000000 .word 0x00000000 ++ 2048: ffffffd8 .word 0xffffffd8 ++ ++000000000000204c <__bar1_veneer>: ++ 204c: d07ffff0 adrp x16, 100000000 ++ 2050: 91000210 add x16, x16, #0x0 ++ 2054: d61f0200 br x16 ++ ... ++ ++Disassembly of section .foo: ++ ++0000000100000000 : ++ 100000000: d65f03c0 ret ++ 100000004: 14000806 b 10000201c <___start_veneer> ++ ... ++ ++0000000100001008 : ++ 100001008: d65f03c0 ret ++ 10000100c: 14000404 b 10000201c <___start_veneer> ++ ... ++ ++0000000100002010 : ++ 100002010: d65f03c0 ret ++ 100002014: 14000008 b 100002034 <___back_veneer> ++ ++[ \t]+100002018:[ \t]+1400000d[ \t]+b[ \t]+10000204c <___back_veneer\+0x18> ++000000010000201c <___start_veneer>: ++ 10000201c: 58000090 ldr x16, 10000202c <___start_veneer\+0x10> ++ 100002020: 10000011 adr x17, 100002020 <___start_veneer\+0x4> ++ 100002024: 8b110210 add x16, x16, x17 ++ 100002028: d61f0200 br x16 ++ 10000202c: fffffffe .word 0xfffffffe ++ 100002030: ffffefe0 .word 0xffffefe0 ++ ++0000000100002034 <___back_veneer>: ++ 100002034: 90800010 adrp x16, 2000 <_start\+0x1000> ++ 100002038: 91007210 add x16, x16, #0x1c ++ 10000203c: d61f0200 br x16 ++ ... +diff --git a/ld/testsuite/ld-aarch64/pcrel.s b/ld/testsuite/ld-aarch64/pcrel.s +new file mode 100644 +index 0000000..df542ef +--- /dev/null ++++ b/ld/testsuite/ld-aarch64/pcrel.s +@@ -0,0 +1,20 @@ ++ .text ++ .align 2 ++main: ++ # R_AARCH64_ADR_PREL_PG_HI21 ++ # R_AARCH64_ADR_PREL_PG_HI21_NC ++ # R_AARCH64_ADR_LO_21 ++ adrp x0, :pg_hi21:global_a ++ adrp x1, :pg_hi21_nc:global_a ++ adr x2, global_a ++ ++ #R_AARCH64_LD_PREL_LO19 ++ ldr x3, global_a ++ ++ # R_AARCH64_PREL16 ++ # R_AARCH64_PREL32 ++ # R_AARCH64_PREL64 ++ .hword global_a - . ++ .word global_a - . ++ .xword global_a - . ++ +diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d b/ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d +new file mode 100644 +index 0000000..832652f +--- /dev/null ++++ b/ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d +@@ -0,0 +1,5 @@ ++#name: PC-Rel relocation against defined ++#source: pcrel.s ++#objdump: -r ++#ld: -shared -e0 -defsym global_a=0x1000 ++#... +diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d b/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d +new file mode 100644 +index 0000000..de7f020 +--- /dev/null ++++ b/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d +@@ -0,0 +1,10 @@ ++#name: PC-Rel relocation against undefined ++#source: pcrel.s ++#ld: -shared -e0 ++#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol.*fPIC.* ++#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21_NC against external symbol.*fPIC.* ++#warning: .*: relocation R_AARCH64_ADR_PREL_LO21 against external symbol.*fPIC.* ++#warning: .*: relocation R_AARCH64_LD_PREL_LO19 against external symbol.*fPIC.* ++#warning: .*: relocation R_AARCH64_PREL16 against external symbol.*fPIC.* ++#warning: .*: relocation R_AARCH64_PREL32 against external symbol.*fPIC.* ++#warning: .*: relocation R_AARCH64_PREL64 against external symbol.*fPIC.* +diff --git a/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d +new file mode 100644 +index 0000000..810fd43 +--- /dev/null ++++ b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d +@@ -0,0 +1,5 @@ ++#source: relocs-257-symbolic-func.s ++#ld: -shared -Bsymbolic-functions ++#readelf: -r --wide ++#... ++.* +R_AARCH64_RELATIVE +.* +diff --git a/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s +new file mode 100644 +index 0000000..35d5ba8 +--- /dev/null ++++ b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s +@@ -0,0 +1,11 @@ ++ .text ++ .global tempy ++ .type tempy, %function ++tempy: ++ .size tempy, .-tempy ++ .section .data.rel ++ .align 3 ++ .type tempy_ptr, %object ++ .size tempy_ptr, 8 ++tempy_ptr: ++ .xword tempy +diff --git a/ld/testsuite/ld-arm/ifunc-10.dd b/ld/testsuite/ld-arm/ifunc-10.dd +index 88bae50..d96c086 100644 +--- a/ld/testsuite/ld-arm/ifunc-10.dd ++++ b/ld/testsuite/ld-arm/ifunc-10.dd +@@ -267,7 +267,7 @@ Disassembly of section \.text: + + 0000a010 : + a010: 46f7 mov pc, lr +- a012: 0000 movs r0, r0 ++ a012: 0000 .short 0x0000 + a014: e1a0f00e mov pc, lr + a018: e1a0f00e mov pc, lr + a01c: e1a0f00e mov pc, lr +diff --git a/ld/testsuite/ld-arm/ifunc-2.dd b/ld/testsuite/ld-arm/ifunc-2.dd +index f6d57fa..91eab54 100644 +--- a/ld/testsuite/ld-arm/ifunc-2.dd ++++ b/ld/testsuite/ld-arm/ifunc-2.dd +@@ -84,10 +84,10 @@ Disassembly of section \.text: + + 0000a00c : + a00c: 46f7 mov pc, lr +- a00e: 0000 movs r0, r0 ++ a00e: 0000 .short 0x0000 + a010: e1a0f00e mov pc, lr + a014: 46f7 mov pc, lr +- a016: 0000 movs r0, r0 ++ a016: 0000 .short 0x0000 + a018: e1a0f00e mov pc, lr + a01c: 46f7 mov pc, lr + \.\.\. +diff --git a/ld/testsuite/ld-cris/tls-gc-68.d b/ld/testsuite/ld-cris/tls-gc-68.d +index 6d3121b..b7fc374 100644 +--- a/ld/testsuite/ld-cris/tls-gc-68.d ++++ b/ld/testsuite/ld-cris/tls-gc-68.d +@@ -21,11 +21,11 @@ private flags = 0: + SYMBOL TABLE: + 0+80074 l d \.text 0+ \.text + 0+82078 l d \.got 0+ \.got +-0+82084 l \.got 0+ __bss_start +-0+82084 l \.got 0+ _edata + 0+82078 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +-0+820a0 l \.got 0+ _end + 0+80074 g \.text 0+ _start ++0+82084 g \.got 0+ __bss_start ++0+82084 g \.got 0+ _edata ++0+820a0 g \.got 0+ _end + + Contents of section \.text: + 80074 41b20+ .* +diff --git a/ld/testsuite/ld-cris/tls-gc-69.d b/ld/testsuite/ld-cris/tls-gc-69.d +index 482088c..c4c51b7 100644 +--- a/ld/testsuite/ld-cris/tls-gc-69.d ++++ b/ld/testsuite/ld-cris/tls-gc-69.d +@@ -22,11 +22,11 @@ private flags = 0: + SYMBOL TABLE: + 0+80074 l d \.text 0+ \.text + 0+82078 l d \.got 0+ \.got +-0+82084 l \.got 0+ __bss_start +-0+82084 l \.got 0+ _edata + 0+82078 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +-0+820a0 l \.got 0+ _end + 0+80074 g \.text 0+ _start ++0+82084 g \.got 0+ __bss_start ++0+82084 g \.got 0+ _edata ++0+820a0 g \.got 0+ _end + + Contents of section .text: + 80074 41b20+ .* +diff --git a/ld/testsuite/ld-cris/tls-gc-70.d b/ld/testsuite/ld-cris/tls-gc-70.d +index 83b4c0b..6ab8f24 100644 +--- a/ld/testsuite/ld-cris/tls-gc-70.d ++++ b/ld/testsuite/ld-cris/tls-gc-70.d +@@ -22,11 +22,11 @@ private flags = 0: + SYMBOL TABLE: + 0+80074 l d \.text 0+ \.text + 0+82078 l d \.got 0+ \.got +-0+82084 l \.got 0+ __bss_start +-0+82084 l \.got 0+ _edata + 0+82078 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +-0+820a0 l \.got 0+ _end + 0+80074 g \.text 0+ _start ++0+82084 g \.got 0+ __bss_start ++0+82084 g \.got 0+ _edata ++0+820a0 g \.got 0+ _end + + Contents of section \.text: + 80074 41b20+ .* +diff --git a/ld/testsuite/ld-cris/tls-gc-71.d b/ld/testsuite/ld-cris/tls-gc-71.d +index b580fd3..9d87500 100644 +--- a/ld/testsuite/ld-cris/tls-gc-71.d ++++ b/ld/testsuite/ld-cris/tls-gc-71.d +@@ -17,11 +17,11 @@ + DYNAMIC SYMBOL TABLE: + 0+18e l d \.text 0+ \.text + 0+2194 l d \.tdata 0+ \.tdata +-0+2280 l D \.got 0+ __bss_start +-0+2280 l D \.got 0+ _edata +-0+2280 l D \.got 0+ _end + 0+18e g DF \.text 0+2 _init ++0+2280 g D \.got 0+ __bss_start + 0+ g D .tdata 0+80 tls128 ++0+2280 g D \.got 0+ _edata ++0+2280 g D \.got 0+ _end + + DYNAMIC RELOCATION RECORDS \(none\) + #... +diff --git a/ld/testsuite/ld-cris/tls-gc-75.d b/ld/testsuite/ld-cris/tls-gc-75.d +index 472f889..c2d5df4 100644 +--- a/ld/testsuite/ld-cris/tls-gc-75.d ++++ b/ld/testsuite/ld-cris/tls-gc-75.d +@@ -24,11 +24,11 @@ private flags = 0: + SYMBOL TABLE: + 0+80074 l d \.text 0+ \.text + 0+82078 l d \.got 0+ \.got +-0+82084 l \.got 0+ __bss_start +-0+82084 l \.got 0+ _edata + 0+82078 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +-0+820a0 l \.got 0+ _end + 0+80074 g \.text 0+ _start ++0+82084 g \.got 0+ __bss_start ++0+82084 g \.got 0+ _edata ++0+820a0 g \.got 0+ _end + + Contents of section \.text: + 80074 41b20+ .* +diff --git a/ld/testsuite/ld-cris/tls-gc-76.d b/ld/testsuite/ld-cris/tls-gc-76.d +index 97edbef..2bcf25c 100644 +--- a/ld/testsuite/ld-cris/tls-gc-76.d ++++ b/ld/testsuite/ld-cris/tls-gc-76.d +@@ -25,11 +25,11 @@ SYMBOL TABLE: + 0+ l df \*ABS\* 0+ .* + 0+82090 l O \.data 0+4 gc76var + 0+ l df \*ABS\* 0+ .* +-0+82094 l \.data 0+ __bss_start +-0+82094 l \.data 0+ _edata + 0+82080 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +-0+820a0 l \.data 0+ _end + 0+80074 g \.text 0+ _start ++0+82094 g \.data 0+ __bss_start ++0+82094 g \.data 0+ _edata ++0+820a0 g \.data 0+ _end + 0+80078 g F \.text 0+6 gc76fn + + Contents of section \.text: +diff --git a/ld/testsuite/ld-cris/tls-gc-79.d b/ld/testsuite/ld-cris/tls-gc-79.d +index 424bfb0..f4916d3 100644 +--- a/ld/testsuite/ld-cris/tls-gc-79.d ++++ b/ld/testsuite/ld-cris/tls-gc-79.d +@@ -22,11 +22,11 @@ private flags = 0: + SYMBOL TABLE: + 0+80074 l d \.text 0+ \.text + 0+82078 l d \.got 0+ \.got +-0+82084 l \.got 0+ __bss_start +-0+82084 l \.got 0+ _edata + 0+82078 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +-0+820a0 l \.got 0+ _end + 0+80074 g \.text 0+ _start ++0+82084 g \.got 0+ __bss_start ++0+82084 g \.got 0+ _edata ++0+820a0 g \.got 0+ _end + + Contents of section \.text: + 80074 41b20+ .* +diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp +index 4ade8cb..37ab6b3 100644 +--- a/ld/testsuite/ld-elf/binutils.exp ++++ b/ld/testsuite/ld-elf/binutils.exp +@@ -38,8 +38,9 @@ if { [istarget *-*-linux*aout*] + # to hardwire the test name. This is important if ld_options contains + # absolute path names because the default test name is constructed + # from the prog_name and ld_options and we do not want absolute paths +-# to appear in the test_name. +-proc binutils_test { prog_name ld_options test {test_name ""}} { ++# to appear in the test_name. The optional readelf_options can be ++# used to specify different options for readelf. ++proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "-l"}} { + global as + global ld + global READELF +@@ -71,8 +72,8 @@ proc binutils_test { prog_name ld_options test {test_name ""}} { + return + } + +- send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n" +- set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"] ++ send_log "$READELF $readelf_options --wide tmpdir/$test > tmpdir/$test.exp\n" ++ set got [remote_exec host "$READELF $readelf_options --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"] + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + send_log "$got\n" + unresolved "$test_name" +@@ -111,8 +112,8 @@ proc binutils_test { prog_name ld_options test {test_name ""}} { + return + } + +- send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n" +- set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"] ++ send_log "$READELF $readelf_options --wide tmpdir/$test > tmpdir/$test.out\n" ++ set got [remote_exec host "$READELF $readelf_options --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"] + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + send_log "$got\n" + unresolved "$test_name" +@@ -176,3 +177,5 @@ foreach testitem $tls_tests { + binutils_test objcopy $testopt $testitem + } + } ++ ++binutils_test strip "-s" gap "" "-lS" +diff --git a/ld/testsuite/ld-elf/endsym.d b/ld/testsuite/ld-elf/endsym.d +new file mode 100644 +index 0000000..912d3de +--- /dev/null ++++ b/ld/testsuite/ld-elf/endsym.d +@@ -0,0 +1,13 @@ ++#source: start.s ++#source: endsym.s ++#ld: --sort-common ++#nm: -n ++#notarget: hppa*-*-hpux* ++ ++#... ++.* end ++#... ++.* end2 ++#... ++.* _?_end ++#pass +diff --git a/ld/testsuite/ld-elf/endsym.s b/ld/testsuite/ld-elf/endsym.s +new file mode 100644 +index 0000000..5255c04 +--- /dev/null ++++ b/ld/testsuite/ld-elf/endsym.s +@@ -0,0 +1,2 @@ ++ .comm end,4,4 ++ .comm end2,2,2 +diff --git a/ld/testsuite/ld-elf/gap.s b/ld/testsuite/ld-elf/gap.s +new file mode 100644 +index 0000000..039d26b +--- /dev/null ++++ b/ld/testsuite/ld-elf/gap.s +@@ -0,0 +1,4 @@ ++ .text ++ .global _start ++_start: ++ .long 0 +diff --git a/ld/testsuite/ld-gc/pr14265.d b/ld/testsuite/ld-gc/pr14265.d +index 04af982..f78297b 100644 +--- a/ld/testsuite/ld-gc/pr14265.d ++++ b/ld/testsuite/ld-gc/pr14265.d +@@ -4,10 +4,10 @@ + #nm: --format=bsd --numeric-sort + + #... +-[0-9a-f]+[ ]d[ ]_*foo1_start ++[0-9a-f]+[ ][dD][ ]_*foo1_start + [0-9a-f]+[ ]D[ ]_*foo1 +-[0-9a-f]+[ ]d[ ]_*foo1_end +-[0-9a-f]+[ ]d[ ]_*foo2_start ++[0-9a-f]+[ ][dD][ ]_*foo1_end ++[0-9a-f]+[ ][dD][ ]_*foo2_start + [0-9a-f]+[ ]D[ ]_*foo2 +-[0-9a-f]+[ ]d[ ]_*foo2_end ++[0-9a-f]+[ ][dD][ ]_*foo2_end + #... +diff --git a/ld/testsuite/ld-mmix/bpo-10.d b/ld/testsuite/ld-mmix/bpo-10.d +index 1bc6269..1cb7d61 100644 +--- a/ld/testsuite/ld-mmix/bpo-10.d ++++ b/ld/testsuite/ld-mmix/bpo-10.d +@@ -15,10 +15,10 @@ SYMBOL TABLE: + 0+ l df \*ABS\* 0+ .* + 0+ l \.init 0+ _start + 0+ l df \*ABS\* 0+ .* +-2000000000000000 l \.init 0+ __bss_start +-2000000000000000 l \.init 0+ _edata +-2000000000000000 l \.init 0+ _end + 0+4 l \.init 0+ _start\. ++2000000000000000 g \.init 0+ __bss_start ++2000000000000000 g \.init 0+ _edata ++2000000000000000 g \.init 0+ _end + + Contents of section \.init: + 0000 e37704a6 .* +diff --git a/ld/testsuite/ld-mmix/bpo-11.d b/ld/testsuite/ld-mmix/bpo-11.d +index 7f47450..9b38be8 100644 +--- a/ld/testsuite/ld-mmix/bpo-11.d ++++ b/ld/testsuite/ld-mmix/bpo-11.d +@@ -17,12 +17,12 @@ SYMBOL TABLE: + 0+ l df \*ABS\* 0+ .* + 0+ l \.init 0+ _start + 0+ l df \*ABS\* 0+ .* +-2000000000000000 l \.text 0+ __bss_start +-2000000000000000 l \.text 0+ _edata +-2000000000000000 l \.text 0+ _end + 0+10 l \.text 0+ _start\. + 0+14 g \.text 0+ x + 0+10 g \.text 0+ x2 ++2000000000000000 g \.text 0+ __bss_start ++2000000000000000 g \.text 0+ _edata ++2000000000000000 g \.text 0+ _end + + Contents of section \.init: + 0000 00000000 0000003d 00000000 0000003a .* +diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp +index 599b980..8fc261e 100644 +--- a/ld/testsuite/ld-powerpc/powerpc.exp ++++ b/ld/testsuite/ld-powerpc/powerpc.exp +@@ -282,13 +282,18 @@ if [ supports_ppc64 ] then { + run_dump_test "ambiguousv2" + run_dump_test "ambiguousv2b" + run_dump_test "defsym" ++ run_dump_test "tlsld" + } + ++run_dump_test "tlsld32" ++ + if { [istarget "powerpc*-eabi*"] } { + run_ld_link_tests $ppceabitests + } + + run_dump_test "plt1" ++run_dump_test "sdabase" ++run_dump_test "sdabase2" + + run_dump_test "attr-gnu-4-00" + run_dump_test "attr-gnu-4-01" +diff --git a/ld/testsuite/ld-powerpc/sdabase.d b/ld/testsuite/ld-powerpc/sdabase.d +new file mode 100644 +index 0000000..c54f750 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/sdabase.d +@@ -0,0 +1,10 @@ ++#source: sdabase.s ++#as: -a32 ++#ld: -melf32ppc -T sdabase.t ++#objdump: -s ++#target: powerpc*-*-* ++ ++.*: file format .* ++ ++Contents of section \.sdata: ++ 0400 (00008400|00840000) (00000400|00040000) .* +diff --git a/ld/testsuite/ld-powerpc/sdabase.s b/ld/testsuite/ld-powerpc/sdabase.s +new file mode 100644 +index 0000000..8c85688 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/sdabase.s +@@ -0,0 +1,9 @@ ++ .text ++ .globl _start ++_start: ++ ++ .section .sdata,"aw",@progbits ++ .globl my_sdata ++my_sdata: ++ .dc.a _SDA_BASE_ ++ .dc.a my_sdata +diff --git a/ld/testsuite/ld-powerpc/sdabase.t b/ld/testsuite/ld-powerpc/sdabase.t +new file mode 100644 +index 0000000..2486962 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/sdabase.t +@@ -0,0 +1,6 @@ ++SECTIONS ++{ ++ .text 0x100 : { *(.text) } ++ .sdata 0x400 : { *(.sdata) } ++ /DISCARD/ : { *(*) } ++} +diff --git a/ld/testsuite/ld-powerpc/sdabase2.d b/ld/testsuite/ld-powerpc/sdabase2.d +new file mode 100644 +index 0000000..a0da6f5 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/sdabase2.d +@@ -0,0 +1,10 @@ ++#source: sdabase.s ++#as: -a32 ++#ld: -melf32ppc -T sdabase2.t ++#objdump: -s ++#target: powerpc*-*-* ++ ++.*: file format .* ++ ++Contents of section \.sdata: ++ 0400 (00000400|00040000) (00000400|00040000) .* +diff --git a/ld/testsuite/ld-powerpc/sdabase2.t b/ld/testsuite/ld-powerpc/sdabase2.t +new file mode 100644 +index 0000000..2a8f5d0 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/sdabase2.t +@@ -0,0 +1,6 @@ ++SECTIONS ++{ ++ .text 0x100 : { *(.text) } ++ .sdata 0x400 : { PROVIDE (_SDA_BASE_ = .); *(.sdata) } ++ /DISCARD/ : { *(*) } ++} +diff --git a/ld/testsuite/ld-powerpc/tls32.d b/ld/testsuite/ld-powerpc/tls32.d +index 2b7d0a0..664f9cd 100644 +--- a/ld/testsuite/ld-powerpc/tls32.d ++++ b/ld/testsuite/ld-powerpc/tls32.d +@@ -9,7 +9,11 @@ + + Disassembly of section \.text: + +-0+1800094 <_start>: ++0+18000a0 <_start>: ++.*: (42 9f 00 05|05 00 9f 42) bcl 20,4\*cr7\+so,.* <_start\+0x4> ++.*: (7f c8 02 a6|a6 02 c8 7f) mflr r30 ++.*: (3f de 00 02|02 00 de 3f) addis r30,r30,2 ++.*: (3b de 80 a0|a0 80 de 3b) addi r30,r30,-32608 + .*: (3c 62 00 00|00 00 62 3c) addis r3,r2,0 + .*: (38 63 90 3c|3c 90 63 38) addi r3,r3,-28612 + .*: (3c 62 00 00|00 00 62 3c) addis r3,r2,0 +@@ -39,12 +43,5 @@ Disassembly of section \.text: + .*: (3d 22 00 00|00 00 22 3d) addis r9,r2,0 + .*: (a9 49 90 18|18 90 49 a9) lha r10,-28648\(r9\) + +-0+1800104 <__tls_get_addr>: ++0+1800120 <__tls_get_addr>: + .*: (4e 80 00 20|20 00 80 4e) blr +-Disassembly of section \.got: +- +-0+1810128 <_GLOBAL_OFFSET_TABLE_-0x4>: +-.*: (4e 80 00 21|21 00 80 4e) blrl +- +-0+181012c <_GLOBAL_OFFSET_TABLE_>: +- \.\.\. +diff --git a/ld/testsuite/ld-powerpc/tls32.g b/ld/testsuite/ld-powerpc/tls32.g +index cbf93cc..24735bd 100644 +--- a/ld/testsuite/ld-powerpc/tls32.g ++++ b/ld/testsuite/ld-powerpc/tls32.g +@@ -8,4 +8,4 @@ + .* + + Contents of section \.got: +- 1810128 (4e800021|2100804e) 00000000 00000000 00000000 .* ++ 1810144 00000000 00000000 00000000 .* +diff --git a/ld/testsuite/ld-powerpc/tls32.s b/ld/testsuite/ld-powerpc/tls32.s +index 1c3092d..b9b8468 100644 +--- a/ld/testsuite/ld-powerpc/tls32.s ++++ b/ld/testsuite/ld-powerpc/tls32.s +@@ -19,8 +19,17 @@ ie4: .long 0x56789abc + le4: .long 0x6789abcd + le5: .long 0x789abcde + ++ .section ".got2","aw" ++.LCTOC1 = .+32768 ++ + .text + _start: ++ bcl 20,31,0f ++0: ++ mflr 30 ++ addis 30,30,.LCTOC1-0b@ha ++ addi 30,30,.LCTOC1-0b@l ++ + #extern syms + #GD + addi 3,31,gd@got@tlsgd #R_PPC_GOT_TLSGD16 gd +diff --git a/ld/testsuite/ld-powerpc/tls32.t b/ld/testsuite/ld-powerpc/tls32.t +index c8b6cb4..5be66ac 100644 +--- a/ld/testsuite/ld-powerpc/tls32.t ++++ b/ld/testsuite/ld-powerpc/tls32.t +@@ -8,5 +8,5 @@ + .* + + Contents of section \.tdata: +- 1810108 (12345678|78563412) (23456789|89674523) (3456789a|9a785634) (456789ab|ab896745) .* +- 1810118 (56789abc|bc9a7856) (6789abcd|cdab8967) (789abcde|debc9a78) (00c0ffee|eeffc000) .* ++ 1810124 (12345678|78563412) (23456789|89674523) (3456789a|9a785634) (456789ab|ab896745) .* ++ 1810134 (56789abc|bc9a7856) (6789abcd|cdab8967) (789abcde|debc9a78) (00c0ffee|eeffc000) .* +diff --git a/ld/testsuite/ld-powerpc/tlsexe.d b/ld/testsuite/ld-powerpc/tlsexe.d +index 747b5e1..7aa1c6d 100644 +--- a/ld/testsuite/ld-powerpc/tlsexe.d ++++ b/ld/testsuite/ld-powerpc/tlsexe.d +@@ -23,8 +23,8 @@ Disassembly of section \.text: + .* (7d 89 03 a6|a6 03 89 7d) mtctr r12 + .* (e8 42 80 50|50 80 42 e8) ld r2,-32688\(r2\) + .* (4e 80 04 21|21 04 80 4e) bctrl +-.* (e9 61 00 20|20 00 61 e9) ld r11,32\(r1\) + .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) ++.* (e9 61 00 20|20 00 61 e9) ld r11,32\(r1\) + .* (7d 68 03 a6|a6 03 68 7d) mtlr r11 + .* (4e 80 00 20|20 00 80 4e) blr + +diff --git a/ld/testsuite/ld-powerpc/tlsexe32.d b/ld/testsuite/ld-powerpc/tlsexe32.d +index d0579ce..e7bc0d6 100644 +--- a/ld/testsuite/ld-powerpc/tlsexe32.d ++++ b/ld/testsuite/ld-powerpc/tlsexe32.d +@@ -9,10 +9,14 @@ + Disassembly of section \.text: + + .* <_start>: +-.*: (80 7f ff f0|f0 ff 7f 80) lwz r3,-16\(r31\) ++.*: (42 9f 00 05|05 00 9f 42) bcl 20,4\*cr7\+so,.* <_start\+0x4> ++.*: (7f c8 02 a6|a6 02 c8 7f) mflr r30 ++.*: (3f de 00 02|02 00 de 3f) addis r30,r30,2 ++.*: (3b de 81 18|18 81 de 3b) addi r30,r30,-32488 ++.*: (80 7f ff f4|f4 ff 7f 80) lwz r3,-12\(r31\) + .*: (7c 63 12 14|14 12 63 7c) add r3,r3,r2 +-.*: (38 7f ff f4|f4 ff 7f 38) addi r3,r31,-12 +-.*: (48 01 01 85|85 01 01 48) bl .*<__tls_get_addr_opt@plt> ++.*: (38 7f ff f8|f8 ff 7f 38) addi r3,r31,-8 ++.*: (48 00 00 65|65 00 00 48) bl .* <__tls_get_addr_opt@plt> + .*: (3c 62 00 00|00 00 62 3c) addis r3,r2,0 + .*: (38 63 90 1c|1c 90 63 38) addi r3,r3,-28644 + .*: (3c 62 00 00|00 00 62 3c) addis r3,r2,0 +@@ -37,11 +41,41 @@ Disassembly of section \.text: + .*: (a1 42 90 14|14 90 42 a1) lhz r10,-28652\(r2\) + .*: (3d 22 00 00|00 00 22 3d) addis r9,r2,0 + .*: (a9 49 90 18|18 90 49 a9) lha r10,-28648\(r9\) +-Disassembly of section \.got: + +-.* <_GLOBAL_OFFSET_TABLE_-0x10>: +- \.\.\. +-.*: (4e 80 00 21|21 00 80 4e) blrl ++.* <__tls_get_addr_opt@plt>: ++.*: (81 63 00 00|00 00 63 81) lwz r11,0\(r3\) ++.*: (81 83 00 04|04 00 83 81) lwz r12,4\(r3\) ++.*: (7c 60 1b 78|78 1b 60 7c) mr r0,r3 ++.*: (2c 0b 00 00|00 00 0b 2c) cmpwi r11,0 ++.*: (7c 6c 12 14|14 12 6c 7c) add r3,r12,r2 ++.*: (4d 82 00 20|20 00 82 4d) beqlr ++.*: (7c 03 03 78|78 03 03 7c) mr r3,r0 ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (3d 60 01 81|81 01 60 3d) lis r11,385 ++.*: (81 6b 04 14|14 04 6b 81) lwz r11,1044\(r11\) ++.*: (7d 69 03 a6|a6 03 69 7d) mtctr r11 ++.*: (4e 80 04 20|20 04 80 4e) bctr + +-.* <_GLOBAL_OFFSET_TABLE_>: +-.*: (01 81 02 b8|b8 02 81 01) 00 00 00 00 00 00 00 00 .* ++.* <__glink>: ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++ ++.* <__glink_PLTresolve>: ++.*: (3d 80 01 81|81 01 80 3d) lis r12,385 ++.*: (3d 6b fe 80|80 fe 6b 3d) addis r11,r11,-384 ++.*: (80 0c 04 0c|0c 04 0c 80) lwz r0,1036\(r12\) ++.*: (39 6b fd 20|20 fd 6b 39) addi r11,r11,-736 ++.*: (7c 09 03 a6|a6 03 09 7c) mtctr r0 ++.*: (7c 0b 5a 14|14 5a 0b 7c) add r0,r11,r11 ++.*: (81 8c 04 10|10 04 8c 81) lwz r12,1040\(r12\) ++.*: (7d 60 5a 14|14 5a 60 7d) add r11,r0,r11 ++.*: (4e 80 04 20|20 04 80 4e) bctr ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop +diff --git a/ld/testsuite/ld-powerpc/tlsexe32.g b/ld/testsuite/ld-powerpc/tlsexe32.g +index 917ca4d..e402f6b 100644 +--- a/ld/testsuite/ld-powerpc/tlsexe32.g ++++ b/ld/testsuite/ld-powerpc/tlsexe32.g +@@ -7,5 +7,5 @@ + .* + + Contents of section \.got: +-.* 00000000 00000000 00000000 (4e800021|2100804e) .* +-.* (018102b8|b8028101) 00000000 00000000 .* ++.* 00000000 00000000 00000000 (0181034c|4c038101) .* ++.* 00000000 00000000 .* +diff --git a/ld/testsuite/ld-powerpc/tlsexe32.r b/ld/testsuite/ld-powerpc/tlsexe32.r +index dea4a0d..a3304ec 100644 +--- a/ld/testsuite/ld-powerpc/tlsexe32.r ++++ b/ld/testsuite/ld-powerpc/tlsexe32.r +@@ -16,12 +16,12 @@ Section Headers: + +\[[ 0-9]+\] \.dynstr +.* + +\[[ 0-9]+\] \.rela\.dyn +.* + +\[[ 0-9]+\] \.rela\.plt +.* +- +\[[ 0-9]+\] \.text +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000070 00 +AX +0 +0 +1 ++ +\[[ 0-9]+\] \.text +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000100 00 +AX +0 +0 +16 + +\[[ 0-9]+\] \.tdata +PROGBITS +[0-9a-f]+ [0-9a-f]+ 00001c 00 WAT +0 +0 +4 + +\[[ 0-9]+\] \.tbss +NOBITS +[0-9a-f]+ [0-9a-f]+ 00001c 00 WAT +0 +0 +4 + +\[[ 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]+ 00001c 04 WAX +0 +0 +4 +- +\[[ 0-9]+\] \.plt +NOBITS +.* ++ +\[[ 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 +.* +@@ -37,7 +37,7 @@ Program Headers: + +INTERP +0x0000f4 0x018000f4 0x018000f4 0x00011 0x00011 R +0x1 + +\[Requesting program interpreter: .*\] + +LOAD .* R E 0x10000 +- +LOAD .* RWE 0x10000 ++ +LOAD .* RW +0x10000 + +DYNAMIC .* RW +0x4 + +TLS .* 0x0001c 0x00038 R +0x4 + +@@ -67,7 +67,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries: + .* NOTYPE +GLOBAL +DEFAULT +12 __end + .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start + .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt +-.* NOTYPE +GLOBAL +DEFAULT +11 _edata ++.* NOTYPE +GLOBAL +DEFAULT +12 _edata + .* NOTYPE +GLOBAL +DEFAULT +12 _end + + Symbol table '\.symtab' contains [0-9]+ entries: +@@ -107,7 +107,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: + .* TLS +GLOBAL +DEFAULT +9 ld1 + .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start + .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt +-.* NOTYPE +GLOBAL +DEFAULT +11 _edata ++.* NOTYPE +GLOBAL +DEFAULT +12 _edata + .* NOTYPE +GLOBAL +DEFAULT +12 _end + .* TLS +GLOBAL +DEFAULT +9 gd0 + .* TLS +GLOBAL +DEFAULT +9 ie0 +diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.d b/ld/testsuite/ld-powerpc/tlsexetoc.d +index f38ca9c..d478167 100644 +--- a/ld/testsuite/ld-powerpc/tlsexetoc.d ++++ b/ld/testsuite/ld-powerpc/tlsexetoc.d +@@ -23,8 +23,8 @@ Disassembly of section \.text: + .* (7d 89 03 a6|a6 03 89 7d) mtctr r12 + .* (e8 42 80 78|78 80 42 e8) ld r2,-32648\(r2\) + .* (4e 80 04 21|21 04 80 4e) bctrl +-.* (e9 61 00 20|20 00 61 e9) ld r11,32\(r1\) + .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) ++.* (e9 61 00 20|20 00 61 e9) ld r11,32\(r1\) + .* (7d 68 03 a6|a6 03 68 7d) mtlr r11 + .* (4e 80 00 20|20 00 80 4e) blr + +diff --git a/ld/testsuite/ld-powerpc/tlsld.d b/ld/testsuite/ld-powerpc/tlsld.d +new file mode 100644 +index 0000000..d66d1db +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/tlsld.d +@@ -0,0 +1,43 @@ ++#source: tlsld.s ++#as: -a64 ++#ld: -melf64ppc ++#objdump: -dr ++#target: powerpc64*-*-* ++ ++.*: file format .* ++ ++Disassembly of section \.text: ++ ++.*: ++.* nop ++.* addis r29,r13,0 ++.* mr r3,r29 ++.* nop ++.* addi r3,r3,4096 ++.* addis r3,r3,0 ++.* ld r3,-32768\(r3\) ++.* nop ++.* addis r29,r13,0 ++.* mr r3,r29 ++.* nop ++.* addi r3,r3,4096 ++.* ld r3,-32768\(r3\) ++.* nop ++.* nop ++.* nop ++.* nop ++.* addis r29,r13,0 ++.* mr r3,r29 ++.* nop ++.* addi r3,r3,-28672 ++.* ld r3,0\(r3\) ++.* nop ++.* nop ++.* addis r29,r13,0 ++.* mr r3,r29 ++.* nop ++.* addi r3,r3,-28672 ++.* ld r3,0\(r3\) ++.* nop ++.* nop ++.* nop +diff --git a/ld/testsuite/ld-powerpc/tlsld.s b/ld/testsuite/ld-powerpc/tlsld.s +new file mode 100644 +index 0000000..925d8bf +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/tlsld.s +@@ -0,0 +1,48 @@ ++ .section ".opd","aw",@progbits ++ .p2align 3 ++ .globl _start ++_start: ++ .quad .L_start,.TOC.@tocbase,0 ++ ++ .text ++.L_start: ++ addis 3,2,PrettyStackTraceHead@got@tlsld@ha ++ addi 29,3,PrettyStackTraceHead@got@tlsld@l ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsld) ++ nop ++ addis 3,3,PrettyStackTraceHead@dtprel@ha ++ ld 3,PrettyStackTraceHead@dtprel@l(3) ++ nop ++ ++ addi 29,2,PrettyStackTraceHead@got@tlsld ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsld) ++ nop ++ ld 3,PrettyStackTraceHead@dtprel(3) ++ nop ++ nop ++ nop ++ ++ addis 3,2,PrettyStackTraceHead@got@tlsgd@ha ++ addi 29,3,PrettyStackTraceHead@got@tlsgd@l ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsgd) ++ nop ++ ld 3,0(3) ++ nop ++ nop ++ ++ addi 29,2,PrettyStackTraceHead@got@tlsgd ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsgd) ++ nop ++ ld 3,0(3) ++ nop ++ nop ++ nop ++ ++ .section ".tbss","awT",@nobits ++ .align 3 ++PrettyStackTraceHead: ++ .space 8 +diff --git a/ld/testsuite/ld-powerpc/tlsld32.d b/ld/testsuite/ld-powerpc/tlsld32.d +new file mode 100644 +index 0000000..b0fd657 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/tlsld32.d +@@ -0,0 +1,44 @@ ++#source: tlsld32.s ++#as: -a32 ++#ld: -melf32ppc ++#objdump: -dr ++#target: powerpc*-*-* ++ ++.*: file format .* ++ ++Disassembly of section \.text: ++ ++.*: ++.* nop ++.* addis r29,r2,0 ++.* mr r3,r29 ++.* addi r3,r3,4096 ++.* addis r3,r3,0 ++.* lwz r3,-32768\(r3\) ++.* nop ++.* nop ++.* addis r29,r2,0 ++.* mr r3,r29 ++.* addi r3,r3,4096 ++.* lwz r3,-32768\(r3\) ++.* nop ++.* nop ++.* nop ++.* nop ++.* nop ++.* addis r29,r2,0 ++.* mr r3,r29 ++.* addi r3,r3,-28672 ++.* lwz r3,0\(r3\) ++.* nop ++.* nop ++.* nop ++.* addis r29,r2,0 ++.* mr r3,r29 ++.* addi r3,r3,-28672 ++.* lwz r3,0\(r3\) ++.* nop ++.* nop ++.* nop ++.* nop ++#pass +diff --git a/ld/testsuite/ld-powerpc/tlsld32.s b/ld/testsuite/ld-powerpc/tlsld32.s +new file mode 100644 +index 0000000..f5561d4 +--- /dev/null ++++ b/ld/testsuite/ld-powerpc/tlsld32.s +@@ -0,0 +1,43 @@ ++ .text ++ .globl _start ++_start: ++ addis 3,31,PrettyStackTraceHead@got@tlsld@ha ++ addi 29,3,PrettyStackTraceHead@got@tlsld@l ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsld) ++ addis 3,3,PrettyStackTraceHead@dtprel@ha ++ lwz 3,PrettyStackTraceHead@dtprel@l(3) ++ nop ++ nop ++ ++ addi 29,31,PrettyStackTraceHead@got@tlsld ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsld) ++ lwz 3,PrettyStackTraceHead@dtprel(3) ++ nop ++ nop ++ nop ++ nop ++ ++ addis 3,31,PrettyStackTraceHead@got@tlsgd@ha ++ addi 29,3,PrettyStackTraceHead@got@tlsgd@l ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsgd) ++ lwz 3,0(3) ++ nop ++ nop ++ nop ++ ++ addi 29,31,PrettyStackTraceHead@got@tlsgd ++ mr 3,29 ++ bl __tls_get_addr(PrettyStackTraceHead@tlsgd) ++ lwz 3,0(3) ++ nop ++ nop ++ nop ++ nop ++ ++ .section ".tbss","awT",@nobits ++ .align 2 ++PrettyStackTraceHead: ++ .space 4 +diff --git a/ld/testsuite/ld-powerpc/tlsso32.d b/ld/testsuite/ld-powerpc/tlsso32.d +index 39c9970..3365eb3 100644 +--- a/ld/testsuite/ld-powerpc/tlsso32.d ++++ b/ld/testsuite/ld-powerpc/tlsso32.d +@@ -9,39 +9,59 @@ + Disassembly of section \.text: + + .* <_start>: +-.*: (38 7f ff e0|e0 ff 7f 38) addi r3,r31,-32 ++.*: (42 9f 00 05|05 00 9f 42) bcl 20,4\*cr7\+so,.* <_start\+0x4> ++.*: (7f c8 02 a6|a6 02 c8 7f) mflr r30 ++.*: (3f de 00 02|02 00 de 3f) addis r30,r30,2 ++.*: (3b de 80 e8|e8 80 de 3b) addi r30,r30,-32536 ++.*: (38 7f ff e4|e4 ff 7f 38) addi r3,r31,-28 + .*: (48 00 00 01|01 00 00 48) bl .* +-.*: (38 7f ff f4|f4 ff 7f 38) addi r3,r31,-12 ++.*: (38 7f ff f8|f8 ff 7f 38) addi r3,r31,-8 + .*: (48 00 00 01|01 00 00 48) bl .* +-.*: (38 7f ff e8|e8 ff 7f 38) addi r3,r31,-24 +-.*: (48 01 01 95|95 01 01 48) bl .*<__tls_get_addr@plt> +-.*: (38 7f ff f4|f4 ff 7f 38) addi r3,r31,-12 +-.*: (48 01 01 8d|8d 01 01 48) bl .*<__tls_get_addr@plt> ++.*: (38 7f ff ec|ec ff 7f 38) addi r3,r31,-20 ++.*: (48 00 00 5d|5d 00 00 48) bl .*<0+8000\.got2\.plt_pic32\.__tls_get_addr> ++.*: (38 7f ff f8|f8 ff 7f 38) addi r3,r31,-8 ++.*: (48 00 00 55|55 00 00 48) bl .*<0+8000\.got2\.plt_pic32\.__tls_get_addr> + .*: (39 23 80 20|20 80 23 39) addi r9,r3,-32736 + .*: (3d 23 00 00|00 00 23 3d) addis r9,r3,0 + .*: (81 49 80 24|24 80 49 81) lwz r10,-32732\(r9\) +-.*: (81 3f ff f0|f0 ff 3f 81) lwz r9,-16\(r31\) ++.*: (81 3f ff f4|f4 ff 3f 81) lwz r9,-12\(r31\) + .*: (7d 49 12 2e|2e 12 49 7d) lhzx r10,r9,r2 + .*: (89 42 00 00|00 00 42 89) lbz r10,0\(r2\) + .*: (3d 22 00 00|00 00 22 3d) addis r9,r2,0 + .*: (99 49 00 00|00 00 49 99) stb r10,0\(r9\) +-.*: (38 7e ff d8|d8 ff 7e 38) addi r3,r30,-40 ++.*: (38 7e ff dc|dc ff 7e 38) addi r3,r30,-36 + .*: (48 00 00 01|01 00 00 48) bl .* +-.*: (38 7e ff f4|f4 ff 7e 38) addi r3,r30,-12 ++.*: (38 7e ff f8|f8 ff 7e 38) addi r3,r30,-8 + .*: (48 00 00 01|01 00 00 48) bl .* + .*: (91 43 80 04|04 80 43 91) stw r10,-32764\(r3\) + .*: (3d 23 00 00|00 00 23 3d) addis r9,r3,0 + .*: (91 49 80 08|08 80 49 91) stw r10,-32760\(r9\) +-.*: (81 3e ff f0|f0 ff 3e 81) lwz r9,-16\(r30\) ++.*: (81 3e ff f4|f4 ff 3e 81) lwz r9,-12\(r30\) + .*: (7d 49 13 2e|2e 13 49 7d) sthx r10,r9,r2 + .*: (a1 42 00 00|00 00 42 a1) lhz r10,0\(r2\) + .*: (3d 22 00 00|00 00 22 3d) addis r9,r2,0 + .*: (a9 49 00 00|00 00 49 a9) lha r10,0\(r9\) +-Disassembly of section \.got: + +-.* <_GLOBAL_OFFSET_TABLE_-0x28>: +-#... +-.*: (4e 80 00 21|21 00 80 4e) blrl +-.* <_GLOBAL_OFFSET_TABLE_>: +-.*: (00 01 03 ec|ec 03 01 00) .* +-#pass ++.* <00008000.got2.plt_pic32.__tls_get_addr>: ++.*: (81 7e 80 d8|d8 80 7e 81) lwz r11,-32552\(r30\) ++.*: (7d 69 03 a6|a6 03 69 7d) mtctr r11 ++.*: (4e 80 04 20|20 04 80 4e) bctr ++.*: (60 00 00 00|00 00 00 60) nop ++ ++.* <__glink>: ++.*: (3d 6b 00 00|00 00 6b 3d) addis r11,r11,0 ++.*: (7c 08 02 a6|a6 02 08 7c) mflr r0 ++.*: (42 9f 00 05|05 00 9f 42) bcl .* <__glink\+0xc> ++.*: (39 6b 00 0c|0c 00 6b 39) addi r11,r11,12 ++.*: (7d 88 02 a6|a6 02 88 7d) mflr r12 ++.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0 ++.*: (7d 6c 58 50|50 58 6c 7d) subf r11,r12,r11 ++.*: (3d 8c 00 01|01 00 8c 3d) addis r12,r12,1 ++.*: (80 0c 01 20|20 01 0c 80) lwz r0,288\(r12\) ++.*: (81 8c 01 24|24 01 8c 81) lwz r12,292\(r12\) ++.*: (7c 09 03 a6|a6 03 09 7c) mtctr r0 ++.*: (7c 0b 5a 14|14 5a 0b 7c) add r0,r11,r11 ++.*: (7d 60 5a 14|14 5a 60 7d) add r11,r0,r11 ++.*: (4e 80 04 20|20 04 80 4e) bctr ++.*: (60 00 00 00|00 00 00 60) nop ++.*: (60 00 00 00|00 00 00 60) nop +diff --git a/ld/testsuite/ld-powerpc/tlsso32.g b/ld/testsuite/ld-powerpc/tlsso32.g +index ac2c4bb..9909063 100644 +--- a/ld/testsuite/ld-powerpc/tlsso32.g ++++ b/ld/testsuite/ld-powerpc/tlsso32.g +@@ -9,5 +9,4 @@ + Contents of section \.got: + .* 00000000 00000000 00000000 00000000 .* + .* 00000000 00000000 00000000 00000000 .* +-.* 00000000 (4e800021|2100804e) (000103ec|ec030100) 00000000 .* +-.* 00000000 .* ++.* 00000000 (0001044c|4c040100) 00000000 00000000 .* +diff --git a/ld/testsuite/ld-powerpc/tlsso32.r b/ld/testsuite/ld-powerpc/tlsso32.r +index 9563b0b..4d12c48 100644 +--- a/ld/testsuite/ld-powerpc/tlsso32.r ++++ b/ld/testsuite/ld-powerpc/tlsso32.r +@@ -14,12 +14,12 @@ Section Headers: + +\[[ 0-9]+\] \.dynstr +.* + +\[[ 0-9]+\] \.rela\.dyn +.* + +\[[ 0-9]+\] \.rela\.plt +.* +- +\[[ 0-9]+\] \.text +PROGBITS .* 0+70 0+ +AX +0 +0 +1 ++ +\[[ 0-9]+\] \.text +PROGBITS .* 0+d0 0+ +AX +0 +0 +16 + +\[[ 0-9]+\] \.tdata +PROGBITS .* 0+1c 0+ WAT +0 +0 +4 + +\[[ 0-9]+\] \.tbss +NOBITS .* 0+1c 0+ WAT +0 +0 +4 + +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 08 +WA +3 +0 +4 +- +\[[ 0-9]+\] \.got +PROGBITS .* 0+34 04 WAX +0 +0 +4 +- +\[[ 0-9]+\] \.plt +.* ++ +\[[ 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 +.* +@@ -32,7 +32,7 @@ There are [0-9]+ program headers, starting at offset [0-9]+ + Program Headers: + +Type +Offset +VirtAddr +PhysAddr +FileSiz MemSiz +Flg Align + +LOAD .* R E 0x10000 +- +LOAD .* RWE 0x10000 ++ +LOAD .* RW +0x10000 + +DYNAMIC .* RW +0x4 + +TLS .* 0x0+1c 0x0+38 R +0x4 + +@@ -52,9 +52,9 @@ Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 18 entries: + [0-9a-f ]+R_PPC_TPREL16 +0+30 +le0 \+ 0 + [0-9a-f ]+R_PPC_TPREL16_HA +0+34 +le1 \+ 0 + [0-9a-f ]+R_PPC_TPREL16_LO +0+34 +le1 \+ 0 +-[0-9a-f ]+R_PPC_TPREL16 +0+103d0 +\.tdata \+ 103e4 +-[0-9a-f ]+R_PPC_TPREL16_HA +0+103d0 +\.tdata \+ 103e8 +-[0-9a-f ]+R_PPC_TPREL16_LO +0+103d0 +\.tdata \+ 103e8 ++[0-9a-f ]+R_PPC_TPREL16 +0+10430 +\.tdata \+ 10444 ++[0-9a-f ]+R_PPC_TPREL16_HA +0+10430 +\.tdata \+ 10448 ++[0-9a-f ]+R_PPC_TPREL16_LO +0+10430 +\.tdata \+ 10448 + [0-9a-f ]+R_PPC_DTPMOD32 +0 + [0-9a-f ]+R_PPC_DTPREL32 +0 + [0-9a-f ]+R_PPC_DTPMOD32 +0 +@@ -84,7 +84,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries: + .* TLS +GLOBAL +DEFAULT +8 ld2 + .* TLS +GLOBAL +DEFAULT +8 ld1 + .* NOTYPE +GLOBAL +DEFAULT +11 __bss_start +-.* NOTYPE +GLOBAL +DEFAULT +10 _edata ++.* NOTYPE +GLOBAL +DEFAULT +11 _edata + .* NOTYPE +GLOBAL +DEFAULT +11 _end + .* TLS +GLOBAL +DEFAULT +8 gd0 + .* TLS +GLOBAL +DEFAULT +8 ie0 +@@ -113,6 +113,9 @@ Symbol table '\.symtab' contains [0-9]+ entries: + .* 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 +@@ -125,7 +128,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: + .* TLS +GLOBAL +DEFAULT +8 ld2 + .* TLS +GLOBAL +DEFAULT +8 ld1 + .* NOTYPE +GLOBAL +DEFAULT +11 __bss_start +-.* NOTYPE +GLOBAL +DEFAULT +10 _edata ++.* NOTYPE +GLOBAL +DEFAULT +11 _edata + .* NOTYPE +GLOBAL +DEFAULT +11 _end + .* TLS +GLOBAL +DEFAULT +8 gd0 + .* TLS +GLOBAL +DEFAULT +8 ie0 +diff --git a/ld/testsuite/ld-powerpc/vxworks-relax-2.rd b/ld/testsuite/ld-powerpc/vxworks-relax-2.rd +index 4d36109..8d8d39c 100644 +--- a/ld/testsuite/ld-powerpc/vxworks-relax-2.rd ++++ b/ld/testsuite/ld-powerpc/vxworks-relax-2.rd +@@ -1,10 +1,10 @@ + + Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 8 entries: + Offset +Info +Type +Sym.Value +Sym. Name \+ Addend +-0+16 +[0-9a-f]+ R_PPC_ADDR16_HA +0+ +.text \+ 4000034 +-0+1a +[0-9a-f]+ R_PPC_ADDR16_LO +0+ +.text \+ 4000034 + 0+6 +[0-9a-f]+ R_PPC_ADDR16_HA +0+ +.text \+ 4000034 + 0+a +[0-9a-f]+ R_PPC_ADDR16_LO +0+ +.text \+ 4000034 ++0+16 +[0-9a-f]+ R_PPC_ADDR16_HA +0+ +.text \+ 4000034 ++0+1a +[0-9a-f]+ R_PPC_ADDR16_LO +0+ +.text \+ 4000034 + 0+26 +[0-9a-f]+ R_PPC_ADDR16_HA +0+ +undefined \+ 0 + 0+2a +[0-9a-f]+ R_PPC_ADDR16_LO +0+ +undefined \+ 0 + 0+400003e +[0-9a-f]+ R_PPC_ADDR16_HA +0+ +_start \+ 0 +diff --git a/ld/testsuite/ld-powerpc/vxworks-relax.rd b/ld/testsuite/ld-powerpc/vxworks-relax.rd +index 572c74d..a72308b 100644 +--- a/ld/testsuite/ld-powerpc/vxworks-relax.rd ++++ b/ld/testsuite/ld-powerpc/vxworks-relax.rd +@@ -1,9 +1,9 @@ + + Relocation section '.rela.text' at offset .* contains 6 entries: + Offset Info Type Sym.Value Sym. Name \+ Addend +-00080012 .* R_PPC_ADDR16_HA 00080000 .text \+ 4000020 +-00080016 .* R_PPC_ADDR16_LO 00080000 .text \+ 4000020 + 00080006 .* R_PPC_ADDR16_HA 00080000 .text \+ 4000020 + 0008000a .* R_PPC_ADDR16_LO 00080000 .text \+ 4000020 ++00080012 .* R_PPC_ADDR16_HA 00080000 .text \+ 4000020 ++00080016 .* R_PPC_ADDR16_LO 00080000 .text \+ 4000020 + 0408002a .* R_PPC_ADDR16_HA 00080000 _start \+ 0 + 0408002e .* R_PPC_ADDR16_LO 00080000 _start \+ 0 +diff --git a/ld/testsuite/ld-scripts/overlay-size.d b/ld/testsuite/ld-scripts/overlay-size.d +index 78a9c92..4e60150 100644 +--- a/ld/testsuite/ld-scripts/overlay-size.d ++++ b/ld/testsuite/ld-scripts/overlay-size.d +@@ -1,6 +1,7 @@ + # ld: -T overlay-size.t -Map tmpdir/overlay-size.map + # name: overlay size + # objdump: --headers ++# map: overlay-size-map.d + # xfail: rx-*-* + # FAILS on the RX because the linker has to set LMA == VMA for the + # Renesas loader. +diff --git a/ld/testsuite/ld-scripts/overlay-size.exp b/ld/testsuite/ld-scripts/overlay-size.exp +index df3407a..c3e6e4b 100644 +--- a/ld/testsuite/ld-scripts/overlay-size.exp ++++ b/ld/testsuite/ld-scripts/overlay-size.exp +@@ -23,12 +23,3 @@ if ![is_elf_format] { + } + + run_dump_test overlay-size +- +-set testname "overlay size (map check)" +- +-if [regexp_diff "tmpdir/overlay-size.map" \ +- "$srcdir/$subdir/overlay-size-map.d"] { +- fail $testname +-} else { +- pass $testname +-} +diff --git a/ld/testsuite/ld-scripts/provide-4-map.d b/ld/testsuite/ld-scripts/provide-4-map.d +new file mode 100644 +index 0000000..189d1d0 +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-4-map.d +@@ -0,0 +1,13 @@ ++#... ++Linker script and memory map ++#... ++ \[!provide\] +PROVIDE \(foo, 0x1\) ++ \[!provide\] +PROVIDE \(bar, 0x2\) ++ 0x0+3 +PROVIDE \(baz, 0x3\) ++#... ++ 0x0+2000 +foo ++ \[!provide\] +PROVIDE \(loc1, ALIGN \(\., 0x10\)\) ++ 0x0+2010 +PROVIDE \(loc2, ALIGN \(\., 0x10\)\) ++ \[!provide\] +PROVIDE \(loc3, \(loc1 \+ 0x20\)\) ++ 0x0+2030 +loc4 = \(loc2 \+ 0x20\) ++#... +diff --git a/ld/testsuite/ld-scripts/provide-4.d b/ld/testsuite/ld-scripts/provide-4.d +new file mode 100644 +index 0000000..a7d37e3 +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-4.d +@@ -0,0 +1,9 @@ ++#source: provide-2.s ++#ld: -T provide-4.t ++#PROG: nm ++#map: provide-4-map.d ++#... ++0+3 A baz ++0+2000 D foo ++0+2010 D loc2 ++0+2030 A loc4 +diff --git a/ld/testsuite/ld-scripts/provide-4.t b/ld/testsuite/ld-scripts/provide-4.t +new file mode 100644 +index 0000000..424c238 +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-4.t +@@ -0,0 +1,16 @@ ++SECTIONS ++{ ++ PROVIDE (foo = 1); ++ PROVIDE (bar = 2); ++ PROVIDE (baz = 3); ++ .data 0x2000 : ++ { ++ *(.data) ++ ++ PROVIDE (loc1 = ALIGN (., 0x10)); ++ PROVIDE (loc2 = ALIGN (., 0x10)); ++ } ++ ++ PROVIDE (loc3 = loc1 + 0x20); ++ loc4 = loc2 + 0x20; ++} +diff --git a/ld/testsuite/ld-scripts/provide-5-map.d b/ld/testsuite/ld-scripts/provide-5-map.d +new file mode 100644 +index 0000000..a75e4aa +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-5-map.d +@@ -0,0 +1,6 @@ ++#... ++Linker script and memory map ++#... ++ 0x0+10 +foo = 0x10 ++ \[!provide\] +PROVIDE \(foo, bar\) ++#... +diff --git a/ld/testsuite/ld-scripts/provide-5.d b/ld/testsuite/ld-scripts/provide-5.d +new file mode 100644 +index 0000000..1b14fa6 +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-5.d +@@ -0,0 +1,6 @@ ++#source: provide-5.s ++#ld: -T provide-5.t ++#PROG: nm ++#map: provide-5-map.d ++#... ++0+10 A foo +diff --git a/ld/testsuite/ld-scripts/provide-5.s b/ld/testsuite/ld-scripts/provide-5.s +new file mode 100644 +index 0000000..1d05efd +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-5.s +@@ -0,0 +1,4 @@ ++ .data ++ .global baz ++baz: ++ .word 0 +diff --git a/ld/testsuite/ld-scripts/provide-5.t b/ld/testsuite/ld-scripts/provide-5.t +new file mode 100644 +index 0000000..eda741e +--- /dev/null ++++ b/ld/testsuite/ld-scripts/provide-5.t +@@ -0,0 +1,10 @@ ++SECTIONS ++{ ++ foo = 0x10; ++ PROVIDE (foo = bar); ++ ++ .data 0x1000 : ++ { ++ *(.data) ++ } ++} +diff --git a/ld/testsuite/ld-scripts/provide.exp b/ld/testsuite/ld-scripts/provide.exp +index a6d3514..83b5c0f 100644 +--- a/ld/testsuite/ld-scripts/provide.exp ++++ b/ld/testsuite/ld-scripts/provide.exp +@@ -40,5 +40,7 @@ run_dump_test provide-1 + run_dump_test provide-2 + setup_xfail *-*-* + run_dump_test provide-3 ++run_dump_test provide-4 ++run_dump_test provide-5 + + set LDFLAGS "$saved_LDFLAGS" +diff --git a/ld/testsuite/ld-sh/sh64/reldl32.rd b/ld/testsuite/ld-sh/sh64/reldl32.rd +index 400e2af..a276d7c 100644 +--- a/ld/testsuite/ld-sh/sh64/reldl32.rd ++++ b/ld/testsuite/ld-sh/sh64/reldl32.rd +@@ -12,10 +12,10 @@ Relocation section '\.rela\.text' at offset 0x[0-9a-f]+ contains 26 entries: + 00000028 +0+21f6 R_SH_IMM_LOW16 +00000000 +file1text5 +\+ 8 + 0000002c +0+2df6 R_SH_IMM_LOW16 +0000000c +file1data2 +\+ 30 + 00000030 +0+2df6 R_SH_IMM_LOW16 +0000000c +file1data2 +\+ 0 +-0000003c +0+42f6 R_SH_IMM_LOW16 +00000000 +unresolved7 +\+ 0 +-00000040 +0+27f6 R_SH_IMM_LOW16 +00000000 +unresolved1 +\+ 0 + 00000034 +0+35f8 R_SH_IMM_MEDLOW16 +00000000 +file2data4 +\+ 10 + 00000038 +0+35f6 R_SH_IMM_LOW16 +00000000 +file2data4 +\+ 10 ++0000003c +0+42f6 R_SH_IMM_LOW16 +00000000 +unresolved7 +\+ 0 ++00000040 +0+27f6 R_SH_IMM_LOW16 +00000000 +unresolved1 +\+ 0 + 00000068 +0+08f6 R_SH_IMM_LOW16 +00000064 +file2text1 +\+ 0 + 0000006c +0+24f6 R_SH_IMM_LOW16 +00000124 +file2data2 +\+ 0 + 00000070 +0+23f6 R_SH_IMM_LOW16 +00000010 +file1text3 +\+ 0 +diff --git a/ld/testsuite/ld-sh/sh64/reldl64.rd b/ld/testsuite/ld-sh/sh64/reldl64.rd +index 8bd5502..71b984c 100644 +--- a/ld/testsuite/ld-sh/sh64/reldl64.rd ++++ b/ld/testsuite/ld-sh/sh64/reldl64.rd +@@ -12,12 +12,12 @@ Relocation section '\.rela\.text' at offset 0x[0-9a-f]+ contains 28 entries: + 0+28 +0+21000000f6 R_SH_IMM_LOW16[ ]+0+ +file1text5[ ]+\+ 8 + 0+2c +0+2d000000f6 R_SH_IMM_LOW16[ ]+0+c +file1data2[ ]+\+ 30 + 0+30 +0+2d000000f6 R_SH_IMM_LOW16[ ]+0+c +file1data2[ ]+\+ 0 +-0+44 +0+42000000f6 R_SH_IMM_LOW16[ ]+0+ +unresolved7[ ]+\+ 0 +-0+48 +0+27000000f6 R_SH_IMM_LOW16[ ]+0+ +unresolved1[ ]+\+ 0 + 0+34 +0+35000000fc R_SH_IMM_HI16[ ]+0+ +file2data4[ ]+\+ 10 + 0+38 +0+35000000fa R_SH_IMM_MEDHI16[ ]+0+ +file2data4[ ]+\+ 10 + 0+3c +0+35000000f8 R_SH_IMM_MEDLOW16[ ]+0+ +file2data4[ ]+\+ 10 + 0+40 +0+35000000f6 R_SH_IMM_LOW16[ ]+0+ +file2data4[ ]+\+ 10 ++0+44 +0+42000000f6 R_SH_IMM_LOW16[ ]+0+ +unresolved7[ ]+\+ 0 ++0+48 +0+27000000f6 R_SH_IMM_LOW16[ ]+0+ +unresolved1[ ]+\+ 0 + 0+70 +0+08000000f6 R_SH_IMM_LOW16[ ]+0+6c +file2text1[ ]+\+ 0 + 0+74 +0+24000000f6 R_SH_IMM_LOW16[ ]+0+124 +file2data2[ ]+\+ 0 + 0+78 +0+23000000f6 R_SH_IMM_LOW16[ ]+0+10 +file1text3[ ]+\+ 0 +diff --git a/ld/testsuite/ld-x86-64/pr17689.out b/ld/testsuite/ld-x86-64/pr17689.out +index 7ef22e9..38e0352 100644 +--- a/ld/testsuite/ld-x86-64/pr17689.out ++++ b/ld/testsuite/ld-x86-64/pr17689.out +@@ -1 +1,2 @@ + PASS ++PASS +diff --git a/ld/testsuite/ld-x86-64/pr17689b.S b/ld/testsuite/ld-x86-64/pr17689b.S +index c95f891..64485c7 100644 +--- a/ld/testsuite/ld-x86-64/pr17689b.S ++++ b/ld/testsuite/ld-x86-64/pr17689b.S +@@ -5,8 +5,18 @@ main: + subq $8, %rsp + movq bar_alias(%rip), %rdi + call foo@PLT ++ movq ptr(%rip), %rax ++ movq (%rax), %rdi ++ call foo@PLT + xorl %eax, %eax + addq $8, %rsp + ret + .size main, .-main ++ .globl ptr ++ .section .data.rel,"aw",@progbits ++ .align 8 ++ .type ptr, @object ++ .size ptr, 8 ++ptr: ++ .quad bar_alias + .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-x86-64/pr17827.rd b/ld/testsuite/ld-x86-64/pr17827.rd +new file mode 100644 +index 0000000..d78ea2f +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr17827.rd +@@ -0,0 +1,4 @@ ++#failif ++#... ++[0-9a-f ]+R_X86_64_NONE.* ++#... +diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp +index 1119133..28e8108 100644 +--- a/ld/testsuite/ld-x86-64/x86-64.exp ++++ b/ld/testsuite/ld-x86-64/x86-64.exp +@@ -373,6 +373,14 @@ if { [isnative] && [which $CC] != 0 } { + {{readelf {-Wr} pr17689.rd}} \ + "pr17689" \ + ] \ ++ [list \ ++ "Build pr17827 with PIE without -fPIE" \ ++ "tmpdir/pr17689.so -pie" \ ++ "" \ ++ { pr17689b.S } \ ++ {{readelf {-Wr} pr17827.rd}} \ ++ "pr17827" \ ++ ] \ + ] + + run_ld_link_exec_tests [] [list \ +diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp +index 7d2df22..ce39a47 100644 +--- a/ld/testsuite/lib/ld-lib.exp ++++ b/ld/testsuite/lib/ld-lib.exp +@@ -554,6 +554,14 @@ proc ld_simple_link_defsyms {} { + # both "error" and "warning". Multiple "warning" directives + # append to the expected linker warning message. + # ++# map: FILE ++# Adding this option will cause the linker to generate a linker ++# map file, using the -Map=MAPFILE command line option. If ++# there is no -Map=MAPFILE in the 'ld: FLAGS' then one will be ++# added to the linker command line. The contents of the ++# generated MAPFILE are then compared against the regexp lines ++# in FILE using `regexp_diff' (see below for details). ++# + # Each option may occur at most once unless otherwise mentioned. + # + # After the option lines come regexp lines. `run_dump_test' calls +@@ -606,6 +614,7 @@ proc run_dump_test { name {extra_options {}} } { + set opts(warning) {} + set opts(objcopy_linked_file) {} + set opts(objcopy_objects) {} ++ set opts(map) {} + + foreach i $opt_array { + set opt_name [lindex $i 0] +@@ -859,6 +868,20 @@ proc run_dump_test { name {extra_options {}} } { + set cmd "$LD $LDFLAGS -L$srcdir/$subdir \ + $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)" + ++ # If needed then check for, or add a -Map option. ++ set mapfile "" ++ if { $opts(map) != "" } then { ++ if { [regexp -- "-Map=(\[^ \]+)" $cmd all mapfile] } then { ++ # Found existing mapfile option ++ verbose -log "Existing mapfile '$mapfile' found" ++ } else { ++ # No mapfile option. ++ set mapfile "tmpdir/dump.map" ++ verbose -log "Adding mapfile '$mapfile'" ++ set cmd "$cmd -Map=$mapfile" ++ } ++ } ++ + send_log "$cmd\n" + set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"] + remote_upload host "ld.tmp" +@@ -907,6 +930,17 @@ proc run_dump_test { name {extra_options {}} } { + return + } + } ++ ++ if { $opts(map) != "" } then { ++ # Check the map file matches. ++ set map_pattern_file $srcdir/$subdir/$opts(map) ++ verbose -log "Compare '$mapfile' against '$map_pattern_file'" ++ if { [regexp_diff $mapfile $map_pattern_file] } then { ++ fail "$testname (map file check)" ++ } else { ++ pass "$testname (map file check)" ++ } ++ } + } else { + set objfile "tmpdir/dump0.o" + } +diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog +index e19e382..53afdd2 100644 +--- a/opcodes/ChangeLog ++++ b/opcodes/ChangeLog +@@ -1,3 +1,53 @@ ++2015-06-16 Matthew Wahab ++ ++ Applied from master ++ 2015-06-16 Matthew Wahab ++ ++ * aarch64-opc.c (aarch64_sys_regs): Add "id_mmfr4_el1". ++ ++2015-05-14 Peter Bergner ++ ++ Applied from master. ++ 2015-05-14 Peter Bergner ++ ++ * ppc-opc.c (IH) New define. ++ (powerpc_opcodes) : Do not enable for POWER7. ++ : Add RS operand for POWER7. ++ : Add IH operand for POWER6. ++ ++2015-05-07 Renlin Li ++ ++ Applied from master. ++ 2015-03-10 Renlin Li ++ ++ * aarch64-tbl.h (aarch64_opcode_table): Remove strub, ldurb, ldursb, ++ stur, ldur, sturh, ldurh, ldursh, ldursw, prfum F_HAS_ALIAS flag and ++ related alias. ++ * aarch64-asm-2.c: Regenerate. ++ * aarch64-dis-2.c: Likewise. ++ * aarch64-opc-2.c: Likewise. ++ ++2015-04-28 Peter Bergner ++ ++ Applied from master. ++ 2015-04-27 Peter Bergner ++ ++ * ppc-opc.c (DCBT_EO): New define. ++ (powerpc_opcodes) : Enable for POWER8 and later. ++ : Likewise. ++ : Likewise. ++ : Likewise. ++ : Do not enable for POWER7 and later. ++ : Likewise. ++ : Default to the two operand form of the instruction for all ++ "old" cpus. For "new" cpus, use the operand ordering that matches ++ whether the cpu is server or embedded. ++ : Likewise. ++ ++2015-03-11 Jiong Wang ++ ++ * arm-dis.c (arm_symbol_is_valid): Skip ARM private symbols. ++ + 2014-12-23 Tristan Gingold + + * configure: Regenerate. +diff --git a/opcodes/aarch64-asm-2.c b/opcodes/aarch64-asm-2.c +index b5cf12c..b70b1b0 100644 +--- a/opcodes/aarch64-asm-2.c ++++ b/opcodes/aarch64-asm-2.c +@@ -155,224 +155,188 @@ aarch64_find_real_opcode (const aarch64_opcode *opcode) + case 595: /* ror */ + value = 594; /* --> extr. */ + break; +- case 695: /* strb */ +- value = 693; /* --> sturb. */ ++ case 746: /* bic */ ++ value = 745; /* --> and. */ + break; +- case 696: /* ldrb */ +- value = 694; /* --> ldurb. */ ++ case 748: /* mov */ ++ value = 747; /* --> orr. */ + break; +- case 698: /* ldrsb */ +- value = 697; /* --> ldursb. */ ++ case 751: /* tst */ ++ value = 750; /* --> ands. */ + break; +- case 701: /* str */ +- value = 699; /* --> stur. */ ++ case 756: /* uxtw */ ++ case 755: /* mov */ ++ value = 754; /* --> orr. */ + break; +- case 702: /* ldr */ +- value = 700; /* --> ldur. */ ++ case 758: /* mvn */ ++ value = 757; /* --> orn. */ + break; +- case 705: /* strh */ +- value = 703; /* --> sturh. */ ++ case 762: /* tst */ ++ value = 761; /* --> ands. */ + break; +- case 706: /* ldrh */ +- value = 704; /* --> ldurh. */ ++ case 888: /* staddb */ ++ value = 792; /* --> ldaddb. */ + break; +- case 708: /* ldrsh */ +- value = 707; /* --> ldursh. */ ++ case 889: /* staddh */ ++ value = 793; /* --> ldaddh. */ + break; +- case 711: /* str */ +- value = 709; /* --> stur. */ ++ case 890: /* stadd */ ++ value = 794; /* --> ldadd. */ + break; +- case 712: /* ldr */ +- value = 710; /* --> ldur. */ ++ case 891: /* staddlb */ ++ value = 796; /* --> ldaddlb. */ + break; +- case 714: /* ldrsw */ +- value = 713; /* --> ldursw. */ ++ case 892: /* staddlh */ ++ value = 799; /* --> ldaddlh. */ + break; +- case 716: /* prfm */ +- value = 715; /* --> prfum. */ ++ case 893: /* staddl */ ++ value = 802; /* --> ldaddl. */ + break; +- case 758: /* bic */ +- value = 757; /* --> and. */ ++ case 894: /* stclrb */ ++ value = 804; /* --> ldclrb. */ + break; +- case 760: /* mov */ +- value = 759; /* --> orr. */ ++ case 895: /* stclrh */ ++ value = 805; /* --> ldclrh. */ + break; +- case 763: /* tst */ +- value = 762; /* --> ands. */ ++ case 896: /* stclr */ ++ value = 806; /* --> ldclr. */ + break; +- case 768: /* uxtw */ +- case 767: /* mov */ +- value = 766; /* --> orr. */ ++ case 897: /* stclrlb */ ++ value = 808; /* --> ldclrlb. */ + break; +- case 770: /* mvn */ +- value = 769; /* --> orn. */ ++ case 898: /* stclrlh */ ++ value = 811; /* --> ldclrlh. */ + break; +- case 774: /* tst */ +- value = 773; /* --> ands. */ ++ case 899: /* stclrl */ ++ value = 814; /* --> ldclrl. */ + break; +- case 900: /* staddb */ +- value = 804; /* --> ldaddb. */ ++ case 900: /* steorb */ ++ value = 816; /* --> ldeorb. */ + break; +- case 901: /* staddh */ +- value = 805; /* --> ldaddh. */ ++ case 901: /* steorh */ ++ value = 817; /* --> ldeorh. */ + break; +- case 902: /* stadd */ +- value = 806; /* --> ldadd. */ ++ case 902: /* steor */ ++ value = 818; /* --> ldeor. */ + break; +- case 903: /* staddlb */ +- value = 808; /* --> ldaddlb. */ ++ case 903: /* steorlb */ ++ value = 820; /* --> ldeorlb. */ + break; +- case 904: /* staddlh */ +- value = 811; /* --> ldaddlh. */ ++ case 904: /* steorlh */ ++ value = 823; /* --> ldeorlh. */ + break; +- case 905: /* staddl */ +- value = 814; /* --> ldaddl. */ ++ case 905: /* steorl */ ++ value = 826; /* --> ldeorl. */ + break; +- case 906: /* stclrb */ +- value = 816; /* --> ldclrb. */ ++ case 906: /* stsetb */ ++ value = 828; /* --> ldsetb. */ + break; +- case 907: /* stclrh */ +- value = 817; /* --> ldclrh. */ ++ case 907: /* stseth */ ++ value = 829; /* --> ldseth. */ + break; +- case 908: /* stclr */ +- value = 818; /* --> ldclr. */ ++ case 908: /* stset */ ++ value = 830; /* --> ldset. */ + break; +- case 909: /* stclrlb */ +- value = 820; /* --> ldclrlb. */ ++ case 909: /* stsetlb */ ++ value = 832; /* --> ldsetlb. */ + break; +- case 910: /* stclrlh */ +- value = 823; /* --> ldclrlh. */ ++ case 910: /* stsetlh */ ++ value = 835; /* --> ldsetlh. */ + break; +- case 911: /* stclrl */ +- value = 826; /* --> ldclrl. */ ++ case 911: /* stsetl */ ++ value = 838; /* --> ldsetl. */ + break; +- case 912: /* steorb */ +- value = 828; /* --> ldeorb. */ ++ case 912: /* stsmaxb */ ++ value = 840; /* --> ldsmaxb. */ + break; +- case 913: /* steorh */ +- value = 829; /* --> ldeorh. */ ++ case 913: /* stsmaxh */ ++ value = 841; /* --> ldsmaxh. */ + break; +- case 914: /* steor */ +- value = 830; /* --> ldeor. */ ++ case 914: /* stsmax */ ++ value = 842; /* --> ldsmax. */ + break; +- case 915: /* steorlb */ +- value = 832; /* --> ldeorlb. */ ++ case 915: /* stsmaxlb */ ++ value = 844; /* --> ldsmaxlb. */ + break; +- case 916: /* steorlh */ +- value = 835; /* --> ldeorlh. */ ++ case 916: /* stsmaxlh */ ++ value = 847; /* --> ldsmaxlh. */ + break; +- case 917: /* steorl */ +- value = 838; /* --> ldeorl. */ ++ case 917: /* stsmaxl */ ++ value = 850; /* --> ldsmaxl. */ + break; +- case 918: /* stsetb */ +- value = 840; /* --> ldsetb. */ ++ case 918: /* stsminb */ ++ value = 852; /* --> ldsminb. */ + break; +- case 919: /* stseth */ +- value = 841; /* --> ldseth. */ ++ case 919: /* stsminh */ ++ value = 853; /* --> ldsminh. */ + break; +- case 920: /* stset */ +- value = 842; /* --> ldset. */ ++ case 920: /* stsmin */ ++ value = 854; /* --> ldsmin. */ + break; +- case 921: /* stsetlb */ +- value = 844; /* --> ldsetlb. */ ++ case 921: /* stsminlb */ ++ value = 856; /* --> ldsminlb. */ + break; +- case 922: /* stsetlh */ +- value = 847; /* --> ldsetlh. */ ++ case 922: /* stsminlh */ ++ value = 859; /* --> ldsminlh. */ + break; +- case 923: /* stsetl */ +- value = 850; /* --> ldsetl. */ ++ case 923: /* stsminl */ ++ value = 862; /* --> ldsminl. */ + break; +- case 924: /* stsmaxb */ +- value = 852; /* --> ldsmaxb. */ ++ case 924: /* stumaxb */ ++ value = 864; /* --> ldumaxb. */ + break; +- case 925: /* stsmaxh */ +- value = 853; /* --> ldsmaxh. */ ++ case 925: /* stumaxh */ ++ value = 865; /* --> ldumaxh. */ + break; +- case 926: /* stsmax */ +- value = 854; /* --> ldsmax. */ ++ case 926: /* stumax */ ++ value = 866; /* --> ldumax. */ + break; +- case 927: /* stsmaxlb */ +- value = 856; /* --> ldsmaxlb. */ ++ case 927: /* stumaxlb */ ++ value = 868; /* --> ldumaxlb. */ + break; +- case 928: /* stsmaxlh */ +- value = 859; /* --> ldsmaxlh. */ ++ case 928: /* stumaxlh */ ++ value = 871; /* --> ldumaxlh. */ + break; +- case 929: /* stsmaxl */ +- value = 862; /* --> ldsmaxl. */ ++ case 929: /* stumaxl */ ++ value = 874; /* --> ldumaxl. */ + break; +- case 930: /* stsminb */ +- value = 864; /* --> ldsminb. */ ++ case 930: /* stuminb */ ++ value = 876; /* --> lduminb. */ + break; +- case 931: /* stsminh */ +- value = 865; /* --> ldsminh. */ ++ case 931: /* stuminh */ ++ value = 877; /* --> lduminh. */ + break; +- case 932: /* stsmin */ +- value = 866; /* --> ldsmin. */ ++ case 932: /* stumin */ ++ value = 878; /* --> ldumin. */ + break; +- case 933: /* stsminlb */ +- value = 868; /* --> ldsminlb. */ ++ case 933: /* stuminlb */ ++ value = 880; /* --> lduminlb. */ + break; +- case 934: /* stsminlh */ +- value = 871; /* --> ldsminlh. */ ++ case 934: /* stuminlh */ ++ value = 883; /* --> lduminlh. */ + break; +- case 935: /* stsminl */ +- value = 874; /* --> ldsminl. */ ++ case 935: /* stuminl */ ++ value = 886; /* --> lduminl. */ + break; +- case 936: /* stumaxb */ +- value = 876; /* --> ldumaxb. */ ++ case 937: /* mov */ ++ value = 936; /* --> movn. */ + break; +- case 937: /* stumaxh */ +- value = 877; /* --> ldumaxh. */ ++ case 939: /* mov */ ++ value = 938; /* --> movz. */ + break; +- case 938: /* stumax */ +- value = 878; /* --> ldumax. */ ++ case 950: /* sevl */ ++ case 949: /* sev */ ++ case 948: /* wfi */ ++ case 947: /* wfe */ ++ case 946: /* yield */ ++ case 945: /* nop */ ++ value = 944; /* --> hint. */ + break; +- case 939: /* stumaxlb */ +- value = 880; /* --> ldumaxlb. */ +- break; +- case 940: /* stumaxlh */ +- value = 883; /* --> ldumaxlh. */ +- break; +- case 941: /* stumaxl */ +- value = 886; /* --> ldumaxl. */ +- break; +- case 942: /* stuminb */ +- value = 888; /* --> lduminb. */ +- break; +- case 943: /* stuminh */ +- value = 889; /* --> lduminh. */ +- break; +- case 944: /* stumin */ +- value = 890; /* --> ldumin. */ +- break; +- case 945: /* stuminlb */ +- value = 892; /* --> lduminlb. */ +- break; +- case 946: /* stuminlh */ +- value = 895; /* --> lduminlh. */ +- break; +- case 947: /* stuminl */ +- value = 898; /* --> lduminl. */ +- break; +- case 949: /* mov */ +- value = 948; /* --> movn. */ +- break; +- case 951: /* mov */ +- value = 950; /* --> movz. */ +- break; +- case 962: /* sevl */ +- case 961: /* sev */ +- case 960: /* wfi */ +- case 959: /* wfe */ +- case 958: /* yield */ +- case 957: /* nop */ +- value = 956; /* --> hint. */ +- break; +- case 971: /* tlbi */ +- case 970: /* ic */ +- case 969: /* dc */ +- case 968: /* at */ +- value = 967; /* --> sys. */ ++ case 959: /* tlbi */ ++ case 958: /* ic */ ++ case 957: /* dc */ ++ case 956: /* at */ ++ value = 955; /* --> sys. */ + break; + default: return NULL; + } +diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c +index fd1da83..5028341 100644 +--- a/opcodes/aarch64-dis-2.c ++++ b/opcodes/aarch64-dis-2.c +@@ -40,7 +40,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx0000xxx0 + adr. */ +- return 953; ++ return 941; + } + else + { +@@ -48,7 +48,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx0000xxx1 + adrp. */ +- return 954; ++ return 942; + } + } + else +@@ -115,7 +115,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx000x0010000 + stxrb. */ +- return 717; ++ return 705; + } + else + { +@@ -123,7 +123,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx000x0010010 + stxrh. */ +- return 723; ++ return 711; + } + } + else +@@ -132,7 +132,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx000x00100x1 + stxr. */ +- return 729; ++ return 717; + } + } + else +@@ -143,7 +143,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx100x00100x0 + casp. */ +- return 788; ++ return 776; + } + else + { +@@ -151,7 +151,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx100x00100x1 + stxp. */ +- return 731; ++ return 719; + } + } + } +@@ -167,7 +167,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx000x0010000 + stlxrb. */ +- return 718; ++ return 706; + } + else + { +@@ -175,7 +175,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx000x0010010 + stlxrh. */ +- return 724; ++ return 712; + } + } + else +@@ -184,7 +184,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx000x00100x1 + stlxr. */ +- return 730; ++ return 718; + } + } + else +@@ -195,7 +195,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx100x00100x0 + caspl. */ +- return 790; ++ return 778; + } + else + { +@@ -203,7 +203,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx100x00100x1 + stlxp. */ +- return 732; ++ return 720; + } + } + } +@@ -214,7 +214,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx00x00101xx + stnp. */ +- return 739; ++ return 727; + } + } + else +@@ -231,7 +231,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxxx01x0010000 + casb. */ +- return 776; ++ return 764; + } + else + { +@@ -239,7 +239,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxxx01x0010010 + cash. */ +- return 777; ++ return 765; + } + } + else +@@ -248,7 +248,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxxx01x00100x1 + cas. */ +- return 778; ++ return 766; + } + } + else +@@ -263,7 +263,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx001x0010000 + stlrb. */ +- return 721; ++ return 709; + } + else + { +@@ -271,7 +271,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx001x0010010 + stlrh. */ +- return 727; ++ return 715; + } + } + else +@@ -280,7 +280,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx001x00100x1 + stlr. */ +- return 737; ++ return 725; + } + } + else +@@ -293,7 +293,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx101x0010000 + caslb. */ +- return 780; ++ return 768; + } + else + { +@@ -301,7 +301,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx101x0010010 + caslh. */ +- return 783; ++ return 771; + } + } + else +@@ -310,7 +310,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx101x00100x1 + casl. */ +- return 786; ++ return 774; + } + } + } +@@ -321,7 +321,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx01x00101xx + stp. */ +- return 748; ++ return 736; + } + } + } +@@ -343,7 +343,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx010x0010000 + ldxrb. */ +- return 719; ++ return 707; + } + else + { +@@ -351,7 +351,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx010x0010010 + ldxrh. */ +- return 725; ++ return 713; + } + } + else +@@ -360,7 +360,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx010x00100x1 + ldxr. */ +- return 733; ++ return 721; + } + } + else +@@ -371,7 +371,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx110x00100x0 + caspa. */ +- return 789; ++ return 777; + } + else + { +@@ -379,7 +379,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxx110x00100x1 + ldxp. */ +- return 735; ++ return 723; + } + } + } +@@ -395,7 +395,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx010x0010000 + ldaxrb. */ +- return 720; ++ return 708; + } + else + { +@@ -403,7 +403,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx010x0010010 + ldaxrh. */ +- return 726; ++ return 714; + } + } + else +@@ -412,7 +412,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx010x00100x1 + ldaxr. */ +- return 734; ++ return 722; + } + } + else +@@ -423,7 +423,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx110x00100x0 + caspal. */ +- return 791; ++ return 779; + } + else + { +@@ -431,7 +431,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx110x00100x1 + ldaxp. */ +- return 736; ++ return 724; + } + } + } +@@ -444,7 +444,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx10x001010x + ldnp. */ +- return 740; ++ return 728; + } + else + { +@@ -452,7 +452,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx10x001011x + ldpsw. */ +- return 747; ++ return 735; + } + } + } +@@ -470,7 +470,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxxx11x0010000 + casab. */ +- return 779; ++ return 767; + } + else + { +@@ -478,7 +478,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxxx11x0010010 + casah. */ +- return 782; ++ return 770; + } + } + else +@@ -487,7 +487,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx0xxxxxx11x00100x1 + casa. */ +- return 785; ++ return 773; + } + } + else +@@ -502,7 +502,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx011x0010000 + ldarb. */ +- return 722; ++ return 710; + } + else + { +@@ -510,7 +510,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx011x0010010 + ldarh. */ +- return 728; ++ return 716; + } + } + else +@@ -519,7 +519,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx011x00100x1 + ldar. */ +- return 738; ++ return 726; + } + } + else +@@ -532,7 +532,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx111x0010000 + casalb. */ +- return 781; ++ return 769; + } + else + { +@@ -540,7 +540,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx111x0010010 + casalh. */ +- return 784; ++ return 772; + } + } + else +@@ -549,7 +549,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxx1xxxxx111x00100x1 + casal. */ +- return 787; ++ return 775; + } + } + } +@@ -562,7 +562,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx11x001010x + ldp. */ +- return 749; ++ return 737; + } + else + { +@@ -570,7 +570,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx11x001011x + ldpsw. */ +- return 752; ++ return 740; + } + } + } +@@ -588,7 +588,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx000110x0 + ldr. */ +- return 753; ++ return 741; + } + else + { +@@ -598,7 +598,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx00011001 + ldrsw. */ +- return 755; ++ return 743; + } + else + { +@@ -606,7 +606,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx00011011 + prfm. */ +- return 756; ++ return 744; + } + } + } +@@ -638,7 +638,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx00000011110 + sturh. */ +- return 703; ++ return 698; + } + } + else +@@ -647,7 +647,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx000000111x1 + stur. */ +- return 709; ++ return 701; + } + } + else +@@ -668,7 +668,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx01000011110 + ldurh. */ +- return 704; ++ return 699; + } + } + else +@@ -677,7 +677,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx010000111x1 + ldur. */ +- return 710; ++ return 702; + } + } + } +@@ -691,7 +691,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx0x100011100 + ldursb. */ +- return 697; ++ return 695; + } + else + { +@@ -699,7 +699,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx0x100011101 + ldursw. */ +- return 713; ++ return 703; + } + } + else +@@ -710,7 +710,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx0x100011110 + ldursh. */ +- return 707; ++ return 700; + } + else + { +@@ -718,7 +718,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxx0x100011111 + prfum. */ +- return 715; ++ return 704; + } + } + } +@@ -745,7 +745,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx10000011100 + ldaddb. */ +- return 804; ++ return 792; + } + else + { +@@ -753,7 +753,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx10000011110 + ldaddh. */ +- return 805; ++ return 793; + } + } + else +@@ -762,7 +762,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx100000111x1 + ldadd. */ +- return 806; ++ return 794; + } + } + else +@@ -775,7 +775,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx10100011100 + ldaddab. */ +- return 807; ++ return 795; + } + else + { +@@ -783,7 +783,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx10100011110 + ldaddah. */ +- return 810; ++ return 798; + } + } + else +@@ -792,7 +792,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx101000111x1 + ldadda. */ +- return 813; ++ return 801; + } + } + } +@@ -808,7 +808,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx11000011100 + ldaddlb. */ +- return 808; ++ return 796; + } + else + { +@@ -816,7 +816,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx11000011110 + ldaddlh. */ +- return 811; ++ return 799; + } + } + else +@@ -825,7 +825,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx110000111x1 + ldaddl. */ +- return 814; ++ return 802; + } + } + else +@@ -838,7 +838,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx11100011100 + ldaddalb. */ +- return 809; ++ return 797; + } + else + { +@@ -846,7 +846,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx11100011110 + ldaddalh. */ +- return 812; ++ return 800; + } + } + else +@@ -855,7 +855,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000000xxxxx111000111x1 + ldaddal. */ +- return 815; ++ return 803; + } + } + } +@@ -874,7 +874,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx10000011100 + swpb. */ +- return 792; ++ return 780; + } + else + { +@@ -882,7 +882,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx10000011110 + swph. */ +- return 793; ++ return 781; + } + } + else +@@ -891,7 +891,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx100000111x1 + swp. */ +- return 794; ++ return 782; + } + } + else +@@ -904,7 +904,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx10100011100 + swpab. */ +- return 795; ++ return 783; + } + else + { +@@ -912,7 +912,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx10100011110 + swpah. */ +- return 798; ++ return 786; + } + } + else +@@ -921,7 +921,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx101000111x1 + swpa. */ +- return 801; ++ return 789; + } + } + } +@@ -937,7 +937,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx11000011100 + swplb. */ +- return 796; ++ return 784; + } + else + { +@@ -945,7 +945,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx11000011110 + swplh. */ +- return 799; ++ return 787; + } + } + else +@@ -954,7 +954,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx110000111x1 + swpl. */ +- return 802; ++ return 790; + } + } + else +@@ -967,7 +967,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx11100011100 + swpalb. */ +- return 797; ++ return 785; + } + else + { +@@ -975,7 +975,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx11100011110 + swpalh. */ +- return 800; ++ return 788; + } + } + else +@@ -984,7 +984,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx000001xxxxx111000111x1 + swpal. */ +- return 803; ++ return 791; + } + } + } +@@ -1004,7 +1004,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx10000011100 + ldsmaxb. */ +- return 852; ++ return 840; + } + else + { +@@ -1012,7 +1012,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx10000011110 + ldsmaxh. */ +- return 853; ++ return 841; + } + } + else +@@ -1021,7 +1021,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx100000111x1 + ldsmax. */ +- return 854; ++ return 842; + } + } + else +@@ -1034,7 +1034,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx10100011100 + ldsmaxab. */ +- return 855; ++ return 843; + } + else + { +@@ -1042,7 +1042,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx10100011110 + ldsmaxah. */ +- return 858; ++ return 846; + } + } + else +@@ -1051,7 +1051,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx101000111x1 + ldsmaxa. */ +- return 861; ++ return 849; + } + } + } +@@ -1067,7 +1067,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx11000011100 + ldsmaxlb. */ +- return 856; ++ return 844; + } + else + { +@@ -1075,7 +1075,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx11000011110 + ldsmaxlh. */ +- return 859; ++ return 847; + } + } + else +@@ -1084,7 +1084,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx110000111x1 + ldsmaxl. */ +- return 862; ++ return 850; + } + } + else +@@ -1097,7 +1097,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx11100011100 + ldsmaxalb. */ +- return 857; ++ return 845; + } + else + { +@@ -1105,7 +1105,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx11100011110 + ldsmaxalh. */ +- return 860; ++ return 848; + } + } + else +@@ -1114,7 +1114,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00001xxxxxx111000111x1 + ldsmaxal. */ +- return 863; ++ return 851; + } + } + } +@@ -1136,7 +1136,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx10000011100 + ldeorb. */ +- return 828; ++ return 816; + } + else + { +@@ -1144,7 +1144,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx10000011110 + ldeorh. */ +- return 829; ++ return 817; + } + } + else +@@ -1153,7 +1153,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx100000111x1 + ldeor. */ +- return 830; ++ return 818; + } + } + else +@@ -1166,7 +1166,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx10100011100 + ldeorab. */ +- return 831; ++ return 819; + } + else + { +@@ -1174,7 +1174,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx10100011110 + ldeorah. */ +- return 834; ++ return 822; + } + } + else +@@ -1183,7 +1183,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx101000111x1 + ldeora. */ +- return 837; ++ return 825; + } + } + } +@@ -1199,7 +1199,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx11000011100 + ldeorlb. */ +- return 832; ++ return 820; + } + else + { +@@ -1207,7 +1207,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx11000011110 + ldeorlh. */ +- return 835; ++ return 823; + } + } + else +@@ -1216,7 +1216,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx110000111x1 + ldeorl. */ +- return 838; ++ return 826; + } + } + else +@@ -1229,7 +1229,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx11100011100 + ldeoralb. */ +- return 833; ++ return 821; + } + else + { +@@ -1237,7 +1237,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx11100011110 + ldeoralh. */ +- return 836; ++ return 824; + } + } + else +@@ -1246,7 +1246,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00010xxxxxx111000111x1 + ldeoral. */ +- return 839; ++ return 827; + } + } + } +@@ -1265,7 +1265,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx10000011100 + ldumaxb. */ +- return 876; ++ return 864; + } + else + { +@@ -1273,7 +1273,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx10000011110 + ldumaxh. */ +- return 877; ++ return 865; + } + } + else +@@ -1282,7 +1282,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx100000111x1 + ldumax. */ +- return 878; ++ return 866; + } + } + else +@@ -1295,7 +1295,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx10100011100 + ldumaxab. */ +- return 879; ++ return 867; + } + else + { +@@ -1303,7 +1303,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx10100011110 + ldumaxah. */ +- return 882; ++ return 870; + } + } + else +@@ -1312,7 +1312,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx101000111x1 + ldumaxa. */ +- return 885; ++ return 873; + } + } + } +@@ -1328,7 +1328,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx11000011100 + ldumaxlb. */ +- return 880; ++ return 868; + } + else + { +@@ -1336,7 +1336,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx11000011110 + ldumaxlh. */ +- return 883; ++ return 871; + } + } + else +@@ -1345,7 +1345,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx110000111x1 + ldumaxl. */ +- return 886; ++ return 874; + } + } + else +@@ -1358,7 +1358,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx11100011100 + ldumaxalb. */ +- return 881; ++ return 869; + } + else + { +@@ -1366,7 +1366,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx11100011110 + ldumaxalh. */ +- return 884; ++ return 872; + } + } + else +@@ -1375,7 +1375,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00011xxxxxx111000111x1 + ldumaxal. */ +- return 887; ++ return 875; + } + } + } +@@ -1400,7 +1400,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx10000011100 + ldclrb. */ +- return 816; ++ return 804; + } + else + { +@@ -1408,7 +1408,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx10000011110 + ldclrh. */ +- return 817; ++ return 805; + } + } + else +@@ -1417,7 +1417,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx100000111x1 + ldclr. */ +- return 818; ++ return 806; + } + } + else +@@ -1430,7 +1430,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx10100011100 + ldclrab. */ +- return 819; ++ return 807; + } + else + { +@@ -1438,7 +1438,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx10100011110 + ldclrah. */ +- return 822; ++ return 810; + } + } + else +@@ -1447,7 +1447,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx101000111x1 + ldclra. */ +- return 825; ++ return 813; + } + } + } +@@ -1463,7 +1463,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx11000011100 + ldclrlb. */ +- return 820; ++ return 808; + } + else + { +@@ -1471,7 +1471,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx11000011110 + ldclrlh. */ +- return 823; ++ return 811; + } + } + else +@@ -1480,7 +1480,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx110000111x1 + ldclrl. */ +- return 826; ++ return 814; + } + } + else +@@ -1493,7 +1493,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx11100011100 + ldclralb. */ +- return 821; ++ return 809; + } + else + { +@@ -1501,7 +1501,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx11100011110 + ldclralh. */ +- return 824; ++ return 812; + } + } + else +@@ -1510,7 +1510,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00100xxxxxx111000111x1 + ldclral. */ +- return 827; ++ return 815; + } + } + } +@@ -1529,7 +1529,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx10000011100 + ldsminb. */ +- return 864; ++ return 852; + } + else + { +@@ -1537,7 +1537,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx10000011110 + ldsminh. */ +- return 865; ++ return 853; + } + } + else +@@ -1546,7 +1546,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx100000111x1 + ldsmin. */ +- return 866; ++ return 854; + } + } + else +@@ -1559,7 +1559,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx10100011100 + ldsminab. */ +- return 867; ++ return 855; + } + else + { +@@ -1567,7 +1567,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx10100011110 + ldsminah. */ +- return 870; ++ return 858; + } + } + else +@@ -1576,7 +1576,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx101000111x1 + ldsmina. */ +- return 873; ++ return 861; + } + } + } +@@ -1592,7 +1592,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx11000011100 + ldsminlb. */ +- return 868; ++ return 856; + } + else + { +@@ -1600,7 +1600,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx11000011110 + ldsminlh. */ +- return 871; ++ return 859; + } + } + else +@@ -1609,7 +1609,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx110000111x1 + ldsminl. */ +- return 874; ++ return 862; + } + } + else +@@ -1622,7 +1622,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx11100011100 + ldsminalb. */ +- return 869; ++ return 857; + } + else + { +@@ -1630,7 +1630,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx11100011110 + ldsminalh. */ +- return 872; ++ return 860; + } + } + else +@@ -1639,7 +1639,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00101xxxxxx111000111x1 + ldsminal. */ +- return 875; ++ return 863; + } + } + } +@@ -1661,7 +1661,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx10000011100 + ldsetb. */ +- return 840; ++ return 828; + } + else + { +@@ -1669,7 +1669,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx10000011110 + ldseth. */ +- return 841; ++ return 829; + } + } + else +@@ -1678,7 +1678,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx100000111x1 + ldset. */ +- return 842; ++ return 830; + } + } + else +@@ -1691,7 +1691,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx10100011100 + ldsetab. */ +- return 843; ++ return 831; + } + else + { +@@ -1699,7 +1699,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx10100011110 + ldsetah. */ +- return 846; ++ return 834; + } + } + else +@@ -1708,7 +1708,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx101000111x1 + ldseta. */ +- return 849; ++ return 837; + } + } + } +@@ -1724,7 +1724,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx11000011100 + ldsetlb. */ +- return 844; ++ return 832; + } + else + { +@@ -1732,7 +1732,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx11000011110 + ldsetlh. */ +- return 847; ++ return 835; + } + } + else +@@ -1741,7 +1741,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx110000111x1 + ldsetl. */ +- return 850; ++ return 838; + } + } + else +@@ -1754,7 +1754,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx11100011100 + ldsetalb. */ +- return 845; ++ return 833; + } + else + { +@@ -1762,7 +1762,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx11100011110 + ldsetalh. */ +- return 848; ++ return 836; + } + } + else +@@ -1771,7 +1771,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00110xxxxxx111000111x1 + ldsetal. */ +- return 851; ++ return 839; + } + } + } +@@ -1790,7 +1790,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx10000011100 + lduminb. */ +- return 888; ++ return 876; + } + else + { +@@ -1798,7 +1798,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx10000011110 + lduminh. */ +- return 889; ++ return 877; + } + } + else +@@ -1807,7 +1807,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx100000111x1 + ldumin. */ +- return 890; ++ return 878; + } + } + else +@@ -1820,7 +1820,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx10100011100 + lduminab. */ +- return 891; ++ return 879; + } + else + { +@@ -1828,7 +1828,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx10100011110 + lduminah. */ +- return 894; ++ return 882; + } + } + else +@@ -1837,7 +1837,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx101000111x1 + ldumina. */ +- return 897; ++ return 885; + } + } + } +@@ -1853,7 +1853,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx11000011100 + lduminlb. */ +- return 892; ++ return 880; + } + else + { +@@ -1861,7 +1861,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx11000011110 + lduminlh. */ +- return 895; ++ return 883; + } + } + else +@@ -1870,7 +1870,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx110000111x1 + lduminl. */ +- return 898; ++ return 886; + } + } + else +@@ -1883,7 +1883,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx11100011100 + lduminalb. */ +- return 893; ++ return 881; + } + else + { +@@ -1891,7 +1891,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx11100011110 + lduminalh. */ +- return 896; ++ return 884; + } + } + else +@@ -1900,7 +1900,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00111xxxxxx111000111x1 + lduminal. */ +- return 899; ++ return 887; + } + } + } +@@ -2340,7 +2340,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx00100x00x + and. */ +- return 757; ++ return 745; + } + else + { +@@ -2348,7 +2348,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx00100x01x + eor. */ +- return 761; ++ return 749; + } + } + else +@@ -2359,7 +2359,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx00100x10x + orr. */ +- return 759; ++ return 747; + } + else + { +@@ -2367,7 +2367,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx00100x11x + ands. */ +- return 762; ++ return 750; + } + } + } +@@ -2381,7 +2381,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx10100x00x + movn. */ +- return 948; ++ return 936; + } + else + { +@@ -2389,7 +2389,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx10100x01x + movz. */ +- return 950; ++ return 938; + } + } + else +@@ -2398,7 +2398,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxx10100x1xx + movk. */ +- return 952; ++ return 940; + } + } + } +@@ -2416,7 +2416,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx0xx0101000x + and. */ +- return 764; ++ return 752; + } + else + { +@@ -2424,7 +2424,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx0xx0101001x + eor. */ +- return 771; ++ return 759; + } + } + else +@@ -2435,7 +2435,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx0xx0101010x + orr. */ +- return 766; ++ return 754; + } + else + { +@@ -2443,7 +2443,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx0xx0101011x + ands. */ +- return 773; ++ return 761; + } + } + } +@@ -2818,7 +2818,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx1xx0101x00x + bic. */ +- return 765; ++ return 753; + } + else + { +@@ -2826,7 +2826,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx1xx0101x01x + eon. */ +- return 772; ++ return 760; + } + } + else +@@ -2837,7 +2837,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx1xx0101x10x + orn. */ +- return 769; ++ return 757; + } + else + { +@@ -2845,7 +2845,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx1xx0101x11x + bics. */ +- return 775; ++ return 763; + } + } + } +@@ -3256,7 +3256,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx0xx1x10x01x + msr. */ +- return 955; ++ return 943; + } + else + { +@@ -3264,7 +3264,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxx1xx1x10x01x + sysl. */ +- return 973; ++ return 961; + } + } + } +@@ -3287,7 +3287,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx0110x1xx + tbz. */ +- return 975; ++ return 963; + } + } + else +@@ -3306,7 +3306,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx1110x1xx + tbnz. */ +- return 976; ++ return 964; + } + } + } +@@ -3337,7 +3337,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx00001101xx + stnp. */ +- return 741; ++ return 729; + } + } + else +@@ -3389,7 +3389,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx00101101xx + stp. */ +- return 745; ++ return 733; + } + } + } +@@ -3453,7 +3453,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx01x01101xx + stp. */ +- return 750; ++ return 738; + } + } + } +@@ -3477,7 +3477,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx10001101xx + ldnp. */ +- return 742; ++ return 730; + } + } + else +@@ -3529,7 +3529,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx10101101xx + ldp. */ +- return 746; ++ return 734; + } + } + } +@@ -3593,7 +3593,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxx11x01101xx + ldp. */ +- return 751; ++ return 739; + } + } + } +@@ -3608,7 +3608,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxxxxxxxxxxxxxxxx001110xx + ldr. */ +- return 754; ++ return 742; + } + else + { +@@ -3622,7 +3622,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxxx0x001111xx + stur. */ +- return 699; ++ return 696; + } + else + { +@@ -3630,7 +3630,7 @@ aarch64_opcode_lookup_1 (uint32_t word) + 10987654321098765432109876543210 + xxxxxxxxxx00xxxxxxxxxx1x001111xx + ldur. */ +- return 700; ++ return 697; + } + } + else +@@ -8707,20 +8707,20 @@ aarch64_find_next_opcode (const aarch64_opcode *opcode) + int value; + switch (key) + { +- case 739: value = 743; break; /* stnp --> stp. */ +- case 743: return NULL; /* stp --> NULL. */ +- case 740: value = 744; break; /* ldnp --> ldp. */ +- case 744: return NULL; /* ldp --> NULL. */ +- case 955: value = 956; break; /* msr --> hint. */ +- case 956: value = 963; break; /* hint --> clrex. */ +- case 963: value = 964; break; /* clrex --> dsb. */ +- case 964: value = 965; break; /* dsb --> dmb. */ +- case 965: value = 966; break; /* dmb --> isb. */ +- case 966: value = 967; break; /* isb --> sys. */ +- case 967: value = 972; break; /* sys --> msr. */ +- case 972: return NULL; /* msr --> NULL. */ +- case 973: value = 974; break; /* sysl --> mrs. */ +- case 974: return NULL; /* mrs --> NULL. */ ++ case 727: value = 731; break; /* stnp --> stp. */ ++ case 731: return NULL; /* stp --> NULL. */ ++ case 728: value = 732; break; /* ldnp --> ldp. */ ++ case 732: return NULL; /* ldp --> NULL. */ ++ case 943: value = 944; break; /* msr --> hint. */ ++ case 944: value = 951; break; /* hint --> clrex. */ ++ case 951: value = 952; break; /* clrex --> dsb. */ ++ case 952: value = 953; break; /* dsb --> dmb. */ ++ case 953: value = 954; break; /* dmb --> isb. */ ++ case 954: value = 955; break; /* isb --> sys. */ ++ case 955: value = 960; break; /* sys --> msr. */ ++ case 960: return NULL; /* msr --> NULL. */ ++ case 961: value = 962; break; /* sysl --> mrs. */ ++ case 962: return NULL; /* mrs --> NULL. */ + case 355: value = 356; break; /* st4 --> st1. */ + case 356: value = 357; break; /* st1 --> st2. */ + case 357: value = 358; break; /* st2 --> st3. */ +@@ -8843,76 +8843,64 @@ aarch64_find_alias_opcode (const aarch64_opcode *opcode) + case 581: value = 582; break; /* umaddl --> umull. */ + case 583: value = 584; break; /* umsubl --> umnegl. */ + case 594: value = 595; break; /* extr --> ror. */ +- case 693: value = 695; break; /* sturb --> strb. */ +- case 694: value = 696; break; /* ldurb --> ldrb. */ +- case 697: value = 698; break; /* ldursb --> ldrsb. */ +- case 699: value = 701; break; /* stur --> str. */ +- case 700: value = 702; break; /* ldur --> ldr. */ +- case 703: value = 705; break; /* sturh --> strh. */ +- case 704: value = 706; break; /* ldurh --> ldrh. */ +- case 707: value = 708; break; /* ldursh --> ldrsh. */ +- case 709: value = 711; break; /* stur --> str. */ +- case 710: value = 712; break; /* ldur --> ldr. */ +- case 713: value = 714; break; /* ldursw --> ldrsw. */ +- case 715: value = 716; break; /* prfum --> prfm. */ +- case 757: value = 758; break; /* and --> bic. */ +- case 759: value = 760; break; /* orr --> mov. */ +- case 762: value = 763; break; /* ands --> tst. */ +- case 766: value = 768; break; /* orr --> uxtw. */ +- case 769: value = 770; break; /* orn --> mvn. */ +- case 773: value = 774; break; /* ands --> tst. */ +- case 804: value = 900; break; /* ldaddb --> staddb. */ +- case 805: value = 901; break; /* ldaddh --> staddh. */ +- case 806: value = 902; break; /* ldadd --> stadd. */ +- case 808: value = 903; break; /* ldaddlb --> staddlb. */ +- case 811: value = 904; break; /* ldaddlh --> staddlh. */ +- case 814: value = 905; break; /* ldaddl --> staddl. */ +- case 816: value = 906; break; /* ldclrb --> stclrb. */ +- case 817: value = 907; break; /* ldclrh --> stclrh. */ +- case 818: value = 908; break; /* ldclr --> stclr. */ +- case 820: value = 909; break; /* ldclrlb --> stclrlb. */ +- case 823: value = 910; break; /* ldclrlh --> stclrlh. */ +- case 826: value = 911; break; /* ldclrl --> stclrl. */ +- case 828: value = 912; break; /* ldeorb --> steorb. */ +- case 829: value = 913; break; /* ldeorh --> steorh. */ +- case 830: value = 914; break; /* ldeor --> steor. */ +- case 832: value = 915; break; /* ldeorlb --> steorlb. */ +- case 835: value = 916; break; /* ldeorlh --> steorlh. */ +- case 838: value = 917; break; /* ldeorl --> steorl. */ +- case 840: value = 918; break; /* ldsetb --> stsetb. */ +- case 841: value = 919; break; /* ldseth --> stseth. */ +- case 842: value = 920; break; /* ldset --> stset. */ +- case 844: value = 921; break; /* ldsetlb --> stsetlb. */ +- case 847: value = 922; break; /* ldsetlh --> stsetlh. */ +- case 850: value = 923; break; /* ldsetl --> stsetl. */ +- case 852: value = 924; break; /* ldsmaxb --> stsmaxb. */ +- case 853: value = 925; break; /* ldsmaxh --> stsmaxh. */ +- case 854: value = 926; break; /* ldsmax --> stsmax. */ +- case 856: value = 927; break; /* ldsmaxlb --> stsmaxlb. */ +- case 859: value = 928; break; /* ldsmaxlh --> stsmaxlh. */ +- case 862: value = 929; break; /* ldsmaxl --> stsmaxl. */ +- case 864: value = 930; break; /* ldsminb --> stsminb. */ +- case 865: value = 931; break; /* ldsminh --> stsminh. */ +- case 866: value = 932; break; /* ldsmin --> stsmin. */ +- case 868: value = 933; break; /* ldsminlb --> stsminlb. */ +- case 871: value = 934; break; /* ldsminlh --> stsminlh. */ +- case 874: value = 935; break; /* ldsminl --> stsminl. */ +- case 876: value = 936; break; /* ldumaxb --> stumaxb. */ +- case 877: value = 937; break; /* ldumaxh --> stumaxh. */ +- case 878: value = 938; break; /* ldumax --> stumax. */ +- case 880: value = 939; break; /* ldumaxlb --> stumaxlb. */ +- case 883: value = 940; break; /* ldumaxlh --> stumaxlh. */ +- case 886: value = 941; break; /* ldumaxl --> stumaxl. */ +- case 888: value = 942; break; /* lduminb --> stuminb. */ +- case 889: value = 943; break; /* lduminh --> stuminh. */ +- case 890: value = 944; break; /* ldumin --> stumin. */ +- case 892: value = 945; break; /* lduminlb --> stuminlb. */ +- case 895: value = 946; break; /* lduminlh --> stuminlh. */ +- case 898: value = 947; break; /* lduminl --> stuminl. */ +- case 948: value = 949; break; /* movn --> mov. */ +- case 950: value = 951; break; /* movz --> mov. */ +- case 956: value = 962; break; /* hint --> sevl. */ +- case 967: value = 971; break; /* sys --> tlbi. */ ++ case 745: value = 746; break; /* and --> bic. */ ++ case 747: value = 748; break; /* orr --> mov. */ ++ case 750: value = 751; break; /* ands --> tst. */ ++ case 754: value = 756; break; /* orr --> uxtw. */ ++ case 757: value = 758; break; /* orn --> mvn. */ ++ case 761: value = 762; break; /* ands --> tst. */ ++ case 792: value = 888; break; /* ldaddb --> staddb. */ ++ case 793: value = 889; break; /* ldaddh --> staddh. */ ++ case 794: value = 890; break; /* ldadd --> stadd. */ ++ case 796: value = 891; break; /* ldaddlb --> staddlb. */ ++ case 799: value = 892; break; /* ldaddlh --> staddlh. */ ++ case 802: value = 893; break; /* ldaddl --> staddl. */ ++ case 804: value = 894; break; /* ldclrb --> stclrb. */ ++ case 805: value = 895; break; /* ldclrh --> stclrh. */ ++ case 806: value = 896; break; /* ldclr --> stclr. */ ++ case 808: value = 897; break; /* ldclrlb --> stclrlb. */ ++ case 811: value = 898; break; /* ldclrlh --> stclrlh. */ ++ case 814: value = 899; break; /* ldclrl --> stclrl. */ ++ case 816: value = 900; break; /* ldeorb --> steorb. */ ++ case 817: value = 901; break; /* ldeorh --> steorh. */ ++ case 818: value = 902; break; /* ldeor --> steor. */ ++ case 820: value = 903; break; /* ldeorlb --> steorlb. */ ++ case 823: value = 904; break; /* ldeorlh --> steorlh. */ ++ case 826: value = 905; break; /* ldeorl --> steorl. */ ++ case 828: value = 906; break; /* ldsetb --> stsetb. */ ++ case 829: value = 907; break; /* ldseth --> stseth. */ ++ case 830: value = 908; break; /* ldset --> stset. */ ++ case 832: value = 909; break; /* ldsetlb --> stsetlb. */ ++ case 835: value = 910; break; /* ldsetlh --> stsetlh. */ ++ case 838: value = 911; break; /* ldsetl --> stsetl. */ ++ case 840: value = 912; break; /* ldsmaxb --> stsmaxb. */ ++ case 841: value = 913; break; /* ldsmaxh --> stsmaxh. */ ++ case 842: value = 914; break; /* ldsmax --> stsmax. */ ++ case 844: value = 915; break; /* ldsmaxlb --> stsmaxlb. */ ++ case 847: value = 916; break; /* ldsmaxlh --> stsmaxlh. */ ++ case 850: value = 917; break; /* ldsmaxl --> stsmaxl. */ ++ case 852: value = 918; break; /* ldsminb --> stsminb. */ ++ case 853: value = 919; break; /* ldsminh --> stsminh. */ ++ case 854: value = 920; break; /* ldsmin --> stsmin. */ ++ case 856: value = 921; break; /* ldsminlb --> stsminlb. */ ++ case 859: value = 922; break; /* ldsminlh --> stsminlh. */ ++ case 862: value = 923; break; /* ldsminl --> stsminl. */ ++ case 864: value = 924; break; /* ldumaxb --> stumaxb. */ ++ case 865: value = 925; break; /* ldumaxh --> stumaxh. */ ++ case 866: value = 926; break; /* ldumax --> stumax. */ ++ case 868: value = 927; break; /* ldumaxlb --> stumaxlb. */ ++ case 871: value = 928; break; /* ldumaxlh --> stumaxlh. */ ++ case 874: value = 929; break; /* ldumaxl --> stumaxl. */ ++ case 876: value = 930; break; /* lduminb --> stuminb. */ ++ case 877: value = 931; break; /* lduminh --> stuminh. */ ++ case 878: value = 932; break; /* ldumin --> stumin. */ ++ case 880: value = 933; break; /* lduminlb --> stuminlb. */ ++ case 883: value = 934; break; /* lduminlh --> stuminlh. */ ++ case 886: value = 935; break; /* lduminl --> stuminl. */ ++ case 936: value = 937; break; /* movn --> mov. */ ++ case 938: value = 939; break; /* movz --> mov. */ ++ case 944: value = 950; break; /* hint --> sevl. */ ++ case 955: value = 959; break; /* sys --> tlbi. */ + default: return NULL; + } + +@@ -8941,15 +8929,15 @@ aarch64_find_next_alias_opcode (const aarch64_opcode *opcode) + case 505: value = 504; break; /* ubfx --> ubfiz. */ + case 527: value = 526; break; /* cset --> cinc. */ + case 530: value = 529; break; /* csetm --> cinv. */ +- case 768: value = 767; break; /* uxtw --> mov. */ +- case 962: value = 961; break; /* sevl --> sev. */ +- case 961: value = 960; break; /* sev --> wfi. */ +- case 960: value = 959; break; /* wfi --> wfe. */ +- case 959: value = 958; break; /* wfe --> yield. */ +- case 958: value = 957; break; /* yield --> nop. */ +- case 971: value = 970; break; /* tlbi --> ic. */ +- case 970: value = 969; break; /* ic --> dc. */ +- case 969: value = 968; break; /* dc --> at. */ ++ case 756: value = 755; break; /* uxtw --> mov. */ ++ case 950: value = 949; break; /* sevl --> sev. */ ++ case 949: value = 948; break; /* sev --> wfi. */ ++ case 948: value = 947; break; /* wfi --> wfe. */ ++ case 947: value = 946; break; /* wfe --> yield. */ ++ case 946: value = 945; break; /* yield --> nop. */ ++ case 959: value = 958; break; /* tlbi --> ic. */ ++ case 958: value = 957; break; /* ic --> dc. */ ++ case 957: value = 956; break; /* dc --> at. */ + default: return NULL; + } + +diff --git a/opcodes/aarch64-opc-2.c b/opcodes/aarch64-opc-2.c +index 3d84d37..d093cd5 100644 +--- a/opcodes/aarch64-opc-2.c ++++ b/opcodes/aarch64-opc-2.c +@@ -135,34 +135,34 @@ static const unsigned op_enum_table [] = + 671, + 693, + 694, ++ 695, ++ 698, ++ 699, ++ 700, ++ 701, ++ 702, ++ 696, + 697, + 703, + 704, +- 707, +- 709, +- 710, +- 699, +- 700, +- 713, +- 715, +- 753, +- 754, +- 755, +- 756, ++ 741, ++ 742, ++ 743, ++ 744, + 12, + 510, + 511, +- 948, +- 950, +- 952, +- 760, +- 951, +- 949, ++ 936, ++ 938, ++ 940, ++ 748, ++ 939, ++ 937, + 259, + 499, + 509, + 508, +- 758, ++ 746, + 505, + 502, + 495, +@@ -171,7 +171,7 @@ static const unsigned op_enum_table [] = + 504, + 506, + 507, +- 768, ++ 756, + 526, + 529, + 532, +diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c +index 430cf5b..e168b9d 100644 +--- a/opcodes/aarch64-opc.c ++++ b/opcodes/aarch64-opc.c +@@ -2765,6 +2765,7 @@ const aarch64_sys_reg aarch64_sys_regs [] = + { "id_mmfr1_el1", CPENC(3,0,C0,C1,5), 0 }, /* RO */ + { "id_mmfr2_el1", CPENC(3,0,C0,C1,6), 0 }, /* RO */ + { "id_mmfr3_el1", CPENC(3,0,C0,C1,7), 0 }, /* RO */ ++ { "id_mmfr4_el1", CPENC(3,0,C0,C2,6), 0 }, /* RO */ + { "id_isar0_el1", CPENC(3,0,C0,C2,0), 0 }, /* RO */ + { "id_isar1_el1", CPENC(3,0,C0,C2,1), 0 }, /* RO */ + { "id_isar2_el1", CPENC(3,0,C0,C2,2), 0 }, /* RO */ +diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h +index 1a16656..3d31f37 100644 +--- a/opcodes/aarch64-tbl.h ++++ b/opcodes/aarch64-tbl.h +@@ -1982,30 +1982,18 @@ struct aarch64_opcode aarch64_opcode_table[] = + {"ldtr", 0xb8400800, 0xbfe00c00, ldst_unpriv, 0, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R, F_GPRSIZE_IN_Q}, + {"ldtrsw", 0xb8800800, 0xffe00c00, ldst_unpriv, 0, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_X32, 0}, + /* Load/store register (unscaled immediate). */ +- {"sturb", 0x38000000, 0xffe00c00, ldst_unscaled, OP_STURB, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W8, F_HAS_ALIAS}, +- {"ldurb", 0x38400000, 0xffe00c00, ldst_unscaled, OP_LDURB, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W8, F_HAS_ALIAS}, +- {"strb", 0x38000000, 0xffe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_W8, F_ALIAS}, +- {"ldrb", 0x38400000, 0xffe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_W8, F_ALIAS}, +- {"ldursb", 0x38800000, 0xffa00c00, ldst_unscaled, OP_LDURSB, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R8, F_HAS_ALIAS | F_LDS_SIZE}, +- {"ldrsb", 0x38800000, 0xffa00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_R8, F_ALIAS | F_LDS_SIZE}, +- {"stur", 0x3c000000, 0x3f600c00, ldst_unscaled, OP_STURV, CORE, OP2 (Ft, ADDR_SIMM9), QL_LDST_FP, F_HAS_ALIAS}, +- {"ldur", 0x3c400000, 0x3f600c00, ldst_unscaled, OP_LDURV, CORE, OP2 (Ft, ADDR_SIMM9), QL_LDST_FP, F_HAS_ALIAS}, +- {"str", 0x3c000000, 0x3f600c00, ldst_unscaled, 0, CORE, OP2 (Ft, ADDR_SIMM9_2), QL_LDST_FP, F_ALIAS}, +- {"ldr", 0x3c400000, 0x3f600c00, ldst_unscaled, 0, CORE, OP2 (Ft, ADDR_SIMM9_2), QL_LDST_FP, F_ALIAS}, +- {"sturh", 0x78000000, 0xffe00c00, ldst_unscaled, OP_STURH, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W16, F_HAS_ALIAS}, +- {"ldurh", 0x78400000, 0xffe00c00, ldst_unscaled, OP_LDURH, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W16, F_HAS_ALIAS}, +- {"strh", 0x78000000, 0xffe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_W16, F_ALIAS}, +- {"ldrh", 0x78400000, 0xffe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_W16, F_ALIAS}, +- {"ldursh", 0x78800000, 0xffa00c00, ldst_unscaled, OP_LDURSH, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R16, F_HAS_ALIAS | F_LDS_SIZE}, +- {"ldrsh", 0x78800000, 0xffa00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_R16, F_ALIAS | F_LDS_SIZE}, +- {"stur", 0xb8000000, 0xbfe00c00, ldst_unscaled, OP_STUR, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R, F_HAS_ALIAS | F_GPRSIZE_IN_Q}, +- {"ldur", 0xb8400000, 0xbfe00c00, ldst_unscaled, OP_LDUR, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R, F_HAS_ALIAS | F_GPRSIZE_IN_Q}, +- {"str", 0xb8000000, 0xbfe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_R, F_ALIAS | F_GPRSIZE_IN_Q}, +- {"ldr", 0xb8400000, 0xbfe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_R, F_ALIAS | F_GPRSIZE_IN_Q}, +- {"ldursw", 0xb8800000, 0xffe00c00, ldst_unscaled, OP_LDURSW, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_X32, F_HAS_ALIAS}, +- {"ldrsw", 0xb8800000, 0xffe00c00, ldst_unscaled, 0, CORE, OP2 (Rt, ADDR_SIMM9_2), QL_LDST_X32, F_ALIAS}, +- {"prfum", 0xf8800000, 0xffe00c00, ldst_unscaled, OP_PRFUM, CORE, OP2 (PRFOP, ADDR_SIMM9), QL_LDST_PRFM, F_HAS_ALIAS}, +- {"prfm", 0xf8800000, 0xffe00c00, ldst_unscaled, 0, CORE, OP2 (PRFOP, ADDR_SIMM9_2), QL_LDST_PRFM, F_ALIAS}, ++ {"sturb", 0x38000000, 0xffe00c00, ldst_unscaled, OP_STURB, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W8, 0}, ++ {"ldurb", 0x38400000, 0xffe00c00, ldst_unscaled, OP_LDURB, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W8, 0}, ++ {"ldursb", 0x38800000, 0xffa00c00, ldst_unscaled, OP_LDURSB, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R8, F_LDS_SIZE}, ++ {"stur", 0x3c000000, 0x3f600c00, ldst_unscaled, OP_STURV, CORE, OP2 (Ft, ADDR_SIMM9), QL_LDST_FP, 0}, ++ {"ldur", 0x3c400000, 0x3f600c00, ldst_unscaled, OP_LDURV, CORE, OP2 (Ft, ADDR_SIMM9), QL_LDST_FP, 0}, ++ {"sturh", 0x78000000, 0xffe00c00, ldst_unscaled, OP_STURH, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W16, 0}, ++ {"ldurh", 0x78400000, 0xffe00c00, ldst_unscaled, OP_LDURH, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_W16, 0}, ++ {"ldursh", 0x78800000, 0xffa00c00, ldst_unscaled, OP_LDURSH, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R16, F_LDS_SIZE}, ++ {"stur", 0xb8000000, 0xbfe00c00, ldst_unscaled, OP_STUR, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R, F_GPRSIZE_IN_Q}, ++ {"ldur", 0xb8400000, 0xbfe00c00, ldst_unscaled, OP_LDUR, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_R, F_GPRSIZE_IN_Q}, ++ {"ldursw", 0xb8800000, 0xffe00c00, ldst_unscaled, OP_LDURSW, CORE, OP2 (Rt, ADDR_SIMM9), QL_LDST_X32, 0}, ++ {"prfum", 0xf8800000, 0xffe00c00, ldst_unscaled, OP_PRFUM, CORE, OP2 (PRFOP, ADDR_SIMM9), QL_LDST_PRFM, 0}, + /* Load/store exclusive. */ + {"stxrb", 0x8007c00, 0xffe08000, ldstexcl, 0, CORE, OP3 (Rs, Rt, ADDR_SIMPLE), QL_W2_LDST_EXC, 0}, + {"stlxrb", 0x800fc00, 0xffe08000, ldstexcl, 0, CORE, OP3 (Rs, Rt, ADDR_SIMPLE), QL_W2_LDST_EXC, 0}, +diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c +index 8f399fb..3fda1da 100644 +--- a/opcodes/arm-dis.c ++++ b/opcodes/arm-dis.c +@@ -4558,7 +4558,10 @@ print_insn_data (bfd_vma pc ATTRIBUTE_UNUSED, + } + + /* Disallow mapping symbols ($a, $b, $d, $t etc) from +- being displayed in symbol relative addresses. */ ++ being displayed in symbol relative addresses. ++ ++ Also disallow private symbol, with __tagsym$$ prefix, ++ from ARM RVCT toolchain being displayed. */ + + bfd_boolean + arm_symbol_is_valid (asymbol * sym, +@@ -4571,7 +4574,7 @@ arm_symbol_is_valid (asymbol * sym, + + name = bfd_asymbol_name (sym); + +- return (name && *name != '$'); ++ return (name && *name != '$' && strncmp (name, "__tagsym$$", 10)); + } + + /* Parse an individual disassembler option. */ +diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c +index 95802b0..85f6049 100644 +--- a/opcodes/ppc-opc.c ++++ b/opcodes/ppc-opc.c +@@ -866,6 +866,9 @@ const struct powerpc_operand powerpc_operands[] = + + #define ERAT_T UIM + 1 + { 0x7, 21, NULL, NULL, 0 }, ++ ++#define IH ERAT_T + 1 ++ { 0x7, 21, NULL, NULL, PPC_OPERAND_OPTIONAL }, + }; + + const unsigned int num_powerpc_operands = (sizeof (powerpc_operands) +@@ -2756,6 +2759,12 @@ extract_vleil (unsigned long insn, + #define E6500 PPC_OPCODE_E6500 + #define PPCVLE PPC_OPCODE_VLE + #define PPCHTM PPC_OPCODE_HTM ++/* 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 \ ++ | PPC_OPCODE_A2 | PPC_OPCODE_VLE) ++ ++ + + /* The opcode table. + +@@ -4463,7 +4472,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"mfvrd", X(31,51)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {RA, VS}}, + {"eratilx", X(31,51), X_MASK, PPCA2, PPCNONE, {ERAT_T, RA, RB}}, + +-{"lbarx", X(31,52), XEH_MASK, POWER7|PPCVLE, PPCNONE, {RT, RA0, RB, EH}}, ++{"lbarx", X(31,52), XEH_MASK, POWER8|PPCVLE, PPCNONE, {RT, RA0, RB, EH}}, + + {"ldux", X(31,53), X_MASK, PPC64|PPCVLE, PPCNONE, {RT, RAL, RB}}, + +@@ -4478,9 +4487,9 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"andc", XRC(31,60,0), X_MASK, COM|PPCVLE, PPCNONE, {RA, RS, RB}}, + {"andc.", XRC(31,60,1), X_MASK, COM|PPCVLE, PPCNONE, {RA, RS, RB}}, + +-{"waitrsv", X(31,62)|(1<<21), 0xffffffff, POWER7|E500MC|PPCA2, PPCNONE, {0}}, +-{"waitimpl", X(31,62)|(2<<21), 0xffffffff, POWER7|E500MC|PPCA2, PPCNONE, {0}}, +-{"wait", X(31,62), XWC_MASK, POWER7|E500MC|PPCA2|PPCVLE, PPCNONE, {WC}}, ++{"waitrsv", X(31,62)|(1<<21), 0xffffffff, E500MC|PPCA2, PPCNONE, {0}}, ++{"waitimpl", X(31,62)|(2<<21), 0xffffffff, E500MC|PPCA2, PPCNONE, {0}}, ++{"wait", X(31,62), XWC_MASK, E500MC|PPCA2|PPCVLE, PPCNONE, {WC}}, + + {"dcbstep", XRT(31,63,0), XRT_MASK, E500MC|PPCA2|PPCVLE, PPCNONE, {RA0, RB}}, + +@@ -4543,7 +4552,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"mfvrwz", X(31,115)|1, XX1RB_MASK|1, PPCVSX2, PPCNONE, {RA, VS}}, + {"mfvsrwz", X(31,115), XX1RB_MASK, PPCVSX2, PPCNONE, {RA, XS6}}, + +-{"lharx", X(31,116), XEH_MASK, POWER7|PPCVLE, PPCNONE, {RT, RA0, RB, EH}}, ++{"lharx", X(31,116), XEH_MASK, POWER8|PPCVLE, PPCNONE, {RT, RA0, RB, EH}}, + + {"clf", X(31,118), XTO_MASK, POWER, PPCNONE, {RA, RB}}, + +@@ -4711,9 +4720,10 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"mtvsrwz", X(31,243), XX1RB_MASK, PPCVSX2, PPCNONE, {XT6, RA}}, + + {"dcbtstt", XRT(31,246,0x10), XRT_MASK, POWER7, PPCNONE, {RA0, RB}}, +-{"dcbtst", X(31,246), X_MASK, POWER4, PPCNONE, {RA0, RB, CT}}, +-{"dcbtst", X(31,246), X_MASK, PPC|PPCVLE, POWER4, {CT, RA0, RB}}, +- ++{"dcbtst", X(31,246), X_MASK, POWER4, DCBT_EO, {RA0, RB, CT}}, ++{"dcbtst", X(31,246), X_MASK, DCBT_EO, PPCNONE, {CT, RA0, RB}}, ++{"dcbtst", X(31,246), X_MASK, PPC, POWER4|DCBT_EO, {RA0, RB}}, ++ + {"stbux", X(31,247), X_MASK, COM|PPCVLE, PPCNONE, {RS, RAS, RB}}, + + {"slliq", XRC(31,248,0), X_MASK, M601, PPCNONE, {RA, RS, SH}}, +@@ -4753,9 +4763,10 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"lscbx.", XRC(31,277,1), X_MASK, M601, PPCNONE, {RT, RA, RB}}, + + {"dcbtt", XRT(31,278,0x10), XRT_MASK, POWER7, PPCNONE, {RA0, RB}}, +-{"dcbt", X(31,278), X_MASK, POWER4, PPCNONE, {RA0, RB, CT}}, +-{"dcbt", X(31,278), X_MASK, PPC|PPCVLE, POWER4, {CT, RA0, RB}}, +- ++{"dcbt", X(31,278), X_MASK, POWER4, DCBT_EO, {RA0, RB, CT}}, ++{"dcbt", X(31,278), X_MASK, DCBT_EO, PPCNONE, {CT, RA0, RB}}, ++{"dcbt", X(31,278), X_MASK, PPC, POWER4|DCBT_EO, {RA0, RB}}, ++ + {"lhzx", X(31,279), X_MASK, COM|PPCVLE, PPCNONE, {RT, RA0, RB}}, + + {"cdtbcd", X(31,282), XRB_MASK, POWER6, PPCNONE, {RA, RS}}, +@@ -4772,7 +4783,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { + + {"mfbhrbe", X(31,302), X_MASK, POWER8, PPCNONE, {RT, BHRBE}}, + +-{"tlbie", X(31,306), XRTLRA_MASK, PPC, TITAN, {RB, L}}, ++{"tlbie", X(31,306), XRA_MASK, POWER7, TITAN, {RB, RS}}, ++{"tlbie", X(31,306), XRTLRA_MASK, PPC, POWER7|TITAN, {RB, L}}, + {"tlbi", X(31,306), XRT_MASK, POWER, PPCNONE, {RA0, RB}}, + + {"eciwx", X(31,310), X_MASK, PPC, TITAN, {RT, RA0, RB}}, +@@ -5364,7 +5376,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { + + {"icbtlse", X(31,494), X_MASK, PPCCHLK, E500MC, {CT, RA, RB}}, + +-{"slbia", X(31,498), 0xffffffff, PPC64, PPCNONE, {0}}, ++{"slbia", X(31,498), 0xff1fffff, POWER6, PPCNONE, {IH}}, ++{"slbia", X(31,498), 0xffffffff, PPC64, POWER6, {0}}, + + {"cli", X(31,502), XRB_MASK, POWER, PPCNONE, {RT, RA}}, + +@@ -5531,7 +5544,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"tendall.", XRC(31,686,1)|(1<<25), XRTRARB_MASK, PPCHTM, PPCNONE, {0}}, + {"tend.", XRC(31,686,1), XRTARARB_MASK, PPCHTM, PPCNONE, {HTM_A}}, + +-{"stbcx.", XRC(31,694,1), X_MASK, POWER7, PPCNONE, {RS, RA0, RB}}, ++{"stbcx.", XRC(31,694,1), X_MASK, POWER8, PPCNONE, {RS, RA0, RB}}, + + {"stfsux", X(31,695), X_MASK, COM, PPCEFS, {FRS, RAS, RB}}, + +@@ -5561,7 +5574,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { + {"stswi", X(31,725), X_MASK, PPCCOM|PPCVLE, E500|E500MC, {RS, RA0, NB}}, + {"stsi", X(31,725), X_MASK, PWRCOM, PPCNONE, {RS, RA0, NB}}, + +-{"sthcx.", XRC(31,726,1), X_MASK, POWER7, PPCNONE, {RS, RA0, RB}}, ++{"sthcx.", XRC(31,726,1), X_MASK, POWER8, PPCNONE, {RS, RA0, RB}}, + + {"stfdx", X(31,727), X_MASK, COM, PPCEFS, {FRS, RA0, RB}}, + --- binutils-2.25.orig/debian/patches/branch-version.diff +++ binutils-2.25/debian/patches/branch-version.diff @@ -0,0 +1,52 @@ +diff --git a/bfd/Makefile.am b/bfd/Makefile.am +index ea4fd28..8610d5e 100644 +--- a/bfd/Makefile.am ++++ b/bfd/Makefile.am +@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = 1.11 no-dist foreign + ACLOCAL_AMFLAGS = -I . -I .. -I ../config + + # Uncomment the following line when doing a release. +-RELEASE=y ++# RELEASE=y + + INCDIR = $(srcdir)/../include + CSEARCH = -I. -I$(srcdir) -I$(INCDIR) +diff --git a/bfd/Makefile.in b/bfd/Makefile.in +index 741809c..34196aa 100644 +--- a/bfd/Makefile.in ++++ b/bfd/Makefile.in +@@ -320,7 +320,7 @@ AUTOMAKE_OPTIONS = 1.11 no-dist foreign + ACLOCAL_AMFLAGS = -I . -I .. -I ../config + + # Uncomment the following line when doing a release. +-RELEASE = y ++# RELEASE=y + INCDIR = $(srcdir)/../include + CSEARCH = -I. -I$(srcdir) -I$(INCDIR) + SUBDIRS = doc po +diff --git a/bfd/configure b/bfd/configure +index bc242b9..d31f0d9 100755 +--- a/bfd/configure ++++ b/bfd/configure +@@ -3988,7 +3988,7 @@ fi + + # Define the identity of the package. + PACKAGE=bfd +- VERSION=2.22 ++ VERSION=2.22.0 + + + cat >>confdefs.h <<_ACEOF +diff --git a/bfd/configure.ac b/bfd/configure.ac +index 435aaaa..9ba3000 100644 +--- a/bfd/configure.ac ++++ b/bfd/configure.ac +@@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([libbfd.c]) + AC_CANONICAL_TARGET + AC_ISC_POSIX + +-AM_INIT_AUTOMAKE(bfd, 2.22) ++AM_INIT_AUTOMAKE(bfd, 2.22.0) + + dnl These must be called before LT_INIT, because it may want + dnl to call AC_CHECK_PROG. --- binutils-2.25.orig/debian/patches/gprof-build.diff +++ binutils-2.25/debian/patches/gprof-build.diff @@ -0,0 +1,16 @@ +# DP: Fix gprof build error. + +Index: b/gprof/gconfig.in +=================================================================== +--- a/gprof/gconfig.in ++++ b/gprof/gconfig.in +@@ -96,9 +96,6 @@ + #endif + + +-/* Version number of package */ +-#undef VERSION +- + /* Number of bits in a file offset, on hosts where this is settable. */ + #undef _FILE_OFFSET_BITS + --- binutils-2.25.orig/debian/patches/mips64-default-n64.diff +++ binutils-2.25/debian/patches/mips64-default-n64.diff @@ -0,0 +1,66 @@ +Index: b/bfd/config.bfd +=================================================================== +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -1061,6 +1061,16 @@ case "${targ}" in + targ_defvec=mips_elf32_be_vec + targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; ++ mips64*el-*-linux*-gnuabi64) ++ targ_defvec=mips_elf64_trad_le_vec ++ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec" ++ want64=true ++ ;; ++ mips64*-*-linux*-gnuabi64) ++ targ_defvec=mips_elf64_trad_be_vec ++ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" ++ want64=true ++ ;; + mips64*el-*-linux*) + targ_defvec=mips_elf32_ntrad_le_vec + targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" +Index: b/gas/configure.ac +=================================================================== +--- a/gas/configure.ac ++++ b/gas/configure.ac +@@ -287,6 +287,9 @@ changequote([,])dnl + esac + # Decide which ABI to target by default. + case ${target} in ++ mips64*-linux-gnuabi64) ++ mips_default_abi=N64_ABI ++ ;; + mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu) + mips_default_abi=N32_ABI + ;; +Index: b/ld/configure.tgt +=================================================================== +--- a/ld/configure.tgt ++++ b/ld/configure.tgt +@@ -476,6 +476,12 @@ mips*el-*-vxworks*) targ_emul=elf32elmip + mips*-*-vxworks*) targ_emul=elf32ebmipvxworks + targ_extra_emuls="elf32elmipvxworks" ;; + mips*-*-windiss) targ_emul=elf32mipswindiss ;; ++mips64*el-*-linux-gnuabi64) targ_emul=elf64ltsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf32ltsmipn32 elf64btsmip" ++ targ_extra_libpath=$targ_extra_emuls ;; ++mips64*-*-linux-gnuabi64) targ_emul=elf64btsmip ++ targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf32btsmipn32 elf64ltsmip" ++ targ_extra_libpath=$targ_extra_emuls ;; + mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 + targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" + targ_extra_libpath=$targ_extra_emuls ;; +Index: b/gas/configure +=================================================================== +--- a/gas/configure ++++ b/gas/configure +@@ -12197,6 +12197,9 @@ _ACEOF + esac + # Decide which ABI to target by default. + case ${target} in ++ mips64*-linux-gnuabi64) ++ mips_default_abi=N64_ABI ++ ;; + mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu) + mips_default_abi=N32_ABI + ;; --- binutils-2.25.orig/debian/patches/pr-ld-16428.diff +++ binutils-2.25/debian/patches/pr-ld-16428.diff @@ -0,0 +1,158 @@ +# DP: Proposed patch for PR ld/16428, disallow -shared/-pie, -shared/-static, -pie/-static. + +2014-01-10 H.J. Lu + + PR ld/16428 + * ld.texinfo: Updated for -static/-non_shared change. + * ldlex.h (option_values): Add OPTION_STATIC. + * lexsup.c (ld_options): Use OPTION_STATIC for -static/-non_shared. + (parse_args): Handle OPTION_STATIC. Disallow -shared and -pie, + -shared and -static, -pie and -static. + +2014-01-10 H.J. Lu + + PR ld/16428 + * ld-elf/pr16428a.d: New file. + * ld-elf/pr16428b.d: Likewise. + * ld-elf/pr16428c.d: Likewise. + * ld-elf/pr16428d.d: Likewise. + +diff --git a/ld/ld.texinfo b/ld/ld.texinfo +index ae3d568..bddfdfe 100644 +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -1204,11 +1204,11 @@ platforms for which shared libraries are supported. The different + variants of this option are for compatibility with various systems. You + may use this option multiple times on the command line: it affects + library searching for @option{-l} options which follow it. This +-option also implies @option{--unresolved-symbols=report-all}. This +-option can be used with @option{-shared}. Doing so means that a +-shared library is being created but that all of the library's external +-references must be resolved by pulling in entries from static +-libraries. ++option also implies @option{--unresolved-symbols=report-all}. ++@option{-Bstatic} and @option{-dn} can be used with @option{-shared}. ++Doing so means that a shared library is being created but that all of ++the library's external references must be resolved by pulling in entries ++from static libraries. + + @kindex -Bsymbolic + @item -Bsymbolic +diff --git a/ld/ldlex.h b/ld/ldlex.h +index 99f4282..6f237dc 100644 +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -49,6 +49,7 @@ enum option_values + OPTION_NO_WARN_SEARCH_MISMATCH, + OPTION_NOINHIBIT_EXEC, + OPTION_NON_SHARED, ++ OPTION_STATIC, + OPTION_NO_WHOLE_ARCHIVE, + OPTION_OFORMAT, + OPTION_RELAX, +diff --git a/ld/lexsup.c b/ld/lexsup.c +index 2f71750..a366613 100644 +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -269,9 +269,9 @@ static const struct ld_option ld_options[] = + '\0', NULL, N_("Do not link against shared libraries"), ONE_DASH }, + { {"dn", no_argument, NULL, OPTION_NON_SHARED}, + '\0', NULL, NULL, ONE_DASH }, +- { {"non_shared", no_argument, NULL, OPTION_NON_SHARED}, ++ { {"non_shared", no_argument, NULL, OPTION_STATIC}, + '\0', NULL, NULL, ONE_DASH }, +- { {"static", no_argument, NULL, OPTION_NON_SHARED}, ++ { {"static", no_argument, NULL, OPTION_STATIC}, + '\0', NULL, NULL, ONE_DASH }, + { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC}, + '\0', NULL, N_("Bind global references locally"), ONE_DASH }, +@@ -523,6 +523,7 @@ parse_args (unsigned argc, char **argv) + struct option *really_longopts; + int last_optind; + enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR; ++ bfd_boolean seen_pie = FALSE, seen_shared = FALSE, seen_static = FALSE; + + shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2); + longopts = (struct option *) +@@ -707,6 +708,8 @@ parse_args (unsigned argc, char **argv) + case OPTION_CALL_SHARED: + input_flags.dynamic = TRUE; + break; ++ case OPTION_STATIC: ++ seen_static = TRUE; + case OPTION_NON_SHARED: + input_flags.dynamic = FALSE; + break; +@@ -1087,6 +1090,7 @@ parse_args (unsigned argc, char **argv) + case OPTION_SHARED: + if (config.has_shared) + { ++ seen_shared = TRUE; + link_info.shared = TRUE; + /* When creating a shared library, the default + behaviour is to ignore any unresolved references. */ +@@ -1101,6 +1105,7 @@ parse_args (unsigned argc, char **argv) + case OPTION_PIE: + if (config.has_shared) + { ++ seen_pie = TRUE; + link_info.shared = TRUE; + link_info.pie = TRUE; + } +@@ -1445,6 +1450,16 @@ parse_args (unsigned argc, char **argv) + } + } + ++ if (seen_shared) ++ { ++ if (seen_pie) ++ einfo (_("%P%F: -shared and -pie are incompatible\n")); ++ if (seen_static) ++ einfo (_("%P%F: -shared and -static are incompatible\n")); ++ } ++ if (seen_pie && seen_static) ++ einfo (_("%P%F: -pie and -static are incompatible\n")); ++ + while (ingroup) + { + lang_leave_group (); +diff --git a/ld/testsuite/ld-elf/pr16428a.d b/ld/testsuite/ld-elf/pr16428a.d +new file mode 100644 +index 0000000..8f5e833 +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr16428a.d +@@ -0,0 +1,4 @@ ++#source: start.s ++#ld: -shared -static ++#target: *-*-linux* *-*-gnu* *-*-nacl* ++#error: -shared and -static are incompatible +diff --git a/ld/testsuite/ld-elf/pr16428b.d b/ld/testsuite/ld-elf/pr16428b.d +new file mode 100644 +index 0000000..f4ccba0 +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr16428b.d +@@ -0,0 +1,4 @@ ++#source: start.s ++#ld: -shared -non_shared ++#target: *-*-linux* *-*-gnu* *-*-nacl* ++#error: -shared and -static are incompatible +diff --git a/ld/testsuite/ld-elf/pr16428c.d b/ld/testsuite/ld-elf/pr16428c.d +new file mode 100644 +index 0000000..747e8da +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr16428c.d +@@ -0,0 +1,4 @@ ++#source: start.s ++#ld: -shared -pie ++#target: *-*-linux* *-*-gnu* *-*-nacl* ++#error: -shared and -pie are incompatible +diff --git a/ld/testsuite/ld-elf/pr16428d.d b/ld/testsuite/ld-elf/pr16428d.d +new file mode 100644 +index 0000000..6e7a915 +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr16428d.d +@@ -0,0 +1,4 @@ ++#source: start.s ++#ld: -pie -static ++#target: *-*-linux* *-*-gnu* *-*-nacl* ++#error: -pie and -static are incompatible --- binutils-2.25.orig/debian/patches/pr17481.diff +++ binutils-2.25/debian/patches/pr17481.diff @@ -0,0 +1,1583 @@ +# DP: Fix PR bfd/17481 + +bfd/ + +2014-10-15 Alan Modra + + PR 17481 + * aoutx.h (NAME (aout, find_nearest_line)): Add "discriminator_ptr" + param, group "section" and "offset" params. Zero discriminator. + * bfd.c (bfd_find_nearest_line): Implement with new + _bfd_find_nearest_line. + (bfd_find_nearest_line_discriminator): Likewise. + * coff-i386.c (_bfd_generic_find_nearest_line_discriminator): Don't + define. + * coff-rs6000.c (xcoff_find_nearest_line, + xcoff_find_nearest_line_discriminator): Delete. + (_bfd_xcoff_find_nearest_line): Don't define. + (_bfd_xcoff_find_nearest_line): Define as coff_find_nearest_line. + * coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator): Don't + define. + * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Adjust. + * coffgen.c (coff_find_nearest_line_with_names): Reorder params, + adjust _bfd_dwarf2_find_nearest_line call. + (coff_find_nearest_line): Add "discriminator_ptr" param, reorder + others. Set discriminator. Adjust call. + (coff_find_nearest_line_discriminator): Delete. + * dwarf1.c (_bfd_dwarf1_find_nearest_line): Reorder params. + * dwarf2.c (find_line): Rename to.. + (_bfd_dwarf2_find_nearest_line): ..this, reordering params. + Simplify setting of do_line. Delete old function. + (_bfd_dwarf2_find_line): Delete. + * ecoff.c (_bfd_ecoff_find_nearest_line): Reorder params, add + discriminator_ptr and set it. + * elf-bfd.h (_bfd_elf_find_nearest_line): Update prototype. + (_bfd_elf_find_nearest_line_discriminator): Delete. + (_bfd_elf_find_line_discriminator): Delete. + (_bfd_generic_find_nearest_line_discriminator): Don't define. + * elf.c (elf_find_function): Reorder params. + (_bfd_elf_find_nearest_line): Reorder params, add discriminator_ptr. + Adjust calls. + (_bfd_elf_find_nearest_line_discriminator): Delete. + (_bfd_elf_find_line): Adjust call. + * elf32-arm.c (arm_elf_find_function): Reorder params. + (elf32_arm_find_nearest_line): Reorder params, add discriminator_ptr. + Adjust calls. + * elf64-alpha.c (elf64_alpha_find_nearest_line): Similarly. + * elfnn-aarch64.c (aarch64_elf_find_function): Reorder params. + (elfNN_aarch64_find_nearest_line): Reorder params, add + discriminator_ptr. Adjust calls. + * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. + * elfxx-mips.h (_bfd_mips_elf_find_nearest_line): Update prototype. + * libaout.h (NAME (aout, find_nearest_line)): Update prototype. + * libbfd-in.h (_bfd_nosymbols_find_nearest_line): Update. + (_bfd_dwarf1_find_nearest_line): Likewise. + (_bfd_dwarf2_find_nearest_line): Likewise. + (_bfd_dwarf2_find_line): Delete. + (_bfd_generic_find_nearest_line_discriminator): Delete. + * libbfd.c (_bfd_generic_find_nearest_line_discriminator): Delete. + * libcoff-in.h (coff_find_nearest_line): Update prototype. + (coff_find_nearest_line_discriminator): Delete. + (coff_find_nearest_line_with_names): Update prototype. + * libecoff.h (_bfd_ecoff_find_nearest_line): Update prototype. + * mach-o.c (bfd_mach_o_find_nearest_line): Reorder params, add + discriminator_ptr. Adjust calls. + * mach-o.h (bfd_mach_o_find_nearest_line): Update prototype. + * pdp11.c (NAME (aout, find_nearest_line)): Reorder params, add + discriminator_ptr and set. + * som.c (som_find_nearest_line): Similarly. + * targets.c (BFD_JUMP_TABLE_SYMBOLS): Delete entry for + _bfd_find_nearest_line_discriminator. + (struct bfd_target <_bfd_find_nearest_line>): Adjust prototype. + (struct bfd_target <_bfd_find_nearest_line_discriminator>): Delete. + * vms-alpha.c (_bfd_vms_find_nearest_dst_line): Rename to.. + (_bfd_vms_find_nearest_line): ..this. Reorder params, add + "discriminator" and set. + (_bfd_vms_find_nearest_line_discriminator): Delete. + (_bfd_generic_find_nearest_line_discriminator): Don't define. + (alpha_vms_find_nearest_line): Update define. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + +2014-10-15 Alan Modra + + * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line. + * aout-adobe.c (aout_32_find_line): Define. + (aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup, + aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define. + * aout-target.h (MY_find_line): Define. + * aout-tic30.c (MY_find_line): Define. + * binary.c (binary_find_line): Define. + * bout.c (aout_32_find_line): Define. + * coff-rs6000.c (_bfd_xcoff_find_line): Define. + * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line. + (rs6000_xcoff64_aix_vec): Likewise. + * elf-bfd.h (_bfd_generic_find_line): Don't define. + * elfxx-target.h (bfd_elfNN_find_line): Define. + * i386msdos.c (msdos_find_line): Define. + * i386os9k.c (aout_32_find_line): Define. + * ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func. + (ieee_find_nearest_line, ieee_find_line, + ieee_find_inliner_info): Define. + * ihex.c (ihex_find_line): Define. + * libbfd-in.h (_bfd_nosymbols_find_line): Define. + (_bfd_generic_find_line): Don't define. + * libbfd.c (_bfd_generic_find_line): Delete. + * libcoff-in.h (coff_find_line): Define. + * libecoff.h (_bfd_ecoff_find_line): Define. + * mach-o.h (bfd_mach_o_find_line): Define. + * mmo.c (mmo_find_line): Define. + * nlm-target.h (nlm_find_line): Define. + * oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete. + (oasys_find_nearest_line, oasys_find_line, + oasys_find_inliner_info): Define. + * pef.c (bfd_pef_find_line): Define. + * plugin.c (bfd_plugin_find_line): Define. + * ppcboot.c (ppcboot_find_line): Define. + * som.c (som_find_line): Define. + * srec.c (srec_find_line): Define. + * tekhex.c (tekhex_find_line): Define. + * versados.c (versados_find_line): Define. + * vms-alpha.c (alpha_vms_find_line): Define. + * xsym.c (bfd_sym_find_line): Define. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + +--- a/bfd/aout-adobe.c ++++ b/bfd/aout-adobe.c +@@ -446,9 +446,10 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, + + /* Build the transfer vector for Adobe A.Out files. */ + +-#define aout_32_bfd_make_debug_symbol ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) +-#define aout_32_bfd_reloc_type_lookup ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) +-#define aout_32_bfd_reloc_name_lookup ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr) ++#define aout_32_find_line _bfd_nosymbols_find_line ++#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol ++#define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup ++#define aout_32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup + #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info + #define aout_32_set_arch_mach aout_adobe_set_arch_mach + #define aout_32_set_section_contents aout_adobe_set_section_contents +--- a/bfd/aout-target.h ++++ b/bfd/aout-target.h +@@ -468,6 +468,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) + #ifndef MY_find_nearest_line + #define MY_find_nearest_line NAME (aout, find_nearest_line) + #endif ++#ifndef MY_find_line ++#define MY_find_line _bfd_nosymbols_find_line ++#endif + #ifndef MY_find_inliner_info + #define MY_find_inliner_info _bfd_nosymbols_find_inliner_info + #endif +--- a/bfd/aout-tic30.c ++++ b/bfd/aout-tic30.c +@@ -926,6 +926,9 @@ tic30_aout_set_arch_mach (bfd *abfd, + #ifndef MY_find_nearest_line + #define MY_find_nearest_line NAME (aout, find_nearest_line) + #endif ++#ifndef MY_find_line ++#define MY_find_line _bfd_nosymbols_find_line ++#endif + #ifndef MY_find_inliner_info + #define MY_find_inliner_info _bfd_nosymbols_find_inliner_info + #endif +--- a/bfd/aoutx.h ++++ b/bfd/aoutx.h +@@ -2640,12 +2640,13 @@ NAME (aout, minisymbol_to_symbol) (bfd *abfd, + + bfd_boolean + NAME (aout, find_nearest_line) (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *disriminator_ptr) + { + /* Run down the file looking for the filename, function and linenumber. */ + asymbol **p; +@@ -2663,6 +2664,8 @@ NAME (aout, find_nearest_line) (bfd *abfd, + *filename_ptr = abfd->filename; + *functionname_ptr = 0; + *line_ptr = 0; ++ if (disriminator_ptr) ++ *disriminator_ptr = 0; + + if (symbols != NULL) + { +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -6651,12 +6651,12 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); + + #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ + BFD_SEND (abfd, _bfd_find_nearest_line, \ +- (abfd, sec, syms, off, file, func, line)) ++ (abfd, syms, sec, off, file, func, line, NULL)) + + #define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ + line, disc) \ +- BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \ +- (abfd, sec, syms, off, file, func, line, disc)) ++ BFD_SEND (abfd, _bfd_find_nearest_line, \ ++ (abfd, syms, sec, off, file, func, line, disc)) + + #define bfd_find_line(abfd, syms, sym, file, line) \ + BFD_SEND (abfd, _bfd_find_line, \ +@@ -7018,8 +7018,7 @@ typedef struct bfd_target + NAME##_bfd_is_target_special_symbol, \ + NAME##_get_lineno, \ + NAME##_find_nearest_line, \ +- _bfd_generic_find_nearest_line_discriminator, \ +- _bfd_generic_find_line, \ ++ NAME##_find_line, \ + NAME##_find_inliner_info, \ + NAME##_bfd_make_debug_symbol, \ + NAME##_read_minisymbols, \ +@@ -7040,10 +7039,7 @@ typedef struct bfd_target + bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); + alent * (*_get_lineno) (bfd *, struct bfd_symbol *); + bfd_boolean (*_bfd_find_nearest_line) +- (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, +- const char **, const char **, unsigned int *); +- bfd_boolean (*_bfd_find_nearest_line_discriminator) +- (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, ++ (bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma, + const char **, const char **, unsigned int *, unsigned int *); + bfd_boolean (*_bfd_find_line) + (bfd *, struct bfd_symbol **, struct bfd_symbol *, +--- a/bfd/bfd.c ++++ b/bfd/bfd.c +@@ -1444,12 +1444,12 @@ DESCRIPTION + . + .#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ + . BFD_SEND (abfd, _bfd_find_nearest_line, \ +-. (abfd, sec, syms, off, file, func, line)) ++. (abfd, syms, sec, off, file, func, line, NULL)) + . + .#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ + . line, disc) \ +-. BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \ +-. (abfd, sec, syms, off, file, func, line, disc)) ++. BFD_SEND (abfd, _bfd_find_nearest_line, \ ++. (abfd, syms, sec, off, file, func, line, disc)) + . + .#define bfd_find_line(abfd, syms, sym, file, line) \ + . BFD_SEND (abfd, _bfd_find_line, \ +--- a/bfd/binary.c ++++ b/bfd/binary.c +@@ -204,6 +204,7 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, + #define binary_bfd_is_local_label_name bfd_generic_is_local_label_name + #define binary_get_lineno _bfd_nosymbols_get_lineno + #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define binary_find_line _bfd_nosymbols_find_line + #define binary_find_inliner_info _bfd_nosymbols_find_inliner_info + #define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define binary_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/bout.c ++++ b/bfd/bout.c +@@ -1374,6 +1374,7 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd, + + /* Build the transfer vectors for Big and Little-Endian B.OUT files. */ + ++#define aout_32_find_line _bfd_nosymbols_find_line + #define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info + #define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +--- a/bfd/coff-i386.c ++++ b/bfd/coff-i386.c +@@ -605,9 +605,6 @@ coff_i386_is_local_label_name (bfd *abfd, const char *name) + + #include "coffcode.h" + +-#define _bfd_generic_find_nearest_line_discriminator \ +- coff_find_nearest_line_discriminator +- + const bfd_target + #ifdef TARGET_SYM + TARGET_SYM = +--- a/bfd/coff-rs6000.c ++++ b/bfd/coff-rs6000.c +@@ -430,39 +430,6 @@ static const struct dwarf_debug_section xcoff_debug_sections[] = + { NULL, NULL }, /* .debug_weaknames */ + { NULL, NULL }, + }; +- +-static bfd_boolean +-xcoff_find_nearest_line (bfd *abfd, +- asection *section, +- asymbol **symbols, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *line_ptr) +-{ +- return coff_find_nearest_line_with_names (abfd, xcoff_debug_sections, +- section, symbols, offset, +- filename_ptr, functionname_ptr, +- line_ptr); +-} +- +-static bfd_boolean +-xcoff_find_nearest_line_discriminator (bfd *abfd, +- asection *section, +- asymbol **symbols, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *line_ptr, +- unsigned int *discriminator) +-{ +- *discriminator = 0; +- return coff_find_nearest_line_with_names (abfd, xcoff_debug_sections, +- section, symbols, offset, +- filename_ptr, functionname_ptr, +- line_ptr); +-} +- + + void + _bfd_xcoff_swap_sym_in (bfd *abfd, void * ext1, void * in1) +@@ -4045,9 +4012,8 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = { + #define _bfd_xcoff_bfd_is_target_special_symbol \ + coff_bfd_is_target_special_symbol + #define _bfd_xcoff_get_lineno coff_get_lineno +-#define _bfd_xcoff_find_nearest_line xcoff_find_nearest_line +-#define _bfd_generic_find_nearest_line_discriminator \ +- xcoff_find_nearest_line_discriminator ++#define _bfd_xcoff_find_nearest_line coff_find_nearest_line ++#define _bfd_xcoff_find_line coff_find_line + #define _bfd_xcoff_find_inliner_info coff_find_inliner_info + #define _bfd_xcoff_bfd_make_debug_symbol coff_bfd_make_debug_symbol + #define _bfd_xcoff_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/coff-x86_64.c ++++ b/bfd/coff-x86_64.c +@@ -730,9 +730,6 @@ coff_amd64_is_local_label_name (bfd *abfd, const char *name) + #define amd64coff_object_p coff_object_p + #endif + +-#define _bfd_generic_find_nearest_line_discriminator \ +- coff_find_nearest_line_discriminator +- + const bfd_target + #ifdef TARGET_SYM + TARGET_SYM = +--- a/bfd/coff64-rs6000.c ++++ b/bfd/coff64-rs6000.c +@@ -2716,8 +2716,7 @@ const bfd_target rs6000_xcoff64_vec = + coff_bfd_is_target_special_symbol, + coff_get_lineno, + coff_find_nearest_line, +- _bfd_generic_find_nearest_line_discriminator, +- _bfd_generic_find_line, ++ coff_find_line, + coff_find_inliner_info, + coff_bfd_make_debug_symbol, + _bfd_generic_read_minisymbols, +@@ -2974,8 +2973,7 @@ const bfd_target rs6000_xcoff64_aix_vec = + coff_bfd_is_target_special_symbol, + coff_get_lineno, + coff_find_nearest_line, +- _bfd_generic_find_nearest_line_discriminator, +- _bfd_generic_find_line, ++ coff_find_line, + coff_find_inliner_info, + coff_bfd_make_debug_symbol, + _bfd_generic_read_minisymbols, +--- a/bfd/coffgen.c ++++ b/bfd/coffgen.c +@@ -2191,13 +2191,13 @@ _bfd_coff_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, + + bfd_boolean + coff_find_nearest_line_with_names (bfd *abfd, +- const struct dwarf_debug_section *debug_sections, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ const struct dwarf_debug_section *debug_sections) + { + bfd_boolean found; + unsigned int i; +@@ -2222,10 +2222,9 @@ coff_find_nearest_line_with_names (bfd *abfd, + return TRUE; + + /* Also try examining DWARF2 debugging information. */ +- if (_bfd_dwarf2_find_nearest_line (abfd, debug_sections, +- section, symbols, offset, ++ if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, + filename_ptr, functionname_ptr, +- line_ptr, NULL, 0, ++ line_ptr, NULL, debug_sections, 0, + &coff_data(abfd)->dwarf2_find_line_info)) + return TRUE; + +@@ -2407,38 +2406,22 @@ coff_find_nearest_line_with_names (bfd *abfd, + + bfd_boolean + coff_find_nearest_line (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { +- return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections, +- section, symbols, offset, ++ if (discriminator_ptr) ++ *discriminator_ptr = 0; ++ return coff_find_nearest_line_with_names (abfd, symbols, section, offset, + filename_ptr, functionname_ptr, +- line_ptr); ++ line_ptr, dwarf_debug_sections); + } + + bfd_boolean +-coff_find_nearest_line_discriminator (bfd *abfd, +- asection *section, +- asymbol **symbols, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *line_ptr, +- unsigned int *discriminator) +-{ +- *discriminator = 0; +- return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections, +- section, symbols, offset, +- filename_ptr, functionname_ptr, +- line_ptr); +-} +- +- +-bfd_boolean + coff_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, +--- a/bfd/dwarf1.c ++++ b/bfd/dwarf1.c +@@ -449,8 +449,8 @@ dwarf1_unit_find_nearest_line (struct dwarf1_debug* stash, + + bfd_boolean + _bfd_dwarf1_find_nearest_line (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +--- a/bfd/dwarf2.c ++++ b/bfd/dwarf2.c +@@ -3602,19 +3602,19 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, + field and in the abbreviation offset, or zero to indicate that the + default value should be used. */ + +-static bfd_boolean +-find_line (bfd *abfd, +- const struct dwarf_debug_section *debug_sections, +- asection *section, +- bfd_vma offset, +- asymbol *symbol, +- asymbol **symbols, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *linenumber_ptr, +- unsigned int *discriminator_ptr, +- unsigned int addr_size, +- void **pinfo) ++bfd_boolean ++_bfd_dwarf2_find_nearest_line (bfd *abfd, ++ asymbol **symbols, ++ asymbol *symbol, ++ asection *section, ++ bfd_vma offset, ++ const char **filename_ptr, ++ const char **functionname_ptr, ++ unsigned int *linenumber_ptr, ++ unsigned int *discriminator_ptr, ++ const struct dwarf_debug_section *debug_sections, ++ unsigned int addr_size, ++ void **pinfo) + { + /* Read each compilation unit from the section .debug_info, and check + to see if it contains the address we are searching for. If yes, +@@ -3645,21 +3645,18 @@ find_line (bfd *abfd, + + stash = (struct dwarf2_debug *) *pinfo; + +- do_line = (section == NULL +- && offset == 0 +- && functionname_ptr == NULL +- && symbol != NULL); ++ do_line = symbol != NULL; + if (do_line) + { +- addr = symbol->value; ++ BFD_ASSERT (section == NULL && offset == 0 && functionname_ptr == NULL); + section = bfd_get_section (symbol); ++ addr = symbol->value; + } +- else if (section != NULL +- && functionname_ptr != NULL +- && symbol == NULL) +- addr = offset; + else +- abort (); ++ { ++ BFD_ASSERT (section != NULL && functionname_ptr != NULL); ++ addr = offset; ++ } + + if (section->output_section) + addr += section->output_section->vma + section->output_offset; +@@ -3874,45 +3871,6 @@ find_line (bfd *abfd, + return found; + } + +-/* The DWARF2 version of find_nearest_line. +- Return TRUE if the line is found without error. */ +- +-bfd_boolean +-_bfd_dwarf2_find_nearest_line (bfd *abfd, +- const struct dwarf_debug_section *debug_sections, +- asection *section, +- asymbol **symbols, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *linenumber_ptr, +- unsigned int *discriminator_ptr, +- unsigned int addr_size, +- void **pinfo) +-{ +- return find_line (abfd, debug_sections, section, offset, NULL, symbols, +- filename_ptr, functionname_ptr, linenumber_ptr, +- discriminator_ptr, addr_size, pinfo); +-} +- +-/* The DWARF2 version of find_line. +- Return TRUE if the line is found without error. */ +- +-bfd_boolean +-_bfd_dwarf2_find_line (bfd *abfd, +- asymbol **symbols, +- asymbol *symbol, +- const char **filename_ptr, +- unsigned int *linenumber_ptr, +- unsigned int *discriminator_ptr, +- unsigned int addr_size, +- void **pinfo) +-{ +- return find_line (abfd, dwarf_debug_sections, NULL, 0, symbol, symbols, +- filename_ptr, NULL, linenumber_ptr, discriminator_ptr, +- addr_size, pinfo); +-} +- + bfd_boolean + _bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, + const char **filename_ptr, +--- a/bfd/ecoff.c ++++ b/bfd/ecoff.c +@@ -1704,12 +1704,13 @@ _bfd_ecoff_canonicalize_reloc (bfd *abfd, + + bfd_boolean + _bfd_ecoff_find_nearest_line (bfd *abfd, ++ asymbol **symbols ATTRIBUTE_UNUSED, + asection *section, +- asymbol **ignore_symbols ATTRIBUTE_UNUSED, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *retline_ptr) ++ unsigned int *retline_ptr, ++ unsigned int *discriminator_ptr) + { + const struct ecoff_debug_swap * const debug_swap + = &ecoff_backend (abfd)->debug_swap; +@@ -1730,8 +1731,10 @@ _bfd_ecoff_find_nearest_line (bfd *abfd, + if (ecoff_data (abfd)->find_line_info == NULL) + return FALSE; + } +- line_info = ecoff_data (abfd)->find_line_info; + ++ if (discriminator_ptr) ++ *discriminator_ptr = 0; ++ line_info = ecoff_data (abfd)->find_line_info; + return _bfd_ecoff_locate_line (abfd, section, offset, debug_info, + debug_swap, line_info, filename_ptr, + functionname_ptr, retline_ptr); +--- a/bfd/elf-bfd.h ++++ b/bfd/elf-bfd.h +@@ -1898,18 +1898,10 @@ extern alent *_bfd_elf_get_lineno + extern bfd_boolean _bfd_elf_set_arch_mach + (bfd *, enum bfd_architecture, unsigned long); + extern bfd_boolean _bfd_elf_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, +- unsigned int *); +-extern bfd_boolean _bfd_elf_find_nearest_line_discriminator +- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, +- unsigned int *, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *); + extern bfd_boolean _bfd_elf_find_line + (bfd *, asymbol **, asymbol *, const char **, unsigned int *); +-extern bfd_boolean _bfd_elf_find_line_discriminator +- (bfd *, asymbol **, asymbol *, const char **, unsigned int *, unsigned int *); +-#define _bfd_generic_find_line _bfd_elf_find_line +-#define _bfd_generic_find_nearest_line_discriminator \ +- _bfd_elf_find_nearest_line_discriminator + extern bfd_boolean _bfd_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); + #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -7549,8 +7549,8 @@ _bfd_elf_set_arch_mach (bfd *abfd, + + static bfd_boolean + elf_find_function (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr) +@@ -7652,52 +7652,35 @@ elf_find_function (bfd *abfd, + + bfd_boolean + _bfd_elf_find_nearest_line (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) +-{ +- return _bfd_elf_find_nearest_line_discriminator (abfd, section, symbols, +- offset, filename_ptr, +- functionname_ptr, +- line_ptr, +- NULL); +-} +- +-bfd_boolean +-_bfd_elf_find_nearest_line_discriminator (bfd *abfd, +- asection *section, +- asymbol **symbols, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *line_ptr, +- unsigned int *discriminator_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + bfd_boolean found; + +- if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, ++ if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, + filename_ptr, functionname_ptr, +- line_ptr)) ++ line_ptr, discriminator_ptr, ++ dwarf_debug_sections, 0, ++ &elf_tdata (abfd)->dwarf2_find_line_info)) + { + if (!*functionname_ptr) +- elf_find_function (abfd, section, symbols, offset, ++ elf_find_function (abfd, symbols, section, offset, + *filename_ptr ? NULL : filename_ptr, + functionname_ptr); + + return TRUE; + } + +- if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, +- section, symbols, offset, +- filename_ptr, functionname_ptr, +- line_ptr, discriminator_ptr, 0, +- &elf_tdata (abfd)->dwarf2_find_line_info)) ++ if (_bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset, ++ filename_ptr, functionname_ptr, line_ptr)) + { + if (!*functionname_ptr) +- elf_find_function (abfd, section, symbols, offset, ++ elf_find_function (abfd, symbols, section, offset, + *filename_ptr ? NULL : filename_ptr, + functionname_ptr); + +@@ -7715,7 +7698,7 @@ _bfd_elf_find_nearest_line_discriminator (bfd *abfd, + if (symbols == NULL) + return FALSE; + +- if (! elf_find_function (abfd, section, symbols, offset, ++ if (! elf_find_function (abfd, symbols, section, offset, + filename_ptr, functionname_ptr)) + return FALSE; + +@@ -7729,20 +7712,10 @@ bfd_boolean + _bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol, + const char **filename_ptr, unsigned int *line_ptr) + { +- return _bfd_elf_find_line_discriminator (abfd, symbols, symbol, +- filename_ptr, line_ptr, +- NULL); +-} +- +-bfd_boolean +-_bfd_elf_find_line_discriminator (bfd *abfd, asymbol **symbols, asymbol *symbol, +- const char **filename_ptr, +- unsigned int *line_ptr, +- unsigned int *discriminator_ptr) +-{ +- return _bfd_dwarf2_find_line (abfd, symbols, symbol, +- filename_ptr, line_ptr, discriminator_ptr, 0, +- &elf_tdata (abfd)->dwarf2_find_line_info); ++ return _bfd_dwarf2_find_nearest_line (abfd, symbols, symbol, NULL, 0, ++ filename_ptr, NULL, line_ptr, NULL, ++ dwarf_debug_sections, 0, ++ &elf_tdata (abfd)->dwarf2_find_line_info); + } + + /* After a call to bfd_find_nearest_line, successive calls to +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -13083,8 +13083,8 @@ elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym) + + static bfd_boolean + arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED, +- asection * section, + asymbol ** symbols, ++ asection * section, + bfd_vma offset, + const char ** filename_ptr, + const char ** functionname_ptr) +@@ -13145,31 +13145,33 @@ arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED, + + static bfd_boolean + elf32_arm_find_nearest_line (bfd * abfd, +- asection * section, + asymbol ** symbols, ++ asection * section, + bfd_vma offset, + const char ** filename_ptr, + const char ** functionname_ptr, +- unsigned int * line_ptr) ++ unsigned int * line_ptr, ++ unsigned int * discriminator_ptr) + { + bfd_boolean found = FALSE; + +- /* We skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain uses it. */ +- +- if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, +- section, symbols, offset, ++ if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, + filename_ptr, functionname_ptr, +- line_ptr, NULL, 0, ++ line_ptr, discriminator_ptr, ++ dwarf_debug_sections, 0, + & elf_tdata (abfd)->dwarf2_find_line_info)) + { + if (!*functionname_ptr) +- arm_elf_find_function (abfd, section, symbols, offset, ++ arm_elf_find_function (abfd, symbols, section, offset, + *filename_ptr ? NULL : filename_ptr, + functionname_ptr); + + return TRUE; + } + ++ /* Skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain ++ uses DWARF1. */ ++ + if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, + & found, filename_ptr, + functionname_ptr, line_ptr, +@@ -13182,7 +13184,7 @@ elf32_arm_find_nearest_line (bfd * abfd, + if (symbols == NULL) + return FALSE; + +- if (! arm_elf_find_function (abfd, section, symbols, offset, ++ if (! arm_elf_find_function (abfd, symbols, section, offset, + filename_ptr, functionname_ptr)) + return FALSE; + +--- a/bfd/elf64-alpha.c ++++ b/bfd/elf64-alpha.c +@@ -1442,17 +1442,19 @@ elf64_alpha_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) + } + + static bfd_boolean +-elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, +- bfd_vma offset, const char **filename_ptr, ++elf64_alpha_find_nearest_line (bfd *abfd, asymbol **symbols, ++ asection *section, bfd_vma offset, ++ const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + asection *msec; + +- if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, +- section, symbols, offset, ++ if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, + filename_ptr, functionname_ptr, +- line_ptr, NULL, 0, ++ line_ptr, discriminator_ptr, ++ dwarf_debug_sections, 0, + &elf_tdata (abfd)->dwarf2_find_line_info)) + return TRUE; + +@@ -1532,9 +1534,9 @@ elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, + + /* Fall back on the generic ELF find_nearest_line routine. */ + +- return _bfd_elf_find_nearest_line (abfd, section, symbols, offset, ++ return _bfd_elf_find_nearest_line (abfd, symbols, section, offset, + filename_ptr, functionname_ptr, +- line_ptr); ++ line_ptr, discriminator_ptr); + } + + /* Structure used to pass information to alpha_elf_output_extsym. */ +--- a/bfd/elfnn-aarch64.c ++++ b/bfd/elfnn-aarch64.c +@@ -5353,8 +5353,8 @@ elfNN_aarch64_is_target_special_symbol (bfd *abfd ATTRIBUTE_UNUSED, + + static bfd_boolean + aarch64_elf_find_function (bfd *abfd ATTRIBUTE_UNUSED, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr) +@@ -5413,32 +5413,33 @@ aarch64_elf_find_function (bfd *abfd ATTRIBUTE_UNUSED, + + static bfd_boolean + elfNN_aarch64_find_nearest_line (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + bfd_boolean found = FALSE; + +- /* We skip _bfd_dwarf1_find_nearest_line since no known AArch64 +- toolchain uses it. */ +- +- if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, +- section, symbols, offset, ++ if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, + filename_ptr, functionname_ptr, +- line_ptr, NULL, 0, ++ line_ptr, discriminator_ptr, ++ dwarf_debug_sections, 0, + &elf_tdata (abfd)->dwarf2_find_line_info)) + { + if (!*functionname_ptr) +- aarch64_elf_find_function (abfd, section, symbols, offset, ++ aarch64_elf_find_function (abfd, symbols, section, offset, + *filename_ptr ? NULL : filename_ptr, + functionname_ptr); + + return TRUE; + } + ++ /* Skip _bfd_dwarf1_find_nearest_line since no known AArch64 ++ toolchain uses DWARF1. */ ++ + if (!_bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, + &found, filename_ptr, + functionname_ptr, line_ptr, +@@ -5451,7 +5452,7 @@ elfNN_aarch64_find_nearest_line (bfd *abfd, + if (symbols == NULL) + return FALSE; + +- if (!aarch64_elf_find_function (abfd, section, symbols, offset, ++ if (!aarch64_elf_find_function (abfd, symbols, section, offset, + filename_ptr, functionname_ptr)) + return FALSE; + +--- a/bfd/elfxx-mips.c ++++ b/bfd/elfxx-mips.c +@@ -12591,24 +12591,26 @@ struct mips_elf_find_line + }; + + bfd_boolean +-_bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, +- asymbol **symbols, bfd_vma offset, ++_bfd_mips_elf_find_nearest_line (bfd *abfd, asymbol **symbols, ++ asection *section, bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + asection *msec; + +- if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, ++ if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, + filename_ptr, functionname_ptr, +- line_ptr)) ++ line_ptr, discriminator_ptr, ++ dwarf_debug_sections, ++ ABI_64_P (abfd) ? 8 : 0, ++ &elf_tdata (abfd)->dwarf2_find_line_info)) + return TRUE; + +- if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, +- section, symbols, offset, ++ if (_bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset, + filename_ptr, functionname_ptr, +- line_ptr, NULL, ABI_64_P (abfd) ? 8 : 0, +- &elf_tdata (abfd)->dwarf2_find_line_info)) ++ line_ptr)) + return TRUE; + + msec = bfd_get_section_by_name (abfd, ".mdebug"); +@@ -12687,9 +12689,9 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, + + /* Fall back on the generic ELF find_nearest_line routine. */ + +- return _bfd_elf_find_nearest_line (abfd, section, symbols, offset, ++ return _bfd_elf_find_nearest_line (abfd, symbols, section, offset, + filename_ptr, functionname_ptr, +- line_ptr); ++ line_ptr, discriminator_ptr); + } + + bfd_boolean +--- a/bfd/elfxx-mips.h ++++ b/bfd/elfxx-mips.h +@@ -86,8 +86,8 @@ extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs + extern bfd_boolean _bfd_mips_elf_is_target_special_symbol + (bfd *abfd, asymbol *sym); + extern bfd_boolean _bfd_mips_elf_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *); + extern bfd_boolean _bfd_mips_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); + extern bfd_boolean _bfd_mips_elf_set_section_contents +--- a/bfd/elfxx-target.h ++++ b/bfd/elfxx-target.h +@@ -49,6 +49,9 @@ + #ifndef bfd_elfNN_find_nearest_line + #define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line + #endif ++#ifndef bfd_elfNN_find_line ++#define bfd_elfNN_find_line _bfd_elf_find_line ++#endif + #ifndef bfd_elfNN_find_inliner_info + #define bfd_elfNN_find_inliner_info _bfd_elf_find_inliner_info + #endif +--- a/bfd/i386msdos.c ++++ b/bfd/i386msdos.c +@@ -163,6 +163,7 @@ msdos_set_section_contents (bfd *abfd, + #define msdos_print_symbol _bfd_nosymbols_print_symbol + #define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info + #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define msdos_find_line _bfd_nosymbols_find_line + #define msdos_find_inliner_info _bfd_nosymbols_find_inliner_info + #define msdos_get_lineno _bfd_nosymbols_get_lineno + #define msdos_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +--- a/bfd/i386os9k.c ++++ b/bfd/i386os9k.c +@@ -154,6 +154,7 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + + #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info + ++#define aout_32_find_line _bfd_nosymbols_find_line + #define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + + #define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +--- a/bfd/ieee.c ++++ b/bfd/ieee.c +@@ -3675,26 +3675,9 @@ ieee_openr_next_archived_file (bfd *arch, bfd *prev) + } + } + +-static bfd_boolean +-ieee_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, +- asection *section ATTRIBUTE_UNUSED, +- asymbol **symbols ATTRIBUTE_UNUSED, +- bfd_vma offset ATTRIBUTE_UNUSED, +- const char **filename_ptr ATTRIBUTE_UNUSED, +- const char **functionname_ptr ATTRIBUTE_UNUSED, +- unsigned int *line_ptr ATTRIBUTE_UNUSED) +-{ +- return FALSE; +-} +- +-static bfd_boolean +-ieee_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, +- const char **filename_ptr ATTRIBUTE_UNUSED, +- const char **functionname_ptr ATTRIBUTE_UNUSED, +- unsigned int *line_ptr ATTRIBUTE_UNUSED) +-{ +- return FALSE; +-} ++#define ieee_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define ieee_find_line _bfd_nosymbols_find_line ++#define ieee_find_inliner_info _bfd_nosymbols_find_inliner_info + + static int + ieee_generic_stat_arch_elt (bfd *abfd, struct stat *buf) +--- a/bfd/ihex.c ++++ b/bfd/ihex.c +@@ -922,6 +922,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + #define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name + #define ihex_get_lineno _bfd_nosymbols_get_lineno + #define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define ihex_find_line _bfd_nosymbols_find_line + #define ihex_find_inliner_info _bfd_nosymbols_find_inliner_info + #define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols +--- a/bfd/libaout.h ++++ b/bfd/libaout.h +@@ -551,8 +551,8 @@ extern void NAME (aout, get_symbol_info) + (bfd *, asymbol *, symbol_info *); + + extern bfd_boolean NAME (aout, find_nearest_line) +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *); + + extern long NAME (aout, read_minisymbols) + (bfd *, bfd_boolean, void * *, unsigned int *); +--- a/bfd/libbfd-in.h ++++ b/bfd/libbfd-in.h +@@ -399,8 +399,13 @@ extern bfd_boolean _bfd_vms_lib_ia64_mkarchive (bfd *abfd); + #define _bfd_nosymbols_get_lineno \ + ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) + #define _bfd_nosymbols_find_nearest_line \ +- ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ +- const char **, unsigned int *)) \ ++ ((bfd_boolean (*) (bfd *, asymbol **, asection *, bfd_vma, \ ++ const char **, const char **, unsigned int *, \ ++ unsigned int *)) \ ++ bfd_false) ++#define _bfd_nosymbols_find_line \ ++ ((bfd_boolean (*) (bfd *, asymbol **, asymbol *, \ ++ const char **, unsigned int *)) \ + bfd_false) + #define _bfd_nosymbols_find_inliner_info \ + ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \ +@@ -520,8 +525,8 @@ extern bfd_boolean _bfd_stab_section_find_nearest_line + + /* Find the nearest line using DWARF 1 debugging information. */ + extern bfd_boolean _bfd_dwarf1_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *); + + struct dwarf_debug_section + { +@@ -536,21 +541,9 @@ extern const struct dwarf_debug_section dwarf_debug_sections[]; + + /* Find the nearest line using DWARF 2 debugging information. */ + extern bfd_boolean _bfd_dwarf2_find_nearest_line +- (bfd *, const struct dwarf_debug_section *, asection *, asymbol **, bfd_vma, +- const char **, const char **, unsigned int *, unsigned int *, unsigned int, +- void **); +- +-/* Find the line using DWARF 2 debugging information. */ +-extern bfd_boolean _bfd_dwarf2_find_line +- (bfd *, asymbol **, asymbol *, const char **, +- unsigned int *, unsigned int *, unsigned int, void **); +- +-bfd_boolean _bfd_generic_find_line +- (bfd *, asymbol **, asymbol *, const char **, unsigned int *); +- +-bfd_boolean _bfd_generic_find_nearest_line_discriminator +- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, +- unsigned int *, unsigned int *); ++ (bfd *, asymbol **, asymbol *, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *, ++ const struct dwarf_debug_section *, unsigned int, void **); + + /* Find inliner info after calling bfd_find_nearest_line. */ + extern bfd_boolean _bfd_dwarf2_find_inliner_info +--- a/bfd/libbfd.c ++++ b/bfd/libbfd.c +@@ -1105,29 +1105,6 @@ read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, + } + + bfd_boolean +-_bfd_generic_find_line (bfd *abfd ATTRIBUTE_UNUSED, +- asymbol **symbols ATTRIBUTE_UNUSED, +- asymbol *symbol ATTRIBUTE_UNUSED, +- const char **filename_ptr ATTRIBUTE_UNUSED, +- unsigned int *linenumber_ptr ATTRIBUTE_UNUSED) +-{ +- return FALSE; +-} +- +-bfd_boolean +-_bfd_generic_find_nearest_line_discriminator (bfd *abfd ATTRIBUTE_UNUSED, +- asection *section ATTRIBUTE_UNUSED, +- asymbol **symbols ATTRIBUTE_UNUSED, +- bfd_vma offset ATTRIBUTE_UNUSED, +- const char **filename_ptr ATTRIBUTE_UNUSED, +- const char **functionname_ptr ATTRIBUTE_UNUSED, +- unsigned int *line_ptr ATTRIBUTE_UNUSED, +- unsigned int *discriminator_ptr ATTRIBUTE_UNUSED) +-{ +- return FALSE; +-} +- +-bfd_boolean + _bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED, + asection *isec ATTRIBUTE_UNUSED, + bfd *obfd ATTRIBUTE_UNUSED, +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -404,8 +404,13 @@ extern bfd_boolean _bfd_vms_lib_ia64_mkarchive (bfd *abfd); + #define _bfd_nosymbols_get_lineno \ + ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) + #define _bfd_nosymbols_find_nearest_line \ +- ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ +- const char **, unsigned int *)) \ ++ ((bfd_boolean (*) (bfd *, asymbol **, asection *, bfd_vma, \ ++ const char **, const char **, unsigned int *, \ ++ unsigned int *)) \ ++ bfd_false) ++#define _bfd_nosymbols_find_line \ ++ ((bfd_boolean (*) (bfd *, asymbol **, asymbol *, \ ++ const char **, unsigned int *)) \ + bfd_false) + #define _bfd_nosymbols_find_inliner_info \ + ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \ +@@ -525,8 +530,8 @@ extern bfd_boolean _bfd_stab_section_find_nearest_line + + /* Find the nearest line using DWARF 1 debugging information. */ + extern bfd_boolean _bfd_dwarf1_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *); + + struct dwarf_debug_section + { +@@ -541,21 +546,9 @@ extern const struct dwarf_debug_section dwarf_debug_sections[]; + + /* Find the nearest line using DWARF 2 debugging information. */ + extern bfd_boolean _bfd_dwarf2_find_nearest_line +- (bfd *, const struct dwarf_debug_section *, asection *, asymbol **, bfd_vma, +- const char **, const char **, unsigned int *, unsigned int *, unsigned int, +- void **); +- +-/* Find the line using DWARF 2 debugging information. */ +-extern bfd_boolean _bfd_dwarf2_find_line +- (bfd *, asymbol **, asymbol *, const char **, +- unsigned int *, unsigned int *, unsigned int, void **); +- +-bfd_boolean _bfd_generic_find_line +- (bfd *, asymbol **, asymbol *, const char **, unsigned int *); +- +-bfd_boolean _bfd_generic_find_nearest_line_discriminator +- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, +- unsigned int *, unsigned int *); ++ (bfd *, asymbol **, asymbol *, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *, ++ const struct dwarf_debug_section *, unsigned int, void **); + + /* Find inliner info after calling bfd_find_nearest_line. */ + extern bfd_boolean _bfd_dwarf2_find_inliner_info +--- a/bfd/libcoff-in.h ++++ b/bfd/libcoff-in.h +@@ -355,15 +355,13 @@ extern bfd_boolean _bfd_coff_is_local_label_name + extern asymbol *coff_bfd_make_debug_symbol + (bfd *, void *, unsigned long); + extern bfd_boolean coff_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *); +-extern bfd_boolean coff_find_nearest_line_discriminator +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *); ++#define coff_find_line _bfd_nosymbols_find_line + struct dwarf_debug_section; + extern bfd_boolean coff_find_nearest_line_with_names +- (bfd *, const struct dwarf_debug_section *, asection *, asymbol **, +- bfd_vma, const char **, const char **, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **, ++ unsigned int *, const struct dwarf_debug_section *); + extern bfd_boolean coff_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); + extern int coff_sizeof_headers +--- a/bfd/libcoff.h ++++ b/bfd/libcoff.h +@@ -359,15 +359,13 @@ extern bfd_boolean _bfd_coff_is_local_label_name + extern asymbol *coff_bfd_make_debug_symbol + (bfd *, void *, unsigned long); + extern bfd_boolean coff_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *); +-extern bfd_boolean coff_find_nearest_line_discriminator +- (bfd *, asection *, asymbol **, bfd_vma, const char **, +- const char **, unsigned int *, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *); ++#define coff_find_line _bfd_nosymbols_find_line + struct dwarf_debug_section; + extern bfd_boolean coff_find_nearest_line_with_names +- (bfd *, const struct dwarf_debug_section *, asection *, asymbol **, +- bfd_vma, const char **, const char **, unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **, ++ unsigned int *, const struct dwarf_debug_section *); + extern bfd_boolean coff_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); + extern int coff_sizeof_headers +--- a/bfd/libecoff.h ++++ b/bfd/libecoff.h +@@ -289,8 +289,9 @@ extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name + (bfd *, const char *); + #define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno + extern bfd_boolean _bfd_ecoff_find_nearest_line +- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, +- unsigned int *); ++ (bfd *, asymbol **, asection *, bfd_vma, ++ const char **, const char **, unsigned int *, unsigned int *); ++#define _bfd_ecoff_find_line _bfd_nosymbols_find_line + #define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols + #define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +--- a/bfd/mach-o.c ++++ b/bfd/mach-o.c +@@ -5631,12 +5631,13 @@ bfd_mach_o_follow_dsym (bfd *abfd) + + bfd_boolean + bfd_mach_o_find_nearest_line (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd); + if (mdata == NULL) +@@ -5668,13 +5669,11 @@ bfd_mach_o_find_nearest_line (bfd *abfd, + default: + return FALSE; + } +- if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, +- section, symbols, offset, +- filename_ptr, functionname_ptr, +- line_ptr, NULL, 0, +- &mdata->dwarf2_find_line_info)) +- return TRUE; +- return FALSE; ++ return _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, ++ filename_ptr, functionname_ptr, ++ line_ptr, discriminator_ptr, ++ dwarf_debug_sections, 0, ++ &mdata->dwarf2_find_line_info); + } + + bfd_boolean +--- a/bfd/mach-o.h ++++ b/bfd/mach-o.h +@@ -680,9 +680,11 @@ unsigned int bfd_mach_o_get_section_attribute_from_name (const char *); + + void bfd_mach_o_convert_section_name_to_bfd (bfd *, const char *, const char *, + const char **, flagword *); +-bfd_boolean bfd_mach_o_find_nearest_line (bfd *, asection *, asymbol **, +- bfd_vma, const char **, +- const char **, unsigned int *); ++bfd_boolean bfd_mach_o_find_nearest_line (bfd *, asymbol **, ++ asection *, bfd_vma, ++ const char **, const char **, ++ unsigned int *, unsigned int *); ++#define bfd_mach_o_find_line _bfd_nosymbols_find_line + bfd_boolean bfd_mach_o_close_and_cleanup (bfd *); + bfd_boolean bfd_mach_o_free_cached_info (bfd *); + +--- a/bfd/mmo.c ++++ b/bfd/mmo.c +@@ -3210,6 +3210,7 @@ mmo_write_object_contents (bfd *abfd) + /* FIXME: We can do better on this one, if we have a dwarf2 .debug_line + section or if MMO line numbers are implemented. */ + #define mmo_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define mmo_find_line _bfd_nosymbols_find_line + #define mmo_find_inliner_info _bfd_nosymbols_find_inliner_info + #define mmo_make_empty_symbol _bfd_generic_make_empty_symbol + #define mmo_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +--- a/bfd/nlm-target.h ++++ b/bfd/nlm-target.h +@@ -29,6 +29,7 @@ + #define nlm_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) + #define nlm_get_lineno _bfd_nosymbols_get_lineno + #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define nlm_find_line _bfd_nosymbols_find_line + #define nlm_find_inliner_info _bfd_nosymbols_find_inliner_info + #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define nlm_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/oasys.c ++++ b/bfd/oasys.c +@@ -1129,26 +1129,9 @@ oasys_openr_next_archived_file (bfd *arch, bfd *prev) + return NULL; + } + +-static bfd_boolean +-oasys_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, +- asection *section ATTRIBUTE_UNUSED, +- asymbol **symbols ATTRIBUTE_UNUSED, +- bfd_vma offset ATTRIBUTE_UNUSED, +- const char **filename_ptr ATTRIBUTE_UNUSED, +- const char **functionname_ptr ATTRIBUTE_UNUSED, +- unsigned int *line_ptr ATTRIBUTE_UNUSED) +-{ +- return FALSE; +-} +- +-static bfd_boolean +-oasys_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, +- const char **filename_ptr ATTRIBUTE_UNUSED, +- const char **functionname_ptr ATTRIBUTE_UNUSED, +- unsigned int *line_ptr ATTRIBUTE_UNUSED) +-{ +- return FALSE; +-} ++#define oasys_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define oasys_find_line _bfd_nosymbols_find_line ++#define oasys_find_inliner_info _bfd_nosymbols_find_inliner_info + + static int + oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf) +--- a/bfd/pdp11.c ++++ b/bfd/pdp11.c +@@ -2182,12 +2182,13 @@ NAME (aout, minisymbol_to_symbol) (bfd *abfd, + + bfd_boolean + NAME (aout, find_nearest_line) (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + /* Run down the file looking for the filename, function and linenumber. */ + asymbol **p; +@@ -2204,6 +2205,8 @@ NAME (aout, find_nearest_line) (bfd *abfd, + *filename_ptr = abfd->filename; + *functionname_ptr = 0; + *line_ptr = 0; ++ if (discriminator_ptr) ++ *discriminator_ptr = 0; + + if (symbols != NULL) + { +--- a/bfd/pef.c ++++ b/bfd/pef.c +@@ -41,6 +41,7 @@ + #define bfd_pef_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) + #define bfd_pef_get_lineno _bfd_nosymbols_get_lineno + #define bfd_pef_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define bfd_pef_find_line _bfd_nosymbols_find_line + #define bfd_pef_find_inliner_info _bfd_nosymbols_find_inliner_info + #define bfd_pef_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define bfd_pef_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/plugin.c ++++ b/bfd/plugin.c +@@ -83,6 +83,7 @@ dlerror (void) + #define bfd_plugin_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) + #define bfd_plugin_get_lineno _bfd_nosymbols_get_lineno + #define bfd_plugin_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define bfd_plugin_find_line _bfd_nosymbols_find_line + #define bfd_plugin_find_inliner_info _bfd_nosymbols_find_inliner_info + #define bfd_plugin_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define bfd_plugin_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/ppcboot.c ++++ b/bfd/ppcboot.c +@@ -331,6 +331,7 @@ ppcboot_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, + #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name + #define ppcboot_get_lineno _bfd_nosymbols_get_lineno + #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define ppcboot_find_line _bfd_nosymbols_find_line + #define ppcboot_find_inliner_info _bfd_nosymbols_find_inliner_info + #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define ppcboot_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/som.c ++++ b/bfd/som.c +@@ -5715,18 +5715,22 @@ som_set_arch_mach (bfd *abfd, + + static bfd_boolean + som_find_nearest_line (bfd *abfd, +- asection *section, + asymbol **symbols, ++ asection *section, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, +- unsigned int *line_ptr) ++ unsigned int *line_ptr, ++ unsigned int *discriminator_ptr) + { + bfd_boolean found; + asymbol *func; + bfd_vma low_func; + asymbol **p; + ++ if (discriminator_ptr) ++ *discriminator_ptr = 0; ++ + if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, + & found, filename_ptr, + functionname_ptr, line_ptr, +@@ -6713,6 +6717,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) + return som_is_subspace (sec) && sec->size > 240000; + } + ++#define som_find_line _bfd_nosymbols_find_line + #define som_close_and_cleanup som_bfd_free_cached_info + #define som_read_ar_hdr _bfd_generic_read_ar_hdr + #define som_write_ar_hdr _bfd_generic_write_ar_hdr +--- a/bfd/srec.c ++++ b/bfd/srec.c +@@ -1255,6 +1255,7 @@ srec_print_symbol (bfd *abfd, + #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name + #define srec_get_lineno _bfd_nosymbols_get_lineno + #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define srec_find_line _bfd_nosymbols_find_line + #define srec_find_inliner_info _bfd_nosymbols_find_inliner_info + #define srec_make_empty_symbol _bfd_generic_make_empty_symbol + #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +--- a/bfd/targets.c ++++ b/bfd/targets.c +@@ -367,8 +367,7 @@ BFD_JUMP_TABLE macros. + . NAME##_bfd_is_target_special_symbol, \ + . NAME##_get_lineno, \ + . NAME##_find_nearest_line, \ +-. _bfd_generic_find_nearest_line_discriminator, \ +-. _bfd_generic_find_line, \ ++. NAME##_find_line, \ + . NAME##_find_inliner_info, \ + . NAME##_bfd_make_debug_symbol, \ + . NAME##_read_minisymbols, \ +@@ -389,10 +388,7 @@ BFD_JUMP_TABLE macros. + . bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); + . alent * (*_get_lineno) (bfd *, struct bfd_symbol *); + . bfd_boolean (*_bfd_find_nearest_line) +-. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, +-. const char **, const char **, unsigned int *); +-. bfd_boolean (*_bfd_find_nearest_line_discriminator) +-. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, ++. (bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma, + . const char **, const char **, unsigned int *, unsigned int *); + . bfd_boolean (*_bfd_find_line) + . (bfd *, struct bfd_symbol **, struct bfd_symbol *, +--- a/bfd/tekhex.c ++++ b/bfd/tekhex.c +@@ -935,6 +935,7 @@ tekhex_print_symbol (bfd *abfd, + #define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name + #define tekhex_get_lineno _bfd_nosymbols_get_lineno + #define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define tekhex_find_line _bfd_nosymbols_find_line + #define tekhex_find_inliner_info _bfd_nosymbols_find_inliner_info + #define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define tekhex_read_minisymbols _bfd_generic_read_minisymbols +--- a/bfd/versados.c ++++ b/bfd/versados.c +@@ -794,6 +794,7 @@ versados_canonicalize_reloc (bfd *abfd, + #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name + #define versados_get_lineno _bfd_nosymbols_get_lineno + #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define versados_find_line _bfd_nosymbols_find_line + #define versados_find_inliner_info _bfd_nosymbols_find_inliner_info + #define versados_make_empty_symbol _bfd_generic_make_empty_symbol + #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +--- a/bfd/vms-alpha.c ++++ b/bfd/vms-alpha.c +@@ -4575,10 +4575,14 @@ module_find_nearest_line (bfd *abfd, struct module *module, bfd_vma addr, + location. */ + + static bfd_boolean +-_bfd_vms_find_nearest_dst_line (bfd *abfd, asection *section, +- asymbol **symbols ATTRIBUTE_UNUSED, +- bfd_vma offset, const char **file, +- const char **func, unsigned int *line) ++_bfd_vms_find_nearest_line (bfd *abfd, ++ asymbol **symbols ATTRIBUTE_UNUSED, ++ asection *section, ++ bfd_vma offset, ++ const char **file, ++ const char **func, ++ unsigned int *line, ++ unsigned int *discriminator) + { + struct module *module; + +@@ -4588,6 +4592,8 @@ _bfd_vms_find_nearest_dst_line (bfd *abfd, asection *section, + *file = NULL; + *func = NULL; + *line = 0; ++ if (discriminator) ++ *discriminator = 0; + + /* We can't do anything if there is no DST (debug symbol table). */ + if (PRIV (dst_section) == NULL) +@@ -4607,26 +4613,6 @@ _bfd_vms_find_nearest_dst_line (bfd *abfd, asection *section, + + return FALSE; + } +- +-/* Likewise but with a discriminator. */ +- +-static bfd_boolean +-_bfd_vms_find_nearest_line_discriminator (bfd *abfd, +- asection *section, +- asymbol **symbols, +- bfd_vma offset, +- const char **filename_ptr, +- const char **functionname_ptr, +- unsigned int *line_ptr, +- unsigned int *discriminator) +-{ +- *discriminator = 0; +- +- return _bfd_vms_find_nearest_dst_line (abfd, section, symbols, offset, +- filename_ptr, functionname_ptr, +- line_ptr); +-} +- + + /* Canonicalizations. */ + /* Set name, value, section and flags of SYM from E. */ +@@ -9207,9 +9193,8 @@ bfd_vms_get_data (bfd *abfd) + #define alpha_vms_get_lineno _bfd_nosymbols_get_lineno + #define alpha_vms_find_inliner_info _bfd_nosymbols_find_inliner_info + #define alpha_vms_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +-#define alpha_vms_find_nearest_line _bfd_vms_find_nearest_dst_line +-#define _bfd_generic_find_nearest_line_discriminator \ +- _bfd_vms_find_nearest_line_discriminator ++#define alpha_vms_find_nearest_line _bfd_vms_find_nearest_line ++#define alpha_vms_find_line _bfd_nosymbols_find_line + #define alpha_vms_bfd_is_local_label_name vms_bfd_is_local_label_name + + /* Generic table. */ +--- a/bfd/xsym.c ++++ b/bfd/xsym.c +@@ -33,6 +33,7 @@ + #define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) + #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno + #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line ++#define bfd_sym_find_line _bfd_nosymbols_find_line + #define bfd_sym_find_inliner_info _bfd_nosymbols_find_inliner_info + #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols --- binutils-2.25.orig/debian/patches/pr17488.diff +++ binutils-2.25/debian/patches/pr17488.diff @@ -0,0 +1,175 @@ +# DP: Fix PR ld/17488, segfault on powerpc64 + +bfd/ + +2014-10-16 Alan Modra + + * elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing + even when output is not ppc64 ELF. Remove redundant tests on + type of input bfd. + +ld/ + +2014-10-16 Alan Modra + + PR 17488 + * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt + to access ELF header e_flags when not ppc64 ELF output. + +--- a/bfd/elf64-ppc.c ++++ b/bfd/elf64-ppc.c +@@ -4962,81 +4962,77 @@ ppc64_elf_before_check_relocs (bfd *ibfd, struct bfd_link_info *info) + { + struct ppc_link_hash_table *htab; + struct ppc_link_hash_entry **p, *eh; ++ asection *opd = bfd_get_section_by_name (ibfd, ".opd"); + +- if (!is_ppc64_elf (info->output_bfd)) +- return TRUE; +- htab = ppc_hash_table (info); +- if (htab == NULL) +- return FALSE; +- +- if (is_ppc64_elf (ibfd)) ++ if (opd != NULL && opd->size != 0) + { +- asection *opd = bfd_get_section_by_name (ibfd, ".opd"); +- +- if (opd != NULL && opd->size != 0) ++ if (abiversion (ibfd) == 0) ++ set_abiversion (ibfd, 1); ++ else if (abiversion (ibfd) == 2) + { +- if (abiversion (ibfd) == 0) +- set_abiversion (ibfd, 1); +- else if (abiversion (ibfd) == 2) +- { +- info->callbacks->einfo (_("%P: %B .opd not allowed in ABI" +- " version %d\n"), +- ibfd, abiversion (ibfd)); +- bfd_set_error (bfd_error_bad_value); +- return FALSE; +- } +- +- if ((ibfd->flags & DYNAMIC) == 0 +- && (opd->flags & SEC_RELOC) != 0 +- && opd->reloc_count != 0 +- && !bfd_is_abs_section (opd->output_section)) +- { +- /* Garbage collection needs some extra help with .opd sections. +- We don't want to necessarily keep everything referenced by +- relocs in .opd, as that would keep all functions. Instead, +- if we reference an .opd symbol (a function descriptor), we +- want to keep the function code symbol's section. This is +- easy for global symbols, but for local syms we need to keep +- information about the associated function section. */ +- bfd_size_type amt; +- asection **opd_sym_map; +- +- amt = opd->size * sizeof (*opd_sym_map) / 8; +- opd_sym_map = bfd_zalloc (ibfd, amt); +- if (opd_sym_map == NULL) +- return FALSE; +- ppc64_elf_section_data (opd)->u.opd.func_sec = opd_sym_map; +- BFD_ASSERT (ppc64_elf_section_data (opd)->sec_type == sec_normal); +- ppc64_elf_section_data (opd)->sec_type = sec_opd; +- } ++ info->callbacks->einfo (_("%P: %B .opd not allowed in ABI" ++ " version %d\n"), ++ ibfd, abiversion (ibfd)); ++ bfd_set_error (bfd_error_bad_value); ++ return FALSE; + } + +- /* For input files without an explicit abiversion in e_flags +- we should have flagged any with symbol st_other bits set +- as ELFv1 and above flagged those with .opd as ELFv2. +- Set the output abiversion if not yet set, and for any input +- still ambiguous, take its abiversion from the output. +- Differences in ABI are reported later. */ +- if (abiversion (info->output_bfd) == 0) +- set_abiversion (info->output_bfd, abiversion (ibfd)); +- else if (abiversion (ibfd) == 0) +- set_abiversion (ibfd, abiversion (info->output_bfd)); +- +- p = &htab->dot_syms; +- while ((eh = *p) != NULL) ++ if ((ibfd->flags & DYNAMIC) == 0 ++ && (opd->flags & SEC_RELOC) != 0 ++ && opd->reloc_count != 0 ++ && !bfd_is_abs_section (opd->output_section)) + { +- *p = NULL; +- if (&eh->elf == htab->elf.hgot) +- ; +- else if (htab->elf.hgot == NULL +- && strcmp (eh->elf.root.root.string, ".TOC.") == 0) +- htab->elf.hgot = &eh->elf; +- else if (!add_symbol_adjust (eh, info)) ++ /* Garbage collection needs some extra help with .opd sections. ++ We don't want to necessarily keep everything referenced by ++ relocs in .opd, as that would keep all functions. Instead, ++ if we reference an .opd symbol (a function descriptor), we ++ want to keep the function code symbol's section. This is ++ easy for global symbols, but for local syms we need to keep ++ information about the associated function section. */ ++ bfd_size_type amt; ++ asection **opd_sym_map; ++ ++ amt = opd->size * sizeof (*opd_sym_map) / 8; ++ opd_sym_map = bfd_zalloc (ibfd, amt); ++ if (opd_sym_map == NULL) + return FALSE; +- p = &eh->u.next_dot_sym; ++ ppc64_elf_section_data (opd)->u.opd.func_sec = opd_sym_map; ++ BFD_ASSERT (ppc64_elf_section_data (opd)->sec_type == sec_normal); ++ ppc64_elf_section_data (opd)->sec_type = sec_opd; + } + } + ++ if (!is_ppc64_elf (info->output_bfd)) ++ return TRUE; ++ htab = ppc_hash_table (info); ++ if (htab == NULL) ++ return FALSE; ++ ++ /* For input files without an explicit abiversion in e_flags ++ we should have flagged any with symbol st_other bits set ++ as ELFv1 and above flagged those with .opd as ELFv2. ++ Set the output abiversion if not yet set, and for any input ++ still ambiguous, take its abiversion from the output. ++ Differences in ABI are reported later. */ ++ if (abiversion (info->output_bfd) == 0) ++ set_abiversion (info->output_bfd, abiversion (ibfd)); ++ else if (abiversion (ibfd) == 0) ++ set_abiversion (ibfd, abiversion (info->output_bfd)); ++ ++ p = &htab->dot_syms; ++ while ((eh = *p) != NULL) ++ { ++ *p = NULL; ++ if (&eh->elf == htab->elf.hgot) ++ ; ++ else if (htab->elf.hgot == NULL ++ && strcmp (eh->elf.root.root.string, ".TOC.") == 0) ++ htab->elf.hgot = &eh->elf; ++ else if (!add_symbol_adjust (eh, info)) ++ return FALSE; ++ p = &eh->u.next_dot_sym; ++ } ++ + /* Clear the list for non-ppc64 input files. */ + p = &htab->dot_syms; + while ((eh = *p) != NULL) +--- a/ld/emultempl/ppc64elf.em ++++ b/ld/emultempl/ppc64elf.em +@@ -531,7 +531,8 @@ gld${EMULATION_NAME}_finish (void) + /* e_entry on PowerPC64 points to the function descriptor for + _start. If _start is missing, default to the first function + descriptor in the .opd section. */ +- if ((elf_elfheader (link_info.output_bfd)->e_flags & EF_PPC64_ABI) == 1) ++ if (stub_file != NULL ++ && (elf_elfheader (link_info.output_bfd)->e_flags & EF_PPC64_ABI) == 1) + entry_section = ".opd"; + + if (params.emit_stub_syms < 0) --- binutils-2.25.orig/debian/patches/pr17493.diff +++ binutils-2.25/debian/patches/pr17493.diff @@ -0,0 +1,49 @@ +# DP: Fix PR gas/17493. + +--- a/gas/config/tc-i386.c ++++ a/gas/config/tc-i386.c +@@ -7985,7 +7985,7 @@ i386_finalize_immediate (segT exp_seg ATTRIBUTE_UNUSED, expressionS *exp, + return 0; + } + #endif +- else if (!intel_syntax && exp->X_op == O_register) ++ else if (!intel_syntax && exp_seg == reg_section) + { + if (imm_start) + as_bad (_("illegal immediate register operand %s"), imm_start); +--- a/gas/testsuite/gas/i386/inval-equ-2.l ++++ a/gas/testsuite/gas/i386/inval-equ-2.l +@@ -7,15 +7,15 @@ GAS LISTING .* + + [ ]*1[ ]+\.globl bar1 + [ ]*2[ ]+\.set bar1,\(%eax\+1\) +-[ ]*3[ ]+\?\?\?\? A12A0000 mov bar1,%eax +-[ ]*3[ ]+00 ++[ ]*3[ ]+\?\?\?\? A1...... mov bar1,%eax ++[ ]*3[ ]+.. + [ ]*4[ ]+\.set bar2,\(%eax\+1\) +-[ ]*5[ ]+\?\?\?\? A12A0000 mov bar2,%eax +-[ ]*5[ ]+00 ++[ ]*5[ ]+\?\?\?\? A1...... mov bar2,%eax ++[ ]*5[ ]+.. + [ ]*6[ ]+\.globl bar2 + [ ]*7[ ]+\.set bar3,\(%eax\+1\) +-[ ]*8[ ]+\?\?\?\? A12A0000 mov bar3,%eax ++[ ]*8[ ]+\?\?\?\? A1...... mov bar3,%eax + .* Error: can't make global register symbol `bar1' + .* Error: can't make global register symbol `bar2' + .* Error: can't make global register symbol `bar3' +-[ ]*8[ ]+00 ++[ ]*8[ ]+.. +--- a/gas/write.c ++++ a/gas/write.c +@@ -836,7 +836,8 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED, + if (symsec == NULL) + abort (); + +- if (bfd_is_abs_section (symsec)) ++ if (bfd_is_abs_section (symsec) ++ || symsec == reg_section) + { + /* The fixup_segment routine normally will not use this + symbol in a relocation. */ --- binutils-2.25.orig/debian/patches/pr18427.diff +++ binutils-2.25/debian/patches/pr18427.diff @@ -0,0 +1,130 @@ +From: John David Anglin +Date: Thu, 11 Jun 2015 22:50:39 +0000 (-0400) +Subject: tc-hppa.c: Speed up search for last label +X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=18c208b2292f3c61097dee99053ecab78b393e46 + +tc-hppa.c: Speed up search for last label +--- + +2015-06-11 John David Anglin + + PR gas/18427 + * gas/config/tc-hppa.c (last_label_symbol): Declare. + (pa_get_label): Return last label in current space/segment or NULL. + (pa_define_label): Record last label and add to root. + (pa_undefine_label): Remove last label from root. + +diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c +index 57d7e96..06e222d 100644 +--- a/gas/config/tc-hppa.c ++++ b/gas/config/tc-hppa.c +@@ -606,6 +606,9 @@ static int within_procedure; + seen in each subspace. */ + static label_symbol_struct *label_symbols_rootp = NULL; + ++/* Last label symbol */ ++static label_symbol_struct last_label_symbol; ++ + /* Nonzero when strict matching is enabled. Zero otherwise. + + Each opcode in the table has a flag which indicates whether or +@@ -1114,19 +1117,17 @@ pa_check_eof (void) + static label_symbol_struct * + pa_get_label (void) + { +- label_symbol_struct *label_chain; ++ label_symbol_struct *label_chain = label_symbols_rootp; + +- for (label_chain = label_symbols_rootp; +- label_chain; +- label_chain = label_chain->lss_next) ++ if (label_chain) + { + #ifdef OBJ_SOM +- if (current_space == label_chain->lss_space && label_chain->lss_label) +- return label_chain; ++ if (current_space == label_chain->lss_space && label_chain->lss_label) ++ return label_chain; + #endif + #ifdef OBJ_ELF +- if (now_seg == label_chain->lss_segment && label_chain->lss_label) +- return label_chain; ++ if (now_seg == label_chain->lss_segment && label_chain->lss_label) ++ return label_chain; + #endif + } + +@@ -1139,28 +1140,23 @@ pa_get_label (void) + void + pa_define_label (symbolS *symbol) + { +- label_symbol_struct *label_chain = pa_get_label (); ++ label_symbol_struct *label_chain = label_symbols_rootp; + +- if (label_chain) +- label_chain->lss_label = symbol; +- else +- { +- /* Create a new label entry and add it to the head of the chain. */ +- label_chain = xmalloc (sizeof (label_symbol_struct)); +- label_chain->lss_label = symbol; ++ if (!label_chain) ++ label_chain = &last_label_symbol; ++ ++ label_chain->lss_label = symbol; + #ifdef OBJ_SOM +- label_chain->lss_space = current_space; ++ label_chain->lss_space = current_space; + #endif + #ifdef OBJ_ELF +- label_chain->lss_segment = now_seg; ++ label_chain->lss_segment = now_seg; + #endif +- label_chain->lss_next = NULL; + +- if (label_symbols_rootp) +- label_chain->lss_next = label_symbols_rootp; ++ /* Not used. */ ++ label_chain->lss_next = NULL; + +- label_symbols_rootp = label_chain; +- } ++ label_symbols_rootp = label_chain; + + #ifdef OBJ_ELF + dwarf2_emit_label (symbol); +@@ -1173,33 +1169,7 @@ pa_define_label (symbolS *symbol) + static void + pa_undefine_label (void) + { +- label_symbol_struct *label_chain; +- label_symbol_struct *prev_label_chain = NULL; +- +- for (label_chain = label_symbols_rootp; +- label_chain; +- label_chain = label_chain->lss_next) +- { +- if (1 +-#ifdef OBJ_SOM +- && current_space == label_chain->lss_space && label_chain->lss_label +-#endif +-#ifdef OBJ_ELF +- && now_seg == label_chain->lss_segment && label_chain->lss_label +-#endif +- ) +- { +- /* Remove the label from the chain and free its memory. */ +- if (prev_label_chain) +- prev_label_chain->lss_next = label_chain->lss_next; +- else +- label_symbols_rootp = label_chain->lss_next; +- +- free (label_chain); +- break; +- } +- prev_label_chain = label_chain; +- } ++ label_symbols_rootp = NULL; + } + + /* An HPPA-specific version of fix_new. This is required because the HPPA --- binutils-2.25.orig/debian/patches/series +++ binutils-2.25/debian/patches/series @@ -0,0 +1,35 @@ +branch-updates.diff +#branch-version.diff +001_ld_makefile_patch.patch +002_gprof_profile_arcs.patch +003_gprof_see_also_monitor.patch +006_better_file_error.patch +012_check_ldrunpath_length.patch +013_bash_in_ld_testsuite.patch +#014_hash_style-both.patch +128_ppc64_powerpc_biarch.patch +129_multiarch_libpath.patch +130_gold_disable_testsuite_build.patch +131_ld_bootstrap_testsuite.patch +135_bfd_version.patch +157_ar_scripts_with_tilde.patch +158_ld_system_root.patch +161_gold_dummy_zoption.diff +170_doc_fixes.diff + +# only applied for GFDL builds +164_ld_doc_remove_xref.diff + +gprof-build.diff +aarch64-libpath.diff +#pr-ld-16428.diff +mips64-default-n64.diff + +# patches taken from the trunk +aarch64-gold-updates.diff +aarch64-gold-updates2.diff +aarch64-bogus-assertion.diff +aarch64-enable-targets.diff +arm-ld-unique-tests.diff +aarch64-thunderx.diff +pr18427.diff --- binutils-2.25.orig/debian/rules +++ binutils-2.25/debian/rules @@ -0,0 +1,1359 @@ +#!/usr/bin/make -f +# debian/rules file - for binutils (2.20) +# Based on sample debian/rules file - for GNU Hello (1.3). +# Copyright 1994,1995 by Ian Jackson. +# Copyright 1998-2007 James Troup. +# Portions Copyright 2008-2014 Canonical Ltd. +# Portions Copyright 2008-2014 Matthias Klose. +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) +# This file may have to be extensively modified + +############################################################################### + +p_bin = binutils +p_dev = $(p_bin)-dev +p_mul = $(p_bin)-multiarch +p_mdev = $(p_mul)-dev +p_doc = $(p_bin)-doc +p_hppa64 = $(p_bin)-hppa64 +p_src = $(p_bin)-source +p_static = $(p_bin)-static +p_udeb = $(p_static)-udeb + +# BACKPORT is used for cross builds for a -source package not conflicting +# with the source package of the native package. +ifeq ($(BACKPORT),true) + p_src = $(p_bin)-$(VERSION)-source +else + p_src = $(p_bin)-source +endif + +pwd := $(shell pwd) +d = debian/tmp +d_bin = $(d) +d_dev = debian/$(p_dev) +d_mul = debian/$(p_mul) +d_mdev = debian/$(p_mdev) +d_doc = debian/$(p_doc) +d_hppa64 = debian/$(p_hppa64) +d_src = debian/$(p_src) +d_static = debian/$(p_static) +d_udeb = debian/$(p_udeb) + +install_dir = install -d -m 755 +install_file = install -m 644 +install_script = install -m 755 +install_binary = install -m 755 -s + +vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1))) +DPKG_VARS := $(shell dpkg-architecture) +DEB_BUILD_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE) +DEB_HOST_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH) +DEB_HOST_GNU_CPU ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_CPU) +DEB_HOST_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE) +DEB_HOST_MULTIARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH) + +ifneq (,$(filter $(DEB_HOST_ARCH),hppa)) + with_hppa64 = yes +endif + +# If $(TARGET) is not set, try reading debian/target +ifeq (,$(TARGET)) + ifneq (,$(wildcard debian/target)) + TARGET := $(shell cat debian/target 2>/dev/null) + endif +endif + +ifneq (,$(TARGET)) + # Support TARGET both as Debian architecture specification (e.g. arm), + # and as the target name (e.g. arm-linux-gnu). + try_convert := $(shell dpkg-architecture -f -a$(TARGET) -qDEB_HOST_GNU_TYPE 2>/dev/null) + ifneq ($(try_convert),) + override TARGET := $(try_convert) + endif + DPKG_TARGET_VARS := $(shell dpkg-architecture -f -t$(TARGET)) + DEB_TARGET_MULTIARCH = $(call vafilt,$(DPKG_TARGET_VARS),DEB_HOST_MULTIARCH) + DEB_TARGET_ARCH = $(call vafilt,$(DPKG_TARGET_VARS),DEB_HOST_ARCH) +else + DEB_TARGET_MULTIARCH = $(DEB_HOST_MULTIARCH) + DEB_TARGET_ARCH = $(DEB_HOST_ARCH) +endif + +ifneq (,$(TARGET)) + APPEND_TOOLLIBDIR=yes + export APPEND_TOOLLIBDIR +endif + +ifeq (,$(DEB_HOST_MULTIARCH)) + ifeq ($(DEB_HOST_ARCH),i386) + DEB_HOST_MULTIARCH = i386-linux-gnu + else + DEB_HOST_MULTIARCH = $(DEB_HOST_GNU_TYPE) + endif +endif + +SHELL = /bin/bash + +gold_targets = \ + amd64 arm64 armel armhf i386 \ + mips mipsel mipsn32 mipsn32el mips64 mips64el \ + powerpc powerpcspe ppc64 ppc64el \ + sparc sparc64 x32 hurd-i386 + +ifneq (,$(filter $(DEB_HOST_ARCH), $(gold_targets))) + with_gold = yes + gold_provides = -Vgold:Provides=binutils-gold +endif + +with_multiarch := yes +with_static := yes + +CC = gcc +CXX = g++ +CFLAGS = -g -O2 -Wno-format-security +STRIP = strip --remove-section=.comment --remove-section=.note +CROSS := +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) + CROSS := $(DEB_HOST_GNU_TYPE)- + CC = $(CROSS)gcc + CXX = $(CROSS)g++ + STRIP= $(CURDIR)/debian/strip.cross + install_binary = install -m 755 -s --strip-program="$(STRIP)" +endif + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS = -g -O0 +endif + +# this outputs 0 or 1 depending on whether a macro appears in the *default* cpp +# -dM -P output; this is used to test the toolchain *default* configuration +check_cpp = $(shell $(CROSS)cpp -dM -P /dev/null | grep -q '^\#define $(1)' && echo 1 || echo 0) + +# testsuite doesn't expect to be built with -mthumb +# TODO if the testsuite is only broken with Thumb-2 (and not with "Thumb-1"), +# we should test for __thumb2__ instead +ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf)) + ifeq ($(call check_cpp,__thumb__),1) + CFLAGS += -marm + endif +endif + +SPACE = $(EMPTY) $(EMPTY) +COMMA = , +CHANGELOG_VARS := $(shell dpkg-parsechangelog | \ + sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p') + +DEB_VERSION := $(call vafilt,$(CHANGELOG_VARS),Version) +DEB_SVERSION := $(shell echo $(DEB_VERSION) | sed 's/+b[0-9][0-9]*$$//') +DEB_UPSTREAM := $(firstword $(subst -,$(SPACE),$(DEB_VERSION))) + +VERSION := $(shell sed -n 's/^ *VERSION=\(.*\)/\1/p' bfd/configure | head -1 | tr -d \') +DATE := $(shell sed -n 's/.* \([0-9]*\)$$/\1/p' bfd/version.h) +ifneq (,$(DATE)) +# DATE_EXT := .$(DATE) +endif +BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p') + +is_rc = yes +is_rc = + +ifneq ($(DEB_UPSTREAM),$(VERSION)$(DATE_EXT)) + $(error upstream ($(DEB_UPSTREAM)) and debian ($(VERSION)$(DATE_EXT)) version mismatch) +endif + +STATIC_UDEB = $(p_udeb)_$(DEB_VERSION)_$(DEB_HOST_ARCH).udeb + +SINGLE_VERSION= $(VERSION)-system +MULTI_VERSION = $(VERSION)-multiarch +HPPA64_VERSION= $(VERSION)-hppa64 + +distribution := $(shell lsb_release -is) +distrelease := $(shell lsb_release -cs) +ifeq ($(distrelease),n/a) + distrelease := sid +endif +ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy dapper hardy jaunty karmic lucid maverick natty oneiric precise quantal raring saucy trusty utopic)) + DPKG_DEV = dpkg-dev (>= 1.17.11), +endif + +NJOBS = +# Support parallel= in DEB_BUILD_OPTIONS (see #209008) +ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) + NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) +endif +ifneq (,$(findstring nogold,$(DEB_BUILD_OPTIONS))) + with_gold = disabled in DEB_BUILD_OPTIONS +endif +ifneq (,$(findstring nostat,$(DEB_BUILD_OPTIONS))) + with_static = disabled in DEB_BUILD_OPTIONS +endif +ifneq (,$(findstring nomult,$(DEB_BUILD_OPTIONS))) + with_multiarch = disabled in DEB_BUILD_OPTIONS +endif + +# PF is the installation prefix for the package without the leading slash. +# It's "usr" for gcc releases, so use this if not explicitly set +ifeq ($(PF),) + PF = usr +endif + +# Don't include docs with GFDL invariant sections +GFDL_INVARIANT_FREE := yes +ifeq ($(distribution),Ubuntu) + GFDL_INVARIANT_FREE := no +endif + +gfdl_toplevel_texinfo_files = \ + bfd/doc/bfd.texinfo \ + bfd/doc/bfdint.texi \ + ld/ldint.texinfo + +gfdl_generated_files = \ + bfd/doc/bfd.info + +######################################## + +CONFARGS = \ + --enable-shared \ + --enable-plugins \ + --enable-threads \ + --prefix=/$(PF) \ + --enable-deterministic-archives \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --host=$(DEB_HOST_GNU_TYPE) \ + --with-pkgversion="GNU Binutils for $(distribution)" + +# not yet ready for GCC 4.9 +CONFARGS += --disable-werror + +ifeq ($(DEB_TARGET_MULTIARCH),x86_64-linux-gnu) + DEB_TARGET_MULTIARCH32 = i386-linux-gnu + DEB_TARGET_MULTIARCHX32 = x86_64-linux-gnux32 +else ifeq ($(DEB_TARGET_MULTIARCH),x86_64-linux-gnux32) + DEB_TARGET_MULTIARCH32 = i386-linux-gnu + DEB_TARGET_MULTIARCH64 = x86_64-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),powerpc64-linux-gnu) + DEB_TARGET_MULTIARCH32 = powerpc-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),s390x-linux-gnu) + DEB_TARGET_MULTIARCH32 = s390-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),sparc64-linux-gnu) + DEB_TARGET_MULTIARCH32 = sparc-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),x86_64-kfreebsd-gnu) + DEB_TARGET_MULTIARCH32 = i386-kfreebsd-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),i386-linux-gnu) + DEB_TARGET_MULTIARCH64 = x86_64-linux-gnu + DEB_TARGET_MULTIARCHX32 = x86_64-linux-gnux32 +else ifeq ($(DEB_TARGET_MULTIARCH),powerpc-linux-gnu) + DEB_TARGET_MULTIARCH64 = powerpc64-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),sparc-linux-gnu) + DEB_TARGET_MULTIARCH64 = sparc64-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),s390-linux-gnu) + DEB_TARGET_MULTIARCH64 = s390x-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),i386-kfreebsd-gnu) + DEB_TARGET_MULTIARCH64 = x86_64-kfreebsd-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),mips-linux-gnu) + DEB_TARGET_MULTIARCH64 = mips64-linux-gnuabi64 + DEB_TARGET_MULTIARCHN32 = mips64-linux-gnuabin32 +else ifeq ($(DEB_TARGET_MULTIARCH),mipsel-linux-gnu) + DEB_TARGET_MULTIARCH64 = mips64el-linux-gnuabi64 + DEB_TARGET_MULTIARCHN32 = mips64el-linux-gnuabin32 +else ifeq ($(DEB_TARGET_MULTIARCH),mips64-linux-gnuabin32) + DEB_TARGET_MULTIARCH64 = mips64-linux-gnuabi64 + DEB_TARGET_MULTIARCH32 = mips-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),mips64el-linux-gnuabin32) + DEB_TARGET_MULTIARCH64 = mips64el-linux-gnuabi64 + DEB_TARGET_MULTIARCH32 = mipsel-linux-gnu +else ifeq ($(DEB_TARGET_MULTIARCH),mips64-linux-gnuabi64) + DEB_TARGET_MULTIARCH32 = mips-linux-gnu + DEB_TARGET_MULTIARCHN32 = mips64-linux-gnuabin32 +else ifeq ($(DEB_TARGET_MULTIARCH),mips64el-linux-gnuabi64) + DEB_TARGET_MULTIARCH32 = mipsel-linux-gnu + DEB_TARGET_MULTIARCHN32 = mips64el-linux-gnuabin32 +else ifeq ($(DEB_TARGET_MULTIARCH),aarch64-linux-gnu) + DEB_TARGET_MULTIARCH32 = aarch64_ilp32-linux-gnu +endif +export DEB_TARGET_MULTIARCH DEB_TARGET_MULTIARCH32 DEB_TARGET_MULTIARCH64 +export DEB_TARGET_MULTIARCHX32 DEB_TARGET_MULTIARCHN32 + +ifeq ($(DEB_TARGET_ARCH),sparc) + CONFARGS += --enable-targets=sparc64-linux-gnu + CONFLICTS = -VextraConflicts="libc6-dev-sparc64 (<< 2.2.5-7)" +endif +ifeq ($(DEB_TARGET_ARCH),sparc64) + CONFARGS += --enable-targets=sparc-linux-gnu + CONFLICTS = -VextraConflicts="libc6-dev-sparc64 (<< 2.2.5-7)" +endif +ifeq ($(DEB_TARGET_ARCH),powerpc) + CONFARGS += --enable-targets=powerpc64-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),ppc64) + CONFARGS += --enable-targets=powerpc-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),ppc64el) + CONFARGS += --enable-targets=powerpc-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),s390) + CONFARGS += --enable-targets=s390x-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),s390x) + CONFARGS += --enable-targets=s390-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),amd64) + CONFARGS += --enable-targets=x86_64-linux-gnux32,x86_64-pep +endif +ifeq ($(DEB_TARGET_ARCH),i386) + CONFARGS += --enable-targets=x86_64-linux-gnu,x86_64-linux-gnux32,x86_64-pep +endif +ifeq ($(DEB_TARGET_ARCH),x32) + CONFARGS += --enable-targets=x86_64-linux-gnu,x86_64-pep +endif +ifneq (,$(filter $(DEB_TARGET_ARCH),amd64 i386 x32)) + CONFLICTS = -VextraConflicts="binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3)" +endif +ifeq ($(DEB_TARGET_ARCH),kfreebsd-i386) + CONFARGS += --enable-targets=x86_64-kfreebsd-gnu +endif +ifeq ($(DEB_TARGET_ARCH),mips) + CONFARGS += --enable-targets=mips64-linux-gnuabi64,mips64-linux-gnuabin32 +endif +ifeq ($(DEB_TARGET_ARCH),mipsel) + CONFARGS += --enable-targets=mips64el-linux-gnuabi64,mips64el-linux-gnuabin32 +endif +ifeq ($(DEB_TARGET_ARCH),mipsn32) + CONFARGS += --enable-targets=mips64-linux-gnuabi64,mips-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),mipsn32el) + CONFARGS += --enable-targets=mips64el-linux-gnuabi64,mipsel-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),mips64) + CONFARGS += --enable-targets=mips64-linux-gnuabin32,mips-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),mips64el) + CONFARGS += --enable-targets=mips64el-linux-gnuabin32,mipsel-linux-gnu +endif +ifeq ($(DEB_TARGET_ARCH),aarch64) + CONFARGS += --enable-targets=aarch64_be-linux-gnu +endif + +with_check := yes +ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) + with_check := disabled through DEB_BUILD_OPTIONS +endif +ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf mips mipsel sparc)) + ignore_regressions := regressions ignored on architecture $(DEB_HOST_ARCH) +endif + +ignore_regressions := regressions ignored on architecture $(DEB_HOST_ARCH) + +with_strip := yes +ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + with_strip := disabled through DEB_BUILD_OPTIONS +endif + +source_files = $(addprefix $(shell basename $(pwd))/, \ + $(filter-out %-stamp .pc CVS debian builddir-% test-summary, $(wildcard *))) + +############################################################################### + +################# +# patch targets # +################# + +patch: patch-stamp +patch-stamp: +ifneq ($(PATCHED_SOURCES),yes) + QUILT_PATCHES=$(CURDIR)/debian/patches \ + quilt --quiltrc /dev/null push -a || test $$? = 2 +endif + touch $@ + +unpatch: + QUILT_PATCHES=$(CURDIR)/debian/patches \ + quilt --quiltrc /dev/null pop -a -R || test $$? = 2 + rm -rf .pc + +update-patches: + export QUILT_PATCHES=$(CURDIR)/debian/patches; \ + export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \ + export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \ + while quilt push; do quilt refresh; done + +############################################################################### + +################ +# clean target # +################ + +clean: unpatch + $(checkdir) + -rm -fr builddir-multi builddir-single builddir-hppa64 + -find . -name \*.gmo -o -name \*~ -o -name \*.info ! -name sysroff.info | xargs rm -f + -rm -f $(pwd)/test-summary* + -rm -fr $(d_bin) $(d_dev) $(d_mul) $(d_mdev) $(d_doc) $(d_hppa64) $(d_src) + -rm -fr builddir-static + -rm -fr $(d_static) $(d_udeb) + -rm -rf debian/patched debian/tmp debian/files* debian/substvars + -rm -f debian/*.orig debian/*.rej + -rm -rf $(d_cross) debian/files debian/substvars + -rm -rf builddir-$(TARGET) {configure,build,install}-cross-stamp + for i in debian/*.in; do \ + case "$$i" in debian/control*.in) continue; esac; \ + rm -f $${i%*.in}; \ + done + + -rm -f *-stamp + +############################################################################### + +control-stamp: debian/control.in $(if $(TARGET),debian/control.cross.in) +ifneq (,$(TARGET)) + sed "s/@dpkg_dev@/$(DPKG_DEV)/;/^$$/ q" < debian/control.in > debian/control + sed -e "s/__TARGET__/$$(echo -n $(TARGET) | sed s/_/-/g)/" \ + < debian/control.cross.in >> debian/control +else + sed -e 's/@dpkg_dev@/$(DPKG_DEV)/' \ + debian/control.in > debian/control +endif +ifneq (,$(CROSS)) + sed -e "s/__TARGET__/$$(echo -n $(CROSS) | sed s/_/-/g)/" \ + < debian/strip.cross.in >> debian/strip.cross + chmod 755 debian/strip.cross +endif + touch $@ + +####################### +# single-arch targets # +####################### + +SINGLE_CONFARGS = $(CONFARGS) +ifeq ($(with_gold),yes) + SINGLE_CONFARGS += --enable-ld=default --enable-gold +endif + +configure-single-stamp: patch-stamp control-stamp + $(checkdir) + +ifeq ($(with_check),yes) + @if echo "spawn true" | /usr/bin/expect -f - >/dev/null; then \ + : ; \ + else \ + echo "expect is failing on your system with the above error, which means the"; \ + echo "testsuite will fail. Please resolve the above issues and retry the build."; \ + echo "-----------------------------------------------------------------------------"; \ + exit 1; \ + fi +endif + + rm -rf configure-single-stamp \ + builddir-single + mkdir builddir-single + cd builddir-single && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" \ + ../configure --with-sysroot=/ $(SINGLE_CONFARGS) + $(MAKE) -C builddir-single configure-host + touch configure-single-stamp + +build-single-stamp: configure-single-stamp + $(checkdir) + env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \ + $(MAKE) -C builddir-single/bfd headers \ + LDFLAGS="-Wl,-z,relro" + env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \ + $(MAKE) $(NJOBS) -C builddir-single \ + LDFLAGS="-Wl,-z,relro" +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) +ifeq ($(with_check),yes) + -env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \ + $(MAKE) -C builddir-single -k check + cat builddir-single/binutils/binutils.sum \ + builddir-single/gas/testsuite/gas.sum \ + builddir-single/ld/ld.sum >> $(pwd)/test-summary + set -e; \ + if [ ! -f /usr/share/doc/binutils/test-summary.gz ]; then \ + echo "No test results available for the installed binutils version"; \ + elif [ -x /usr/bin/python3 ]; then \ + echo "Test results, compared with installed binutils:"; \ + zcat /usr/share/doc/binutils/test-summary.gz > test-summary-installed; \ + if python3 debian/test-suite-compare.py test-summary-installed test-summary; then \ + : ; \ + elif [ -n "$(ignore_regressions)" ]; then \ + echo "$(ignore_regressions)"; \ + else \ + case "$(DEB_HOST_ARCH)" in \ + powerpc) \ + echo "WARNING: ignoring test results";; \ + *) \ + false;; \ + esac; \ + fi; \ + else \ + echo "python3 not installed, not comparing test results."; \ + fi +endif +endif + touch build-single-stamp + + +############################################################################### + +##################### +# multiarch targets # +##################### + +multiarch_targets += \ + aarch64-linux-gnu \ + aarch64_be-linux-gnu \ + alpha-linux-gnu \ + arm-linux-gnueabi \ + i686-linux-gnu \ + m32r-linux-gnu \ + m68k-linux-gnu \ + m68k-rtems \ + powerpc-linux-gnu \ + powerpc64-linux-gnu \ + powerpc64le-linux-gnu \ + s390x-linux-gnu \ + sh-linux-gnu \ + sh64-linux-gnu \ + sparc-linux-gnu \ + sparc64-linux-gnu \ + x86_64-linux-gnu \ + x86_64-linux-gnux32 \ + x86_64-pep + +# try to work around #758830 +ifeq ($(DEB_HOST_ARCH),sh4) + multiarch_targets := $(filter-out hppa-linux-gnu, $(multiarch_targets)) +endif + +configure-multi-stamp: patch-stamp + $(checkdir) + rm -rf configure-multi-stamp \ + builddir-multi + mkdir builddir-multi + cd builddir-multi \ + && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" ../configure $(CONFARGS) \ + --with-sysroot=/ \ + --enable-targets=$(subst $(SPACE),$(COMMA),$(multiarch_targets)) + $(MAKE) -C builddir-multi configure-host + touch configure-multi-stamp + +build-multi-stamp: configure-multi-stamp + $(checkdir) + $(MAKE) -C builddir-multi/bfd headers + env MAKE="$(MAKE) VERSION=$(MULTI_VERSION)" \ + $(MAKE) $(NJOBS) -C builddir-multi \ + LDFLAGS="-Wl,-z,relro" + touch build-multi-stamp + +############################################################################### + +################# +# static target # +################# + +configure-static-stamp: patch-stamp + $(checkdir) + rm -rf configure-static-stamp \ + builddir-static + mkdir builddir-static + cd builddir-static \ + && env CC="$(CC)" CXX="$(CXX)" CFLAGS="-g0 -Os" ../configure \ + $(filter-out --enable-shared --enable-plugins --enable-targets=%, $(CONFARGS)) + $(MAKE) -C builddir-static configure-bfd + $(MAKE) -C builddir-static configure-ld + touch configure-static-stamp + +build-static-stamp: configure-static-stamp + $(checkdir) + $(MAKE) $(NJOBS) -C builddir-static/libiberty CCLD='$(CC) -all-static' + $(MAKE) $(NJOBS) -C builddir-static/bfd CCLD='$(CC) -all-static' + $(MAKE) $(NJOBS) -C builddir-static/ld CCLD='$(CC) -all-static' + touch build-static-stamp + +############################################################################### + +################# +# hppa64 target # +################# + +configure-hppa64-stamp: patch-stamp + $(checkdir) + rm -rf configure-hppa64-stamp \ + builddir-hppa64 + mkdir builddir-hppa64 + cd builddir-hppa64 \ + && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" ../configure \ + $(filter-out --enable-targets=%, $(CONFARGS)) \ + --target=hppa64-linux-gnu + $(MAKE) -C builddir-hppa64 configure-host + touch configure-hppa64-stamp + +build-hppa64-stamp: configure-hppa64-stamp + $(checkdir) + $(MAKE) -C builddir-hppa64/bfd headers + env MAKE="$(MAKE) VERSION=$(HPPA64_VERSION)" \ + $(MAKE) $(NJOBS) -C builddir-hppa64 + touch build-hppa64-stamp + +############################################################################### + +pre-build: +#ifneq (,$(filter $(DEB_HOST_ARCH), amd64)) +# @echo Build it ... +#else +# @echo Explicitely fail the build for architecture $(DEB_HOST_ARCH) +# false +#endif + +build_stamps = build-single-stamp +ifeq ($(with_multiarch),yes) + build_stamps += build-multi-stamp +endif +ifeq ($(with_hppa64),yes) + build_stamps += build-hppa64-stamp +endif +ifneq (,$(TARGET)) + ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS))) + build_stamps = build-static-cross-stamp + else + build_stamps = build-cross-stamp + endif +endif + +ifeq ($(BACKPORT),true) + build_stamps := + with_check := no +endif + +build: pre-build build-stamp +build-arch: pre-build build-stamp +build-indep: pre-build build-stamp +build-stamp: $(build_stamps) + touch build-stamp + +############################################################################### + +################## +# install target # +################## + +install_stamps = install-stamp +ifeq ($(with_hppa64),yes) + install_stamps += install-hppa64-stamp +endif +ifeq ($(with_static),yes) + install_stamps += install-static-stamp +endif +ifneq (,$(TARGET)) + ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS))) + install_stamps = install-static-cross-stamp + else + install_stamps = install-cross-stamp + endif +endif +ifeq ($(BACKPORT),true) + install_stamps := +endif +install: $(install_stamps) +install-stamp: checkroot build-stamp + $(checkdir) + + rm -fr $(d_bin) $(d_dev) $(d_mul) $(d_mdev) $(d_doc) $(d_src) + $(install_dir) $(d_bin) $(d_dev) $(d_mul) $(d_mdev) $(d_doc) $(d_src) + + : # install binutils and -dev stuff + env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \ + $(MAKE) -C builddir-single \ + CFLAGS="$(CFLAGS)" prefix=$(pwd)/$(d_bin)/$(PF) \ + mandir=$(pwd)/$(d_bin)/$(PF)/share/man \ + infodir=$(pwd)/$(d_doc)/$(PF)/share/info install + +ifeq ($(with_multiarch),yes) + : # now install binutils-multiarch stuff + env MAKE="$(MAKE) VERSION=$(MULTI_VERSION)" \ + $(MAKE) -C builddir-multi \ + CFLAGS="$(CFLAGS)" \ + prefix=$(pwd)/$(d_mul)/$(PF) \ + mandir=$(pwd)/$(d_mul)/$(PF)/share/man \ + infodir=$(pwd)/$(d_doc)/$(PF)/share/info install +endif + + : # fix bfd.h, removing the safety inclusion guard + awk '/PR 14072/,/^#endif/ {next} {print}' $(d_bin)/$(PF)/include/bfd.h \ + > $(d_bin)/$(PF)/include/bfd.h.new + mv $(d_bin)/$(PF)/include/bfd.h.new $(d_bin)/$(PF)/include/bfd.h + + : # fix multilib conflicts of generated values by __WORDSIZE-based expressions + sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$$~#include ~;}' \ + -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \ + -e 's/^#define BFD_HOST_64BIT_LONG [01] *$$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \ + -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$$/#if __WORDSIZE == 32\ +#define BFD_HOST_64_BIT long long\ +#else\ +#define BFD_HOST_64_BIT long\ +#endif/' \ + -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \ + $(d_bin)/$(PF)/include/bfd.h + + : # copy plugin-api.h ... + cp -f include/plugin-api.h $(d_bin)/$(PF)/include + + : # We don't need to distribute everything in binutils and -dev + rm -rf $(d_bin)/$(PF)/include/obstack.h + rm -f $(d_bin)/$(PF)/man/man1/configure.1 + rm -f $(d_doc)/$(PF)/share/info/configure.* $(d_doc)/$(PF)/share/info/standards.* + : # *sigh*, bugs.debian.org/213524 + rm -f $(d_doc)/$(PF)/share/info/dir* + +ifeq ($(with_multiarch),yes) + : # Now get rid of just about everything in binutils-multiarch + rm -rf $(d_mul)/$(PF)/man $(d_mul)/$(PF)/info $(d_mul)/$(PF)/include + rm -rf $(d_mul)/$(PF)/share/man $(d_mul)/$(PF)/share/info $(d_mul)/$(PF)/share/locale + + : # elfedit (even with its --input-mach option) + : # is the same for all targets. + rm -f $(d_mul)/$(PF)/bin/elfedit + + : # c++filt does not link to libbfd for anything more than + : # the help message, and its behavior does not vary + : # between arches aside from the --version message. + rm -f $(d_mul)/$(PF)/bin/c++filt + + : # As gas/README points out (search for --enable-targets), + : # multi-arch gas is not ready yet. + rm -f $(d_mul)/$(PF)/bin/as + rm -f $(d_mul)/$(PF)/bin/ld + rm -f $(d_mul)/$(PF)/bin/ld.bfd + rm -f $(d_mul)/$(PF)/bin/ld.gold + rm -fr $(d_mul)/$(PF)/lib/ldscripts + + ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64 ppc64el)) + rm -f $(d_mul)/$(PF)/bin/embedspu + endif +endif + + $(install_dir) $(d_dev)/$(PF)/include/ $(d_dev)/$(PF)/lib/ + mv $(d_bin)/$(PF)/include/* $(d_dev)/$(PF)/include/ + mv $(d_bin)/$(PF)/lib/*.a $(d_bin)/$(PF)/lib/libbfd.so $(d_bin)/$(PF)/lib/libopcodes.so \ + $(d_dev)/$(PF)/lib/ + +ifeq ($(with_multiarch),yes) + $(install_dir) $(d_mdev)/$(PF)/lib/ + mv $(d_mul)/$(PF)/lib/libbfd.so \ + $(d_mdev)/$(PF)/lib/libbfd-multiarch.so + mv $(d_mul)/$(PF)/lib/libopcodes.so \ + $(d_mdev)/$(PF)/lib/libopcodes-multiarch.so + rm -f $(d_mul)/$(PF)/lib/*.la $(d_mul)/$(PF)/lib/*.a + rm -f $(d_mul)/$(PF)/lib*/libiberty* +endif + + : # Get rid of .la files since libtool obviously has no idea about transient paths + rm -f $(d_bin)/$(PF)/lib/*.la + + chmod ugo-x $(d_bin)/$(PF)/lib/*.so + $(call strip_package, $(p_bin), $(d_bin)) +ifeq ($(with_multiarch),yes) + chmod ugo-x $(d_mul)/$(PF)/lib/*.so + $(call strip_package, $(p_mul), $(d_mul)) +endif + + if which strip-nondeterminism >/dev/null 2>&1; then \ + find $(d_dev) -name '*.a' -print0 \ + | xargs -0r strip-nondeterminism --type ar; \ + fi + + : # Don't want /usr/-linux to exist in any package + rm -rf $(d_bin)/$(PF)/$(DEB_HOST_GNU_TYPE) + + : # Remove windres manpages + rm -f $(d_bin)/$(PF)/share/man/man1/windres.1 + +ifeq ($(with_multiarch),yes) + rm -rf $(d_mul)/$(PF)/$(DEB_HOST_GNU_TYPE) + rm -f $(d_mul)/$(PF)/share/man/man1/windres.1 +endif + + rm -f $(d_bin)/$(PF)/bin/ld + ln -s ld.bfd $(d_bin)/$(PF)/bin/ld +ifeq ($(with_gold),yes) + ln -s ld.gold $(d_bin)/$(PF)/bin/gold + mv $(d_bin)/$(PF)/share/man/man1/ld.1 \ + $(d_bin)/$(PF)/share/man/man1/ld.bfd.1 + ln -s ld.bfd.1.gz $(d_bin)/$(PF)/share/man/man1/ld.1.gz + ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) + if which help2man >/dev/null 2>&1; then \ + help2man -N -n 'The GNU ELF linker' $(d_bin)/$(PF)/bin/ld.gold \ + | sed 's,$(d_bin)/$(PF)/bin/,,g' > debian/ld.gold.1; \ + help2man -N -n 'The DWARF packaging utility' $(d_bin)/$(PF)/bin/dwp \ + | sed 's,$(d_bin)/$(PF)/bin/,,g' > debian/dwp.1; \ + fi + endif + cp debian/dwp.1 $(d_bin)/$(PF)/share/man/man1/ + cp debian/ld.gold.1 $(d_bin)/$(PF)/share/man/man1/ + ln -s ld.gold.1.gz $(d_bin)/$(PF)/share/man/man1/gold.1.gz + + : # install a symlink for the gold linker + $(install_dir) $(d_bin)/$(PF)/lib/gold-ld + ln -s ../../bin/ld.gold $(d_bin)/$(PF)/lib/gold-ld/ld +endif + : # install a symlink for the old linker + $(install_dir) $(d_bin)/$(PF)/lib/compat-ld + ln -s ../../bin/ld.bfd $(d_bin)/$(PF)/lib/compat-ld/ld + + : # Remove empty directory + rmdir $(d_bin)/$(PF)/include/ + + : # Provide $(DEB_HOST_GNU_TYPE)- prefixed binaries + for i in \ + addr2line ar as c++filt elfedit gprof ld ld.bfd \ + $(if $(with_gold),ld.gold dwp) \ + nm objcopy objdump ranlib readelf size strings strip; \ + do \ + ln -sf $$i $(d_bin)/$(PF)/bin/$(DEB_HOST_GNU_TYPE)-$$i; \ + ln -sf $$i.1.gz $(d_bin)/$(PF)/share/man/man1/$(DEB_HOST_GNU_TYPE)-$$i.1.gz; \ + done + +ifneq (,$(filter $(DEB_HOST_ARCH),i386 kfreebsd-i386 hurd-i386)) +# temporary i486-* symlinks for jessie/sid + ifeq ($(DEB_HOST_GNU_CPU),i586) + gnutype=$(subst i586,i486,$(DEB_HOST_GNU_TYPE)); \ + for i in \ + addr2line ar as c++filt elfedit gprof ld ld.bfd \ + $(if $(with_gold),ld.gold dwp) \ + nm objcopy objdump ranlib readelf size strings strip; \ + do \ + ln -sf $$i $(d_bin)/$(PF)/bin/$$gnutype-$$i; \ + ln -sf $$i.1.gz $(d_bin)/$(PF)/share/man/man1/$$gnutype-$$i.1.gz; \ + done + endif +# for backports to wheezy and squeeze + ifeq ($(DEB_HOST_GNU_CPU),i486) + gnutype=$(subst i486,i586,$(DEB_HOST_GNU_TYPE)); \ + for i in \ + addr2line ar as c++filt elfedit gprof ld ld.bfd \ + $(if $(with_gold),ld.gold dwp) \ + nm objcopy objdump ranlib readelf size strings strip; \ + do \ + ln -sf $$i $(d_bin)/$(PF)/bin/$$gnutype-$$i; \ + ln -sf $$i.1.gz $(d_bin)/$(PF)/share/man/man1/$$gnutype-$$i.1.gz; \ + done + endif +endif + + touch install-stamp + +install-hppa64-stamp: checkroot build-hppa64-stamp + $(checkdir) + + rm -fr $(d_hppa64) + $(install_dir) $(d_hppa64) + $(install_dir) $(d_hppa64)/$(PF)/lib + + : # install binutils-hppa64 stuff + env MAKE="$(MAKE) VERSION=$(HPPA64_VERSION)" \ + $(MAKE) -C builddir-hppa64 \ + CFLAGS="$(CFLAGS)" \ + prefix=$(pwd)/$(d_hppa64)/$(PF)/ \ + mandir=$(pwd)/$(d_hppa64)/$(PF)/share/man \ + infodir=$(pwd)/$(d_hppa64)/$(PF)/share/info install + + : # move shared libs to the standard path + mv $(d_hppa64)/$(PF)/$(DEB_HOST_GNU_TYPE)/hppa64-linux-gnu/lib/lib*-*.so \ + $(d_hppa64)/$(PF)/lib/. + + : # Now get rid of just about everything in binutils-hppa64 + rm -rf $(d_hppa64)/$(PF)/man + rm -rf $(d_hppa64)/$(PF)/info + rm -rf $(d_hppa64)/$(PF)/include + rm -rf $(d_hppa64)/$(PF)/share + rm -rf $(d_hppa64)/$(PF)/hppa-linux-gnu + rm -rf $(d_hppa64)/$(PF)/lib/libiberty.a + + $(call strip_package, $(p_hppa64), $(d_hppa64)) + chmod ugo-x $(d_hppa64)/$(PF)/lib/*.so + + : # Don't want /usr/-linux to exist in any package + rm -rf $(d_hppa64)/$(PF)/hppa64-linux-gnu + + touch install-hppa64-stamp + +install-static-stamp: checkroot build-static-stamp + $(checkdir) + + rm -fr $(d_static) $(d_udeb) + $(install_dir) $(d_static) $(d_udeb) + + : # Copy static ld-new into /bin for both -static and -static-udeb + $(install_dir) $(d_static)/bin + $(install_binary) builddir-static/ld/ld-new $(d_static)/bin/ld_static + $(install_dir) $(d_udeb)/bin + $(install_binary) builddir-static/ld/ld-new $(d_udeb)/bin/ld_static +ifeq ($(with_strip),yes) + pkg_create_dbgsym $(p_static) $(d_static) || true + $(STRIP) --strip-unneeded $(d_static)/bin/ld_static $(d_udeb)/bin/ld_static +endif + + touch install-static-stamp + +############################################################################### + +####################### +# binary-indep target # +####################### + +binary-indep: checkroot build install + $(checkdir) + + rm -f debian/files debian/substvars + +# Cross builds do not have documentation packages +ifeq (,$(TARGET)) + + $(install_dir) $(d_doc)/DEBIAN + +ifeq ($(GFDL_INVARIANT_FREE),yes) + rm -f $(d_doc)/$(PF)/share/info/bfd.info* + rm -f $(d_doc)/$(PF)/share/info/bfdint.info* + rm -f $(d_doc)/$(PF)/share/info/ldint.info* +endif + +ifneq ($(BACKPORT),true) + $(install_dir) $(d_doc)/$(PF)/share/doc/$(p_doc)/ + $(install_file) debian/changelog $(d_doc)/$(PF)/share/doc/$(p_doc)/changelog.Debian + $(install_file) debian/copyright $(d_doc)/$(PF)/share/doc/$(p_doc)/ + for i in bfd gas gprof ld; do \ + ln -sf ../$(p_bin)/$$i $(d_doc)/$(PF)/share/doc/$(p_doc)/$$i; \ + done + find $(d_doc)/$(PF)/share/doc/$(p_doc) -maxdepth 1 -type f ! -name copyright | xargs gzip -9n + gzip -9n $(d_doc)/$(PF)/share/info/* + + dpkg-gencontrol -isp -P$(d_doc) -p$(p_doc) + chown -R root:root $(d_doc) + chmod -R go=rX $(d_doc) + find $(d_doc) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_doc) .. + + $(install_dir) $(d_src)/$(PF)/share/doc/$(p_src)/ + $(install_file) debian/changelog $(d_src)/$(PF)/share/doc/$(p_src)/changelog.Debian + $(install_file) debian/copyright $(d_src)/$(PF)/share/doc/$(p_src)/ + find $(d_src)/$(PF)/share/doc/$(p_src) -maxdepth 1 -type f ! -name copyright | xargs gzip -9n +endif # ifndef BACKPORT + + $(install_dir) $(d_src)/DEBIAN + $(install_dir) $(d_src)/$(PF)/src/binutils/patches + $(install_file) debian/patches/* $(d_src)/$(PF)/src/binutils/patches/ + cd .. && find $(source_files) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' && \ + find $(source_files) -type f -print0 | LC_ALL=C sort -z | \ + tar --null -T - -c --xz --exclude=CVS --mode=go=rX,u+rw,a-s \ + -f $(pwd)/$(d_src)/$(PF)/src/binutils/binutils-$(VERSION).tar.xz \ + $(source_files) + + tar cf - $$(find './debian' -mindepth 1 \( \ + -path './debian/binutils*' -type d -prune -o \ + -path './debian/patches' -prune -o \ + -path './debian/tmp*' -prune -o \ + -path './debian/.bzr*' -prune -o \ + -path './debian/files' -prune -o \ + -print \) ) \ + | tar -x -C $(d_src)/$(PF)/src/binutils -f - + -chmod 755 $(d_src)/$(PF)/src/binutils/debian/*.{pre,post}{inst,rm} + chmod 755 $(d_src)/$(PF)/src/binutils/debian/test-suite-compare.py + + dpkg-gencontrol -isp -P$(d_src) -p$(p_src) + chown -R root:root $(d_src) + chmod -R go=rX $(d_src) + find $(d_src) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_src) .. + +endif + +############################################################################### + +####################### +# binary-arch target # +####################### + +binary-arch: checkroot build install + $(checkdir) + +ifneq ($(BACKPORT),true) +# Process the following only if $(TARGET) is set +ifneq (,$(TARGET)) + test "" != "$(TARGET)" + + rm -rf $(d_cross)/$(PF)/share/info $(d_cross)/$(PF)/share/man + + $(install_dir) $(d_cross)/DEBIAN + + $(install_dir) $(d_cross)/$(PF)/share/doc/$(p_cross)/ + $(install_file) debian/changelog $(d_cross)/$(PF)/share/doc/$(p_cross)/changelog.Debian + $(install_file) debian/copyright debian/README.cross $(d_cross)/$(PF)/share/doc/$(p_cross)/ + gzip -9nf $(d_cross)/$(PF)/share/doc/$(p_cross)/changelog.Debian + + for pkg in bfd gas gprof ld; do \ + ln -sf ../binutils/$$pkg $(d_cross)/$(PF)/share/doc/$(p_cross)/$$pkg; \ + done + + rm -f debian/substvars + dpkg-shlibdeps $(d_cross)/$(PF)/bin/* + dpkg-gencontrol -isp -P$(d_cross) -p$(p_cross) \ + -VBuilt-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W binutils-source)" + find $(d_cross) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_cross) .. + +else + : # generate some control & helper files + if [ "$(is_rc)" = yes ]; then \ + nver=$$(echo $(DEB_UPSTREAM) | awk -F. '{ OFS="."; NF--; $$NF=$$NF+1; print }'); \ + else \ + nver=$$(echo $(DEB_UPSTREAM) | awk -F. '{ OFS="."; $$NF=$$NF+1; print }'); \ + fi; \ + for i in debian/*.in; do \ + case "$$i" in debian/control.cross.in) continue; esac; \ + date_ext=$(DATE_EXT); \ + case "$$i" in debian/*.shlibs.in) [ "$(is_rc)" = yes ] && date_ext=; esac; \ + sed -e 's/@VER@/$(VERSION)/g' \ + -e 's/@DEB_VER@/$(DEB_VERSION)/g' \ + -e 's/@DEB_SVER@/$(DEB_SVERSION)/g' \ + -e 's/@DEB_UVER@/$(DEB_UPSTREAM)/g' \ + -e "s/@DEB_NVER@/$$nver/g" \ + -e "s/@DATE_EXT@/$$date_ext/g" \ + -e 's/@DEB_ARCH@/$(DEB_HOST_ARCH)/g' \ + -e "s/@dpkg_dev@/$(DPKG_DEV)/" \ + $$i > $${i%*.in}; \ + case "$$i" in *.post*|*.pre*) chmod 755 $${i%*.in}; esac; \ + done + + : # install bug reporting information + $(install_file) -D debian/$(p_bin).presubj \ + $(d_bin)/$(PF)/share/bug/$(p_bin)/presubj +ifeq ($(with_multiarch),yes) + $(install_dir) $(d_mul)/$(PF)/share/bug + ln -sf $(p_bin) $(d_mul)/$(PF)/share/bug/$(p_mul) +endif +ifeq ($(with_hppa64),yes) + $(install_dir) $(d_hppa64)/$(PF)/share/bug + ln -sf $(p_bin) $(d_hppa64)/$(PF)/share/bug/$(p_hppa64) +endif + + : # make lintian happy + $(install_file) -D debian/$(p_bin).overrides \ + $(d_bin)/$(PF)/share/lintian/overrides/$(p_bin) +ifeq ($(with_multiarch),yes) + $(install_file) -D debian/$(p_mul).overrides \ + $(d_mul)/$(PF)/share/lintian/overrides/$(p_mul) + $(install_file) -D debian/$(p_mdev).overrides \ + $(d_mdev)/$(PF)/share/lintian/overrides/$(p_mdev) +endif +ifeq ($(with_static),yes) + $(install_file) -D debian/$(p_static).overrides \ + $(d_static)/$(PF)/share/lintian/overrides/$(p_static) + $(install_file) -D debian/$(p_udeb).overrides \ + $(d_udeb)/$(PF)/share/lintian/overrides/$(p_udeb) +endif +ifeq ($(with_hppa64),yes) + $(install_file) -D debian/$(p_hppa64).overrides \ + $(d_hppa64)/$(PF)/share/lintian/overrides/$(p_hppa64) +endif + + : # install maintainer scrtips + $(install_dir) $(d_bin)/DEBIAN + $(install_script) debian/binutils.postinst $(d_bin)/DEBIAN/postinst + $(install_script) debian/binutils.postrm $(d_bin)/DEBIAN/postrm + $(install_file) debian/binutils.shlibs $(d_bin)/DEBIAN/shlibs + + $(install_dir) $(d_dev)/DEBIAN + +ifeq ($(with_multiarch),yes) + $(install_dir) $(d_mul)/DEBIAN + $(install_script) debian/binutils-multiarch.preinst $(d_mul)/DEBIAN/preinst + $(install_script) debian/binutils-multiarch.postinst $(d_mul)/DEBIAN/postinst + $(install_script) debian/binutils-multiarch.prerm $(d_mul)/DEBIAN/prerm + $(install_script) debian/binutils-multiarch.postrm $(d_mul)/DEBIAN/postrm + $(install_file) debian/binutils-multiarch.shlibs $(d_mul)/DEBIAN/shlibs +endif + +ifeq ($(with_static),yes) + $(install_dir) $(d_static)/DEBIAN + $(install_script) debian/binutils-static.preinst $(d_static)/DEBIAN/preinst + $(install_dir) $(d_udeb)/DEBIAN +endif + +ifeq ($(with_hppa64),yes) + $(install_dir) $(d_hppa64)/DEBIAN + $(install_script) debian/binutils-hppa64.postinst $(d_hppa64)/DEBIAN/postinst + $(install_script) debian/binutils-hppa64.postrm $(d_hppa64)/DEBIAN/postrm + $(install_file) debian/binutils-hppa64.shlibs $(d_hppa64)/DEBIAN/shlibs +endif + + : # install docs + $(install_dir) $(d_bin)/$(PF)/share/doc/$(p_bin)/ + $(install_file) debian/changelog $(d_bin)/$(PF)/share/doc/$(p_bin)/changelog.Debian + $(install_file) debian/copyright $(d_bin)/$(PF)/share/doc/$(p_bin)/ + +ifeq ($(with_static),yes) + $(install_dir) $(d_static)/$(PF)/share/doc/$(p_static)/ + $(install_file) debian/changelog $(d_static)/$(PF)/share/doc/$(p_static)/changelog.Debian + $(install_file) debian/copyright $(d_static)/$(PF)/share/doc/$(p_static)/ +endif + + $(install_dir) $(d_dev)/$(PF)/share/doc/ + ln -sf $(p_bin) $(d_dev)/$(PF)/share/doc/$(p_dev) +ifeq ($(with_multiarch),yes) + $(install_dir) $(d_mul)/$(PF)/share/doc/ + ln -sf $(p_bin) $(d_mul)/$(PF)/share/doc/$(p_mul) + $(install_dir) $(d_mdev)/$(PF)/share/doc/ + ln -sf $(p_mul) $(d_mdev)/$(PF)/share/doc/$(p_mdev) +endif +ifeq ($(with_hppa64),yes) + $(install_dir) $(d_hppa64)/$(PF)/share/doc/ + ln -sf $(p_bin) $(d_hppa64)/$(PF)/share/doc/$(p_hppa64) +endif + +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) +ifeq ($(with_check),yes) + : # remove user and date from test-summary for reproducible builds + sed -i -e '/Test Run By/d' $(pwd)/test-summary + $(install_file) $(pwd)/test-summary $(d_bin)/$(PF)/share/doc/$(p_bin)/ +endif +endif + $(install_file) binutils/NEWS debian/README.cross \ + $(d_bin)/$(PF)/share/doc/$(p_bin)/ + + $(install_file) binutils/ChangeLog $(d_bin)/$(PF)/share/doc/$(p_bin)/changelog + + for pkg in bfd gas gprof ld; do \ + $(install_dir) $(d_bin)/$(PF)/share/doc/$(p_bin)/$$pkg; \ + done + $(install_file) bfd/ChangeLog bfd/PORTING bfd/TODO \ + $(d_bin)/$(PF)/share/doc/$(p_bin)/bfd/ + $(install_file) gas/ChangeLog gas/NEWS $(d_bin)/$(PF)/share/doc/$(p_bin)/gas/ + $(install_file) gprof/ChangeLog gprof/TODO gprof/TEST \ + $(d_bin)/$(PF)/share/doc/$(p_bin)/gprof/ + $(install_file) ld/ChangeLog ld/TODO ld/NEWS \ + $(d_bin)/$(PF)/share/doc/$(p_bin)/ld/ + + : # These only exist in H. J. Lu releases not GNU ones. + for dir in binutils bfd gas gprof ld; do \ + if [ -f $$dir/ChangeLog.linux ]; then \ + $(install_file) $$dir/ChangeLog.linux $(d_bin)/$(PF)/share/doc/$(p_bin)/$$dir/; \ + fi; \ + done + + : # Copy bbconv.pl to the doc dir for use by interested people + $(install_file) gprof/bbconv.pl $(d_bin)/$(PF)/share/doc/$(p_bin)/gprof/. + + : # Compress stuff that needs it + gzip -9n $(d_bin)/$(PF)/share/man/man1/*.1 + find $(d_bin)/$(PF)/share/doc/$(p_bin)/ -type f ! -name copyright -a ! -name bbconv.pl | xargs gzip -9n +ifeq ($(with_static),yes) + find $(d_static)/$(PF)/share/doc/$(p_static)/ -type f ! -name copyright | xargs gzip -9n +endif + + : # Finish it all up + find $(d_bin) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps + dpkg-gencontrol -isp -P$(d_bin) -p$(p_bin) $(CONFLICTS) $(gold_provides) + cd $(d_bin) && find -type f ! -regex './DEBIAN/.*' -printf '%P\n' | LC_ALL=C sort | xargs md5sum > DEBIAN/md5sums + + rm -f debian/substvars + dpkg-gencontrol -isp -P$(d_dev) -p$(p_dev) + cd $(d_dev) && find -type f ! -regex './DEBIAN/.*' -printf '%P\n' | LC_ALL=C sort | xargs md5sum > DEBIAN/md5sums + +ifeq ($(with_multiarch),yes) + rm -f debian/substvars + find $(d_mul) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps + dpkg-gencontrol -isp -P$(d_mul) -p$(p_mul) + cd $(d_mul) && find -type f ! -regex './DEBIAN/.*' -printf '%P\n' | LC_ALL=C sort | xargs md5sum > DEBIAN/md5sums + + rm -f debian/substvars + mkdir -p $(d_mdev)/DEBIAN + dpkg-gencontrol -isp -P$(d_mdev) -p$(p_mdev) + cd $(d_mdev) && find -type f ! -regex './DEBIAN/.*' -printf '%P\n' | LC_ALL=C sort | xargs -r md5sum > DEBIAN/md5sums +endif + +ifeq ($(with_static),yes) + dpkg-gencontrol -isp -P$(d_static) -p$(p_static) + dpkg-gencontrol -isp -P$(d_udeb) -p$(p_udeb) -fdebian/files~ + dpkg-distaddfile $(STATIC_UDEB) debian-installer optional +endif + +ifeq ($(with_hppa64),yes) + rm -f debian/substvars + find $(d_hppa64) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps + dpkg-gencontrol -isp -P$(d_hppa64) -p$(p_hppa64) + cd $(d_hppa64) && find -type f ! -regex './DEBIAN/.*' -printf '%P\n' | LC_ALL=C sort | xargs md5sum > DEBIAN/md5sums +endif + + chown -R root:root $(d_bin) $(d_dev) + chmod -R go=rX $(d_bin) $(d_dev) + find $(d_bin) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_bin) .. + find $(d_dev) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_dev) .. +ifeq ($(with_multiarch),yes) + chown -R root:root $(d_mul) + chmod -R go=rX $(d_mul) + find $(d_mul) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_mul) .. + + chown -R root:root $(d_mdev) + chmod -R go=rX $(d_mdev) + find $(d_mdev) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_mdev) .. +endif +ifeq ($(with_static),yes) + chown -R root:root $(d_static) $(d_udeb) + chmod -R go=rX $(d_static) $(d_udeb) + find $(d_static) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_static) .. + find $(d_udeb) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_udeb) ../$(STATIC_UDEB) +endif +ifeq ($(with_hppa64),yes) + chown -R root:root $(d_hppa64) + chmod -R go=rX $(d_hppa64) + find $(d_hppa64) -depth -newermt '$(BUILD_DATE)' -print0 | \ + xargs -0r touch --no-dereference --date='$(BUILD_DATE)' + dpkg --build $(d_hppa64) .. +endif + +endif # Process the following only if $(TARGET) is set +endif # ifndef BACKPORT +############################################################################### + +################# +# cross targets # +################# + +# Process the following only if $(TARGET) is set +ifneq (,$(TARGET)) + +p_cross = $(subst _,-,binutils-$(TARGET)) +d_cross = debian/$(p_cross) + +#----------------------------------------------------------------- +# sysroot options +ifdef WITH_SYSROOT + with_sysroot = $(WITH_SYSROOT) +endif +ifdef WITH_BUILD_SYSROOT + with_build_sysroot = $(WITH_BUILD_SYSROOT) +endif + +ifneq ($(with_sysroot),) + CONFARGS += --with-sysroot=$(with_sysroot) +endif +ifneq ($(with_build_sysroot),) + CONFARGS += --with-build-sysroot=$(with_build_sysroot) +endif +ifeq ($(with_gold),yes) + CONFARGS += --enable-ld=default --enable-gold +endif + +configure-cross-stamp: patch-stamp control-stamp + $(checkdir) + test "" != "$(TARGET)" + rm -rf configure-cross-stamp builddir-$(TARGET) + mkdir builddir-$(TARGET) + cd builddir-$(TARGET) \ + && env CC="$(CC)" CXX="$(CXX)" ../configure \ + $(CONFARGS) \ + --target=$(TARGET) + touch $@ + +build-cross-stamp: configure-cross-stamp + $(checkdir) + test "" != "$(TARGET)" + $(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" + touch $@ + +install-cross-stamp: build-cross-stamp + $(checkdir) + test "" != "$(TARGET)" + rm -rf $(d_cross) + $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/$(PF) \ + mandir=$(pwd)/$(d_cross)/$(PF)/share/man install + rm -rf $(d_cross)/$(PF)/lib* $(d_cross)/$(PF)/info $(d_cross)/$(PF)/share/locale + + $(call strip_package, $(p_cross), $(d_cross),$(DEB_HOST_GNU_TYPE)/$(TARGET)) + chmod ugo-x $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(TARGET)/lib/*.so + + : # Get rid of .la files since libtool obviously has no idea about transient paths + rm -f $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(TARGET)/lib/*.la + + gzip -9n $(d_cross)/$(PF)/share/man/man1/* + touch $@ + +configure-host-cross-stamp: configure-cross-stamp + $(checkdir) + test "" != "$(TARGET)" + $(MAKE) configure-host -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" + touch $@ + +build-static-cross-stamp: configure-host-cross-stamp + $(checkdir) + test "" != "$(TARGET)" + $(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" LDFLAGS="-all-static" + touch $@ + +install-static-cross-stamp: build-static-cross-stamp install-cross-stamp + +binary-cross: + @echo "Please use dpkg-buildpackage instead of calling binary-cross directly; see README.cross" + @false + +endif # ifneq ($(TARGET),) + +############################################################################### + +define checkdir + test -f bfd/elf32.c -a -f debian/rules +endef + +ifeq ($(with_strip),yes) +define strip_package + : # Strip shared libraries + if which pkg_create_dbgsym >/dev/null 2>&1; then \ + pkg_create_dbgsym $1 $2; \ + fi + $(STRIP) --strip-unneeded $2/$(PF)/$3/lib/libbfd-*so + $(STRIP) --strip-unneeded $2/$(PF)/$3/lib/libopcodes-*so + $(STRIP) $$(file $2/$(PF)/bin/* |awk -F: '$$0 !~ /script/ {print $$1}') +endef +else +define strip_package +endef +endif + +remove-gfdl-files: +ifeq ($(GFDL_INVARIANT_FREE),yes) + for i in $(gfdl_toplevel_texinfo_files); do \ + if [ -f $$i ]; then \ + sed "s/@name@/$$(basename $$i)/g" debian/gfdl.texi > $$i; \ + fi; \ + done + rm -f $(gfdl_generated_files) +endif + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot --- binutils-2.25.orig/debian/source.lintian-overrides +++ binutils-2.25/debian/source.lintian-overrides @@ -0,0 +1,5 @@ +# handled via diversions +binutils source: binaries-have-file-conflict + +# wrong positive +binutils source: license-problem-gfdl-invariants --- binutils-2.25.orig/debian/source/format +++ binutils-2.25/debian/source/format @@ -0,0 +1 @@ +1.0 --- binutils-2.25.orig/debian/strip.cross.in +++ binutils-2.25/debian/strip.cross.in @@ -0,0 +1,3 @@ +#! /bin/sh + +__TARGET__strip --remove-section=.comment --remove-section=.note $* --- binutils-2.25.orig/debian/test-suite-compare.py +++ binutils-2.25/debian/test-suite-compare.py @@ -0,0 +1,230 @@ +#!/usr/bin/python3 + +# Quick'n'dirty regression check for dejagnu testsuites +# Copyright (C) 2003, 2004, 2005, 2006, 2007 James Troup + +# 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 2 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;5B General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +################################################################################ + +import optparse +import os +import sys + +################################################################################ + +def fubar(msg, exit_code=1): + sys.stderr.write("E: %s\n" % (msg)) + sys.exit(exit_code) + +def warn(msg): + sys.stderr.write("W: %s\n" % (msg)) + +def info(msg): + sys.stderr.write("I: %s\n" % (msg)) + +################################################################################ + +def read_testsummary(filename): + results = {} + file = open(filename) + for line in file.readlines(): + if not line: + continue + if line.startswith("Running"): + s = line.split() + if "/" in s[1]: + x = s[1] + if x.find("/testsuite/") == -1: + fubar("Can't find /testsuite/ in '%s'." % (x)) + # 'Running /home/james/debian/packages/binutils/binutils-2.14.90.0.7/gas/testsuite/gas/hppa/unsorted/unsorted.exp ...' -> 'gas/hppa/unsorted/unsorted.exp' + # ... since using basename() isn't dupe safe. + section = x[x.find("/testsuite/"):].replace("/testsuite/","").split()[0] + + # Tests can be duplicated, e.g. hppa/basic/basic.exp + # is run twice, once for hppa-linux and once for + # hppa64-linux. This is of course a horrible bodge, + # but I can't think of anything trivial and better off + # hand. + + if section in results: + extra = 1 + too_many = 10 + while section in results and extra < too_many: + section = "%s.%s" % (section, extra) + extra += 1 + if extra >= too_many: + fubar("gave up trying to unduplicate %s." % (section)) + + results[section] = {} + continue + + got_state = 0 + for state in [ "PASS", "XPASS", "FAIL", "XFAIL", "UNRESOLVED", + "UNTESTED", "UNSUPPORTED" ]: + if line.startswith(state): + s = line.split(':') + state = s[0] + test = ':'.join(s[1:]).strip() + if test in results: + warn("%s/%s is duplicated." % (section, test)) + results[section][test] = state + got_state = 1 + break + + if got_state: + continue + + return results + +################################################################################ + +def compare_results(old, new): + total_num = 0 + pass_count = 0 + fail_count = 0 + xfail_count = 0 + untested_count = 0 + regression_count = 0 + progression_count = 0 + change_count = 0 + + for section in list(new.keys()): + for test in list(new[section].keys()): + state = new[section][test] + + # Stats pr0n + total_num += 1 + if state == "PASS" or state == "XPASS": + pass_count += 1 + elif state == "FAIL" or state == "UNRESOLVED": + fail_count += 1 + elif state == "XFAIL": + xfail_count += 1 + elif state == "UNTESTED": + untested_count += 1 + + # Compare to old + if section not in old: + continue + if test not in old[section]: + continue + old_state = old[section][test] + if state == "PASS": + if old_state != "PASS": + progression_count += 1 + info("[%s] progression (%s -> %s): %s" % (section, old_state, state, test)) + elif state == "XPASS": + if old_state != "XPASS" and old_state != "PASS": + progression_count += 1 + warn("[%s] %s: %s" % (section, state, test)) + elif state == "FAIL": + if old_state != "FAIL": + regression_count += 1 + warn("[%s] REGRESSION (%s -> %s): %s" % (section, old_state, state, test)) + elif state == "XFAIL": + if old_state != "XFAIL": + change_count += 1 + info("[%s] change (%s -> %s): %s" % (section, old_state, state, test)) + elif state == "UNRESOLVED": + if old_state != "UNRESOLVED" and old_state != "FAIL": + regression_count += 1 + warn("[%s] REGRESSION (%s -> %s): %s" % (section, old_state, state, test)) + if old_state == "FAIL": + change_count += 1 + info("[%s] change (%s -> %s): %s" % (section, old_state, state, test)) + elif state == "UNTESTED": + if old_state != "UNTESTED": + change_count += 1 + warn("[%s] REGRESSION (%s -> %s): %s" % (section, old_state, state, test)) + + if regression_count: + print("%d REGRESSIONS (%.2f%%)." % (regression_count, (float(regression_count)/total_num)*100)) + if progression_count: + print("%d progressions (%.2f%%)." % (progression_count, (float(progression_count)/total_num)*100)) + + if change_count: + print("%d changes (%.2f%%)." % (change_count, (float(change_count)/total_num)*100)) + + print("%d tests: %d pass (%.2f%%), %d fail (%.2f%%), %d xfail (%.2f%%) %d untested (%.2f%%)." \ + % (total_num, pass_count, (float(pass_count)/total_num)*100, + fail_count, (float(fail_count)/total_num)*100, + xfail_count, (float(xfail_count)/total_num)*100, + untested_count, (float(untested_count)/total_num)*100)) + + if regression_count: + sys.exit(1) + +################################################################################ + +def compare_multiple(directory, first_version, second_version): + architectures = [ "alpha", "arm", "hppa", "i386", "ia64", "mips", + "m68k", "mipsel", "powerpc", "s390", "sparc" ] + + for arch in architectures: + print("*********************************** %s ******************************" % (arch)) + second_filename = "%s/%s_%s" % (directory, second_version, arch) + if not os.path.exists(second_filename): + print(" -- NOT AVAILABLE --") + continue + + new = read_testsummary(second_filename) + first_filename = "%s/%s_%s" % (directory, first_version, arch) + old = read_testsummary(first_filename) + compare_results(old, new) + +################################################################################ + +def init(): + """Initalization, including parsing of options.""" + + usage = """usage: %prog [OPTIONS] +compare (binutils) dejagnu testsuite results. + +Example usage: + + test-suite-compare.py binutils-2.17/test-summary binutils-2.18/test-summary + +Or to compare across all architectures (with test results stored in a +'test-summary' directory): + + test-suite-compare.py -mtest-summary 2.17-3 2.18-1""" + parser = optparse.OptionParser(usage) + parser.add_option("-m", "--multiple", dest="multiple", + nargs=1, type="string", + help="compare multiple architectures") + (options, args) = parser.parse_args() + + if len(args) > 2 or len(args) < 2: + parser.error("takes 2 arguments (old and new)") + (old_version, new_version) = args + + return options, old_version, new_version + +################################################################################ + +def main(): + (options, old_version, new_version) = init() + if options.multiple: + compare_multiple(options.multiple, old_version, new_version) + else: + old = read_testsummary(old_version) + new = read_testsummary(new_version) + compare_results(old, new) + +################################################################################ + +if __name__ == '__main__': + main() --- binutils-2.25.orig/debian/tests/build +++ binutils-2.25/debian/tests/build @@ -0,0 +1 @@ +#!/bin/true --- binutils-2.25.orig/debian/tests/control +++ binutils-2.25/debian/tests/control @@ -0,0 +1,9 @@ +Tests: build +Depends: build-essential +Restrictions: build-needed + +Tests: libc-link +Depends: build-essential + +Tests: shlib-build +Depends: build-essential --- binutils-2.25.orig/debian/tests/libc-link +++ binutils-2.25/debian/tests/libc-link @@ -0,0 +1,29 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libc, to verify +# basic binutils compile-time and run-time linking functionality. +# +# (C) 2012 Canonical Ltd. +# Author: Martin Pitt + +set -e + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat < libctest.c +#include +#include + +int main() +{ + assert (1 > 0); + assert (strcmp ("hello", "hello") == 0); + return 0; +} +EOF + +gcc -o libctest libctest.c +echo "build: OK" +[ -x libctest ] +./libctest +echo "run: OK" --- binutils-2.25.orig/debian/tests/shlib-build +++ binutils-2.25/debian/tests/shlib-build @@ -0,0 +1,44 @@ +#!/bin/sh +# autopkgtest check: Build and link against a simple shared library, to test +# basic binutils compile-time and run-time linking functionality. +# +# (C) 2012 Canonical Ltd. +# Author: Martin Pitt + +set -e + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat < testlib.c + +int ultimate_answer() +{ + return 42; +} +EOF + +gcc -Wall -Werror -shared -o libultimate.so testlib.c +echo "library build: OK" + +# should export the symbol +nm -D libultimate.so | grep -q 'T ultimate_answer' + +# link it against a program +cat < testprog.c +#include + +int ultimate_answer(); + +int main() +{ + assert (ultimate_answer() == 42); + return 0; +} +EOF + +gcc -Wall -Werror -L . -o testprog testprog.c -lultimate +echo "program build: OK" +[ -x testprog ] +LD_LIBRARY_PATH=. ./testprog +echo "run: OK" --- binutils-2.25.orig/debian/watch +++ binutils-2.25/debian/watch @@ -0,0 +1,2 @@ +version=2 +http://ftp.gnu.org/gnu/binutils/binutils-([\d\.]*).tar.gz