--- binutils-2.24.orig/debian/README.cross +++ binutils-2.24/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.24.orig/debian/README.source +++ binutils-2.24/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.24.orig/debian/binutils-hppa64.overrides +++ binutils-2.24/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.24.orig/debian/binutils-hppa64.postinst +++ binutils-2.24/debian/binutils-hppa64.postinst @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "configure" ]; then + ldconfig +fi --- binutils-2.24.orig/debian/binutils-hppa64.postrm +++ binutils-2.24/debian/binutils-hppa64.postrm @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + ldconfig +fi --- binutils-2.24.orig/debian/binutils-hppa64.shlibs.in +++ binutils-2.24/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.24.orig/debian/binutils-multiarch.overrides +++ binutils-2.24/debian/binutils-multiarch.overrides @@ -0,0 +1,10 @@ +# 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 + +# 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.24.orig/debian/binutils-multiarch.postinst +++ binutils-2.24/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.24.orig/debian/binutils-multiarch.postrm.in +++ binutils-2.24/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.24.orig/debian/binutils-multiarch.preinst.in +++ binutils-2.24/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.24.orig/debian/binutils-multiarch.prerm.in +++ binutils-2.24/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.24.orig/debian/binutils-multiarch.shlibs.in +++ binutils-2.24/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.24.orig/debian/binutils-static-udeb.overrides +++ binutils-2.24/debian/binutils-static-udeb.overrides @@ -0,0 +1,2 @@ +# yes, it's embedded +binutils-static-udeb udeb: embedded-zlib --- binutils-2.24.orig/debian/binutils-static.overrides +++ binutils-2.24/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.24.orig/debian/binutils-static.preinst +++ binutils-2.24/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.24.orig/debian/binutils.overrides +++ binutils-2.24/debian/binutils.overrides @@ -0,0 +1,8 @@ +# the API of the shared libs is not public, don't care about the name +binutils binary: package-name-doesnt-match-sonames + +# 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.24.orig/debian/binutils.postinst +++ binutils-2.24/debian/binutils.postinst @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "configure" ]; then + ldconfig +fi --- binutils-2.24.orig/debian/binutils.postrm +++ binutils-2.24/debian/binutils.postrm @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + ldconfig +fi --- binutils-2.24.orig/debian/binutils.presubj +++ binutils-2.24/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.24.orig/debian/binutils.shlibs.in +++ binutils-2.24/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.24.orig/debian/changelog +++ binutils-2.24/debian/changelog @@ -0,0 +1,5181 @@ +binutils (2.24-5ubuntu14) trusty-proposed; urgency=medium + + * SRU: LP: #1490352. + * Fix -Bsymbolic-functions on arm64. + + -- Michael Hudson-Doyle Thu, 10 Sep 2015 22:22:45 +1200 + +binutils (2.24-5ubuntu13) trusty-proposed; urgency=medium + + * SRU LP: #1311866. + * Update from the 2.24 branch, 20141113. + - Fix PR gold/16945, properly handle 64-bit GOT relocations on x86_64. + - Fix PR gold/16900, an issue where first reserved word of GOT is not + initialized if there is no PLT. + - gold: Fix handling of __ehdr_start when it cannot be defined. + - Apply mainline patches for ppc476 workaround. + - Add binutils test cases for AArch64. + - Disassembler fix on AArch64. + - Fix PR ld/17047, crash in the bfd linker with MALLOC_PERTURB. + - Fix PR ld/17277, ARM32, bogus DT_TEXTREL marker (and R_ARM_NONE) + for PC-relative cross-section relocs. + - [AArch64] Cortex-A53 erratum 835769 linker workaround. + * Remove the aarch64-fix-instruction-mask, applied on the branch. + * Fix PR gold/15639, -flto and ld.gold on ARM. LP: #1191909. + * Use 64k for COMMONPAGESIZE on PPC. LP: #1412553. + * Fix PR ld/16452, PR ld/16457, don't output symbol version definitions + for non-DT_NEEDED. LP: #1248642. + * Add powerpc target for ppc64el builds. Closes: #760395. LP: #1433238. + * binutils-doc: Include all info files. LP: #1410780. + * Fix PR ld/16715 (ARM), set st_value to zero for undefined symbols. + LP: #1441961. + + -- Matthias Klose Tue, 14 Apr 2015 19:52:45 +0200 + +binutils (2.24-5ubuntu3.1) trusty-security; urgency=medium + + * SECURITY UPDATE: out-of-bounds read in srec_scan of bfd/srec.c + - debian/patches/binutils-CVE-2014-8484.patch: report an error for + S-records with less than the miniumum size + - debian/patches/series: disable srec_scan_null_deref.diff as it is + an incomplete fix for this issue and did not go upstream + - CVE-2014-8484 + * SECURITY UPDATE: incorrect memory handling around corrupt group + section headers + - debian/patches/binutils-CVE-2014-8485.patch: Improve handling of + corrupt group sections + - CVE-2014-8485 + * SECURITY UPDATE: out-of-bounds write in _bfd_XXi_swap_aouthdr_in + - debian/patches/binutils-CVE-2014-8501.patch: Handle corrupt + binaries with an invalid value for NumberOfRvaAndSizes. + - CVE-2014-8501 + * SECURITY UPDATE: pe_print_edata buffer overflow + - debian/patches/binutils-CVE-2014-8502.patch: Detect out of + range and truncated rvas or entry counts + - CVE-2014-8502 + * SECURITY UPDATE: ihex_scan buffer overflow + - debian/patches/binutils-CVE-2014-8503.patch: Fix typo in + invocation of ihex_bad_byte. + - CVE-2014-8503 + * SECURITY UPDATE: srec_scan buffer overflow + - debian/patches/binutils-CVE-2014-8504.patch: Increase size of buf + - CVE-2014-8504 + * SECURITY UPDATE: directory traversal vulnerabilities + - debian/patches/binutils-CVE-2014-8737.patch: disallow paths that + include ../ + - CVE-2014-8737 + * SECURITY UPDATE: _bfd_slurp_extended_name_table out-of-bounds write + - debian/patches/binutils-CVE-2014-8738.patch: Handle archives + with corrupt extended name tables. + - CVE-2014-8738 + * SECURITY UPDATE: multiple miscellaneous overflows and out-of-bounds + reads and writes + - debian/patches/binutils-bz17512_prereqs.patch: cherrypicked + prerequisite commits needed to apply following patch + - debian/patches/binutils-bz17512-misc.patch: fix invalid memory + accesses. + * Security hardening: don't use libbfd by default in strings(1) + - debian/patches/binutils-harden_strings.patch: Add new command + line option --data to only scan the initialized, loadable data + sections of binaries, using libbfd; make --all the default. + + -- Steve Beattie Mon, 09 Feb 2015 02:09:07 -0800 + +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.24.orig/debian/control +++ binutils-2.24/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.5 +Build-Depends: autoconf (>= 2.64), + 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: any +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.24.orig/debian/control.cross.in +++ binutils-2.24/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.24.orig/debian/control.in +++ binutils-2.24/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.5 +Build-Depends: autoconf (>= 2.64), + 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: any +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.24.orig/debian/copyright +++ binutils-2.24/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.24.orig/debian/dwp.1 +++ binutils-2.24/debian/dwp.1 @@ -0,0 +1,30 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.44.1. +.TH DWP "1" "July 2014" "dwp (GNU Binutils for Ubuntu) 2.24" "User Commands" +.SH NAME +dwp \- The DWARF packaging utility +.SH SYNOPSIS +.B dwp +[\fIoptions\fR] [\fIfile\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\-V\fR, \fB\-\-version\fR +Print version number +.SH "REPORTING BUGS" +Report bugs to +.SH COPYRIGHT +Copyright 2012 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.24.orig/debian/gfdl.texi +++ binutils-2.24/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.24.orig/debian/ld.gold.1 +++ binutils-2.24/debian/ld.gold.1 @@ -0,0 +1,741 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.44.1. +.TH GOLD "1" "July 2014" "gold (GNU Binutils for Ubuntu 2.24) 1.11" "User Commands" +.SH NAME +gold \- The GNU ELF linker +.SH SYNOPSIS +.B ld.gold +[\fIoptions\fR] \fIfile\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\-\-pic\-executable\fR +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=\fIfiles\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 2013 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.24.orig/debian/patches/001_ld_makefile_patch.patch +++ binutils-2.24/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 @@ + # 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 +@@ -386,7 +386,7 @@ + # 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.24.orig/debian/patches/002_gprof_profile_arcs.patch +++ binutils-2.24/debian/patches/002_gprof_profile_arcs.patch @@ -0,0 +1,27 @@ +Author: Chris Chimelis +Description: Add more documentation about profiling and -fprofile-arcs. +--- a/gprof/gprof.texi ++++ b/gprof/gprof.texi +@@ -148,6 +148,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 +@@ -279,6 +283,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.24.orig/debian/patches/003_gprof_see_also_monitor.patch +++ binutils-2.24/debian/patches/003_gprof_see_also_monitor.patch @@ -0,0 +1,13 @@ +Author: Chris Chimelis +Description: Don't mention monitor(3) which doesn't exist in Debian. (#160654) +--- a/gprof/gprof.texi ++++ b/gprof/gprof.texi +@@ -196,7 +196,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.24.orig/debian/patches/006_better_file_error.patch +++ binutils-2.24/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 +@@ -203,6 +203,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.24.orig/debian/patches/012_check_ldrunpath_length.patch +++ binutils-2.24/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 +@@ -1269,6 +1269,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1505,6 +1507,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + + for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) --- binutils-2.24.orig/debian/patches/013_bash_in_ld_testsuite.patch +++ binutils-2.24/debian/patches/013_bash_in_ld_testsuite.patch @@ -0,0 +1,26 @@ +Author: Matthias Klose +Description: Explicitely use bash for the ld testsuite. +--- a/ld/testsuite/config/default.exp ++++ b/ld/testsuite/config/default.exp +@@ -120,10 +120,10 @@ + #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.24.orig/debian/patches/128_build_id.patch +++ binutils-2.24/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.24.orig/debian/patches/128_ppc64_powerpc_biarch.patch +++ binutils-2.24/debian/patches/128_ppc64_powerpc_biarch.patch @@ -0,0 +1,15 @@ +--- a/ld/emulparams/elf32ppccommon.sh ++++ b/ld/emulparams/elf32ppccommon.sh +@@ -48,3 +48,12 @@ + case "$EMULATION_NAME" in + *64*) LIBPATH_SUFFIX=64 ;; + 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.24.orig/debian/patches/129_multiarch_libpath.patch +++ binutils-2.24/debian/patches/129_multiarch_libpath.patch @@ -0,0 +1,199 @@ +# DP: Add multiarch directories to linker search path for ld and gold. + +Index: binutils/ld/genscripts.sh +=================================================================== +--- binutils.orig/ld/genscripts.sh 2013-05-28 00:51:54.056225962 +0800 ++++ binutils/ld/genscripts.sh 2013-05-28 00:56:39.352233920 +0800 +@@ -240,8 +240,102 @@ + esac + fi + 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 ++ ;; ++ *) ++ ;; ++ 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: binutils/gold/Makefile.am +=================================================================== +--- binutils.orig/gold/Makefile.am 2013-05-28 00:51:54.056225962 +0800 ++++ binutils/gold/Makefile.am 2013-05-28 00:51:54.024225962 +0800 +@@ -33,6 +33,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: binutils/gold/configure +=================================================================== +--- binutils.orig/gold/configure 2013-05-28 00:51:54.056225962 +0800 ++++ binutils/gold/configure 2013-05-28 00:51:54.032225962 +0800 +@@ -594,6 +594,7 @@ + MAINT + MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE ++MULTIARCH_DIRNAME + HAVE_PUBNAMES_FALSE + HAVE_PUBNAMES_TRUE + DLOPEN_LIBS +@@ -7499,6 +7500,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: binutils/gold/configure.ac +=================================================================== +--- binutils.orig/gold/configure.ac 2013-05-28 00:51:54.056225962 +0800 ++++ binutils/gold/configure.ac 2013-05-28 00:51:54.032225962 +0800 +@@ -591,6 +591,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: binutils/gold/options.cc +=================================================================== +--- binutils.orig/gold/options.cc 2013-05-28 00:51:54.056225962 +0800 ++++ binutils/gold/options.cc 2013-05-28 00:51:54.032225962 +0800 +@@ -1141,8 +1141,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: binutils/gold/Makefile.in +=================================================================== +--- binutils.orig/gold/Makefile.in 2013-05-28 00:51:54.056225962 +0800 ++++ binutils/gold/Makefile.in 2013-05-28 00:51:54.052225962 +0800 +@@ -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.24.orig/debian/patches/130_gold_disable_testsuite_build.patch +++ binutils-2.24/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 +@@ -20,7 +20,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.24.orig/debian/patches/131_ld_bootstrap_testsuite.patch +++ binutils-2.24/debian/patches/131_ld_bootstrap_testsuite.patch @@ -0,0 +1,45 @@ +Author: +Description: Description: Fix ld-bootstrap testsuite when configured with --enable-plugins +Author: Rafael Espindola +Upstream status: proposed patch +--- a/ld/testsuite/ld-bootstrap/bootstrap.exp ++++ b/ld/testsuite/ld-bootstrap/bootstrap.exp +@@ -45,6 +45,15 @@ + 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 +@@ -83,6 +92,11 @@ + 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 { +@@ -117,6 +131,10 @@ + if { $plugins == "yes" } { + set extralibs "$extralibs -ldl" + } ++ ++ if { $plugins == "yes" } { ++ set extralibs "$extralibs -ldl" ++ } + + # On Irix 5, linking with --static only works if all the files are + # compiled using -non_shared. --- binutils-2.24.orig/debian/patches/134_gold_no_spu.patch +++ binutils-2.24/debian/patches/134_gold_no_spu.patch @@ -0,0 +1,15 @@ +Author: +Description: Description: Don't configure gold for spu target. +Index: b/Makefile.in +=================================================================== +--- a/Makefile.in ++++ b/Makefile.in +@@ -15603,7 +15603,7 @@ + srcdiroption="--srcdir=$${topdir}/gold"; \ + libsrcdir="$$s/gold"; \ + $(SHELL) $${libsrcdir}/configure \ +- $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ ++ $$(echo $(HOST_CONFIGARGS) |sed 's/,spu//') --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + || exit 1 + @endif gold --- binutils-2.24.orig/debian/patches/135_bfd_version.patch +++ binutils-2.24/debian/patches/135_bfd_version.patch @@ -0,0 +1,47 @@ +Author: +Description: Description: Fix bfd version handling for extra builds + +Index: b/bfd/Makefile.am +=================================================================== +--- a/bfd/Makefile.am ++++ b/bfd/Makefile.am +@@ -1030,14 +1030,14 @@ + + bfdver.h: $(srcdir)/version.h $(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)\"" ;\ + if test "x$(RELEASE)" = x ; 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 +@@ -2091,14 +2091,14 @@ + + bfdver.h: $(srcdir)/version.h $(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)\"" ;\ + if test "x$(RELEASE)" = x ; 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.24.orig/debian/patches/157_ar_scripts_with_tilde.patch +++ binutils-2.24/debian/patches/157_ar_scripts_with_tilde.patch @@ -0,0 +1,11 @@ +--- a/binutils/arlex.l ++++ b/binutils/arlex.l +@@ -79,7 +79,7 @@ + "(" { return '('; } + ")" { return ')'; } + "," { return ','; } +-[A-Za-z0-9/\\$:.\-\_]+ { ++[A-Za-z0-9/\\$:.\-\_~]+ { + yylval.name = xstrdup (yytext); + return FILENAME; + } --- binutils-2.24.orig/debian/patches/158_ld_system_root.patch +++ binutils-2.24/debian/patches/158_ld_system_root.patch @@ -0,0 +1,42 @@ +Index: b/ld/configure.in +=================================================================== +--- a/ld/configure.in ++++ b/ld/configure.in +@@ -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.24.orig/debian/patches/161_gold_dummy_zoption.diff +++ binutils-2.24/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 +@@ -1322,6 +1322,9 @@ + 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 @@ + { + 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.24.orig/debian/patches/164_ld_doc_remove_xref.diff +++ binutils-2.24/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 +@@ -7583,7 +7583,8 @@ + 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.24.orig/debian/patches/168_pr14918.diff +++ binutils-2.24/debian/patches/168_pr14918.diff @@ -0,0 +1,29 @@ +# DP: Fix PR ld/14918: linking with -flto always links in libgcc_s.so + +2012-12-06 H.J. Lu + + PR ld/14918 + * plugin.c (plugin_opt_plugin_arg): Ignore -pass-through=. + +diff --git a/ld/plugin.c b/ld/plugin.c +index da99e77..2966f0f 100644 +--- a/ld/plugin.c ++++ b/ld/plugin.c +@@ -217,6 +220,17 @@ plugin_opt_plugin_arg (const char *arg) + if (!last_plugin) + return set_plugin_error (_("")); + ++ /* Ignore -pass-through= from GCC driver. */ ++ if (*arg == '-') ++ { ++ const char *p; ++ for (p = arg + 1; p; p++) ++ if (*p != '-') ++ break; ++ if (strncmp (p, "pass-through=", 13) == 0) ++ return 0; ++ } ++ + newarg = xmalloc (sizeof *newarg); + newarg->arg = arg; + newarg->next = NULL; --- binutils-2.24.orig/debian/patches/170_doc_fixes.diff +++ binutils-2.24/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 +@@ -1664,7 +1664,7 @@ + @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.24.orig/debian/patches/aarch-symbolic-functions.diff +++ binutils-2.24/debian/patches/aarch-symbolic-functions.diff @@ -0,0 +1,66 @@ +Subject: Fix -Bsymbolic-functions on arm64 +Origin: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=cd3813a8c9e59ccba0c42f5e3664465428e0e89c + + Backport from mainline + + bfd/ChangeLog + 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. + + ld/testsuite/ChangeLog + 2015-01-22 Thomas Preud'homme + + Backport from mainline + 2015-01-13 Thomas Preud'homme + + * ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func + test. + * ld-aarch64/relocs-257-symbolic-func.d: New file. + * ld-aarch64/relocs-257-symbolic-func.s: Likewise. + +--- a/bfd/elfnn-aarch64.c ++++ b/bfd/elfnn-aarch64.c +@@ -4302,7 +4302,7 @@ + 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 + { +--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp ++++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp +@@ -165,3 +165,5 @@ + run_dump_test "ifunc-20" + run_dump_test "ifunc-21" + run_dump_test "ifunc-22" ++ ++run_dump_test "relocs-257-symbolic-func" +--- /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 +.* +--- /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 --- binutils-2.24.orig/debian/patches/aarch64-ilp32.diff +++ binutils-2.24/debian/patches/aarch64-ilp32.diff @@ -0,0 +1,33 @@ +# DP: Update Aarch64 ilp32 linker and libdir names. + +ld/ + +2014-02-11 Andrew Pinski + + * emulparams/aarch64linux32.sh (LIBPATH_SUFFIX): Change to ilp32. + (ELF_INTERPRETER_NAME): Define. + * emulparams/aarch64linux32b.sh (ELF_INTERPRETER_NAME): Define. + +diff --git a/ld/emulparams/aarch64linux32.sh b/ld/emulparams/aarch64linux32.sh +index 573b432..b84eb45 100644 +--- a/ld/emulparams/aarch64linux32.sh ++++ b/ld/emulparams/aarch64linux32.sh +@@ -41,7 +41,9 @@ PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} + case "$target" in + aarch64*-linux*) + case "$EMULATION_NAME" in +- aarch64linux*) LIBPATH_SUFFIX=32 ;; ++ aarch64linux*) LIBPATH_SUFFIX=ilp32 ;; + esac + ;; + esac ++ ++ELF_INTERPRETER_NAME=\"/lib/ld-linux-aarch64_ilp32.so.1\" +diff --git a/ld/emulparams/aarch64linux32b.sh b/ld/emulparams/aarch64linux32b.sh +index f878b18..e92feec 100644 +--- a/ld/emulparams/aarch64linux32b.sh ++++ b/ld/emulparams/aarch64linux32b.sh +@@ -1,2 +1,3 @@ + . ${srcdir}/emulparams/aarch64linux32.sh + OUTPUT_FORMAT="elf32-bigaarch64" ++ELF_INTERPRETER_NAME=\"/lib/ld-linux-aarch64_be_ilp32.so.1\" --- binutils-2.24.orig/debian/patches/aarch64-libpath.diff +++ binutils-2.24/debian/patches/aarch64-libpath.diff @@ -0,0 +1,23 @@ +--- a/ld/emulparams/aarch64linux.sh ++++ b/ld/emulparams/aarch64linux.sh +@@ -38,10 +38,13 @@ + + # 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 --- binutils-2.24.orig/debian/patches/armhf-sf-float-abi-flags.diff +++ binutils-2.24/debian/patches/armhf-sf-float-abi-flags.diff @@ -0,0 +1,369 @@ +>From 0a02e2d8e2ffb551a3a3699dd09ec9f69393e327 Mon Sep 17 00:00:00 2001 +From: Steve McIntyre +Date: Tue, 4 Sep 2012 17:48:06 +0100 +Subject: [PATCH] Add new ARM hard-float/soft-float ABI flags for EABI_VER5 + +bfd: + * elf32-arm.c (elf32_arm_print_private_bfd_data): Recognise and + display the new ARM hard-float/soft-float ABI flags for EABI_VER5 + (elf32_arm_post_process_headers): Add the hard-float/soft-float + ABI flag as appropriate for ET_DYN/ET_EXEC in EABI_VER5. + +binutils: + * readelf.c (decode_ARM_machine_flags): Recognise and display the + new ARM hard-float/soft-float ABI flags for EABI_VER5. Split out + the code for EABI_VER4 and EABI_VER5 to allow this. + +elfcpp: + * arm.h: New enum for EABI soft- and hard-float flags. + +gold: + * gold.cc (Target_arm::do_adjust_elf_header): Add the + hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC + in EABI_VER5. + +include: + * elf/arm.h (EF_ARM_ABI_FLOAT_SOFT): New define. + (EF_ARM_ABI_FLOAT_HARD): Likewise. + +ld/testsuite: + * ld-arm/eabi-hard-float.s: New test source. + * ld-arm/eabi-soft-float.s: New test source. + * ld-arm/eabi-hard-float.d: New test. + * ld-arm/eabi-soft-float.d: New test. + * ld-arm/eabi-soft-float-ABI4.d: New test. + * ld-arm/eabi-soft-float-r.d: New test. + * ld-arm/arm-elf.xp: Use the new tests. +--- + bfd/elf32-arm.c | 19 +++++++++++++++ + binutils/readelf.c | 35 ++++++++++++++++++++++++++-- + elfcpp/arm.h | 8 +++++++ + gold/arm.cc | 22 ++++++++++++++--- + include/elf/arm.h | 5 ++++ + ld/testsuite/ld-arm/arm-elf.exp | 15 ++++++++++++ + ld/testsuite/ld-arm/eabi-hard-float.d | 12 ++++++++++ + ld/testsuite/ld-arm/eabi-hard-float.s | 9 +++++++ + ld/testsuite/ld-arm/eabi-soft-float-ABI4.d | 12 ++++++++++ + ld/testsuite/ld-arm/eabi-soft-float-r.d | 12 ++++++++++ + ld/testsuite/ld-arm/eabi-soft-float.d | 12 ++++++++++ + ld/testsuite/ld-arm/eabi-soft-float.s | 8 +++++++ + 18 files changed, 203 insertions(+), 5 deletions(-) + create mode 100644 ld/testsuite/ld-arm/eabi-hard-float.d + create mode 100644 ld/testsuite/ld-arm/eabi-hard-float.s + create mode 100644 ld/testsuite/ld-arm/eabi-soft-float-ABI4.d + create mode 100644 ld/testsuite/ld-arm/eabi-soft-float-r.d + create mode 100644 ld/testsuite/ld-arm/eabi-soft-float.d + create mode 100644 ld/testsuite/ld-arm/eabi-soft-float.s + +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index 633bb64..fefc7db 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -12110,6 +12110,15 @@ elf32_arm_print_private_bfd_data (bfd *abfd, void * ptr) + + case EF_ARM_EABI_VER5: + fprintf (file, _(" [Version5 EABI]")); ++ ++ if (flags & EF_ARM_ABI_FLOAT_SOFT) ++ fprintf (file, _(" [soft-float ABI]")); ++ ++ if (flags & EF_ARM_ABI_FLOAT_HARD) ++ fprintf (file, _(" [hard-float ABI]")); ++ ++ flags &= ~(EF_ARM_ABI_FLOAT_SOFT | EF_ARM_ABI_FLOAT_HARD); ++ + eabi: + if (flags & EF_ARM_BE8) + fprintf (file, _(" [BE8]")); +@@ -14417,6 +14426,16 @@ elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATT + if (globals != NULL && globals->byteswap_code) + i_ehdrp->e_flags |= EF_ARM_BE8; + } ++ ++ if (EF_ARM_EABI_VERSION (i_ehdrp->e_flags) == EF_ARM_EABI_VER5 ++ && ((i_ehdrp->e_type == ET_DYN) || (i_ehdrp->e_type == ET_EXEC))) ++ { ++ int abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_PROC, Tag_ABI_VFP_args); ++ if (abi) ++ i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_HARD; ++ else ++ i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_SOFT; ++ } + } + + static enum elf_reloc_type_class +diff --git a/binutils/readelf.c b/binutils/readelf.c +index 2fbf2ae..d69dcfc 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -2104,11 +2104,34 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) + + case EF_ARM_EABI_VER4: + strcat (buf, ", Version4 EABI"); +- goto eabi; ++ while (e_flags) ++ { ++ unsigned flag; ++ ++ /* Process flags one bit at a time. */ ++ flag = e_flags & - e_flags; ++ e_flags &= ~ flag; ++ ++ switch (flag) ++ { ++ case EF_ARM_BE8: ++ strcat (buf, ", BE8"); ++ break; ++ ++ case EF_ARM_LE8: ++ strcat (buf, ", LE8"); ++ break; ++ ++ default: ++ unknown = 1; ++ break; ++ } ++ break; ++ } ++ break; + + case EF_ARM_EABI_VER5: + strcat (buf, ", Version5 EABI"); +- eabi: + while (e_flags) + { + unsigned flag; +@@ -2127,6 +2150,14 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) + strcat (buf, ", LE8"); + break; + ++ case EF_ARM_ABI_FLOAT_SOFT: /* Conflicts with EF_ARM_SOFT_FLOAT. */ ++ strcat (buf, ", soft-float ABI"); ++ break; ++ ++ case EF_ARM_ABI_FLOAT_HARD: /* Conflicts with EF_ARM_VFP_FLOAT. */ ++ strcat (buf, ", hard-float ABI"); ++ break; ++ + default: + unknown = 1; + break; +diff --git a/elfcpp/arm.h b/elfcpp/arm.h +index cb85eeb..4cb79d6 100644 +--- a/elfcpp/arm.h ++++ b/elfcpp/arm.h +@@ -222,6 +222,14 @@ inline Elf_Word + arm_eabi_version(Elf_Word flags) + { return flags & EF_ARM_EABIMASK; } + ++// EABI_VER5 e_flags values for identifying soft- and hard-float ABI ++// choice. ++enum ++{ ++ EF_ARM_ABI_FLOAT_SOFT = 0x200, ++ EF_ARM_ABI_FLOAT_HARD = 0x400, ++}; ++ + // Values for the Tag_CPU_arch EABI attribute. + enum + { +diff --git a/gold/arm.cc b/gold/arm.cc +index fa257a7..30db5a2 100644 +--- a/gold/arm.cc ++++ b/gold/arm.cc +@@ -2476,7 +2476,7 @@ class Target_arm : public Sized_target<32, big_endian> + { return new Arm_output_section(name, type, flags); } + + void +- do_adjust_elf_header(unsigned char* view, int len) const; ++ do_adjust_elf_header(unsigned char* view, int len); + + // We only need to generate stubs, and hence perform relaxation if we are + // not doing relocatable linking. +@@ -10011,15 +10011,16 @@ template + void + Target_arm::do_adjust_elf_header( + unsigned char* view, +- int len) const ++ int len) + { + gold_assert(len == elfcpp::Elf_sizes<32>::ehdr_size); + + elfcpp::Ehdr<32, big_endian> ehdr(view); ++ elfcpp::Elf_Word flags = this->processor_specific_flags(); + unsigned char e_ident[elfcpp::EI_NIDENT]; + memcpy(e_ident, ehdr.get_e_ident(), elfcpp::EI_NIDENT); + +- if (elfcpp::arm_eabi_version(this->processor_specific_flags()) ++ if (elfcpp::arm_eabi_version(flags) + == elfcpp::EF_ARM_EABI_UNKNOWN) + e_ident[elfcpp::EI_OSABI] = elfcpp::ELFOSABI_ARM; + else +@@ -10028,6 +10029,21 @@ Target_arm::do_adjust_elf_header( + + // FIXME: Do EF_ARM_BE8 adjustment. + ++ // If we're working in EABI_VER5, set the hard/soft float ABI flags ++ // as appropriate. ++ if (elfcpp::arm_eabi_version(flags) == elfcpp::EF_ARM_EABI_VER5) ++ { ++ elfcpp::Elf_Half type = ehdr.get_e_type(); ++ if (type == elfcpp::ET_EXEC || type == elfcpp::ET_DYN) ++ { ++ Object_attribute* attr = this->get_aeabi_object_attribute(elfcpp::Tag_ABI_VFP_args); ++ if (attr->int_value()) ++ flags |= elfcpp::EF_ARM_ABI_FLOAT_HARD; ++ else ++ flags |= elfcpp::EF_ARM_ABI_FLOAT_SOFT; ++ this->set_processor_specific_flags(flags); ++ } ++ } + elfcpp::Ehdr_write<32, big_endian> oehdr(view); + oehdr.put_e_ident(e_ident); + } +diff --git a/include/elf/arm.h b/include/elf/arm.h +index 8ea3fe8..d799303 100644 +--- a/include/elf/arm.h ++++ b/include/elf/arm.h +@@ -46,6 +46,11 @@ + #define EF_ARM_MAPSYMSFIRST 0x10 /* NB conflicts with EF_APCS_FLOAT. */ + #define EF_ARM_EABIMASK 0xFF000000 + ++/* New constants defined in the ARM ELF spec. version XXX. ++ Only valid in conjunction with EF_ARM_EABI_VER5. */ ++#define EF_ARM_ABI_FLOAT_SOFT 0x200 /* NB conflicts with EF_ARM_SOFT_FLOAT. */ ++#define EF_ARM_ABI_FLOAT_HARD 0x400 /* NB conflicts with EF_ARM_VFP_FLOAT. */ ++ + /* Constants defined in AAELF. */ + #define EF_ARM_BE8 0x00800000 + #define EF_ARM_LE8 0x00400000 +diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp +index 8e15ffe..81ee0bd 100644 +--- a/ld/testsuite/ld-arm/arm-elf.exp ++++ b/ld/testsuite/ld-arm/arm-elf.exp +@@ -271,6 +271,21 @@ set armelftests_common { + {"Simple non-PIC shared library (no PLT check)" "-shared" "" {arm-lib.s} + {{objdump -Rw arm-lib.r}} + "arm-lib.so"} ++ {"EABI soft-float ET_EXEC ABI flag" "-T arm.ld" "-mfloat-abi=soft -meabi=5" {eabi-soft-float.s} ++ {{readelf -h eabi-soft-float.d}} ++ "eabi-soft-float"} ++ {"EABI hard-float ET_EXEC ABI flag" "-T arm.ld" "-mfloat-abi=hard -meabi=5" {eabi-hard-float.s} ++ {{readelf -h eabi-hard-float.d}} ++ "eabi-hard-float"} ++ {"EABI hard-float ET_DYN ABI flag" "-shared" "-mfloat-abi=hard -meabi=5" {eabi-hard-float.s} ++ {{readelf -h eabi-hard-float.d}} ++ "eabi-hard-float.so"} ++ {"EABI ABI flags wrong ABI version" "-T arm.ld" "-mfloat-abi=soft -meabi=4" {eabi-soft-float.s} ++ {{readelf -h eabi-soft-float-ABI4.d}} ++ "eabi-soft-float-no-flags"} ++ {"EABI ABI flags ld -r" "-r" "-mfloat-abi=soft -meabi=5" {eabi-soft-float.s} ++ {{readelf -h eabi-soft-float-r.d}} ++ "eabi-soft-float-r.o"} + } + + set armelftests_nonacl { +diff --git a/ld/testsuite/ld-arm/eabi-hard-float.d b/ld/testsuite/ld-arm/eabi-hard-float.d +new file mode 100644 +index 0000000..bc8cc3f +--- /dev/null ++++ b/ld/testsuite/ld-arm/eabi-hard-float.d +@@ -0,0 +1,12 @@ ++#source: eabi-hard-float.s ++#as: ++#ld: -r ++#readelf: -h ++# This test is only valid on ELF based ports. ++# not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* ++# Check that we set the hard-float ABI flag directly ++ ++ELF Header: ++#... ++ Flags: 0x5000400, Version5 EABI, hard-float ABI ++#... +diff --git a/ld/testsuite/ld-arm/eabi-hard-float.s b/ld/testsuite/ld-arm/eabi-hard-float.s +new file mode 100644 +index 0000000..3d49794 +--- /dev/null ++++ b/ld/testsuite/ld-arm/eabi-hard-float.s +@@ -0,0 +1,9 @@ ++ .cpu cortex-a9 ++ .fpu vfpv3 ++ .eabi_attribute Tag_ABI_VFP_args, 1 ++ .file "eabi-hard-float.s" ++ .globl _start ++ .type _start,%function ++_start: ++ .size _start,.-_start ++ +diff --git a/ld/testsuite/ld-arm/eabi-soft-float-ABI4.d b/ld/testsuite/ld-arm/eabi-soft-float-ABI4.d +new file mode 100644 +index 0000000..1804826 +--- /dev/null ++++ b/ld/testsuite/ld-arm/eabi-soft-float-ABI4.d +@@ -0,0 +1,12 @@ ++#source: eabi-soft-float.s ++#as: ++#ld: -r ++#readelf: -h ++# This test is only valid on ELF based ports. ++# not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* ++# if we compile for EABI ver4, ld should *not* set either of the float ABI flags ++ ++ELF Header: ++#... ++ Flags: 0x4000000, Version4 EABI ++#... +diff --git a/ld/testsuite/ld-arm/eabi-soft-float-r.d b/ld/testsuite/ld-arm/eabi-soft-float-r.d +new file mode 100644 +index 0000000..262d482 +--- /dev/null ++++ b/ld/testsuite/ld-arm/eabi-soft-float-r.d +@@ -0,0 +1,12 @@ ++#source: eabi-soft-float.s ++#as: ++#ld: -r ++#readelf: -h ++# This test is only valid on ELF based ports. ++# not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* ++# if we call "ld -r", it should *not* set either of the float ABI flags ++ ++ELF Header: ++#... ++ Flags: 0x5000000, Version5 EABI ++#... +diff --git a/ld/testsuite/ld-arm/eabi-soft-float.d b/ld/testsuite/ld-arm/eabi-soft-float.d +new file mode 100644 +index 0000000..6cc7086 +--- /dev/null ++++ b/ld/testsuite/ld-arm/eabi-soft-float.d +@@ -0,0 +1,12 @@ ++#source: eabi-soft-float.s ++#as: ++#ld: -r ++#readelf: -h ++# This test is only valid on ELF based ports. ++# not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* ++# Check that we set the soft-float ABI flag directly ++ ++ELF Header: ++#... ++ Flags: 0x5000200, Version5 EABI, soft-float ABI ++#... +diff --git a/ld/testsuite/ld-arm/eabi-soft-float.s b/ld/testsuite/ld-arm/eabi-soft-float.s +new file mode 100644 +index 0000000..f23fb17 +--- /dev/null ++++ b/ld/testsuite/ld-arm/eabi-soft-float.s +@@ -0,0 +1,8 @@ ++ .cpu cortex-a9 ++ .fpu vfpv3 ++ .eabi_attribute Tag_ABI_VFP_args, 0 ++ .file "eabi-soft-float.s" ++ .globl _start ++ .type _start,%function ++_start: ++ .size _start,.-_start +-- +1.7.9.5 + --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8484.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8484.patch @@ -0,0 +1,52 @@ +From bd25671c6f202c4a5108883caa2adb24ff6f361f Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Fri, 29 Aug 2014 10:36:29 +0930 +Subject: [PATCH] Report an error for S-records with less than the miniumum size + + * srec.c (srec_scan): Revert last change. Report an error for + S-records with less than the miniumum byte count. + +[Ubuntu note: patch differs from upstream by removing the changelog +update, and the reversion of the previous svn commit. -- sbeattie] + +CVE-2014-8484 +--- + bfd/srec.c | 18 +++++++++++++++--- + 2 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/bfd/srec.c b/bfd/srec.c +index d979bf5..42143c7 100644 +--- a/bfd/srec.c ++++ b/bfd/srec.c +@@ -453,7 +453,7 @@ srec_scan (bfd *abfd) + { + file_ptr pos; + char hdr[3]; +- unsigned int bytes; ++ unsigned int bytes, min_bytes; + bfd_vma address; + bfd_byte *data; + unsigned char check_sum; +@@ -476,6 +476,19 @@ srec_scan (bfd *abfd) + } + + check_sum = bytes = HEX (hdr + 1); ++ min_bytes = 3; ++ if (hdr[0] == '2' || hdr[0] == '8') ++ min_bytes = 4; ++ else if (hdr[0] == '3' || hdr[0] == '7') ++ min_bytes = 5; ++ if (bytes < min_bytes) ++ { ++ (*_bfd_error_handler) (_("%B:%d: byte count %d too small\n"), ++ abfd, lineno, bytes); ++ bfd_set_error (bfd_error_bad_value); ++ goto error_return; ++ } ++ + if (bytes * 2 > bufsize) + { + if (buf != NULL) +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8485.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8485.patch @@ -0,0 +1,90 @@ +From 493a33860c71cac998f1a56d6d87d6faa801fbaa Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 27 Oct 2014 12:43:16 +0000 +Subject: [PATCH] This patch closes a potential security hole in applications that use + the bfd library to parse binaries containing maliciously corrupt section + group headers. + + PR binutils/17510 + * elf.c (setup_group): Improve handling of corrupt group + sections. + +[Ubuntu note: this patch differs from upstream by dropping the Changelog +entry to reduce patch conflicts. -- sbeattie] + +CVE-2014-8485 + +--- + bfd/elf.c | 34 ++++++++++++++++++++++++++++++---- + 2 files changed, 36 insertions(+), 4 deletions(-) + +diff --git a/bfd/elf.c b/bfd/elf.c +index c884d1d..c8ac826 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -608,9 +608,10 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) + if (shdr->contents == NULL) + { + _bfd_error_handler +- (_("%B: Corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size); ++ (_("%B: corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size); + bfd_set_error (bfd_error_bad_value); +- return FALSE; ++ -- num_group; ++ continue; + } + + memset (shdr->contents, 0, amt); +@@ -618,8 +619,17 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) + if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0 + || (bfd_bread (shdr->contents, shdr->sh_size, abfd) + != shdr->sh_size)) +- return FALSE; +- ++ { ++ _bfd_error_handler ++ (_("%B: invalid size field in group section header: 0x%lx"), abfd, shdr->sh_size); ++ bfd_set_error (bfd_error_bad_value); ++ -- num_group; ++ /* PR 17510: If the group contents are even partially ++ corrupt, do not allow any of the contents to be used. */ ++ memset (shdr->contents, 0, amt); ++ continue; ++ } ++ + /* Translate raw contents, a flag word followed by an + array of elf section indices all in target byte order, + to the flag word followed by an array of elf section +@@ -651,6 +661,21 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) + } + } + } ++ ++ /* PR 17510: Corrupt binaries might contain invalid groups. */ ++ if (num_group != (unsigned) elf_tdata (abfd)->num_group) ++ { ++ elf_tdata (abfd)->num_group = num_group; ++ ++ /* If all groups are invalid then fail. */ ++ if (num_group == 0) ++ { ++ elf_tdata (abfd)->group_sect_ptr = NULL; ++ elf_tdata (abfd)->num_group = num_group = -1; ++ (*_bfd_error_handler) (_("%B: no valid group sections found"), abfd); ++ bfd_set_error (bfd_error_bad_value); ++ } ++ } + } + } + +@@ -716,6 +741,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) + { + (*_bfd_error_handler) (_("%B: no group info for section %A"), + abfd, newsect); ++ return FALSE; + } + return TRUE; + } +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8501.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8501.patch @@ -0,0 +1,42 @@ +From 7e1e19887abd24aeb15066b141cdff5541e0ec8e Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 27 Oct 2014 14:45:06 +0000 +Subject: [PATCH] Fix a seg-fault in strings and other binutuils when parsing a corrupt PE + executable with an invalid value in the NumberOfRvaAndSizes field of the + AOUT header. + + PR binutils/17512 + * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Handle corrupt binaries + with an invalid value for NumberOfRvaAndSizes. + +[Ubuntu note: patch differs from upstream commit in that it drops the +changelog update to reduce patch conflicts. --sbeattie] + +CVE-2014-8501 +--- + bfd/peXXigen.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +Index: b/bfd/peXXigen.c +=================================================================== +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -460,6 +460,18 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + { + int idx; + ++ /* PR 17512: Corrupt PE binaries can cause seg-faults. */ ++ if (a->NumberOfRvaAndSizes > 16) ++ { ++ (*_bfd_error_handler) ++ (_("%B: aout header specifies an invalid number of data-directory entries: %d"), ++ abfd, a->NumberOfRvaAndSizes); ++ /* Paranoia: If the number is corrupt, then assume that the ++ actual entries themselves might be corrupt as well. */ ++ a->NumberOfRvaAndSizes = 0; ++ } ++ ++ + for (idx = 0; idx < a->NumberOfRvaAndSizes; idx++) + { + /* If data directory is empty, rva also should be 0. */ --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8502.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8502.patch @@ -0,0 +1,630 @@ +From b69c87280595b7ce4e956cb2a62278412f0722f7 Mon Sep 17 00:00:00 2001 +From: Jon Turney +Date: Thu, 3 Apr 2014 12:26:27 +0100 +Subject: [PATCH] * peXXigen.c (pe_print_edata): Verify edt.name lies inside + section before dereferencing. + (pe_print_idata, pe_print_edata, pe_print_reloc) + (rsrc_print_section): Don't bother interpreting the contents + of sections which have no contents. + +From b2f93c5011cab00f31669363577b938697752e43 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Tue, 28 Oct 2014 10:50:17 +0000 +Subject: [PATCH] Import patches from the master branch which prevent seg-faults when parsing + corrupt binaries. + + 2014-10-27 Nick Clifton + PR binutils/17512 + * elf.c (bfd_section_from_shdr): Detect and warn about ELF + binaries with a group of sections linked by the string table + indicies. + * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Handle corrupt binaries + with an invalid value for NumberOfRvaAndSizes. + (pe_print_edata): Detect out of range rvas and entry counts for + the Export Address table, Name Pointer table and Ordinal table. + + PR binutils/17510 + * elf.c (setup_group): Improve handling of corrupt group + sections. + +From 5a4b0ccc20ba30caef53b01bee2c0aaa5b855339 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Tue, 28 Oct 2014 15:42:56 +0000 +Subject: [PATCH] More fixes for corrupt binaries crashing the binutils. + + PR binutils/17512 + * elf.c (bfd_section_from_shdr): Allocate and free the recursion + detection table on a per-bfd basis. + * peXXigen.c (pe_print_edata): Handle binaries with a truncated + export table. + +From e5b470e24ce448a56230137a37d3b17299593041 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 29 Oct 2014 20:58:13 +0000 +Subject: [PATCH] Fixes another memory corruption bug introduced by patches for PR 17512. + + * elf.c (bfd_section_from_shdr): Fix heap use after free memory + leak. + +[Ubuntu note: patch differs from upstream commits in that it drops +the changelog entry to reduce patch conflicts, the first patches +fix to rsrc_print_section as it doesn't exist yet, and the second +commit's fixes to handle srec, as that's already covered by the +binutils-CVE-2014-8504.patch. -- sbeattie] + +Third commit fixes CVE-2014-8502, but first two commits are needed as +prerequisites, and the last one fixes a use-after-free introduced by +earlier patches. + +--- + bfd/elf.c | 204 ++++++++++++++++++++++++++++++++++++++------------------- + bfd/peXXigen.c | 55 ++++++++++++--- + 2 files changed, 185 insertions(+), 74 deletions(-) + +Index: b/bfd/peXXigen.c +=================================================================== +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -1115,6 +1115,13 @@ pe_print_idata (bfd * abfd, void * vfile + _("\nThere is an import table, but the section containing it could not be found\n")); + return TRUE; + } ++ else if (!(section->flags & SEC_HAS_CONTENTS)) ++ { ++ fprintf (file, ++ _("\nThere is an import table in %s, but that section has no contents\n"), ++ section->name); ++ return TRUE; ++ } + } + + fprintf (file, _("\nThere is an import table in %s at 0x%lx\n"), +@@ -1376,7 +1383,7 @@ pe_print_edata (bfd * abfd, void * vfile + bfd_size_type datasize = 0; + bfd_size_type dataoff; + bfd_size_type i; +- bfd_signed_vma adj; ++ bfd_vma adj; + struct EDT_type + { + long export_flags; /* Reserved - should be zero. */ +@@ -1426,6 +1433,13 @@ pe_print_edata (bfd * abfd, void * vfile + _("\nThere is an export table, but the section containing it could not be found\n")); + return TRUE; + } ++ else if (!(section->flags & SEC_HAS_CONTENTS)) ++ { ++ fprintf (file, ++ _("\nThere is an export table in %s, but that section has no contents\n"), ++ section->name); ++ return TRUE; ++ } + + dataoff = addr - section->vma; + datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size; +@@ -1438,6 +1452,15 @@ pe_print_edata (bfd * abfd, void * vfile + } + } + ++ /* PR 17512: Handle corrupt PE binaries. */ ++ if (datasize < 36) ++ { ++ fprintf (file, ++ _("\nThere is an export table in %s, but it is too small (%d)\n"), ++ section->name, (int) datasize); ++ return TRUE; ++ } ++ + fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"), + section->name, (unsigned long) addr); + +@@ -1481,8 +1504,11 @@ pe_print_edata (bfd * abfd, void * vfile + fprintf (file, + _("Name \t\t\t\t")); + bfd_fprintf_vma (abfd, file, edt.name); +- fprintf (file, +- " %s\n", data + edt.name - adj); ++ ++ if ((edt.name >= adj) && (edt.name < adj + datasize)) ++ fprintf (file, " %s\n", data + edt.name - adj); ++ else ++ fprintf (file, "(outside .edata section)\n"); + + fprintf (file, + _("Ordinal Base \t\t\t%ld\n"), edt.base); +@@ -1528,7 +1554,12 @@ pe_print_edata (bfd * abfd, void * vfile + _("\nExport Address Table -- Ordinal Base %ld\n"), + edt.base); + +- for (i = 0; i < edt.num_functions; ++i) ++ /* PR 17512: Handle corrupt PE binaries. */ ++ if (edt.eat_addr + (edt.num_functions * 4) - adj >= datasize) ++ fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"), ++ (long) edt.eat_addr, ++ (long) edt.num_functions); ++ else for (i = 0; i < edt.num_functions; ++i) + { + bfd_vma eat_member = bfd_get_32 (abfd, + data + edt.eat_addr + (i * 4) - adj); +@@ -1564,7 +1595,16 @@ pe_print_edata (bfd * abfd, void * vfile + fprintf (file, + _("\n[Ordinal/Name Pointer] Table\n")); + +- for (i = 0; i < edt.num_names; ++i) ++ /* PR 17512: Handle corrupt PE binaries. */ ++ if (edt.npt_addr + (edt.num_names * 4) - adj >= datasize) ++ fprintf (file, _("\tInvalid Name Pointer Table rva (0x%lx) or entry count (0x%lx)\n"), ++ (long) edt.npt_addr, ++ (long) edt.num_names); ++ else if (edt.ot_addr + (edt.num_names * 2) - adj >= datasize) ++ fprintf (file, _("\tInvalid Ordinal Table rva (0x%lx) or entry count (0x%lx)\n"), ++ (long) edt.ot_addr, ++ (long) edt.num_names); ++ else for (i = 0; i < edt.num_names; ++i) + { + bfd_vma name_ptr = bfd_get_32 (abfd, + data + +@@ -1930,10 +1970,7 @@ pe_print_reloc (bfd * abfd, void * vfile + bfd_size_type i; + bfd_size_type start, stop; + +- if (section == NULL) +- return TRUE; +- +- if (section->size == 0) ++ if (section == NULL || section->size == 0 || !(section->flags & SEC_HAS_CONTENTS)) + return TRUE; + + fprintf (file, +Index: b/bfd/elf.c +=================================================================== +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -1574,38 +1574,74 @@ bfd_section_from_shdr (bfd *abfd, unsign + Elf_Internal_Ehdr *ehdr; + const struct elf_backend_data *bed; + const char *name; ++ bfd_boolean ret = TRUE; ++ static bfd_boolean * sections_being_created = NULL; ++ static bfd * sections_being_created_abfd = NULL; ++ static unsigned int nesting = 0; + + if (shindex >= elf_numsections (abfd)) + return FALSE; + ++ 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 ++ 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 ++ can expect to recurse at least once. ++ ++ FIXME: It would be better if this array was attached to the bfd, ++ rather than being held in a static pointer. */ ++ ++ if (sections_being_created_abfd != abfd) ++ sections_being_created = NULL; ++ if (sections_being_created == NULL) ++ { ++ /* FIXME: It would be more efficient to attach this array to the bfd somehow. */ ++ sections_being_created = (bfd_boolean *) ++ bfd_zalloc (abfd, elf_numsections (abfd) * sizeof (bfd_boolean)); ++ sections_being_created_abfd = abfd; ++ } ++ if (sections_being_created [shindex]) ++ { ++ (*_bfd_error_handler) ++ (_("%B: warning: loop in section dependencies detected"), abfd); ++ return FALSE; ++ } ++ sections_being_created [shindex] = TRUE; ++ } ++ + hdr = elf_elfsections (abfd)[shindex]; + ehdr = elf_elfheader (abfd); + name = bfd_elf_string_from_elf_section (abfd, ehdr->e_shstrndx, + hdr->sh_name); + if (name == NULL) +- return FALSE; ++ goto fail; + + bed = get_elf_backend_data (abfd); + switch (hdr->sh_type) + { + case SHT_NULL: + /* Inactive section. Throw it away. */ +- return TRUE; ++ goto success; + +- case SHT_PROGBITS: /* Normal section with contents. */ +- case SHT_NOBITS: /* .bss section. */ +- case SHT_HASH: /* .hash section. */ +- case SHT_NOTE: /* .note section. */ ++ case SHT_PROGBITS: /* Normal section with contents. */ ++ case SHT_NOBITS: /* .bss section. */ ++ case SHT_HASH: /* .hash section. */ ++ case SHT_NOTE: /* .note section. */ + case SHT_INIT_ARRAY: /* .init_array section. */ + case SHT_FINI_ARRAY: /* .fini_array section. */ + case SHT_PREINIT_ARRAY: /* .preinit_array section. */ + case SHT_GNU_LIBLIST: /* .gnu.liblist section. */ + case SHT_GNU_HASH: /* .gnu.hash section. */ +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; + + case SHT_DYNAMIC: /* Dynamic linking information. */ + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) +- return FALSE; ++ goto fail; ++ + if (hdr->sh_link > elf_numsections (abfd)) + { + /* PR 10478: Accept Solaris binaries with a sh_link +@@ -1619,11 +1655,11 @@ bfd_section_from_shdr (bfd *abfd, unsign + break; + /* Otherwise fall through. */ + default: +- return FALSE; ++ goto fail; + } + } + else if (elf_elfsections (abfd)[hdr->sh_link] == NULL) +- return FALSE; ++ goto fail; + else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) + { + Elf_Internal_Shdr *dynsymhdr; +@@ -1652,24 +1688,26 @@ bfd_section_from_shdr (bfd *abfd, unsign + } + } + } +- break; ++ goto success; + +- case SHT_SYMTAB: /* A symbol table */ ++ case SHT_SYMTAB: /* A symbol table. */ + if (elf_onesymtab (abfd) == shindex) +- return TRUE; ++ goto success; + + if (hdr->sh_entsize != bed->s->sizeof_sym) +- return FALSE; ++ goto fail; ++ + if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size) + { + if (hdr->sh_size != 0) +- return FALSE; ++ goto fail; + /* Some assemblers erroneously set sh_info to one with a + zero sh_size. ld sees this as a global symbol count + of (unsigned) -1. Fix it here. */ + hdr->sh_info = 0; +- return TRUE; ++ goto success; + } ++ + BFD_ASSERT (elf_onesymtab (abfd) == 0); + elf_onesymtab (abfd) = shindex; + elf_tdata (abfd)->symtab_hdr = *hdr; +@@ -1686,7 +1724,7 @@ bfd_section_from_shdr (bfd *abfd, unsign + && (abfd->flags & DYNAMIC) != 0 + && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex)) +- return FALSE; ++ goto fail; + + /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we + can't read symbols without that section loaded as well. It +@@ -1712,26 +1750,29 @@ bfd_section_from_shdr (bfd *abfd, unsign + break; + } + if (i != shindex) +- return bfd_section_from_shdr (abfd, i); ++ ret = bfd_section_from_shdr (abfd, i); + } +- return TRUE; ++ goto success; + +- case SHT_DYNSYM: /* A dynamic symbol table */ ++ case SHT_DYNSYM: /* A dynamic symbol table. */ + if (elf_dynsymtab (abfd) == shindex) +- return TRUE; ++ goto success; + + if (hdr->sh_entsize != bed->s->sizeof_sym) +- return FALSE; ++ goto fail; ++ + if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size) + { + if (hdr->sh_size != 0) +- return FALSE; ++ goto fail; ++ + /* Some linkers erroneously set sh_info to one with a + zero sh_size. ld sees this as a global symbol count + of (unsigned) -1. Fix it here. */ + hdr->sh_info = 0; +- return TRUE; ++ goto success; + } ++ + BFD_ASSERT (elf_dynsymtab (abfd) == 0); + elf_dynsymtab (abfd) = shindex; + elf_tdata (abfd)->dynsymtab_hdr = *hdr; +@@ -1740,34 +1781,38 @@ bfd_section_from_shdr (bfd *abfd, unsign + + /* Besides being a symbol table, we also treat this as a regular + section, so that objcopy can handle it. */ +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; + +- case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */ ++ case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections. */ + if (elf_symtab_shndx (abfd) == shindex) +- return TRUE; ++ goto success; + + BFD_ASSERT (elf_symtab_shndx (abfd) == 0); + elf_symtab_shndx (abfd) = shindex; + elf_tdata (abfd)->symtab_shndx_hdr = *hdr; + elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr; +- return TRUE; ++ goto success; + +- case SHT_STRTAB: /* A string table */ ++ case SHT_STRTAB: /* A string table. */ + if (hdr->bfd_section != NULL) +- return TRUE; ++ goto success; ++ + if (ehdr->e_shstrndx == shindex) + { + elf_tdata (abfd)->shstrtab_hdr = *hdr; + elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr; +- return TRUE; ++ goto success; + } ++ + if (elf_elfsections (abfd)[elf_onesymtab (abfd)]->sh_link == shindex) + { + symtab_strtab: + elf_tdata (abfd)->strtab_hdr = *hdr; + elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->strtab_hdr; +- return TRUE; ++ goto success; + } ++ + if (elf_elfsections (abfd)[elf_dynsymtab (abfd)]->sh_link == shindex) + { + dynsymtab_strtab: +@@ -1776,8 +1821,9 @@ bfd_section_from_shdr (bfd *abfd, unsign + elf_elfsections (abfd)[shindex] = hdr; + /* We also treat this as a regular section, so that objcopy + can handle it. */ +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, +- shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, ++ shindex); ++ goto success; + } + + /* If the string table isn't one of the above, then treat it as a +@@ -1795,9 +1841,9 @@ bfd_section_from_shdr (bfd *abfd, unsign + { + /* Prevent endless recursion on broken objects. */ + if (i == shindex) +- return FALSE; ++ goto fail; + if (! bfd_section_from_shdr (abfd, i)) +- return FALSE; ++ goto fail; + if (elf_onesymtab (abfd) == i) + goto symtab_strtab; + if (elf_dynsymtab (abfd) == i) +@@ -1805,7 +1851,8 @@ bfd_section_from_shdr (bfd *abfd, unsign + } + } + } +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; + + case SHT_REL: + case SHT_RELA: +@@ -1820,7 +1867,7 @@ bfd_section_from_shdr (bfd *abfd, unsign + if (hdr->sh_entsize + != (bfd_size_type) (hdr->sh_type == SHT_REL + ? bed->s->sizeof_rel : bed->s->sizeof_rela)) +- return FALSE; ++ goto fail; + + /* Check for a bogus link to avoid crashing. */ + if (hdr->sh_link >= num_sec) +@@ -1828,8 +1875,9 @@ bfd_section_from_shdr (bfd *abfd, unsign + ((*_bfd_error_handler) + (_("%B: invalid link %lu for reloc section %s (index %u)"), + abfd, hdr->sh_link, name, shindex)); +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, +- shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, ++ shindex); ++ goto success; + } + + /* For some incomprehensible reason Oracle distributes +@@ -1870,7 +1918,7 @@ bfd_section_from_shdr (bfd *abfd, unsign + if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB + || elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM) + && ! bfd_section_from_shdr (abfd, hdr->sh_link)) +- return FALSE; ++ goto fail; + + /* If this reloc section does not use the main symbol table we + don't treat it as a reloc section. BFD can't adequately +@@ -1885,14 +1933,18 @@ bfd_section_from_shdr (bfd *abfd, unsign + || hdr->sh_info >= num_sec + || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL + || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA) +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, +- shindex); ++ { ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, ++ shindex); ++ goto success; ++ } + + if (! bfd_section_from_shdr (abfd, hdr->sh_info)) +- return FALSE; ++ goto fail; ++ + target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info); + if (target_sect == NULL) +- return FALSE; ++ goto fail; + + esdt = elf_section_data (target_sect); + if (hdr->sh_type == SHT_RELA) +@@ -1904,7 +1956,7 @@ bfd_section_from_shdr (bfd *abfd, unsign + amt = sizeof (*hdr2); + hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); + if (hdr2 == NULL) +- return FALSE; ++ goto fail; + *hdr2 = *hdr; + *p_hdr = hdr2; + elf_elfsections (abfd)[shindex] = hdr2; +@@ -1920,34 +1972,40 @@ bfd_section_from_shdr (bfd *abfd, unsign + target_sect->use_rela_p = 1; + } + abfd->flags |= HAS_RELOC; +- return TRUE; ++ goto success; + } + + case SHT_GNU_verdef: + elf_dynverdef (abfd) = shindex; + elf_tdata (abfd)->dynverdef_hdr = *hdr; +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; + + case SHT_GNU_versym: + if (hdr->sh_entsize != sizeof (Elf_External_Versym)) +- return FALSE; ++ goto fail; ++ + elf_dynversym (abfd) = shindex; + elf_tdata (abfd)->dynversym_hdr = *hdr; +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; + + case SHT_GNU_verneed: + elf_dynverref (abfd) = shindex; + elf_tdata (abfd)->dynverref_hdr = *hdr; +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; + + case SHT_SHLIB: +- return TRUE; ++ goto success; + + case SHT_GROUP: + if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE)) +- return FALSE; ++ goto fail; ++ + if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) +- return FALSE; ++ goto fail; ++ + if (hdr->contents != NULL) + { + Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents; +@@ -1973,7 +2031,7 @@ bfd_section_from_shdr (bfd *abfd, unsign + } + } + } +- break; ++ goto success; + + default: + /* Possibly an attributes section. */ +@@ -1981,14 +2039,14 @@ bfd_section_from_shdr (bfd *abfd, unsign + || hdr->sh_type == bed->obj_attrs_section_type) + { + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) +- return FALSE; ++ goto fail; + _bfd_elf_parse_attributes (abfd, hdr); +- return TRUE; ++ goto success; + } + + /* Check for any processor-specific section types. */ + if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex)) +- return TRUE; ++ goto success; + + if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER) + { +@@ -2000,9 +2058,12 @@ bfd_section_from_shdr (bfd *abfd, unsign + "specific section `%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else +- /* Allow sections reserved for applications. */ +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, +- shindex); ++ { ++ /* Allow sections reserved for applications. */ ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, ++ shindex); ++ goto success; ++ } + } + else if (hdr->sh_type >= SHT_LOPROC + && hdr->sh_type <= SHT_HIPROC) +@@ -2023,8 +2084,11 @@ bfd_section_from_shdr (bfd *abfd, unsign + "`%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else +- /* Otherwise it should be processed. */ +- return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ { ++ /* Otherwise it should be processed. */ ++ ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); ++ goto success; ++ } + } + else + /* FIXME: We should handle this section. */ +@@ -2032,10 +2096,20 @@ bfd_section_from_shdr (bfd *abfd, unsign + (_("%B: don't know how to handle section `%s' [0x%8x]"), + abfd, name, hdr->sh_type); + +- return FALSE; ++ goto fail; + } + +- return TRUE; ++ fail: ++ ret = FALSE; ++ success: ++ if (sections_being_created && sections_being_created_abfd == abfd) ++ sections_being_created [shindex] = FALSE; ++ if (-- nesting == 0) ++ { ++ sections_being_created = NULL; ++ sections_being_created_abfd = abfd; ++ } ++ return ret; + } + + /* Return the local symbol specified by ABFD, R_SYMNDX. */ --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8503.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8503.patch @@ -0,0 +1,33 @@ +From 0102ea8cec5fc509bba6c91df61b7ce23a799d32 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Thu, 30 Oct 2014 17:16:17 +0000 +Subject: [PATCH] Fixes a seg-fault in the ihex parser when it encounters a malformed ihex file. + + PR binutils/17512 + * ihex.c (ihex_scan): Fix typo in invocation of ihex_bad_byte. + +[Ubuntu note: patch differs from upstream commit in that it drops the +changelog entry to reduce patch conflicts. -- sbeattie] + +CVE-2014-8503 +--- + bfd/ChangeLog | 1 + + bfd/ihex.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/bfd/ihex.c b/bfd/ihex.c +index 8d3590d..9b3b813 100644 +--- a/bfd/ihex.c ++++ b/bfd/ihex.c +@@ -321,7 +321,7 @@ ihex_scan (bfd *abfd) + { + if (! ISHEX (buf[i])) + { +- ihex_bad_byte (abfd, lineno, hdr[i], error); ++ ihex_bad_byte (abfd, lineno, buf[i], error); + goto error_return; + } + } +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8504.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8504.patch @@ -0,0 +1,48 @@ +From 708d7d0d11f0f2d776171979aa3479e8e12a38a0 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Tue, 28 Oct 2014 10:48:14 +0000 +Subject: [PATCH] This patch fixes a flaw in the SREC parser which could cause a stack overflow + and potential secuiryt breach. + + PR binutils/17510 + * srec.c (srec_bad_byte): Increase size of buf to allow for + negative values. + (srec_scan): Use an unsigned char buffer to hold header bytes. + +[Ubuntu note: patch differs from upstream commit in that it drops the +changelog entry and the cosmetic whitespace changes to reduce patch +conflicts. -- sbeattie] + +CVE-2014-8504 +--- + bfd/ChangeLog | 8 ++++++++ + bfd/elf.c | 2 +- + bfd/peXXigen.c | 1 - + bfd/srec.c | 4 ++-- + 4 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/bfd/srec.c b/bfd/srec.c +index 9ed2080..5f9a546 100644 +--- a/bfd/srec.c ++++ b/bfd/srec.c +@@ -246,7 +246,7 @@ srec_bad_byte (bfd *abfd, + } + else + { +- char buf[10]; ++ char buf[40]; + + if (! ISPRINT (c)) + sprintf (buf, "\\%03o", (unsigned int) c); +@@ -452,7 +452,7 @@ srec_scan (bfd *abfd) + case 'S': + { + file_ptr pos; +- char hdr[3]; ++ unsigned char hdr[3]; + unsigned int bytes, min_bytes; + bfd_vma address; + bfd_byte *data; +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8737.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8737.patch @@ -0,0 +1,208 @@ +From dd9b91de2149ee81d47f708e7b0bbf57da10ad42 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Thu, 6 Nov 2014 14:49:10 +0000 +Subject: [PATCH] Prevent archive memebers with illegal pathnames from being extracted from an archive. + + PR binutils/17552, binutils/17533 + * bucomm.c (is_valid_archive_path): New function. Returns false + for absolute pathnames and pathnames that include /../. + * bucomm.h (is_valid_archive_path): Add prototype. + * ar.c (extract_file): Use new function to check for valid + pathnames when extracting files from an archive. + * objcopy.c (copy_archive): Likewise. + * doc/binutils.texi: Update documentation to mention the + limitation on pathname of archive members. + +From 5e186ece2feebb46e63ff6bb2d2490aad0d5a724 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 10 Nov 2014 14:28:43 +0000 +Subject: [PATCH] Fix objcopy and strip so that they remove their temporary files even if an error occurs. + + PR binutils/17552 + * (copy_archive): Clean up temporary files even if an error + occurs. + +[Ubuntu note: patches differ from upstream commit by dropping the +changelog updates to reduce patch conflicts. -- sbeattie] + +CVE-2014-8737 + fix to clean up temporary files on error +--- + binutils/ar.c | 9 +++++++++ + binutils/bucomm.c | 26 ++++++++++++++++++++++++++ + binutils/bucomm.h | 12 ++++++++---- + binutils/doc/binutils.texi | 3 ++- + binutils/objcopy.c | 23 ++++++++++++++++++----- + 5 files changed, 63 insertions(+), 10 deletions(-) + +Index: b/binutils/ar.c +=================================================================== +--- a/binutils/ar.c ++++ b/binutils/ar.c +@@ -1031,6 +1031,15 @@ extract_file (bfd *abfd) + bfd_size_type size; + struct stat buf; + ++ /* PR binutils/17533: Do not allow directory traversal ++ outside of the current directory tree. */ ++ if (! is_valid_archive_path (bfd_get_filename (abfd))) ++ { ++ non_fatal (_("illegal pathname found in archive member: %s"), ++ bfd_get_filename (abfd)); ++ return; ++ } ++ + if (bfd_stat_arch_elt (abfd, &buf) != 0) + /* xgettext:c-format */ + fatal (_("internal stat error on %s"), bfd_get_filename (abfd)); +Index: b/binutils/bucomm.c +=================================================================== +--- a/binutils/bucomm.c ++++ b/binutils/bucomm.c +@@ -624,3 +624,29 @@ bfd_get_archive_filename (const bfd *abf + bfd_get_filename (abfd)); + return buf; + } ++ ++/* Returns TRUE iff PATHNAME, a filename of an archive member, ++ is valid for writing. For security reasons absolute paths ++ and paths containing /../ are not allowed. See PR 17533. */ ++ ++bfd_boolean ++is_valid_archive_path (char const * pathname) ++{ ++ const char * n = pathname; ++ ++ if (IS_ABSOLUTE_PATH (n)) ++ return FALSE; ++ ++ while (*n) ++ { ++ if (*n == '.' && *++n == '.' && ( ! *++n || IS_DIR_SEPARATOR (*n))) ++ return FALSE; ++ ++ while (*n && ! IS_DIR_SEPARATOR (*n)) ++ n++; ++ while (IS_DIR_SEPARATOR (*n)) ++ n++; ++ } ++ ++ return TRUE; ++} +Index: b/binutils/bucomm.h +=================================================================== +--- a/binutils/bucomm.h ++++ b/binutils/bucomm.h +@@ -23,6 +23,8 @@ + #ifndef _BUCOMM_H + #define _BUCOMM_H + ++/* In bucomm.c. */ ++ + /* Return the filename in a static buffer. */ + const char *bfd_get_archive_filename (const bfd *); + +@@ -58,20 +60,22 @@ bfd_vma parse_vma (const char *, const c + + off_t get_file_size (const char *); + ++bfd_boolean is_valid_archive_path (char const *); ++ + extern char *program_name; + +-/* filemode.c */ ++/* In filemode.c. */ + void mode_string (unsigned long, char *); + +-/* version.c */ ++/* In version.c. */ + extern void print_version (const char *); + +-/* rename.c */ ++/* In rename.c. */ + extern void set_times (const char *, const struct stat *); + + extern int smart_rename (const char *, const char *, int); + +-/* libiberty. */ ++/* In libiberty. */ + void *xmalloc (size_t); + + void *xrealloc (void *, size_t); +Index: b/binutils/doc/binutils.texi +=================================================================== +--- a/binutils/doc/binutils.texi ++++ b/binutils/doc/binutils.texi +@@ -234,7 +234,8 @@ a normal archive. Instead the elements + individually to the second archive. + + The paths to the elements of the archive are stored relative to the +-archive itself. ++archive itself. For security reasons absolute paths and paths with a ++@code{/../} component are not allowed. + + @cindex compatibility, @command{ar} + @cindex @command{ar} compatibility +Index: b/binutils/objcopy.c +=================================================================== +--- a/binutils/objcopy.c ++++ b/binutils/objcopy.c +@@ -2206,6 +2206,16 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + bfd_boolean del = TRUE; + bfd_boolean ok_object; + ++ /* PR binutils/17533: Do not allow directory traversal ++ outside of the current directory tree by archive members. */ ++ if (! is_valid_archive_path (bfd_get_filename (this_element))) ++ { ++ non_fatal (_("illegal pathname found in archive member: %s"), ++ bfd_get_filename (this_element)); ++ status = 1; ++ goto cleanup_and_exit; ++ } ++ + /* Create an output file for this member. */ + output_name = concat (dir, "/", + bfd_get_filename (this_element), (char *) 0); +@@ -2215,8 +2225,12 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + { + output_name = make_tempdir (output_name); + if (output_name == NULL) +- fatal (_("cannot create tempdir for archive copying (error: %s)"), +- strerror (errno)); ++ { ++ non_fatal (_("cannot create tempdir for archive copying (error: %s)"), ++ strerror (errno)); ++ status = 1; ++ goto cleanup_and_exit; ++ } + + l = (struct name_list *) xmalloc (sizeof (struct name_list)); + l->name = output_name; +@@ -2258,7 +2272,7 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + { + bfd_nonfatal_message (output_name, NULL, NULL, NULL); + status = 1; +- return; ++ goto cleanup_and_exit; + } + + if (ok_object) +@@ -2319,7 +2333,6 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + { + status = 1; + bfd_nonfatal_message (filename, NULL, NULL, NULL); +- return; + } + + filename = bfd_get_filename (ibfd); +@@ -2327,9 +2340,9 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + { + status = 1; + bfd_nonfatal_message (filename, NULL, NULL, NULL); +- return; + } + ++ cleanup_and_exit: + /* Delete all the files that we opened. */ + for (l = list; l != NULL; l = l->next) + { --- binutils-2.24.orig/debian/patches/binutils-CVE-2014-8738.patch +++ binutils-2.24/debian/patches/binutils-CVE-2014-8738.patch @@ -0,0 +1,49 @@ +From bb0d867169d7e9743d229804106a8fbcab7f3b3f Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Tue, 4 Nov 2014 13:15:37 +0000 +Subject: [PATCH] Fix a seg-fault triggered by reading a mal-formed archive. + + PR binutils/17533 + * archive.c (_bfd_slurp_extended_name_table): Handle archives with + corrupt extended name tables. + +[Ubuntu note: patch differs from upstream commit in that it drops the +changelog entry and cosmetic changes to reduce patch conflicts. + -- sbeattie] + +CVE-2014-8738 +--- + bfd/archive.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +Index: b/bfd/archive.c +=================================================================== +--- a/bfd/archive.c ++++ b/bfd/archive.c +@@ -1292,6 +1292,9 @@ _bfd_slurp_extended_name_table (bfd *abf + amt = namedata->parsed_size; + if (amt + 1 == 0) + goto byebye; ++ /* PR binutils/17533: A corrupt archive can contain an invalid size. */ ++ if (amt > (bfd_size_type) bfd_get_size (abfd)) ++ goto byebye; + + bfd_ardata (abfd)->extended_names_size = amt; + bfd_ardata (abfd)->extended_names = (char *) bfd_zalloc (abfd, amt + 1); +@@ -1299,6 +1302,8 @@ _bfd_slurp_extended_name_table (bfd *abf + { + byebye: + free (namedata); ++ bfd_ardata (abfd)->extended_names = NULL; ++ bfd_ardata (abfd)->extended_names_size = 0; + return FALSE; + } + +@@ -1307,7 +1312,6 @@ _bfd_slurp_extended_name_table (bfd *abf + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_malformed_archive); + bfd_release (abfd, (bfd_ardata (abfd)->extended_names)); +- bfd_ardata (abfd)->extended_names = NULL; + goto byebye; + } + --- binutils-2.24.orig/debian/patches/binutils-bz17512-misc.patch +++ binutils-2.24/debian/patches/binutils-bz17512-misc.patch @@ -0,0 +1,5501 @@ +From 32a9d621c3c480aa093a089a36e36c35f68a4010 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 17 Nov 2014 16:59:09 +0000 +Subject: [PATCH] Applies a series of patches for PR 17512 and 17533 which fix invalid memory accesses. +Origin: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=32a9d621c3c480aa093a089a36e36c35f68a4010 +Bug-Upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=17512#c95 + + 2014-11-13 Nick Clifton + + PR binutils/17512 + * config/obj-coff.c (coff_obj_symbol_new_hook): Set the is_sym + field. + + 2014-11-14 Nick Clifton + + PR binutils/17512 + * dwarf.c (get_encoded_value): Add an 'end' parameter. Change the + 'data' parameter to a double pointer and return the updated value. + (decode_location_expression): Update call to get_encoded_value. + (frame_need_space): Handle the case where one or both of the + mallocs fails. + (read_cie): Initialise the cie pointer, even if the read fails. + (display_debug_frames): Warn if the calculated block_end is before + the start of the block. Break the loop if the CIE could not be + read. Update call to get_encoded_value. Warn if the read CFA + expressions are too big. + + 2014-11-13 Nick Clifton + + PR binutils/17531 + * readelf.c (process_version_sections): If the read of the version + def information fails, make sure that the external verdef data is + not used. + (get_dynamic_data): Do not attempt to allocate memory for more + dynamic data than there is in the file. If the read fails, free + the allocated buffer. + (process_symbol_table): Do not print dynamic information if we + were unable to read the dynamic symbol table. + (print_gnu_note): Do not print the note if the descsz is too + small. + + 2014-11-12 Nick Clifton + + PR binutils/17512 + * dwarf.c (read_and_display_attr_value): Check that we do not read + past end. + (display_debug_pubnames_worker): Add range checks. + (process_debug_info): Check for invalid pointer sizes. + (display_loc_list): Likewise. + (display_loc_list_dwo): Likewise. + (display_debug_ranges): Likewise. + (display_debug_aranges): Check for invalid address size. + (read_cie): Add range checks. Replace call strchr with while loop. + * objdump.c (dump_dwarf): Replace abort with a warning message. + (print_section_stabs): Improve range checks. + * rdcoff.c (coff_get_slot): Use long for indx parameter type. + Add check for an excesively large index. + * rddbg.c (read_section_stabs_debugging_info): Zero terminate the + string table. Avoid walking off the end of the stabs data. + * stabs.c (parse_stab_string): Add check for a NULL name. + + 2014-11-11 Nick Clifton + + PR binutils/17531 + * binutils/readelf.c (dynamic_nent): Change type to size_t. + (slurp_rela_relocs): Use size_t type for nrelas. + (slurp_rel_relocs): Likewise. + (get_program_headers): Improve out of memory error message. + (get_32bit_section_headers): Likewise. + (get_32bit_section_headers): Likewise. + (get_64bit_section_headers): Likewise. + (get_32bit_elf_symbols): Likewise. + (get_64bit_elf_symbols): Likewise. + (process_section_groups): Likewise. + (get_32bit_dynamic_section): Likewise. + (get_64bit_dynamic_section): Likewise. + (process_dynamic_section): Likewise. + (process_version_sections): Likewise. + (get_symbol_index_type): Likewise. + (process_mips_specific): Likewise. + (process_corefile_note_segment): Likewise. + (process_version_sections): Use size_t type for total. + (get_dynamic_data): Change type of number parameter to size_t. + Improve out of memory error messages. + (process_symbol_table): Change type of nbuckets and nchains to + size_t. Skip processing of sections headers if there are none. + Improve out of memory error messages. + + 2014-11-11 Nick Clifton + + PR binutils/17531 + * readelf.c (display_arm_attribute): Avoid reading off the end of + the buffer when processing a Tag_nodefaults. + + 2014-11-10 Nick Clifton + + PR binutils/17531 + * readelf.c (ia64_process_unwind): Replace assertion with an error + message. Add range checking for group section indicies. + (hppa_process_unwind): Replace assertion with an error message. + (process_syminfo): Likewise. + (decode_arm_unwind_bytecode): Add range checking. + (dump_section_as_strings): Add more string range checking. + (display_tag_value): Likewise. + (display_arm_attribute): Likewise. + (display_gnu_attribute): Likewise. + (display_tic6x_attribute): Likewise. + (display_msp430x_attribute): Likewise. + + 2014-11-10 Nick Clifton + + PR binutils/17552 + * objcopy.c (copy_archive): Clean up temporary files even if an + error occurs. + + 2014-11-07 Nick Clifton + + PR binutils/17531 + * readelf.c (get_data): Avoid allocating memory when we know that + the read will fail. + (find_section_by_type): New function. + (get_unwind_section_word): Check for invalid symbol indicies. + Check for invalid reloc types. + (get_32bit_dynamic_section): Add range checks. + (get_64bit_dynamic_section): Add range checks. + (process_dynamic_section): Check for a corrupt time value. + (process_symbol_table): Add range checks. + (dump_section_as_strings): Add string length range checks. + (display_tag_value): Likewise. + (display_arm_attribute): Likewise. + (display_gnu_attribute): Likewise. + (display_tic6x_attribute): Likewise. + (display_msp430x_attribute): Likewise. + (process_mips_specific): Add range check. + + 2014-11-06 Nick Clifton + + PR binutils/17552, binutils/17533 + * bucomm.c (is_valid_archive_path): New function. Returns false + for absolute pathnames and pathnames that include /../. + * bucomm.h (is_valid_archive_path): Add prototype. + * ar.c (extract_file): Use new function to check for valid + pathnames when extracting files from an archive. + * objcopy.c (copy_archive): Likewise. + * doc/binutils.texi: Update documentation to mention the + limitation on pathname of archive members. + + 2014-11-05 Nick Clifton + + PR binutils/17531 + * readelf.c (printable_section_name): New function. + (printable_section_name_from_index): New function. + (dump_relocations): Use new function. + (process_program_headers, get_32bit_elf_symbols, + (get_64bit_elf_symbols, process_section_headers, + (process_section_groups, process_relocs, ia64_process_unwind, + (hppa_process_unwind, get_unwind_section_word, decode_arm_unwind, + (arm_process_unwind, process_version_sections, + (process_symbol_table, apply_relocations, get_section_contents, + (dump_section_as_strings, dump_section_as_bytes, + (display_debug_section, process_attributes, process_mips_specific, + (process_mips_specific process_gnu_liblist): Likewise. + (get_unwind_section_word): Check for a missing symbol table. + Replace aborts with error messages. + (arm_process_unwind): Check for a missing string table. + (process_attributes): Check for an attribute length that is too + small. + (process_mips_specific): Check for a corrupt GOT symbol offset. + + 2014-11-05 Nick Clifton + + PR binutils/17533 + * bucomm.c (is_valid_archive_path): New function. + * bucomm.h (is_valid_archive_path): Prototype it. + * ar.c (extract_file): Call is_valid_archive_path to verify a + member filename before extracting it. + * objcopy.c (copy_archive): Likewise. + + 2014-11-04 Nick Clifton + + PR binutils/17531 + * readelf.c (get_data): If the reason parameter is null, do not + print any error messages. + (get_32bit_section_headers): Verify section header entry size + before reading in the section headers. + (get_64bit_section_headers): Likewise. + (process_section_headers): Pass FALSE to get_section_headers. + (get_file_header): Pass TRUE to get_section_headers. + (process_dynamic_section): Change an assert to an error message. + (process_symbol_table): Handle corrupt histograms. + (get_32bit_program_headers): Verify program header entry size + before reading in the program headers. + (get_64bit_program_headers): Likewise. + (get_unwind_section_word): Do nothing if no section was provided. + Fail if the offset is outside of the section. + (print_dynamic_symbol): Catch out of range symbol indicies. + (process_mips_specific): Likewise. + (process_attributes): Make sure that there is enough space left in + the section before attempting to read the length of the next + attribute. + + 2014-11-03 Nick Clifton + + PR binutils/17512 + * objdump.c (slurp_symtab): Fail gracefully if the table could not + be read. + (dump_relocs_in_section): Likewise. + + 2014-11-14 Nick Clifton + + PR binutils/17597 + * opncls.c (bfd_get_debug_link_info): Avoid reading off the end of + the section. + (bfd_get_alt_debug_link_info): Likewise. + + 2014-11-14 Nick Clifton + + PR binutils/17512 + * ieee.c (ieee_archive_p) Skip processing if no bytes are read at + all. + (ieee_object_p): Likewise. + + 2014-11-13 H.J. Lu + + * coffcode.h (coff_slurp_line_table): Add cast to unsigned int. + + 2014-11-13 H.J. Lu + + * coffcode.h (coff_pointerize_aux_hook): Fix a typo. + + 2014-11-13 Nick Clifton + + PR binutils/17512 + * coffcode.h (coff_ptr_struct): Add is_sym field. + (coff_new_section_hook): Set the is_sym field. + (coff_pointerize_aux_hook): Check the is_sym field. + (coff_print_aux): Likewise. + (coff_compute_section_file_positions): Likewise. + (coff_write_object_contents): Likewise. + (coff_slurp_line_table): Likewise. + (coff_slurp_symbol_table): Likewise. + (CALC_ADDEND): Likewise. + * coffgen.c (coff_renumber_symbols): Likewise. + (coff_mangle_symbols): Likewise. + (coff_fix_symbol_name): Likewise. + (coff_write_symbol): Likewise. + (coff_write_alien_symbol): Likewise. + (coff_write_native_symbol): Likewise. + (coff_write_symbols): Likewise. + (coff_write_linenumbers): Likewise. + (coff_pointerize_aux): Likewise. + (coff_get_normalized_symtab): Likewise. + (coff_get_symbol_info): Likewise. + (bfd_coff_get_syment): Likewise. + (bfd_coff_get_auxent): Likewise. + (coff_print_symbol): Likewise. + (coff_find_nearest_line_with_names): Likewise. + (bfd_coff_set_symbol_class): Likewise. + (coff_make_empty_symbol): Set the is_sym field. + (coff_bfd_make_debug_symbol): Likewise. + * peicode.h (pe_ILF_make_a_symbol): Likewise. + * libcoff.h: Regenerate. + * libcoff-in.h: Regenerate. + + 2014-11-12 Nick Clifton + + PR binutils/17512 + * coffcode.h (coff_slurp_line_table): Set the line number of + corrupt entries to -1. + (coff_slurp_symbol_table): Alway initialise the value of the + symbol. + * coffgen.c (coff_print_symbol): Check that the combined pointer + is valid. + (coff_print_symbol): Do not print negative line numbers. + * peXXigen.c (pe_print_idata): Add range checking displaying + member names. + + 2014-11-12 Alan Modra + + PR binutils/17512 + * coffcode.h (coff_slurp_line_table): Drop line number info + not preceded by a valid function entry. Revert last change. + + 2014-11-11 Nick Clifton + + PR binutils/17512 + * coffcode.h (coff_slurp_line_table): Initialise the parts of the + line number cache that would not be initialised by the copy from + the new line number table. + (coff_classify_symbol): Allow for _bfd_coff_internal_syment_name + returning NULL. + * coffgen.c (coff_get_normalized_symbols): Get the external + symbols before allocating space for the internal symbols, in case + the get fails. + * elf.c (_bfd_elf_slurp_version_tables): Only allocate a verref + array if one is needed. Likewise with the verdef array. + * peXXigen.c (_bfd_XXi_swap_sym_in): Replace abort()'s with error + messages. + (_bfd_XXi_swap_aux_in): Make sure that all fields of the aux + structure are initialised. + (pe_print_edata): Avoid reading off the end of the data buffer. + + 2014-11-11 Alan Modra + + PR binutils/17512 + * coffcode.h (coff_slurp_line_table): Use updated lineno_count + when building func_table. + + 2014-11-11 Alan Modra + + PR binutils/17512 + * coffcode.h (coff_slurp_line_table): Don't bfd_zalloc, just + memset the particular bits we need. Update src after hitting loop + "continue". Don't count lineno omitted due to invalid symbols in + nbr_func, and update lineno_count. Init entire terminating + lineno. Don't both allocating terminator in n_lineno_cache. + Redirect sym->lineno pointer to where n_lineno_cache will be + copied, and free n_lineno_cache. + * pe-mips.c (NUM_HOWTOS): Typo fix. + + 2014-11-10 Nick Clifton + + PR binutils/17521 + * coff-i386.c (NUM_HOWTOS): New define. + (RTYPE2HOWTO): Use it. + (coff_i386_rtype_to_howto): Likewise. + (coff_i386_reloc_name_lookup): Likewise. + (CALC_ADDEND): Check that reloc r_type field is valid. + * coff-x86_64.c (NUM_HOWTOS): New define. + (RTYPE2HOWTO): Use it. + (coff_amd64_rtype_to_howto): Likewise. + (coff_amd64_reloc_name_lookup): Likewise. + (CALC_ADDEND): Check that reloc r_type field is valid. + * coffcode.h (coff_slurp_line_table): Check for symbol table + indexing underflow. + (coff_slurp_symbol_table): Use zalloc to ensure that all table + entries are initialised. + * coffgen.c (_bfd_coff_read_string_table): Initialise unused bits + in the string table. Also ensure that the table is 0 terminated. + (coff_get_normalized_symtab): Check for symbol table indexing + underflow. + * opncls.c (bfd_alloc): Catch the case where a small negative size + can result in only 1 byte being allocated. + (bfd_alloc2): Use bfd_alloc. + * pe-mips.c (NUM_HOWTOS): New define. + (coff_mips_reloc_name_lookup): Use it. + (CALC_ADDEND): Check that reloc r_type field is valid. + * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Initialise unused entries + in the DataDirectory. + (pe_print_idata): Avoid reading beyond the end of the data block + wen printing strings. + (pe_print_edata): Likewise. + Check for table indexing underflow. + * peicode.h (pe_mkobject): Initialise the pe_opthdr field. + (pe_bfd_object_p): Allocate and initialize enough space to hold a + PEAOUTHDR, even if the opt_hdr field specified less. + + 2014-11-08 Alan Modra + + * peXXigen.c (pe_print_idata): Revert last patch, cast lhs instead. + + 2014-11-07 H.J. Lu + + * peXXigen.c (pe_print_idata): Cast to unsigned long in range + checks. + + 2014-11-07 Alan Modra + + * tekhex.c (tekhex_set_arch_mach): Ignore unknown arch errors. + + 2014-11-07 Alan Modra + + * tekhex.c (CHUNK_SPAN): Define. + (struct data_struct ): Use one byte per span, update + all code accessing this field. + (find_chunk): Add create param, don't create new entry unless set. + (insert_byte): Don't save zeros. + (first_phase): Set section SEC_CODE or SEC_DATA flag depending + on symbol type. Create an alternate section if both types of + symbol are given. Attach type '2' and '6' symbols to absolute + section. + (move_section_contents): Fix caching of chunk. Don't create chunk + when reading, or for writing zeros. + (tekhex_set_section_contents): Don't create initial chunks. + (tekhex_write_object_contents): Use CHUNK_SPAN. + + 2014-11-07 Alan Modra + + * aoutx.h (aout_get_external_symbols): Tidy allocation of symbol buffer. + + 2014-11-07 Alan Modra + + * archive.c (_bfd_slurp_extended_name_table): Revert bfd_get_size check. + * coffcode.h (coff_set_alignment_hook): Likewise. + (coff_slurp_line_table): Likewise. + * coffgen.c (coff_get_normalized_symtab): Likewise. + (_bfd_coff_get_external_symbols): Likewise. + * elf.c (bfd_elf_get_str_section): Likewise. + * tekhex.c (first_phase): Likewise. + + 2014-11-06 Nick Clifton + + * aoutx.h (slurp_symbol_table): Revert previous delta. + (slurp_reloc_table): Likewise. + * compress.c (bfd_get_full_section_contents): Remove file size + test. + * coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs + and do not complain about linker generated files. + + 2014-11-04 Nick Clifton + + PR binutils/17512 + * coffcode.h (handle_COMDAT): Replace abort with BFD_ASSERT. + Replace another abort with an error message. + (coff_slurp_line_table): Add more range checking. + * peXXigen.c (pe_print_debugdata): Add range checking. + + 2014-11-05 Nick Clifton + + PR binutils/17512 + * coffcode.h (coff_set_alignment_hook): Warn if the file lies + about the number of relocations it contains. + (coff_sort_func_alent): Return 0 if the pointers are NULL. + (coff_slurp_line_table): Add more range checks. Do not free new + tables created when sorting line numbers. + * peXXigen.c (pe_print_idata): Add range checks. + (pe_print_edata): Likewise. + (rsrc_print_resource_entries): Likewise. Avoid printing control + characters. Terminate priniting if corruption is detected. + (rsrc_print_resource_directory): Terminate printing if an unknown + directory type is encountered. + (pe_print_debugdata): Fix off-by-one error. + (rsrc_count_entries): Add range checking. + (rsrc_parse_entry): Likewise. + + 2014-11-04 Nick Clifton + + PR binutils/17512 + * compress.c (bfd_get_full_section_contents): Improve test for + linker created objects. + + PR binutils/17533 + * archive.c (_bfd_slurp_extended_name_table): Handle archives with + corrupt extended name tables. + + 2014-11-03 Nick Clifton + + PR binutils/17512 + * aoutx.h (slurp_symbol_table): Check that computed table size is + not bigger than the file from which is it being read. + (slurp_reloc_table): Likewise. + * coffcode.h (coff_slurp_line_table): Remove unneeded local + 'warned'. Do not try to print the details of a symbol with an + invalid index. + * coffgen.c (make_a_sectiobn_from_file): Check computed string + index against length of string table. + (bfd_coff_internal_syment_name): Check read in string offset + against length of string table. + (build_debug_section): Return a pointer to the section used. + (_bfd_coff_read_string_table): Store the length of the string + table in the coff_tdata structure. + (bfd_coff_free_symbols): Set the length of the string table to + zero when it is freed. + (coff_get_normalized_symtab): Check offsets against string table + or data table lengths as appropriate. + * cofflink.c (_bfd_coff_link_input_bfd): Check offset against + length of string table. + * compress.c (bfd_get_full_section_contents): Check computed size + against the size of the file. + * libcoff-in.h (obj_coff_strings_len): Define. + (struct coff_tdata): Add strings_len field. + * libcoff.h: Regenerate. + * peXXigen.c (pe_print_debugdata): Do not attempt to print the + data if the debug section is too small. + * xcofflink.c (xcoff_link_input_bfd): Check offset against + length of string table. + + 2014-10-31 Nick Clifton + + PR binutils/17512 + * coffgen.c (_bfd_coff_get_external_symbols): Do not try to load a + symbol table bigger than the file. + * elf.c (bfd_elf_get_str_section): Do not try to load a string + table bigger than the file. + * tekhex.c (first_phase): Check that the section range is sane. + +From: Cary Coutant +Date: Tue, 11 Feb 2014 19:33:49 +0000 (-0800) +Subject: Fix readelf so it doesn't complain about corrupt attribute. +X-Git-Tag: gdb-7.8-release~1356 +X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=503a609192b5d13905b40969ea82c62a72b576e0 + +Fix readelf so it doesn't complain about corrupt attribute. + +When a DW_FORM_flag_present attribute comes at the very end of a +debug section, readelf complains about a corrupt attribute +because it's checking to make sure there's at least one byte of +data remaining. This patch suppresses the check when the form +is DW_FORM_flag_present. + +From 513ea82edf8533e3483073561c06be97de035c83 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Thu, 14 Aug 2014 15:53:19 +0930 +Subject: [PATCH] Fix for objdump segfault on broken PE executable + + * peXXigen.c (pe_print_reloc): Protect against access past end + of .reloc section. + +[Ubuntu note: this patch fixes multiple issues that did not get CVEs +assigned. The patch differs from upstream commits in that the changelog +entries have been dropped to reduce patch conflicts, as well as the +following changes: + + * bfd/archive.c: already applied in patch binutils-CVE-2014-8738.patch + * bfd/coffcode.h: remove comment change (chunk 25) that was causing a + patch conflict + * bfd/opncls.c: backport last chunk (#7) to current code + * bfd/peXXigen.c: drop changes to code printing resource and debug + section data, as these functions had not been added yet. + * binutils/ar.c, binutils/bucomm.c, binutils/bucomm.h, + binutils/doc/binutils.texi, binutils/objcopy.c: already applied + in patch binutils-CVE-2104-8737.patch + * binutils/dwarf.c: backport change to display_debug_pubnames + * binutils/readelf.c: + - remove comment change (chunk 27) that was causing + a patch conflict + - add missing frees to fix memory leaks, were preventing patch + from applying (chunk 78, 81) + - drop four whitespace-only changes to display_sparc_hwcaps{,2} that + did not apply cleanly + - + + -- sbeattie] + +--- + bfd/ChangeLog | 282 ++++++++++++ + bfd/aoutx.h | 24 +- + bfd/archive.c | 5 +- + bfd/coff-i386.c | 17 +- + bfd/coff-x86_64.c | 11 +- + bfd/coffcode.h | 170 +++++--- + bfd/coffgen.c | 168 ++++++-- + bfd/cofflink.c | 5 +- + bfd/elf.c | 24 +- + bfd/ieee.c | 6 +- + bfd/libcoff-in.h | 3 + + bfd/libcoff.h | 16 +- + bfd/opncls.c | 41 +- + bfd/pe-mips.c | 9 +- + bfd/peXXigen.c | 220 +++++++--- + bfd/peicode.h | 15 +- + bfd/tekhex.c | 112 +++-- + bfd/xcofflink.c | 5 +- + binutils/ChangeLog | 199 +++++++++ + binutils/ar.c | 9 + + binutils/bucomm.c | 26 ++ + binutils/bucomm.h | 12 +- + binutils/doc/binutils.texi | 3 +- + binutils/dwarf.c | 209 +++++++--- + binutils/objcopy.c | 23 +- + binutils/objdump.c | 27 +- + binutils/rdcoff.c | 9 +- + binutils/rddbg.c | 40 ++- + binutils/readelf.c | 1039 ++++++++++++++++++++++++++++++++------------ + binutils/stabs.c | 30 +- + gas/ChangeLog | 10 + + gas/config/obj-coff.c | 1 + + 32 files changed, 2109 insertions(+), 661 deletions(-) + +diff --git a/bfd/aoutx.h b/bfd/aoutx.h +index bef59b4..9385a98 100644 +--- a/bfd/aoutx.h ++++ b/bfd/aoutx.h +@@ -1300,14 +1300,14 @@ aout_get_external_symbols (bfd *abfd) + { + bfd_size_type count; + struct external_nlist *syms; ++ bfd_size_type amt = exec_hdr (abfd)->a_syms; + +- count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE; ++ count = amt / EXTERNAL_NLIST_SIZE; + if (count == 0) + return TRUE; /* Nothing to do. */ + + #ifdef USE_MMAP +- if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), +- exec_hdr (abfd)->a_syms, ++ if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt, + &obj_aout_sym_window (abfd), TRUE)) + return FALSE; + syms = (struct external_nlist *) obj_aout_sym_window (abfd).data; +@@ -1315,20 +1315,16 @@ aout_get_external_symbols (bfd *abfd) + /* We allocate using malloc to make the values easy to free + later on. If we put them on the objalloc it might not be + possible to free them. */ +- syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE); ++ syms = (struct external_nlist *) bfd_malloc (amt); + if (syms == NULL) + return FALSE; + +- { +- bfd_size_type amt; +- amt = exec_hdr (abfd)->a_syms; +- if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 +- || bfd_bread (syms, amt, abfd) != amt) +- { +- free (syms); +- return FALSE; +- } +- } ++ if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 ++ || bfd_bread (syms, amt, abfd) != amt) ++ { ++ free (syms); ++ return FALSE; ++ } + #endif + + obj_aout_external_syms (abfd) = syms; +diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c +index 87b014b..848d69b 100644 +--- a/bfd/coff-i386.c ++++ b/bfd/coff-i386.c +@@ -340,16 +340,18 @@ static reloc_howto_type howto_table[] = + PCRELOFFSET) /* pcrel_offset */ + }; + ++#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) I386BADMAG(x) + #define I386 1 /* Customize coffcode.h */ + +-#define RTYPE2HOWTO(cache_ptr, dst) \ +- ((cache_ptr)->howto = \ +- ((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0]) \ +- ? howto_table + (dst)->r_type \ ++#define RTYPE2HOWTO(cache_ptr, dst) \ ++ ((cache_ptr)->howto = \ ++ ((dst)->r_type < NUM_HOWTOS \ ++ ? howto_table + (dst)->r_type \ + : NULL)) + + /* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared +@@ -386,7 +388,8 @@ static reloc_howto_type howto_table[] = + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ +- if (ptr && howto_table[reloc.r_type].pc_relative) \ ++ if (ptr && reloc.r_type < NUM_HOWTOS \ ++ && howto_table[reloc.r_type].pc_relative) \ + cache_ptr->addend += asect->vma; \ + } + +@@ -438,7 +441,7 @@ coff_i386_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + { + reloc_howto_type *howto; + +- if (rel->r_type >= sizeof (howto_table) / sizeof (howto_table[0])) ++ if (rel->r_type >= NUM_HOWTOS) + { + bfd_set_error (bfd_error_bad_value); + return NULL; +@@ -574,7 +577,7 @@ coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + { + unsigned int i; + +- for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) ++ for (i = 0; i < NUM_HOWTOS; i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; +diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c +index 8d23733..2a21bb8 100644 +--- a/bfd/coff-x86_64.c ++++ b/bfd/coff-x86_64.c +@@ -448,6 +448,8 @@ static reloc_howto_type howto_table[] = + PCRELOFFSET) /* pcrel_offset */ + }; + ++#define NUM_HOWTOS ARRAY_SIZE (howto_table) ++ + /* Turn a howto into a reloc nunmber */ + + #define SELECT_RELOC(x,howto) { x.r_type = howto->type; } +@@ -456,7 +458,7 @@ static reloc_howto_type howto_table[] = + + #define RTYPE2HOWTO(cache_ptr, dst) \ + ((cache_ptr)->howto = \ +- ((dst)->r_type < ARRAY_SIZE (howto_table)) \ ++ ((dst)->r_type < NUM_HOWTOS) \ + ? howto_table + (dst)->r_type \ + : NULL) + +@@ -496,7 +498,8 @@ static reloc_howto_type howto_table[] = + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ +- if (ptr && howto_table[reloc.r_type].pc_relative) \ ++ if (ptr && reloc.r_type < NUM_HOWTOS \ ++ && howto_table[reloc.r_type].pc_relative) \ + cache_ptr->addend += asect->vma; \ + } + +@@ -546,7 +549,7 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + { + reloc_howto_type *howto; + +- if (rel->r_type >= ARRAY_SIZE (howto_table)) ++ if (rel->r_type >= NUM_HOWTOS) + { + bfd_set_error (bfd_error_bad_value); + return NULL; +@@ -689,7 +692,7 @@ coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + { + unsigned int i; + +- for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) ++ for (i = 0; i < NUM_HOWTOS; i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; +diff --git a/bfd/coffcode.h b/bfd/coffcode.h +index 6678b88..9990b16 100644 +--- a/bfd/coffcode.h ++++ b/bfd/coffcode.h +@@ -307,7 +307,7 @@ CODE_FRAGMENT + .typedef struct coff_ptr_struct + .{ + . {* Remembers the offset from the first symbol in the file for +-. this symbol. Generated by coff_renumber_symbols. *} ++. this symbol. Generated by coff_renumber_symbols. *} + . unsigned int offset; + . + . {* Should the value of this symbol be renumbered. Used for +@@ -315,15 +315,15 @@ CODE_FRAGMENT + . unsigned int fix_value : 1; + . + . {* Should the tag field of this symbol be renumbered. +-. Created by coff_pointerize_aux. *} ++. Created by coff_pointerize_aux. *} + . unsigned int fix_tag : 1; + . + . {* Should the endidx field of this symbol be renumbered. +-. Created by coff_pointerize_aux. *} ++. Created by coff_pointerize_aux. *} + . unsigned int fix_end : 1; + . + . {* Should the x_csect.x_scnlen field be renumbered. +-. Created by coff_pointerize_aux. *} ++. Created by coff_pointerize_aux. *} + . unsigned int fix_scnlen : 1; + . + . {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the +@@ -331,12 +331,15 @@ CODE_FRAGMENT + . unsigned int fix_line : 1; + . + . {* The container for the symbol structure as read and translated +-. from the file. *} ++. from the file. *} + . union + . { + . union internal_auxent auxent; + . struct internal_syment syment; + . } u; ++. ++. {* Selector for the union above. *} ++. bfd_boolean is_sym; + .} combined_entry_type; + . + . +@@ -928,12 +931,7 @@ handle_COMDAT (bfd * abfd, + + bfd_coff_swap_sym_in (abfd, esym, & isym); + +- if (sizeof (internal_s->s_name) > SYMNMLEN) +- { +- /* This case implies that the matching +- symbol name will be in the string table. */ +- abort (); +- } ++ BFD_ASSERT (sizeof (internal_s->s_name) <= SYMNMLEN); + + if (isym.n_scnum == section->target_index) + { +@@ -964,8 +962,12 @@ handle_COMDAT (bfd * abfd, + /* All 3 branches use this. */ + symname = _bfd_coff_internal_syment_name (abfd, &isym, buf); + ++ /* PR 17512 file: 078-11867-0.004 */ + if (symname == NULL) +- abort (); ++ { ++ _bfd_error_handler (_("%B: unable to load COMDAT section name"), abfd); ++ break; ++ } + + switch (seen_state) + { +@@ -1797,6 +1799,7 @@ coff_new_section_hook (bfd * abfd, asection * section) + in case this symbol winds up getting written out. The value 0 + for n_numaux is already correct. */ + ++ native->is_sym = TRUE; + native->u.syment.n_type = T_NULL; + native->u.syment.n_sclass = sclass; + +@@ -2498,11 +2501,13 @@ coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED, + unsigned int indaux, + combined_entry_type *aux) + { ++ BFD_ASSERT (symbol->is_sym); + int n_sclass = symbol->u.syment.n_sclass; + + if (CSECT_SYM_P (n_sclass) + && indaux + 1 == symbol->u.syment.n_numaux) + { ++ BFD_ASSERT (! aux->is_sym); + if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD) + { + aux->u.auxent.x_csect.x_scnlen.p = +@@ -2535,6 +2540,7 @@ coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED, + /* Return TRUE if we don't want to pointerize this aux entry, which + is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ + return (indaux == 1 ++ && symbol->is_sym + && (symbol->u.syment.n_sclass == C_LEAFPROC + || symbol->u.syment.n_sclass == C_LEAFSTAT + || symbol->u.syment.n_sclass == C_LEAFEXT)); +@@ -2557,6 +2563,8 @@ coff_print_aux (bfd *abfd ATTRIBUTE_UNUSED, + combined_entry_type *aux ATTRIBUTE_UNUSED, + unsigned int indaux ATTRIBUTE_UNUSED) + { ++ BFD_ASSERT (symbol->is_sym); ++ BFD_ASSERT (! aux->is_sym); + #ifdef RS6000COFF_C + if (CSECT_SYM_P (symbol->u.syment.n_sclass) + && indaux + 1 == symbol->u.syment.n_numaux) +@@ -3169,6 +3177,7 @@ coff_compute_section_file_positions (bfd * abfd) + cf = coff_symbol_from (abfd, *symp); + if (cf != NULL + && cf->native != NULL ++ && cf->native->is_sym + && SYMNAME_IN_DEBUG (&cf->native->u.syment)) + { + size_t len; +@@ -3866,6 +3875,7 @@ coff_write_object_contents (bfd * abfd) + csym = coff_symbol_from (abfd, *psym); + if (csym == NULL + || csym->native == NULL ++ || ! csym->native->is_sym + || csym->native->u.syment.n_numaux < 1 + || csym->native->u.syment.n_sclass != C_STAT + || csym->native->u.syment.n_type != T_NULL) +@@ -3888,6 +3898,7 @@ coff_write_object_contents (bfd * abfd) + x_associated field is not currently supported. */ + + aux = csym->native + 1; ++ BFD_ASSERT (! aux->is_sym); + switch (current->flags & SEC_LINK_DUPLICATES) + { + case SEC_LINK_DUPLICATES_DISCARD: +@@ -4033,8 +4044,6 @@ coff_write_object_contents (bfd * abfd) + internal_f.f_flags |= F_DYNLOAD; + #endif + +- memset (&internal_a, 0, sizeof internal_a); +- + /* Set up architecture-dependent stuff. */ + { + unsigned int magic = 0; +@@ -4456,11 +4465,11 @@ buy_and_read (bfd *abfd, file_ptr where, bfd_size_type size) + void * area = bfd_alloc (abfd, size); + + if (!area) +- return (NULL); ++ return NULL; + if (bfd_seek (abfd, where, SEEK_SET) != 0 + || bfd_bread (area, size, abfd) != size) +- return (NULL); +- return (area); ++ return NULL; ++ return area; + } + + /* +@@ -4494,6 +4503,8 @@ coff_sort_func_alent (const void * arg1, const void * arg2) + const coff_symbol_type *s1 = (const coff_symbol_type *) (al1->u.sym); + const coff_symbol_type *s2 = (const coff_symbol_type *) (al2->u.sym); + ++ if (s1 == NULL || s2 == NULL) ++ return 0; + if (s1->symbol.value < s2->symbol.value) + return -1; + else if (s1->symbol.value > s2->symbol.value) +@@ -4511,9 +4522,10 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + unsigned int counter; + alent *cache_ptr; + bfd_vma prev_offset = 0; +- int ordered = 1; ++ bfd_boolean ordered = TRUE; + unsigned int nbr_func; + LINENO *src; ++ bfd_boolean have_func; + + BFD_ASSERT (asect->lineno == NULL); + +@@ -4536,57 +4548,85 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + asect->lineno = lineno_cache; + src = native_lineno; + nbr_func = 0; ++ have_func = FALSE; + +- for (counter = 0; counter < asect->lineno_count; counter++) ++ for (counter = 0; counter < asect->lineno_count; counter++, src++) + { + struct internal_lineno dst; + + bfd_coff_swap_lineno_in (abfd, src, &dst); + cache_ptr->line_number = dst.l_lnno; ++ /* Appease memory checkers that get all excited about ++ uninitialised memory when copying alents if u.offset is ++ larger than u.sym. (64-bit BFD on 32-bit host.) */ ++ memset (&cache_ptr->u, 0, sizeof (cache_ptr->u)); + + if (cache_ptr->line_number == 0) + { +- bfd_boolean warned; +- bfd_signed_vma symndx; ++ combined_entry_type * ent; ++ bfd_vma symndx; + coff_symbol_type *sym; + +- nbr_func++; +- warned = FALSE; ++ have_func = FALSE; + symndx = dst.l_addr.l_symndx; +- if (symndx < 0 +- || (bfd_vma) symndx >= obj_raw_syment_count (abfd)) ++ if (symndx >= obj_raw_syment_count (abfd)) + { + (*_bfd_error_handler) +- (_("%B: warning: illegal symbol index %ld in line numbers"), +- abfd, (long) symndx); +- symndx = 0; +- warned = TRUE; ++ (_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), ++ abfd, (long) symndx, counter); ++ cache_ptr->line_number = -1; ++ continue; + } + ++ ent = obj_raw_syments (abfd) + symndx; + /* FIXME: We should not be casting between ints and + pointers like this. */ +- sym = ((coff_symbol_type *) +- ((symndx + obj_raw_syments (abfd)) +- ->u.syment._n._n_n._n_zeroes)); ++ if (! ent->is_sym) ++ { ++ (*_bfd_error_handler) ++ (_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), ++ abfd, (long) symndx, counter); ++ cache_ptr->line_number = -1; ++ continue; ++ } ++ sym = (coff_symbol_type *) (ent->u.syment._n._n_n._n_zeroes); ++ ++ /* PR 17512 file: 078-10659-0.004 */ ++ if (sym < obj_symbols (abfd) ++ || sym >= obj_symbols (abfd) + bfd_get_symcount (abfd)) ++ { ++ (*_bfd_error_handler) ++ (_("%B: warning: illegal symbol in line number entry %d"), ++ abfd, counter); ++ cache_ptr->line_number = -1; ++ continue; ++ } ++ ++ have_func = TRUE; ++ nbr_func++; + cache_ptr->u.sym = (asymbol *) sym; +- if (sym->lineno != NULL && ! warned) ++ if (sym->lineno != NULL) + (*_bfd_error_handler) + (_("%B: warning: duplicate line number information for `%s'"), + abfd, bfd_asymbol_name (&sym->symbol)); + + sym->lineno = cache_ptr; + if (sym->symbol.value < prev_offset) +- ordered = 0; ++ ordered = FALSE; + prev_offset = sym->symbol.value; + } ++ else if (!have_func) ++ /* Drop line information that has no associated function. ++ PR 17521: file: 078-10659-0.004. */ ++ continue; + else +- cache_ptr->u.offset = dst.l_addr.l_paddr +- - bfd_section_vma (abfd, asect); +- ++ cache_ptr->u.offset = (dst.l_addr.l_paddr ++ - bfd_section_vma (abfd, asect)); + cache_ptr++; +- src++; + } +- cache_ptr->line_number = 0; ++ ++ asect->lineno_count = cache_ptr - lineno_cache; ++ memset (cache_ptr, 0, sizeof (*cache_ptr)); + bfd_release (abfd, native_lineno); + + /* On some systems (eg AIX5.3) the lineno table may not be sorted. */ +@@ -4603,15 +4643,17 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + alent **p = func_table; + unsigned int i; + +- for (i = 0; i < counter; i++) ++ for (i = 0; i < asect->lineno_count; i++) + if (lineno_cache[i].line_number == 0) + *p++ = &lineno_cache[i]; + ++ BFD_ASSERT ((unsigned int) (p - func_table) == nbr_func); ++ + /* Sort by functions. */ + qsort (func_table, nbr_func, sizeof (alent *), coff_sort_func_alent); + + /* Create the new sorted table. */ +- amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); ++ amt = (bfd_size_type) asect->lineno_count * sizeof (alent); + n_lineno_cache = (alent *) bfd_alloc (abfd, amt); + if (n_lineno_cache != NULL) + { +@@ -4622,18 +4664,18 @@ coff_slurp_line_table (bfd *abfd, asection *asect) + coff_symbol_type *sym; + alent *old_ptr = func_table[i]; + +- /* Copy the function entry and update it. */ +- *n_cache_ptr = *old_ptr; +- sym = (coff_symbol_type *)n_cache_ptr->u.sym; +- sym->lineno = n_cache_ptr; +- n_cache_ptr++; +- old_ptr++; +- +- /* Copy the line number entries. */ +- while (old_ptr->line_number != 0) ++ /* Update the function entry. */ ++ sym = (coff_symbol_type *) old_ptr->u.sym; ++ /* PR binutils/17512: Point the lineno to where ++ this entry will be after the memcpy below. */ ++ sym->lineno = lineno_cache + (n_cache_ptr - n_lineno_cache); ++ /* Copy the function and line number entries. */ ++ do + *n_cache_ptr++ = *old_ptr++; ++ while (old_ptr->line_number != 0); + } +- n_cache_ptr->line_number = 0; ++ BFD_ASSERT ((bfd_size_type) (n_cache_ptr - n_lineno_cache) == (amt / sizeof (alent))); ++ + memcpy (lineno_cache, n_lineno_cache, amt); + } + bfd_release (abfd, func_table); +@@ -4672,7 +4714,7 @@ coff_slurp_symbol_table (bfd * abfd) + + amt = obj_raw_syment_count (abfd); + amt *= sizeof (unsigned int); +- table_ptr = (unsigned int *) bfd_alloc (abfd, amt); ++ table_ptr = (unsigned int *) bfd_zalloc (abfd, amt); + + if (table_ptr == NULL) + return FALSE; +@@ -4686,14 +4728,17 @@ coff_slurp_symbol_table (bfd * abfd) + { + combined_entry_type *src = native_symbols + this_index; + table_ptr[this_index] = number_of_symbols; +- dst->symbol.the_bfd = abfd; + ++ dst->symbol.the_bfd = abfd; ++ BFD_ASSERT (src->is_sym); + dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset); + /* We use the native name field to point to the cached field. */ + src->u.syment._n._n_n._n_zeroes = (bfd_hostptr_t) dst; + dst->symbol.section = coff_section_from_bfd_index (abfd, + src->u.syment.n_scnum); + dst->symbol.flags = 0; ++ /* PR 17512: file: 079-7098-0.001:0.1. */ ++ dst->symbol.value = 0; + dst->done_lineno = FALSE; + + switch (src->u.syment.n_sclass) +@@ -4980,9 +5025,9 @@ coff_slurp_symbol_table (bfd * abfd) + } + + dst->native = src; +- + dst->symbol.udata.i = 0; + dst->lineno = NULL; ++ + this_index += (src->u.syment.n_numaux) + 1; + dst++; + number_of_symbols++; +@@ -5065,13 +5110,13 @@ coff_classify_symbol (bfd *abfd, + if (syment->n_value == 0) + { + asection *sec; +- char buf[SYMNMLEN + 1]; +- +- sec = coff_section_from_bfd_index (abfd, syment->n_scnum); +- if (sec != NULL +- && (strcmp (bfd_get_section_name (abfd, sec), +- _bfd_coff_internal_syment_name (abfd, syment, buf)) +- == 0)) ++ char * name; ++ char buf[SYMNMLEN + 1]; ++ ++ name = _bfd_coff_internal_syment_name (abfd, syment, buf) ++ sec = coff_section_from_bfd_index (abfd, syment->n_scnum); ++ if (sec != NULL && name != NULL ++ && (strcmp (bfd_get_section_name (abfd, sec), name) == 0)) + return COFF_SYMBOL_PE_SECTION; + } + #endif +@@ -5142,6 +5187,7 @@ SUBSUBSECTION + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != NULL \ ++ && coffsym->native->is_sym \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = 0; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ +diff --git a/bfd/coffgen.c b/bfd/coffgen.c +index 3f22389..a22f67a 100644 +--- a/bfd/coffgen.c ++++ b/bfd/coffgen.c +@@ -84,9 +84,8 @@ make_a_section_from_file (bfd *abfd, + strings = _bfd_coff_read_string_table (abfd); + if (strings == NULL) + return FALSE; +- /* FIXME: For extra safety, we should make sure that +- strindex does not run us past the end, but right now we +- don't know the length of the string table. */ ++ if ((bfd_size_type)(strindex + 2) >= obj_coff_strings_len (abfd)) ++ return FALSE; + strings += strindex; + name = (char *) bfd_alloc (abfd, + (bfd_size_type) strlen (strings) + 1 + 1); +@@ -464,6 +463,8 @@ _bfd_coff_internal_syment_name (bfd *abfd, + if (strings == NULL) + return NULL; + } ++ if (sym->_n._n_n._n_offset >= obj_coff_strings_len (abfd)) ++ return NULL; + return strings + sym->_n._n_n._n_offset; + } + } +@@ -760,12 +761,14 @@ 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]); ++ + symbol_ptr_ptr[symbol_index]->udata.i = symbol_index; + if (coff_symbol_ptr && coff_symbol_ptr->native) + { + combined_entry_type *s = coff_symbol_ptr->native; + int i; + ++ BFD_ASSERT (s->is_sym); + if (s->u.syment.n_sclass == C_FILE) + { + if (last_file != NULL) +@@ -810,6 +813,7 @@ coff_mangle_symbols (bfd *bfd_ptr) + int i; + combined_entry_type *s = coff_symbol_ptr->native; + ++ BFD_ASSERT (s->is_sym); + if (s->fix_value) + { + /* FIXME: We should use a union here. */ +@@ -833,6 +837,8 @@ coff_mangle_symbols (bfd *bfd_ptr) + for (i = 0; i < s->u.syment.n_numaux; i++) + { + combined_entry_type *a = s + i + 1; ++ ++ BFD_ASSERT (! a->is_sym); + if (a->fix_tag) + { + a->u.auxent.x_sym.x_tagndx.l = +@@ -876,6 +882,7 @@ coff_fix_symbol_name (bfd *abfd, + } + name_length = strlen (name); + ++ BFD_ASSERT (native->is_sym); + if (native->u.syment.n_sclass == C_FILE + && native->u.syment.n_numaux > 0) + { +@@ -891,6 +898,7 @@ coff_fix_symbol_name (bfd *abfd, + else + strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN); + ++ BFD_ASSERT (! (native + 1)->is_sym); + auxent = &(native + 1)->u.auxent; + + filnmlen = bfd_coff_filnmlen (abfd); +@@ -993,6 +1001,8 @@ coff_write_symbol (bfd *abfd, + void * buf; + bfd_size_type symesz; + ++ BFD_ASSERT (native->is_sym); ++ + if (native->u.syment.n_sclass == C_FILE) + symbol->flags |= BSF_DEBUGGING; + +@@ -1033,6 +1043,7 @@ coff_write_symbol (bfd *abfd, + return FALSE; + for (j = 0; j < native->u.syment.n_numaux; j++) + { ++ BFD_ASSERT (! (native + j + 1)->is_sym); + bfd_coff_swap_aux_out (abfd, + &((native + j + 1)->u.auxent), + type, n_sclass, (int) j, +@@ -1078,10 +1089,12 @@ coff_write_alien_symbol (bfd *abfd, + { + symbol->name = ""; + if (isym != NULL) +- memset (isym, 0, sizeof(*isym)); ++ memset (isym, 0, sizeof (*isym)); + return TRUE; + } + native = dummy; ++ native->is_sym = TRUE; ++ native[1].is_sym = FALSE; + native->u.syment.n_type = T_NULL; + native->u.syment.n_flags = 0; + native->u.syment.n_numaux = 0; +@@ -1108,7 +1121,7 @@ coff_write_alien_symbol (bfd *abfd, + name to keep it from being put in the string table. */ + symbol->name = ""; + if (isym != NULL) +- memset (isym, 0, sizeof(*isym)); ++ memset (isym, 0, sizeof (*isym)); + return TRUE; + } + else +@@ -1167,6 +1180,7 @@ coff_write_native_symbol (bfd *abfd, + return TRUE; + } + ++ BFD_ASSERT (native->is_sym); + /* If this symbol has an associated line number, we must store the + symbol index in the line number field. We also tag the auxent to + point to the right place in the lineno table. */ +@@ -1276,8 +1290,9 @@ coff_write_symbols (bfd *abfd) + symbol which has no associated section and we do not have to + worry about this, all we need to know is that it is local. */ + current_error_handler = bfd_set_error_handler (null_error_handler); ++ BFD_ASSERT (c_symbol->native->is_sym); + sym_class = bfd_coff_classify_symbol (abfd, +- &c_symbol->native->u.syment); ++ &c_symbol->native->u.syment); + (void) bfd_set_error_handler (current_error_handler); + + n_sclass = &c_symbol->native->u.syment.n_sclass; +@@ -1368,6 +1383,9 @@ coff_write_symbols (bfd *abfd) + file name, nor does it go in the .debug section. */ + maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; + ++ else if (! c_symbol->native->is_sym) ++ maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; ++ + else if (bfd_coff_symname_in_debug (abfd, + &c_symbol->native->u.syment)) + /* This symbol name is in the XCOFF .debug section. +@@ -1458,6 +1476,7 @@ coff_write_linenumbers (bfd *abfd) + { + /* Found a linenumber entry, output. */ + struct internal_lineno out; ++ + memset ((void *) & out, 0, sizeof (out)); + out.l_lnno = 0; + out.l_addr.l_symndx = l->u.offset; +@@ -1505,6 +1524,7 @@ coff_pointerize_aux (bfd *abfd, + unsigned int type = symbol->u.syment.n_type; + unsigned int n_sclass = symbol->u.syment.n_sclass; + ++ BFD_ASSERT (symbol->is_sym); + if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) + { + if ((*coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) +@@ -1518,6 +1538,7 @@ coff_pointerize_aux (bfd *abfd, + if (n_sclass == C_FILE) + return; + ++ BFD_ASSERT (! auxent->is_sym); + /* Otherwise patch up. */ + #define N_TMASK coff_data (abfd)->local_n_tmask + #define N_BTSHFT coff_data (abfd)->local_n_btshft +@@ -1545,7 +1566,7 @@ coff_pointerize_aux (bfd *abfd, + we didn't want to go to the trouble until someone needed it. */ + + static char * +-build_debug_section (bfd *abfd) ++build_debug_section (bfd *abfd, asection ** sect_return) + { + char *debug_section; + file_ptr position; +@@ -1573,6 +1594,8 @@ build_debug_section (bfd *abfd) + || bfd_bread (debug_section, sec_size, abfd) != sec_size + || bfd_seek (abfd, position, SEEK_SET) != 0) + return NULL; ++ ++ * sect_return = sect; + return debug_section; + } + +@@ -1635,7 +1658,9 @@ _bfd_coff_get_external_symbols (bfd *abfd) + + /* Read in the external strings. The strings are not loaded until + they are needed. This is because we have no simple way of +- detecting a missing string table in an archive. */ ++ detecting a missing string table in an archive. If the strings ++ are loaded then the STRINGS and STRINGS_LEN fields in the ++ coff_tdata structure will be set. */ + + const char * + _bfd_coff_read_string_table (bfd *abfd) +@@ -1685,7 +1710,13 @@ _bfd_coff_read_string_table (bfd *abfd) + return NULL; + } + +- strings = (char *) bfd_malloc (strsize); ++ strings = (char *) bfd_malloc (strsize + 1); ++ /* 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; + +@@ -1697,7 +1728,9 @@ _bfd_coff_read_string_table (bfd *abfd) + } + + obj_coff_strings (abfd) = strings; +- ++ obj_coff_strings_len (abfd) = strsize; ++ /* Terminate the string table, just in case. */ ++ strings[strsize] = 0; + return strings; + } + +@@ -1717,6 +1750,7 @@ _bfd_coff_free_symbols (bfd *abfd) + { + free (obj_coff_strings (abfd)); + obj_coff_strings (abfd) = NULL; ++ obj_coff_strings_len (abfd) = 0; + } + return TRUE; + } +@@ -1737,21 +1771,22 @@ coff_get_normalized_symtab (bfd *abfd) + char *raw_src; + char *raw_end; + const char *string_table = NULL; +- char *debug_section = NULL; ++ asection * debug_sec = NULL; ++ char *debug_sec_data = NULL; + bfd_size_type size; + + if (obj_raw_syments (abfd) != NULL) + return obj_raw_syments (abfd); + ++ if (! _bfd_coff_get_external_symbols (abfd)) ++ return NULL; ++ + size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type); + internal = (combined_entry_type *) bfd_zalloc (abfd, size); + if (internal == NULL && size != 0) + return NULL; + internal_end = internal + obj_raw_syment_count (abfd); +- +- if (! _bfd_coff_get_external_symbols (abfd)) +- return NULL; +- ++ + raw_src = (char *) obj_coff_external_syms (abfd); + + /* Mark the end of the symbols. */ +@@ -1766,23 +1801,29 @@ coff_get_normalized_symtab (bfd *abfd) + raw_src < raw_end; + raw_src += symesz, internal_ptr++) + { +- + unsigned int i; ++ + bfd_coff_swap_sym_in (abfd, (void *) raw_src, + (void *) & internal_ptr->u.syment); + symbol_ptr = internal_ptr; ++ internal_ptr->is_sym = TRUE; + + for (i = 0; + i < symbol_ptr->u.syment.n_numaux; + i++) + { + internal_ptr++; ++ /* PR 17512: Prevent buffer overrun. */ ++ if (internal_ptr >= internal_end) ++ return NULL; ++ + raw_src += symesz; + bfd_coff_swap_aux_in (abfd, (void *) raw_src, + symbol_ptr->u.syment.n_type, + 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); + } +@@ -1796,12 +1837,18 @@ coff_get_normalized_symtab (bfd *abfd) + for (internal_ptr = internal; internal_ptr < internal_end; + internal_ptr++) + { ++ BFD_ASSERT (internal_ptr->is_sym); ++ + if (internal_ptr->u.syment.n_sclass == C_FILE + && internal_ptr->u.syment.n_numaux > 0) + { ++ combined_entry_type * aux = internal_ptr + 1; ++ + /* Make a file symbol point to the name in the auxent, since + the text ".file" is redundant. */ +- if ((internal_ptr + 1)->u.auxent.x_file.x_n.x_zeroes == 0) ++ BFD_ASSERT (! aux->is_sym); ++ ++ if (aux->u.auxent.x_file.x_n.x_zeroes == 0) + { + /* The filename is a long one, point into the string table. */ + if (string_table == NULL) +@@ -1811,10 +1858,12 @@ coff_get_normalized_symtab (bfd *abfd) + return NULL; + } + +- internal_ptr->u.syment._n._n_n._n_offset = +- ((bfd_hostptr_t) +- (string_table +- + (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset)); ++ if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_offset) ++ >= obj_coff_strings_len (abfd)) ++ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _(""); ++ else ++ internal_ptr->u.syment._n._n_n._n_offset = ++ (bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_offset)); + } + else + { +@@ -1824,15 +1873,15 @@ coff_get_normalized_symtab (bfd *abfd) + if (internal_ptr->u.syment.n_numaux > 1 + && coff_data (abfd)->pe) + internal_ptr->u.syment._n._n_n._n_offset = +- ((bfd_hostptr_t) +- copy_name (abfd, +- (internal_ptr + 1)->u.auxent.x_file.x_fname, +- internal_ptr->u.syment.n_numaux * symesz)); ++ (bfd_hostptr_t) ++ copy_name (abfd, ++ aux->u.auxent.x_file.x_fname, ++ internal_ptr->u.syment.n_numaux * symesz); + else + internal_ptr->u.syment._n._n_n._n_offset = + ((bfd_hostptr_t) + copy_name (abfd, +- (internal_ptr + 1)->u.auxent.x_file.x_fname, ++ aux->u.auxent.x_file.x_fname, + (size_t) bfd_coff_filnmlen (abfd))); + } + } +@@ -1869,18 +1918,33 @@ coff_get_normalized_symtab (bfd *abfd) + if (string_table == NULL) + return NULL; + } +- internal_ptr->u.syment._n._n_n._n_offset = +- ((bfd_hostptr_t) +- (string_table +- + internal_ptr->u.syment._n._n_n._n_offset)); ++ if (internal_ptr->u.syment._n._n_n._n_offset >= obj_coff_strings_len (abfd) ++ || string_table + internal_ptr->u.syment._n._n_n._n_offset < string_table) ++ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _(""); ++ else ++ internal_ptr->u.syment._n._n_n._n_offset = ++ ((bfd_hostptr_t) ++ (string_table ++ + internal_ptr->u.syment._n._n_n._n_offset)); + } + else + { + /* Long name in debug section. Very similar. */ +- if (debug_section == NULL) +- debug_section = build_debug_section (abfd); +- internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) +- (debug_section + internal_ptr->u.syment._n._n_n._n_offset); ++ if (debug_sec_data == NULL) ++ debug_sec_data = build_debug_section (abfd, & debug_sec); ++ if (debug_sec_data != NULL) ++ { ++ BFD_ASSERT (debug_sec != NULL); ++ /* PR binutils/17512: Catch out of range offsets into the debug data. */ ++ if (internal_ptr->u.syment._n._n_n._n_offset > debug_sec->size ++ || debug_sec_data + internal_ptr->u.syment._n._n_n._n_offset < debug_sec_data) ++ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _(""); ++ else ++ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) ++ (debug_sec_data + internal_ptr->u.syment._n._n_n._n_offset); ++ } ++ else ++ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) ""; + } + } + internal_ptr += internal_ptr->u.syment.n_numaux; +@@ -1913,7 +1977,7 @@ coff_make_empty_symbol (bfd *abfd) + if (new_symbol == NULL) + return NULL; + new_symbol->symbol.section = 0; +- new_symbol->native = 0; ++ new_symbol->native = NULL; + new_symbol->lineno = NULL; + new_symbol->done_lineno = FALSE; + new_symbol->symbol.the_bfd = abfd; +@@ -1939,6 +2003,7 @@ coff_bfd_make_debug_symbol (bfd *abfd, + new_symbol->native = (combined_entry_type *) bfd_zalloc (abfd, amt); + if (!new_symbol->native) + return NULL; ++ new_symbol->native->is_sym = TRUE; + new_symbol->symbol.section = bfd_abs_section_ptr; + new_symbol->symbol.flags = BSF_DEBUGGING; + new_symbol->lineno = NULL; +@@ -1954,7 +2019,8 @@ coff_get_symbol_info (bfd *abfd, asymbol *symbol, symbol_info *ret) + bfd_symbol_info (symbol, ret); + + if (coffsymbol (symbol)->native != NULL +- && coffsymbol (symbol)->native->fix_value) ++ && coffsymbol (symbol)->native->fix_value ++ && coffsymbol (symbol)->native->is_sym) + ret->value = coffsymbol (symbol)->native->u.syment.n_value - + (bfd_hostptr_t) obj_raw_syments (abfd); + } +@@ -1969,7 +2035,8 @@ bfd_coff_get_syment (bfd *abfd, + coff_symbol_type *csym; + + csym = coff_symbol_from (abfd, symbol); +- if (csym == NULL || csym->native == NULL) ++ if (csym == NULL || csym->native == NULL ++ || ! csym->native->is_sym) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; +@@ -2001,6 +2068,7 @@ bfd_coff_get_auxent (bfd *abfd, + + if (csym == NULL + || csym->native == NULL ++ || ! csym->native->is_sym + || indx >= csym->native->u.syment.n_numaux) + { + bfd_set_error (bfd_error_invalid_operation); +@@ -2009,6 +2077,7 @@ bfd_coff_get_auxent (bfd *abfd, + + ent = csym->native + indx + 1; + ++ BFD_ASSERT (! ent->is_sym); + *pauxent = ent->u.auxent; + + if (ent->fix_tag) +@@ -2062,6 +2131,15 @@ coff_print_symbol (bfd *abfd, + + fprintf (file, "[%3ld]", (long) (combined - root)); + ++ /* PR 17512: file: 079-33786-0.001:0.1. */ ++ if (combined < obj_raw_syments (abfd) ++ || combined >= obj_raw_syments (abfd) + obj_raw_syment_count (abfd)) ++ { ++ fprintf (file, _(" %s"), symbol->name); ++ break; ++ } ++ ++ BFD_ASSERT (combined->is_sym); + if (! combined->fix_value) + val = (bfd_vma) combined->u.syment.n_value; + else +@@ -2081,6 +2159,7 @@ coff_print_symbol (bfd *abfd, + combined_entry_type *auxp = combined + aux + 1; + long tagndx; + ++ BFD_ASSERT (! auxp->is_sym); + if (auxp->fix_tag) + tagndx = auxp->u.auxent.x_sym.x_tagndx.p - root; + else +@@ -2155,8 +2234,11 @@ coff_print_symbol (bfd *abfd, + l++; + while (l->line_number) + { +- fprintf (file, "\n%4d : ", l->line_number); +- bfd_fprintf_vma (abfd, file, l->u.offset + symbol->section->vma); ++ if (l->line_number > 0) ++ { ++ fprintf (file, "\n%4d : ", l->line_number); ++ bfd_fprintf_vma (abfd, file, l->u.offset + symbol->section->vma); ++ } + l++; + } + } +@@ -2247,6 +2329,7 @@ coff_find_nearest_line_with_names (bfd *abfd, + pend = p + cof->raw_syment_count; + while (p < pend) + { ++ BFD_ASSERT (p->is_sym); + if (p->u.syment.n_sclass == C_FILE) + break; + p += 1 + p->u.syment.n_numaux; +@@ -2270,6 +2353,7 @@ coff_find_nearest_line_with_names (bfd *abfd, + p2 < pend; + p2 += 1 + p2->u.syment.n_numaux) + { ++ BFD_ASSERT (p2->is_sym); + if (p2->u.syment.n_scnum > 0 + && (section + == coff_section_from_bfd_index (abfd, +@@ -2281,6 +2365,8 @@ coff_find_nearest_line_with_names (bfd *abfd, + break; + } + } ++ if (p2 >= pend) ++ break; + + file_addr = (bfd_vma) p2->u.syment.n_value; + /* PR 11512: Include the section address of the function name symbol. */ +@@ -2345,6 +2431,8 @@ coff_find_nearest_line_with_names (bfd *abfd, + if (coff->native) + { + combined_entry_type *s = coff->native; ++ ++ BFD_ASSERT (s->is_sym); + s = s + 1 + s->u.syment.n_numaux; + + /* In XCOFF a debugging symbol can follow the +@@ -2357,6 +2445,7 @@ coff_find_nearest_line_with_names (bfd *abfd, + { + /* The linenumber is stored in the auxent. */ + union internal_auxent *a = &((s + 1)->u.auxent); ++ + line_base = a->x_sym.x_misc.x_lnsz.x_lnno; + *line_ptr = line_base; + } +@@ -2478,6 +2567,7 @@ bfd_coff_set_symbol_class (bfd * abfd, + if (native == NULL) + return FALSE; + ++ native->is_sym = TRUE; + native->u.syment.n_type = T_NULL; + native->u.syment.n_sclass = symbol_class; + +diff --git a/bfd/cofflink.c b/bfd/cofflink.c +index 8c3f71b..2782795 100644 +--- a/bfd/cofflink.c ++++ b/bfd/cofflink.c +@@ -2003,7 +2003,10 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) + if (strings == NULL) + return FALSE; + } +- filename = strings + auxp->x_file.x_n.x_offset; ++ if ((bfd_size_type) auxp->x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd)) ++ filename = _(""); ++ else ++ filename = strings + auxp->x_file.x_n.x_offset; + indx = _bfd_stringtab_add (flaginfo->strtab, filename, + hash, copy); + if (indx == (bfd_size_type) -1) +diff --git a/bfd/elf.c b/bfd/elf.c +index c8e659a..8b207ad 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -7269,8 +7269,12 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bfd_boolean default_imported_symver) + + hdr = &elf_tdata (abfd)->dynverref_hdr; + +- elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) ++ if (hdr->sh_info) ++ elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) + bfd_zalloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed)); ++ else ++ elf_tdata (abfd)->verref = NULL; ++ + if (elf_tdata (abfd)->verref == NULL) + goto error_return; + +@@ -7430,8 +7434,12 @@ error_return_verref: + else + freeidx = ++maxidx; + } +- elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) ++ if (maxidx) ++ elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) + bfd_zalloc2 (abfd, maxidx, sizeof (Elf_Internal_Verdef)); ++ else ++ elf_tdata (abfd)->verdef = NULL; ++ + if (elf_tdata (abfd)->verdef == NULL) + goto error_return; + +@@ -7572,16 +7580,12 @@ asymbol * + _bfd_elf_make_empty_symbol (bfd *abfd) + { + elf_symbol_type *newsym; +- bfd_size_type amt = sizeof (elf_symbol_type); + +- newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt); ++ newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof * newsym); + if (!newsym) + return NULL; +- else +- { +- newsym->symbol.the_bfd = abfd; +- return &newsym->symbol; +- } ++ newsym->symbol.the_bfd = abfd; ++ return &newsym->symbol; + } + + void +@@ -9408,7 +9412,7 @@ elfcore_write_lwpstatus (bfd *abfd, + lwpstat.pr_lwpid = pid >> 16; + lwpstat.pr_cursig = cursig; + #if defined (HAVE_LWPSTATUS_T_PR_REG) +- memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg)); ++ memcpy (&lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg)); + #elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT) + #if !defined(gregs) + memcpy (lwpstat.pr_context.uc_mcontext.gregs, +diff --git a/bfd/ieee.c b/bfd/ieee.c +index 256e8f6..313834e 100644 +--- a/bfd/ieee.c ++++ b/bfd/ieee.c +@@ -1312,7 +1312,8 @@ ieee_archive_p (bfd *abfd) + + /* Ignore the return value here. It doesn't matter if we don't read + the entire buffer. We might have a very small ieee file. */ +- bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd); ++ if (bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd) <= 0) ++ goto got_wrong_format_error; + + ieee->h.first_byte = buffer; + ieee->h.input_p = buffer; +@@ -1801,7 +1802,8 @@ ieee_object_p (bfd *abfd) + goto fail; + /* Read the first few bytes in to see if it makes sense. Ignore + bfd_bread return value; The file might be very small. */ +- bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd); ++ if (bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd) <= 0) ++ goto got_wrong_format; + + ieee->h.input_p = buffer; + if (this_byte_and_next (&(ieee->h)) != Module_Beginning) +diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h +index 6162f2e..6b6eb28 100644 +--- a/bfd/libcoff-in.h ++++ b/bfd/libcoff-in.h +@@ -35,6 +35,7 @@ + #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) + #define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) + #define obj_coff_strings(bfd) (coff_data (bfd)->strings) ++#define obj_coff_strings_len(bfd) (coff_data (bfd)->strings_len) + #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) + #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) + #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) +@@ -75,6 +76,8 @@ typedef struct coff_tdata + /* The string table. May be NULL. Read by + _bfd_coff_read_string_table. */ + char *strings; ++ /* The length of the strings table. For error checking. */ ++ bfd_size_type strings_len; + /* If this is TRUE, the strings may not be freed. */ + bfd_boolean keep_strings; + /* If this is TRUE, the strings have been written out already. */ +diff --git a/bfd/libcoff.h b/bfd/libcoff.h +index 12f19d0..9479985 100644 +--- a/bfd/libcoff.h ++++ b/bfd/libcoff.h +@@ -39,6 +39,7 @@ + #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) + #define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) + #define obj_coff_strings(bfd) (coff_data (bfd)->strings) ++#define obj_coff_strings_len(bfd) (coff_data (bfd)->strings_len) + #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) + #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) + #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) +@@ -79,6 +80,8 @@ typedef struct coff_tdata + /* The string table. May be NULL. Read by + _bfd_coff_read_string_table. */ + char *strings; ++ /* The length of the strings table. For error checking. */ ++ bfd_size_type strings_len; + /* If this is TRUE, the strings may not be freed. */ + bfd_boolean keep_strings; + /* If this is TRUE, the strings have been written out already. */ +@@ -627,7 +630,7 @@ extern bfd_boolean ppc_process_before_allocation + typedef struct coff_ptr_struct + { + /* Remembers the offset from the first symbol in the file for +- this symbol. Generated by coff_renumber_symbols. */ ++ this symbol. Generated by coff_renumber_symbols. */ + unsigned int offset; + + /* Should the value of this symbol be renumbered. Used for +@@ -635,15 +638,15 @@ typedef struct coff_ptr_struct + unsigned int fix_value : 1; + + /* Should the tag field of this symbol be renumbered. +- Created by coff_pointerize_aux. */ ++ Created by coff_pointerize_aux. */ + unsigned int fix_tag : 1; + + /* Should the endidx field of this symbol be renumbered. +- Created by coff_pointerize_aux. */ ++ Created by coff_pointerize_aux. */ + unsigned int fix_end : 1; + + /* Should the x_csect.x_scnlen field be renumbered. +- Created by coff_pointerize_aux. */ ++ Created by coff_pointerize_aux. */ + unsigned int fix_scnlen : 1; + + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the +@@ -651,12 +654,15 @@ typedef struct coff_ptr_struct + unsigned int fix_line : 1; + + /* The container for the symbol structure as read and translated +- from the file. */ ++ from the file. */ + union + { + union internal_auxent auxent; + struct internal_syment syment; + } u; ++ ++ /* Selector for the union above. */ ++ bfd_boolean is_sym; + } combined_entry_type; + + +diff --git a/bfd/opncls.c b/bfd/opncls.c +index a2a35f4..75af627 100644 +--- a/bfd/opncls.c ++++ b/bfd/opncls.c +@@ -937,14 +937,19 @@ void * + bfd_alloc (bfd *abfd, bfd_size_type size) + { + void *ret; ++ unsigned long ul_size = (unsigned long) size; + +- if (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))) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } +- +- ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size); ++ ++ ret = objalloc_alloc ((struct objalloc *) abfd->memory, ul_size); + if (ret == NULL) + bfd_set_error (bfd_error_no_memory); + return ret; +@@ -965,8 +970,6 @@ DESCRIPTION + void * + bfd_alloc2 (bfd *abfd, 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) +@@ -975,18 +978,7 @@ bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size) + return NULL; + } + +- size *= nmemb; +- +- if (size != (unsigned long) size) +- { +- bfd_set_error (bfd_error_no_memory); +- return NULL; +- } +- +- ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size); +- if (ret == NULL) +- bfd_set_error (bfd_error_no_memory); +- return ret; ++ return bfd_alloc (abfd, size * nmemb); + } + + /* +@@ -1178,7 +1170,7 @@ bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out) + asection *sect; + unsigned long crc32; + bfd_byte *contents; +- int crc_offset; ++ unsigned int crc_offset; + char *name; + + BFD_ASSERT (abfd); +@@ -1196,10 +1188,13 @@ bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out) + return NULL; + } + +- /* Crc value is stored after the filename, aligned up to 4 bytes. */ ++ /* CRC value is stored after the filename, aligned up to 4 bytes. */ + name = (char *) contents; +- crc_offset = strlen (name) + 1; ++ /* PR 17597: avoid reading off the end of the buffer. */ ++ crc_offset = strnlen (name, bfd_get_section_size (sect)) + 1; + crc_offset = (crc_offset + 3) & ~3; ++ if (crc_offset >= bfd_get_section_size (sect)) ++ return NULL; + + crc32 = bfd_get_32 (abfd, contents + crc_offset); + +@@ -1231,7 +1226,7 @@ bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len, + { + asection *sect; + bfd_byte *contents; +- int buildid_offset; ++ unsigned int buildid_offset; + char *name; + + BFD_ASSERT (abfd); +@@ -1252,8 +1247,10 @@ bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len, + + /* BuildID value is stored after the filename, aligned up to 4 bytes. */ + name = (char *) contents; +- buildid_offset = strlen (name) + 1; ++ buildid_offset = strnlen (name, bfd_get_section_size (sect)) + 1; + buildid_offset = (buildid_offset + 3) & ~3; ++ if (buildid_offset >= bfd_get_section_size (sect)) ++ return NULL; + + * buildid_out = bfd_get_32 (abfd, contents + buildid_offset); + +diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c +index ec7afc4..57ec51f 100644 +--- a/bfd/pe-mips.c ++++ b/bfd/pe-mips.c +@@ -339,6 +339,8 @@ static reloc_howto_type howto_table[] = + FALSE), /* Pcrel_offset. */ + }; + ++#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; } +@@ -379,7 +381,8 @@ static reloc_howto_type howto_table[] = + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ +- if (ptr && howto_table[reloc.r_type].pc_relative) \ ++ if (ptr && reloc.r_type < NUM_HOWTOS \ ++ && howto_table[reloc.r_type].pc_relative) \ + cache_ptr->addend += asect->vma; \ + } + +@@ -509,9 +512,7 @@ coff_mips_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + { + unsigned int i; + +- for (i = 0; +- i < sizeof (howto_table) / sizeof (howto_table[0]); +- i++) ++ for (i = 0; i < NUM_HOWTOS; i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; +diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c +index 1a5cb31..13e39e4 100644 +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -149,8 +149,13 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1) + + name = _bfd_coff_internal_syment_name (abfd, in, namebuf); + if (name == NULL) +- /* FIXME: Return error. */ +- abort (); ++ { ++ _bfd_error_handler (_("%B: unable to find name for empty section"), ++ abfd); ++ bfd_set_error (bfd_error_invalid_target); ++ return; ++ } ++ + sec = bfd_get_section_by_name (abfd, name); + if (sec != NULL) + in->n_scnum = sec->target_index; +@@ -170,15 +175,22 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1) + { + name = (const char *) bfd_alloc (abfd, strlen (namebuf) + 1); + if (name == NULL) +- /* FIXME: Return error. */ +- abort (); ++ { ++ _bfd_error_handler (_("%B: out of memory creating name for empty section"), ++ abfd); ++ return; ++ } + strcpy ((char *) name, namebuf); + } ++ + flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; + sec = bfd_make_section_anyway_with_flags (abfd, name, flags); + if (sec == NULL) +- /* FIXME: Return error. */ +- abort (); ++ { ++ _bfd_error_handler (_("%B: unable to create fake empty section"), ++ abfd); ++ return; ++ } + + sec->vma = 0; + sec->lma = 0; +@@ -283,6 +295,9 @@ _bfd_XXi_swap_aux_in (bfd * abfd, + AUXENT *ext = (AUXENT *) ext1; + union internal_auxent *in = (union internal_auxent *) in1; + ++ /* PR 17521: Make sure that all fields in the aux structure ++ are initialised. */ ++ memset (in, 0, sizeof * in); + switch (in_class) + { + case C_FILE: +@@ -458,6 +473,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry); + aouthdr_int->text_start = + GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); ++ + #if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) + /* PE32+ does not have data_start member! */ + aouthdr_int->data_start = +@@ -505,7 +521,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + int idx; + + /* PR 17512: Corrupt PE binaries can cause seg-faults. */ +- if (a->NumberOfRvaAndSizes > 16) ++ if (a->NumberOfRvaAndSizes > IMAGE_NUMBEROF_DIRECTORY_ENTRIES) + { + (*_bfd_error_handler) + (_("%B: aout header specifies an invalid number of data-directory entries: %d"), +@@ -529,6 +545,13 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + else + a->DataDirectory[idx].VirtualAddress = 0; + } ++ ++ while (idx < IMAGE_NUMBEROF_DIRECTORY_ENTRIES) ++ { ++ a->DataDirectory[idx].Size = 0; ++ a->DataDirectory[idx].VirtualAddress = 0; ++ idx ++; ++ } + } + + if (aouthdr_int->entry) +@@ -772,7 +795,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) + { + int idx; + +- for (idx = 0; idx < 16; idx++) ++ for (idx = 0; idx < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; idx++) + { + H_PUT_32 (abfd, extra->DataDirectory[idx].VirtualAddress, + aouthdr_out->DataDirectory[idx][0]); +@@ -1391,7 +1414,9 @@ pe_print_idata (bfd * abfd, void * vfile) + break; + + dll = (char *) data + dll_name - adj; +- fprintf (file, _("\n\tDLL Name: %s\n"), dll); ++ /* PR 17512 file: 078-12277-0.004. */ ++ bfd_size_type maxlen = (char *)(data + datasize) - dll - 1; ++ fprintf (file, _("\n\tDLL Name: %.*s\n"), (int) maxlen, dll); + + if (hint_addr != 0) + { +@@ -1456,23 +1481,30 @@ pe_print_idata (bfd * abfd, void * vfile) + #ifdef COFF_WITH_pex64 + for (j = 0; idx + j + 8 <= datasize; j += 8) + { ++ bfd_size_type amt; + unsigned long member = bfd_get_32 (abfd, data + idx + j); + unsigned long member_high = bfd_get_32 (abfd, data + idx + j + 4); + + if (!member && !member_high) + break; + ++ amt = member - adj; ++ + if (member_high & 0x80000000) + fprintf (file, "\t%lx%08lx\t %4lx%08lx ", + member_high,member, member_high & 0x7fffffff, member); ++ /* PR binutils/17512: Handle corrupt PE data. */ ++ else if (amt + 2 >= datasize) ++ fprintf (file, _("\t"), member); + else + { + int ordinal; + char *member_name; + +- ordinal = bfd_get_16 (abfd, data + member - adj); +- member_name = (char *) data + member - adj + 2; +- fprintf (file, "\t%04lx\t %4d %s",member, ordinal, member_name); ++ ordinal = bfd_get_16 (abfd, data + amt); ++ member_name = (char *) data + amt + 2; ++ fprintf (file, "\t%04lx\t %4d %.*s",member, ordinal, ++ (int) (datasize - (amt + 2)), member_name); + } + + /* If the time stamp is not zero, the import address +@@ -1489,24 +1521,30 @@ pe_print_idata (bfd * abfd, void * vfile) + #else + for (j = 0; idx + j + 4 <= datasize; j += 4) + { ++ bfd_size_type amt; + unsigned long member = bfd_get_32 (abfd, data + idx + j); + + /* Print single IMAGE_IMPORT_BY_NAME vector. */ + if (member == 0) + break; + ++ amt = member - adj; + if (member & 0x80000000) + fprintf (file, "\t%04lx\t %4lu ", + member, member & 0x7fffffff); ++ /* PR binutils/17512: Handle corrupt PE data. */ ++ else if (amt + 2 >= datasize) ++ fprintf (file, _("\t"), member); + else + { + int ordinal; + char *member_name; + +- ordinal = bfd_get_16 (abfd, data + member - adj); +- member_name = (char *) data + member - adj + 2; +- fprintf (file, "\t%04lx\t %4d %s", +- member, ordinal, member_name); ++ ordinal = bfd_get_16 (abfd, data + amt); ++ member_name = (char *) data + amt + 2; ++ fprintf (file, "\t%04lx\t %4d %.*s", ++ member, ordinal, ++ (int) (datasize - (amt + 2)), member_name); + } + + /* If the time stamp is not zero, the import address +@@ -1665,7 +1703,9 @@ pe_print_edata (bfd * abfd, void * vfile) + bfd_fprintf_vma (abfd, file, edt.name); + + if ((edt.name >= adj) && (edt.name < adj + datasize)) +- fprintf (file, " %s\n", data + edt.name - adj); ++ fprintf (file, " %.*s\n", ++ (int) (datasize - (edt.name - adj)), ++ data + edt.name - adj); + else + fprintf (file, "(outside .edata section)\n"); + +@@ -1714,7 +1754,9 @@ pe_print_edata (bfd * abfd, void * vfile) + edt.base); + + /* PR 17512: Handle corrupt PE binaries. */ +- if (edt.eat_addr + (edt.num_functions * 4) - adj >= datasize) ++ if (edt.eat_addr + (edt.num_functions * 4) - adj >= datasize ++ /* 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"), + (long) edt.eat_addr, + (long) edt.num_functions); +@@ -1730,11 +1772,12 @@ pe_print_edata (bfd * abfd, void * vfile) + /* This rva is to a name (forwarding function) in our section. */ + /* Should locate a function descriptor. */ + fprintf (file, +- "\t[%4ld] +base[%4ld] %04lx %s -- %s\n", ++ "\t[%4ld] +base[%4ld] %04lx %s -- %.*s\n", + (long) i, + (long) (i + edt.base), + (unsigned long) eat_member, + _("Forwarder RVA"), ++ (int)(datasize - (eat_member - adj)), + data + eat_member - adj); + } + else +@@ -1755,29 +1798,37 @@ pe_print_edata (bfd * abfd, void * vfile) + _("\n[Ordinal/Name Pointer] Table\n")); + + /* PR 17512: Handle corrupt PE binaries. */ +- if (edt.npt_addr + (edt.num_names * 4) - adj >= datasize) ++ if (edt.npt_addr + (edt.num_names * 4) - adj >= datasize ++ || (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, + (long) edt.num_names); +- else if (edt.ot_addr + (edt.num_names * 2) - adj >= datasize) ++ /* PR 17512: file: 140-147171-0.004. */ ++ else if (edt.ot_addr + (edt.num_names * 2) - adj >= datasize ++ || data + edt.ot_addr - adj < data) + fprintf (file, _("\tInvalid Ordinal Table rva (0x%lx) or entry count (0x%lx)\n"), + (long) edt.ot_addr, + (long) edt.num_names); + else for (i = 0; i < edt.num_names; ++i) + { +- bfd_vma name_ptr = bfd_get_32 (abfd, +- data + +- edt.npt_addr +- + (i*4) - adj); ++ bfd_vma name_ptr; ++ bfd_vma ord; + +- char *name = (char *) data + name_ptr - adj; ++ ord = bfd_get_16 (abfd, data + edt.ot_addr + (i * 2) - adj); ++ name_ptr = bfd_get_32 (abfd, data + edt.npt_addr + (i * 4) - adj); + +- bfd_vma ord = bfd_get_16 (abfd, +- data + +- edt.ot_addr +- + (i*2) - adj); +- fprintf (file, +- "\t[%4ld] %s\n", (long) ord, name); ++ if ((name_ptr - adj) >= datasize) ++ { ++ fprintf (file, _("\t[%4ld] \n"), ++ (long) ord, (long) name_ptr); ++ } ++ else ++ { ++ char * name = (char *) data + name_ptr - adj; ++ ++ fprintf (file, "\t[%4ld] %.*s\n", (long) ord, ++ (int)((char *)(data + datasize) - name), name); ++ } + } + + free (data); +@@ -2092,8 +2092,7 @@ pe_print_reloc (bfd * abfd, void * vfile) + FILE *file = (FILE *) vfile; + bfd_byte *data = 0; + asection *section = bfd_get_section_by_name (abfd, ".reloc"); +- bfd_size_type i; +- bfd_size_type start, stop; ++ bfd_byte *p, *end; + + if (section == NULL || section->size == 0 || !(section->flags & SEC_HAS_CONTENTS)) + return TRUE; +@@ -2108,20 +2107,20 @@ pe_print_reloc (bfd * abfd, void * vfile) + return FALSE; + } + +- start = 0; +- +- stop = section->size; +- +- for (i = start; i < stop;) ++ p = data; ++ end = data + section->size; ++ while (p + 8 <= end) + { + int j; + bfd_vma virtual_address; + long number, size; ++ bfd_byte *chunk_end; + + /* The .reloc section is a sequence of blocks, with a header consisting + of two 32 bit quantities, followed by a number of 16 bit entries. */ +- virtual_address = bfd_get_32 (abfd, data+i); +- size = bfd_get_32 (abfd, data+i+4); ++ virtual_address = bfd_get_32 (abfd, p); ++ size = bfd_get_32 (abfd, p + 4); ++ p += 8; + number = (size - 8) / 2; + + if (size == 0) +@@ -2131,9 +2130,13 @@ pe_print_reloc (bfd * abfd, void * vfile) + _("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"), + (unsigned long) virtual_address, size, (unsigned long) size, number); + +- for (j = 0; j < number; ++j) ++ chunk_end = p + size; ++ if (chunk_end > end) ++ chunk_end = end; ++ j = 0; ++ while (p + 2 <= chunk_end) + { +- unsigned short e = bfd_get_16 (abfd, data + i + 8 + j * 2); ++ unsigned short e = bfd_get_16 (abfd, p); + unsigned int t = (e & 0xF000) >> 12; + int off = e & 0x0FFF; + +@@ -2144,20 +2147,20 @@ pe_print_reloc (bfd * abfd, void * vfile) + _("\treloc %4d offset %4x [%4lx] %s"), + j, off, (unsigned long) (off + virtual_address), tbl[t]); + ++ p += 2; ++ j++; ++ + /* HIGHADJ takes an argument, - the next record *is* the + low 16 bits of addend. */ +- if (t == IMAGE_REL_BASED_HIGHADJ) ++ if (t == IMAGE_REL_BASED_HIGHADJ && p + 2 <= chunk_end) + { +- fprintf (file, " (%4x)", +- ((unsigned int) +- bfd_get_16 (abfd, data + i + 8 + j * 2 + 2))); ++ fprintf (file, " (%4x)", (unsigned int) bfd_get_16 (abfd, p)); ++ p += 2; + j++; + } + + fprintf (file, "\n"); + } +- +- i += size; + } + + free (data); +diff --git a/bfd/peicode.h b/bfd/peicode.h +index 157879b..8365353 100644 +--- a/bfd/peicode.h ++++ b/bfd/peicode.h +@@ -271,6 +271,7 @@ pe_mkobject (bfd * abfd) + /* in_reloc_p is architecture dependent. */ + pe->in_reloc_p = in_reloc_p; + ++ memset (& pe->pe_opthdr, 0, sizeof pe->pe_opthdr); + return TRUE; + } + +@@ -567,6 +568,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars, + ent->u.syment.n_sclass = sclass; + ent->u.syment.n_scnum = section->target_index; + ent->u.syment._n._n_n._n_offset = (bfd_hostptr_t) sym; ++ ent->is_sym = TRUE; + + sym->symbol.the_bfd = vars->abfd; + sym->symbol.name = vars->string_ptr; +@@ -1313,7 +1315,7 @@ pe_bfd_object_p (bfd * abfd) + + /* Swap file header, so that we get the location for calling + real_object_p. */ +- bfd_coff_swap_filehdr_in (abfd, (PTR)&image_hdr, &internal_f); ++ bfd_coff_swap_filehdr_in (abfd, &image_hdr, &internal_f); + + if (! bfd_coff_bad_format_hook (abfd, &internal_f) + || internal_f.f_opthdr > bfd_coff_aoutsz (abfd)) +@@ -1327,16 +1329,21 @@ pe_bfd_object_p (bfd * abfd) + + if (opt_hdr_size != 0) + { +- PTR opthdr; ++ bfd_size_type amt = opt_hdr_size; ++ void * opthdr; + +- opthdr = bfd_alloc (abfd, opt_hdr_size); ++ /* PR 17521 file: 230-131433-0.004. */ ++ if (amt < sizeof (PEAOUTHDR)) ++ amt = sizeof (PEAOUTHDR); ++ ++ opthdr = bfd_zalloc (abfd, amt); + if (opthdr == NULL) + return NULL; + if (bfd_bread (opthdr, opt_hdr_size, abfd) + != (bfd_size_type) opt_hdr_size) + return NULL; + +- bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) & internal_a); ++ bfd_coff_swap_aouthdr_in (abfd, opthdr, & internal_a); + } + + return coff_real_object_p (abfd, internal_f.f_nscns, &internal_f, +diff --git a/bfd/tekhex.c b/bfd/tekhex.c +index 2220d50..0328689 100644 +--- a/bfd/tekhex.c ++++ b/bfd/tekhex.c +@@ -246,11 +246,12 @@ struct tekhex_data_list_struct + typedef struct tekhex_data_list_struct tekhex_data_list_type; + + #define CHUNK_MASK 0x1fff ++#define CHUNK_SPAN 32 + + struct data_struct + { +- char chunk_data[CHUNK_MASK + 1]; +- char chunk_init[CHUNK_MASK + 1]; ++ unsigned char chunk_data[CHUNK_MASK + 1]; ++ unsigned char chunk_init[(CHUNK_MASK + 1 + CHUNK_SPAN - 1) / CHUNK_SPAN]; + bfd_vma vma; + struct data_struct *next; + }; +@@ -312,7 +313,7 @@ getsym (char *dstp, char **srcp, unsigned int *lenp) + } + + static struct data_struct * +-find_chunk (bfd *abfd, bfd_vma vma) ++find_chunk (bfd *abfd, bfd_vma vma, bfd_boolean create) + { + struct data_struct *d = abfd->tdata.tekhex_data->data; + +@@ -320,7 +321,7 @@ find_chunk (bfd *abfd, bfd_vma vma) + while (d && (d->vma) != vma) + d = d->next; + +- if (!d) ++ if (!d && create) + { + /* No chunk for this address, so make one up. */ + d = (struct data_struct *) +@@ -339,11 +340,14 @@ find_chunk (bfd *abfd, bfd_vma vma) + static void + insert_byte (bfd *abfd, int value, bfd_vma addr) + { +- /* Find the chunk that this byte needs and put it in. */ +- struct data_struct *d = find_chunk (abfd, addr); ++ if (value != 0) ++ { ++ /* Find the chunk that this byte needs and put it in. */ ++ struct data_struct *d = find_chunk (abfd, addr, TRUE); + +- d->chunk_data[addr & CHUNK_MASK] = value; +- d->chunk_init[addr & CHUNK_MASK] = 1; ++ d->chunk_data[addr & CHUNK_MASK] = value; ++ d->chunk_init[(addr & CHUNK_MASK) / CHUNK_SPAN] = 1; ++ } + } + + /* The first pass is to find the names of all the sections, and see +@@ -352,7 +356,7 @@ insert_byte (bfd *abfd, int value, bfd_vma addr) + static bfd_boolean + first_phase (bfd *abfd, int type, char *src) + { +- asection *section = bfd_abs_section_ptr; ++ asection *section, *alt_section; + unsigned int len; + bfd_vma val; + char sym[17]; /* A symbol can only be 16chars long. */ +@@ -392,6 +396,7 @@ first_phase (bfd *abfd, int type, char *src) + if (section == NULL) + return FALSE; + } ++ alt_section = NULL; + while (*src) + { + switch (*src) +@@ -439,6 +444,42 @@ first_phase (bfd *abfd, int type, char *src) + new_symbol->symbol.flags = (BSF_GLOBAL | BSF_EXPORT); + else + new_symbol->symbol.flags = BSF_LOCAL; ++ if (stype == '2' || stype == '6') ++ new_symbol->symbol.section = bfd_abs_section_ptr; ++ else if (stype == '3' || stype == '7') ++ { ++ if ((section->flags & SEC_DATA) == 0) ++ section->flags |= SEC_CODE; ++ else ++ { ++ if (alt_section == NULL) ++ alt_section = bfd_get_next_section_by_name (section); ++ if (alt_section == NULL) ++ alt_section = bfd_make_section_anyway_with_flags ++ (abfd, section->name, ++ (section->flags & ~SEC_DATA) | SEC_CODE); ++ if (alt_section == NULL) ++ return FALSE; ++ new_symbol->symbol.section = alt_section; ++ } ++ } ++ else if (stype == '4' || stype == '8') ++ { ++ if ((section->flags & SEC_CODE) == 0) ++ section->flags |= SEC_DATA; ++ else ++ { ++ if (alt_section == NULL) ++ alt_section = bfd_get_next_section_by_name (section); ++ if (alt_section == NULL) ++ alt_section = bfd_make_section_anyway_with_flags ++ (abfd, section->name, ++ (section->flags & ~SEC_CODE) | SEC_DATA); ++ if (alt_section == NULL) ++ return FALSE; ++ new_symbol->symbol.section = alt_section; ++ } ++ } + if (!getvalue (&src, &val)) + return FALSE; + new_symbol->symbol.value = val - section->vma; +@@ -589,22 +630,26 @@ move_section_contents (bfd *abfd, + /* Get high bits of address. */ + bfd_vma chunk_number = addr & ~(bfd_vma) CHUNK_MASK; + bfd_vma low_bits = addr & CHUNK_MASK; ++ bfd_boolean must_write = !get && *location != 0; + +- if (chunk_number != prev_number) +- /* Different chunk, so move pointer. */ +- d = find_chunk (abfd, chunk_number); ++ if (chunk_number != prev_number || (!d && must_write)) ++ { ++ /* Different chunk, so move pointer. */ ++ d = find_chunk (abfd, chunk_number, must_write); ++ prev_number = chunk_number; ++ } + + if (get) + { +- if (d->chunk_init[low_bits]) ++ if (d) + *location = d->chunk_data[low_bits]; + else + *location = 0; + } +- else ++ else if (must_write) + { + d->chunk_data[low_bits] = *location; +- d->chunk_init[low_bits] = (*location != 0); ++ d->chunk_init[low_bits / CHUNK_SPAN] = 1; + } + + location++; +@@ -632,7 +677,9 @@ tekhex_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long machine) + { +- return bfd_default_set_arch_mach (abfd, arch, machine); ++ /* Ignore errors about unknown architecture. */ ++ return (bfd_default_set_arch_mach (abfd, arch, machine) ++ || arch == bfd_arch_unknown); + } + + /* We have to save up all the Tekhexords for a splurge before output. */ +@@ -644,24 +691,6 @@ tekhex_set_section_contents (bfd *abfd, + file_ptr offset, + bfd_size_type bytes_to_do) + { +- if (! abfd->output_has_begun) +- { +- /* The first time around, allocate enough sections to hold all the chunks. */ +- asection *s = abfd->sections; +- bfd_vma vma; +- +- for (s = abfd->sections; s; s = s->next) +- { +- if (s->flags & SEC_LOAD) +- { +- for (vma = s->vma & ~(bfd_vma) CHUNK_MASK; +- vma < s->vma + s->size; +- vma += CHUNK_MASK) +- find_chunk (abfd, vma); +- } +- } +- } +- + if (section->flags & (SEC_LOAD | SEC_ALLOC)) + { + move_section_contents (abfd, section, locationp, offset, bytes_to_do, +@@ -772,26 +801,17 @@ tekhex_write_object_contents (bfd *abfd) + d = d->next) + { + int low; +- +- const int span = 32; + int addr; + + /* Write it in blocks of 32 bytes. */ +- for (addr = 0; addr < CHUNK_MASK + 1; addr += span) ++ for (addr = 0; addr < CHUNK_MASK + 1; addr += CHUNK_SPAN) + { +- int need = 0; +- +- /* Check to see if necessary. */ +- for (low = 0; !need && low < span; low++) +- if (d->chunk_init[addr + low]) +- need = 1; +- +- if (need) ++ if (d->chunk_init[addr / CHUNK_SPAN]) + { + char *dst = buffer; + + writevalue (&dst, addr + d->vma); +- for (low = 0; low < span; low++) ++ for (low = 0; low < CHUNK_SPAN; low++) + { + TOHEX (dst, d->chunk_data[addr + low]); + dst += 2; +diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c +index 1ca9c2e..9522974 100644 +--- a/bfd/xcofflink.c ++++ b/bfd/xcofflink.c +@@ -4494,7 +4494,10 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, + if (strings == NULL) + return FALSE; + } +- filename = strings + aux.x_file.x_n.x_offset; ++ if ((bfd_size_type) aux.x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd)) ++ filename = _(""); ++ else ++ filename = strings + aux.x_file.x_n.x_offset; + indx = _bfd_stringtab_add (flinfo->strtab, filename, + hash, copy); + if (indx == (bfd_size_type) -1) +diff --git a/binutils/dwarf.c b/binutils/dwarf.c +index ee982de..84e628a 100644 +--- a/binutils/dwarf.c ++++ b/binutils/dwarf.c +@@ -118,13 +118,22 @@ size_of_encoded_value (int encoding) + } + + static dwarf_vma +-get_encoded_value (unsigned char *data, ++get_encoded_value (unsigned char **pdata, + int encoding, +- struct dwarf_section *section) ++ struct dwarf_section *section, ++ unsigned char * end) + { ++ unsigned char * data = * pdata; + int size = size_of_encoded_value (encoding); + dwarf_vma val; + ++ if (data + size >= end) ++ { ++ warn (_("Encoded value extends past end of section\n")); ++ * pdata = end; ++ return 0; ++ } ++ + if (encoding & DW_EH_PE_signed) + val = byte_get_signed (data, size); + else +@@ -132,6 +141,8 @@ get_encoded_value (unsigned char *data, + + if ((encoding & 0x70) == DW_EH_PE_pcrel) + val += section->address + (data - section->start); ++ ++ * pdata = data + size; + return val; + } + +@@ -399,7 +410,7 @@ process_extended_line_op (unsigned char * data, + + if (len == 0 || data == end) + { +- warn (_("badly formed extended line op encountered!\n")); ++ warn (_("Badly formed extended line op encountered!\n")); + return bytes_read; + } + +@@ -1238,8 +1249,7 @@ decode_location_expression (unsigned char * data, + dwarf_vma addr; + + encoding = *data++; +- addr = get_encoded_value (data, encoding, section); +- data += size_of_encoded_value (encoding); ++ addr = get_encoded_value (&data, encoding, section, end); + + printf ("DW_OP_GNU_encoded_addr: fmt:%02x addr:", encoding); + print_dwarf_vma (addr, pointer_size); +@@ -1464,9 +1474,9 @@ read_and_display_attr_value (unsigned long attribute, + unsigned char * orig_data = data; + unsigned int bytes_read; + +- if (data == end) ++ if (data > end || (data == end && form != DW_FORM_flag_present)) + { +- warn (_("corrupt attribute\n")); ++ warn (_("Corrupt attribute\n")); + return data; + } + +@@ -1623,6 +1633,12 @@ read_and_display_attr_value (unsigned long attribute, + case DW_FORM_exprloc: + uvalue = read_uleb128 (data, & bytes_read, end); + block_start = data + bytes_read; ++ /* PR 17512: file: 008-103549-0.001:0.1. */ ++ if (block_start + uvalue > end) ++ { ++ warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); ++ uvalue = end - block_start; ++ } + if (do_loc) + data = block_start + uvalue; + else +@@ -1632,6 +1648,11 @@ 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) ++ { ++ warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); ++ uvalue = end - block_start; ++ } + if (do_loc) + data = block_start + uvalue; + else +@@ -1641,6 +1662,11 @@ 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) ++ { ++ warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); ++ uvalue = end - block_start; ++ } + if (do_loc) + data = block_start + uvalue; + else +@@ -1650,6 +1676,11 @@ 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) ++ { ++ warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue); ++ uvalue = end - block_start; ++ } + if (do_loc) + data = block_start + uvalue; + else +@@ -2184,7 +2215,7 @@ process_debug_info (struct dwarf_section *section, + + if (num_units == 0) + { +- error (_("No comp units in %s section ?"), section->name); ++ error (_("No comp units in %s section ?\n"), section->name); + return 0; + } + +@@ -2193,7 +2224,7 @@ process_debug_info (struct dwarf_section *section, + sizeof (* debug_information)); + if (debug_information == NULL) + { +- error (_("Not enough memory for a debug info array of %u entries"), ++ error (_("Not enough memory for a debug info array of %u entries\n"), + num_units); + return 0; + } +@@ -2271,6 +2302,13 @@ process_debug_info (struct dwarf_section *section, + } + + SAFE_BYTE_GET_AND_INC (compunit.cu_pointer_size, hdrptr, 1, end); ++ /* PR 17512: file: 001-108546-0.001:0.1. */ ++ if (compunit.cu_pointer_size < 2 || compunit.cu_pointer_size > 8) ++ { ++ warn (_("Invalid pointer size (%d) in compunit header, using %d instead\n"), ++ compunit.cu_pointer_size, offset_size); ++ compunit.cu_pointer_size = offset_size; ++ } + + if (do_types) + { +@@ -2602,20 +2640,20 @@ read_debug_line_header (struct dwarf_section * section, + SAFE_BYTE_GET_AND_INC (linfo->li_length, hdrptr, 4, end); + + if (linfo->li_length == 0xffffffff) +- { +- /* This section is 64-bit DWARF 3. */ ++ { ++ /* This section is 64-bit DWARF 3. */ + SAFE_BYTE_GET_AND_INC (linfo->li_length, hdrptr, 8, end); +- offset_size = 8; +- initial_length_size = 12; +- } +- else +- { +- offset_size = 4; +- initial_length_size = 4; +- } ++ offset_size = 8; ++ initial_length_size = 12; ++ } ++ else ++ { ++ offset_size = 4; ++ initial_length_size = 4; ++ } + + if (linfo->li_length + initial_length_size > section->size) +- { ++ { + /* If the length is just a bias against the initial_length_size then + this means that the field has a relocation against it which has not + been applied. (Ie we are dealing with an object file, not a linked +@@ -2627,11 +2665,10 @@ read_debug_line_header (struct dwarf_section * section, + } + else + { +- warn (_("The line info appears to be corrupt - " +- "the section is too small\n")); ++ warn (_("The line info appears to be corrupt - the section is too small\n")); + return NULL; + } +- } ++ } + + /* Get and check the version number. */ + SAFE_BYTE_GET_AND_INC (linfo->li_version, hdrptr, 2, end); +@@ -2639,25 +2676,25 @@ read_debug_line_header (struct dwarf_section * section, + if (linfo->li_version != 2 + && linfo->li_version != 3 + && linfo->li_version != 4) +- { +- warn (_("Only DWARF version 2, 3 and 4 line info is currently supported.\n")); ++ { ++ warn (_("Only DWARF version 2, 3 and 4 line info is currently supported.\n")); + return NULL; +- } ++ } + + SAFE_BYTE_GET_AND_INC (linfo->li_prologue_length, hdrptr, offset_size, end); + SAFE_BYTE_GET_AND_INC (linfo->li_min_insn_length, hdrptr, 1, end); + + if (linfo->li_version >= 4) +- { ++ { + SAFE_BYTE_GET_AND_INC (linfo->li_max_ops_per_insn, hdrptr, 1, end); + + if (linfo->li_max_ops_per_insn == 0) +- { +- warn (_("Invalid maximum operations per insn.\n")); ++ { ++ warn (_("Invalid maximum operations per insn.\n")); + return NULL; +- } + } +- else ++ } ++ else + linfo->li_max_ops_per_insn = 1; + + SAFE_BYTE_GET_AND_INC (linfo->li_default_is_stmt, hdrptr, 1, end); +@@ -3204,7 +3241,7 @@ display_debug_lines_decoded (struct dwarf_section *section, + + if (ext_op_code_len == 0) + { +- warn (_("badly formed extended line op encountered!\n")); ++ warn (_("Badly formed extended line op encountered!\n")); + break; + } + ext_op_code_len += bytes_read; +@@ -3598,6 +3635,8 @@ display_debug_pubnames_worker (struct dwarf_section *section, + if (offset != 0) + { + data += offset_size; ++ if (data >= end) ++ break; + printf (" %-6lx\t%s\n", offset, data); + data += strnlen ((char *) data, end - data) + 1; + } +@@ -4135,6 +4182,13 @@ display_loc_list (struct dwarf_section *section, + unsigned short length; + int need_frame_base; + ++ if (pointer_size < 2 || pointer_size > 8) ++ { ++ warn (_("Invalid pointer size (%d) in debug info for entry %d\n"), ++ pointer_size, debug_info_entry); ++ return; ++ } ++ + while (1) + { + if (start + 2 * pointer_size > section_end) +@@ -4247,6 +4301,13 @@ display_loc_list_dwo (struct dwarf_section *section, + unsigned int idx; + unsigned int bytes_read; + ++ if (pointer_size < 2 || pointer_size > 8) ++ { ++ warn (_("Invalid pointer size (%d) in debug info for entry %d\n"), ++ pointer_size, debug_info_entry); ++ return; ++ } ++ + while (1) + { + printf (" %8.8lx ", offset + (start - *start_ptr)); +@@ -4647,7 +4708,8 @@ display_debug_aranges (struct dwarf_section *section, + + address_size = arange.ar_pointer_size + arange.ar_segment_size; + +- if (address_size == 0) ++ /* PR 17512: file: 001-108546-0.001:0.1. */ ++ if (address_size == 0 || address_size > 8) + { + error (_("Invalid address size in %s section!\n"), + section->name); +@@ -4886,12 +4948,19 @@ display_debug_ranges (struct dwarf_section *section, + unsigned long base_address; + + pointer_size = debug_info_p->pointer_size; +- + /* DWARF sections under Mach-O have non-zero addresses. */ + offset = range_entry->ranges_offset - section->address; + next = section_begin + offset; + base_address = debug_info_p->base_address; + ++ /* PR 17512: file: 001-101485-0.001:0.1. */ ++ if (pointer_size < 2 || pointer_size > 8) ++ { ++ warn (_("Corrupt pointer size (%d) in debug entry at offset %8.8lx\n"), ++ pointer_size, offset); ++ continue; ++ } ++ + if (dwarf_check != 0 && i > 0) + { + if (start < next) +@@ -5009,6 +5078,14 @@ frame_need_space (Frame_Chunk *fc, unsigned int reg) + fc->col_type = (short int *) xcrealloc (fc->col_type, fc->ncols, + sizeof (short int)); + fc->col_offset = (int *) xcrealloc (fc->col_offset, fc->ncols, sizeof (int)); ++ /* 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"), ++ fc->ncols); ++ fc->ncols = 0; ++ return -1; ++ } + + while (prev < fc->ncols) + { +@@ -5243,6 +5320,11 @@ read_cie (unsigned char *start, unsigned char *end, + unsigned char *augmentation_data = NULL; + unsigned long augmentation_data_len = 0; + ++ * p_cie = NULL; ++ /* PR 17512: file: 001-228113-0.004. */ ++ if (start >= end) ++ return end; ++ + fc = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk)); + memset (fc, 0, sizeof (Frame_Chunk)); + +@@ -5252,7 +5334,16 @@ read_cie (unsigned char *start, unsigned char *end, + version = *start++; + + fc->augmentation = (char *) start; +- start = (unsigned char *) strchr ((char *) start, '\0') + 1; ++ /* PR 17512: file: 001-228113-0.004. ++ Skip past augmentation name, but avoid running off the end of the data. */ ++ while (start < end) ++ if (* start ++ == '\0') ++ break; ++ if (start == end) ++ { ++ warn (_("No terminator for augmentation name\n")); ++ return start; ++ } + + if (strcmp (fc->augmentation, "eh") == 0) + start += eh_addr_size; +@@ -5355,6 +5446,7 @@ display_debug_frames (struct dwarf_section *section, + saved_start = start; + + SAFE_BYTE_GET_AND_INC (length, start, 4, end); ++ + if (length == 0) + { + printf ("\n%08lx ZERO terminator\n\n", +@@ -5375,7 +5467,7 @@ display_debug_frames (struct dwarf_section *section, + } + + block_end = saved_start + length + initial_length_size; +- if (block_end > end) ++ if (block_end > end || block_end < start) + { + warn ("Invalid length 0x%s in FDE at %#08lx\n", + dwarf_vmatoa_1 (NULL, length, offset_size), +@@ -5393,6 +5485,9 @@ display_debug_frames (struct dwarf_section *section, + + 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; +@@ -5549,11 +5644,9 @@ 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); +- } +- fc->pc_begin = get_encoded_value (start, fc->fde_encoding, section); +- start += encoded_ptr_size; ++ SAFE_BYTE_GET_AND_INC (segment_selector, start, fc->segment_size, end); ++ ++ fc->pc_begin = get_encoded_value (&start, fc->fde_encoding, section, end); + + /* FIXME: It appears that sometimes the final pc_range value is + encoded in less than encoded_ptr_size bytes. See the x86_64 +@@ -5608,8 +5701,8 @@ display_debug_frames (struct dwarf_section *section, + + while (start < block_end) + { +- unsigned op, opa; +- unsigned long reg, temp; ++ unsigned int reg, op, opa; ++ unsigned long temp; + + op = *start++; + opa = op & 0x3f; +@@ -5681,13 +5774,26 @@ display_debug_frames (struct dwarf_section *section, + break; + case DW_CFA_def_cfa_expression: + temp = LEB (); +- start += temp; ++ if (start + temp < start) ++ { ++ warn (_("Corrupt CFA_def expression value: %lu\n"), temp); ++ start = block_end; ++ } ++ else ++ start += temp; + break; + case DW_CFA_expression: + case DW_CFA_val_expression: + reg = LEB (); + temp = LEB (); +- start += temp; ++ if (start + temp < start) ++ { ++ /* PR 17512: file:306-192417-0.005. */ ++ warn (_("Corrupt CFA expression value: %lu\n"), temp); ++ start = block_end; ++ } ++ else ++ start += temp; + if (frame_need_space (fc, reg) >= 0) + fc->col_type[reg] = DW_CFA_undefined; + break; +@@ -5787,8 +5893,7 @@ display_debug_frames (struct dwarf_section *section, + break; + + case DW_CFA_set_loc: +- vma = get_encoded_value (start, fc->fde_encoding, section); +- start += encoded_ptr_size; ++ vma = get_encoded_value (&start, fc->fde_encoding, section, end); + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else +@@ -6140,7 +6245,7 @@ display_debug_frames (struct dwarf_section *section, + if (op >= DW_CFA_lo_user && op <= DW_CFA_hi_user) + printf (_(" DW_CFA_??? (User defined call frame op: %#x)\n"), op); + else +- warn (_("unsupported or unknown Dwarf Call Frame Instruction number: %#x\n"), op); ++ warn (_("Unsupported or unknown Dwarf Call Frame Instruction number: %#x\n"), op); + start = block_end; + } + } +diff --git a/binutils/objdump.c b/binutils/objdump.c +index 413de56..da68f39 100644 +--- a/binutils/objdump.c ++++ b/binutils/objdump.c +@@ -562,7 +562,10 @@ slurp_symtab (bfd *abfd) + + storage = bfd_get_symtab_upper_bound (abfd); + if (storage < 0) +- bfd_fatal (bfd_get_filename (abfd)); ++ { ++ non_fatal (_("failed to read symbol table from: %s"), bfd_get_filename (abfd)); ++ bfd_fatal (_("error message was")); ++ } + if (storage) + sy = (asymbol **) xmalloc (storage); + +@@ -2385,7 +2388,12 @@ dump_dwarf (bfd *abfd) + else if (bfd_little_endian (abfd)) + byte_get = byte_get_little_endian; + else +- abort (); ++ /* PR 17512: file: objdump-s-endless-loop.tekhex. */ ++ { ++ warn (_("File %s does not contain any dwarf debug information\n"), ++ bfd_get_filename (abfd)); ++ return; ++ } + + switch (bfd_get_arch (abfd)) + { +@@ -2493,7 +2501,7 @@ print_section_stabs (bfd *abfd, + + We start the index at -1 because there is a dummy symbol on + the front of stabs-in-{coff,elf} sections that supplies sizes. */ +- for (i = -1; stabp < stabs_end; stabp += STABSIZE, i++) ++ for (i = -1; stabp <= stabs_end - STABSIZE; stabp += STABSIZE, i++) + { + const char *name; + unsigned long strx; +@@ -2531,10 +2539,13 @@ print_section_stabs (bfd *abfd, + } + else + { ++ bfd_size_type amt = strx + file_string_table_offset; ++ + /* Using the (possibly updated) string table offset, print the + string (if any) associated with this symbol. */ +- if ((strx + file_string_table_offset) < stabstr_size) +- printf (" %s", &strtab[strx + file_string_table_offset]); ++ if (amt < stabstr_size) ++ /* PR 17512: file: 079-79389-0.001:0.1. */ ++ printf (" %.*s", (int)(stabstr_size - amt), strtab + amt); + else + printf (" *"); + } +@@ -3108,7 +3119,11 @@ dump_relocs_in_section (bfd *abfd, + relcount = bfd_canonicalize_reloc (abfd, section, relpp, syms); + + if (relcount < 0) +- bfd_fatal (bfd_get_filename (abfd)); ++ { ++ printf ("\n"); ++ non_fatal (_("failed to read relocs in: %s"), bfd_get_filename (abfd)); ++ bfd_fatal (_("error message was")); ++ } + else if (relcount == 0) + printf (" (none)\n\n"); + else +diff --git a/binutils/rdcoff.c b/binutils/rdcoff.c +index 859aefe..6785136 100644 +--- a/binutils/rdcoff.c ++++ b/binutils/rdcoff.c +@@ -83,7 +83,7 @@ struct coff_types + debug_type basic[T_MAX + 1]; + }; + +-static debug_type *coff_get_slot (struct coff_types *, int); ++static debug_type *coff_get_slot (struct coff_types *, long); + static debug_type parse_coff_type + (bfd *, struct coff_symbols *, struct coff_types *, long, int, + union internal_auxent *, bfd_boolean, void *); +@@ -104,12 +104,17 @@ static bfd_boolean external_coff_symbol_p (int sym_class); + /* Return the slot for a type. */ + + static debug_type * +-coff_get_slot (struct coff_types *types, int indx) ++coff_get_slot (struct coff_types *types, long indx) + { + struct coff_slots **pps; + + pps = &types->slots; + ++ /* PR 17512: file: 078-18333-0.001:0.1. ++ FIXME: The value of 1000 is a guess. Maybe a better heuristic is needed. */ ++ if (indx / COFF_SLOTS > 1000) ++ fatal (_("Excessively large slot index: %lx"), indx); ++ + while (indx >= COFF_SLOTS) + { + if (*pps == NULL) +diff --git a/binutils/rddbg.c b/binutils/rddbg.c +index bfa54ab..ea8161b 100644 +--- a/binutils/rddbg.c ++++ b/binutils/rddbg.c +@@ -139,7 +139,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, + } + + strsize = bfd_section_size (abfd, strsec); +- strings = (bfd_byte *) xmalloc (strsize); ++ strings = (bfd_byte *) xmalloc (strsize + 1); + if (! bfd_get_section_contents (abfd, strsec, strings, 0, strsize)) + { + fprintf (stderr, "%s: %s: %s\n", +@@ -147,7 +147,8 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, + bfd_errmsg (bfd_get_error ())); + return FALSE; + } +- ++ /* Zero terminate the strings table, just in case. */ ++ strings [strsize] = 0; + if (shandle == NULL) + { + shandle = start_stab (dhandle, abfd, TRUE, syms, symcount); +@@ -159,7 +160,8 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, + + stroff = 0; + next_stroff = 0; +- for (stab = stabs; stab < stabs + stabsize; stab += 12) ++ /* PR 17512: file: 078-60391-0.001:0.1. */ ++ for (stab = stabs; stab <= (stabs + stabsize) - 12; stab += 12) + { + unsigned int strx; + int type; +@@ -184,33 +186,43 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, + } + else + { ++ size_t len; + char *f, *s; + +- f = NULL; +- +- if (stroff + strx > strsize) ++ if (stroff + strx >= strsize) + { +- fprintf (stderr, "%s: %s: stab entry %ld is corrupt, strx = 0x%x, type = %d\n", ++ fprintf (stderr, _("%s: %s: stab entry %ld is corrupt, strx = 0x%x, type = %d\n"), + bfd_get_filename (abfd), names[i].secname, + (long) (stab - stabs) / 12, strx, type); + continue; + } + + s = (char *) strings + stroff + strx; ++ f = NULL; + +- while (s[strlen (s) - 1] == '\\' ++ /* PR 17512: file: 002-87578-0.001:0.1. ++ It is possible to craft a file where, without the 'strlen (s) > 0', ++ an attempt to read the byte before 'strings' would occur. */ ++ while ((len = strlen (s)) > 0 ++ && s[len - 1] == '\\' + && stab + 12 < stabs + stabsize) + { + char *p; + + stab += 12; +- p = s + strlen (s) - 1; ++ p = s + len - 1; + *p = '\0'; +- s = concat (s, +- ((char *) strings +- + stroff +- + bfd_get_32 (abfd, stab)), +- (const char *) NULL); ++ strx = stroff + bfd_get_32 (abfd, stab); ++ if (strx >= strsize) ++ { ++ fprintf (stderr, _("%s: %s: stab entry %ld is corrupt\n"), ++ bfd_get_filename (abfd), names[i].secname, ++ (long) (stab - stabs) / 12); ++ break; ++ } ++ else ++ s = concat (s, (char *) strings + strx, ++ (const char *) NULL); + + /* We have to restore the backslash, because, if + the linker is hashing stabs strings, we may +diff --git a/binutils/readelf.c b/binutils/readelf.c +index 4118f62..0c00b2f 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -167,9 +167,10 @@ + char * program_name = "readelf"; + static long archive_file_offset; + static unsigned long archive_file_size; ++static bfd_size_type current_file_size; + static unsigned long dynamic_addr; + static bfd_size_type dynamic_size; +-static unsigned int dynamic_nent; ++static size_t dynamic_nent; + static char * dynamic_strings; + static unsigned long dynamic_strings_length; + static char * string_table; +@@ -315,8 +316,19 @@ get_data (void * var, FILE * file, long offset, size_t size, size_t nmemb, + + if (fseek (file, archive_file_offset + offset, SEEK_SET)) + { +- error (_("Unable to seek to 0x%lx for %s\n"), +- (unsigned long) archive_file_offset + offset, reason); ++ if (reason) ++ error (_("Unable to seek to 0x%lx for %s\n"), ++ (unsigned long) archive_file_offset + offset, 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 (reason) ++ error (_("Reading 0x%lx bytes extends past end of file for %s\n"), ++ (unsigned long) (size * nmemb), reason); + return NULL; + } + +@@ -330,8 +342,9 @@ get_data (void * var, FILE * file, long offset, size_t size, size_t nmemb, + + if (mvar == NULL) + { +- error (_("Out of memory allocating 0x%lx bytes for %s\n"), +- (unsigned long)(size * nmemb), reason); ++ if (reason) ++ error (_("Out of memory allocating 0x%lx bytes for %s\n"), ++ (unsigned long)(size * nmemb), reason); + return NULL; + } + +@@ -340,8 +353,9 @@ get_data (void * var, FILE * file, long offset, size_t size, size_t nmemb, + + if (fread (mvar, size, nmemb, file) != nmemb) + { +- error (_("Unable to read in 0x%lx bytes of %s\n"), +- (unsigned long)(size * nmemb), reason); ++ if (reason) ++ error (_("Unable to read in 0x%lx bytes of %s\n"), ++ (unsigned long)(size * nmemb), reason); + if (mvar != var) + free (mvar); + return NULL; +@@ -418,6 +432,7 @@ print_symbol (int width, const char *symbol) + width = - width; + extra_padding = TRUE; + } ++ assert (width != 0); + + if (do_wide) + /* Set the remaining width to a very large value. +@@ -490,6 +505,66 @@ print_symbol (int width, const char *symbol) + return num_printed; + } + ++/* Returns a pointer to a static buffer containing a printable version of ++ the given section's name. Like print_symbol, except that it does not try ++ to print multibyte characters, it just interprets them as hex values. */ ++ ++static const char * ++printable_section_name (Elf_Internal_Shdr * sec) ++{ ++#define MAX_PRINT_SEC_NAME_LEN 128 ++ static char sec_name_buf [MAX_PRINT_SEC_NAME_LEN + 1]; ++ const char * name = SECTION_NAME (sec); ++ char * buf = sec_name_buf; ++ char c; ++ unsigned int remaining = MAX_PRINT_SEC_NAME_LEN; ++ ++ while ((c = * name ++) != 0) ++ { ++ if (ISCNTRL (c)) ++ { ++ if (remaining < 2) ++ break; ++ ++ * buf ++ = '^'; ++ * buf ++ = c + 0x40; ++ remaining -= 2; ++ } ++ else if (ISPRINT (c)) ++ { ++ * buf ++ = c; ++ remaining -= 1; ++ } ++ else ++ { ++ static char hex[17] = "0123456789ABCDEF"; ++ ++ if (remaining < 4) ++ break; ++ * buf ++ = '<'; ++ * buf ++ = hex[(c & 0xf0) >> 4]; ++ * buf ++ = hex[c & 0x0f]; ++ * buf ++ = '>'; ++ remaining -= 4; ++ } ++ ++ if (remaining == 0) ++ break; ++ } ++ ++ * buf = 0; ++ return sec_name_buf; ++} ++ ++static const char * ++printable_section_name_from_index (unsigned long ndx) ++{ ++ if (ndx >= elf_header.e_shnum) ++ return _(""); ++ ++ return printable_section_name (section_headers + ndx); ++} ++ + /* Return a pointer to section NAME, or NULL if no such section exists. */ + + static Elf_Internal_Shdr * +@@ -522,6 +597,21 @@ find_section_by_address (bfd_vma addr) + return NULL; + } + ++static Elf_Internal_Shdr * ++find_section_by_type (unsigned int type) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < elf_header.e_shnum; i++) ++ { ++ Elf_Internal_Shdr *sec = section_headers + i; ++ if (sec->sh_type == type) ++ return sec; ++ } ++ ++ return NULL; ++} ++ + /* Return a pointer to section NAME, or NULL if no such section exists, + restricted to the list of sections given in SET. */ + +@@ -687,7 +777,7 @@ slurp_rela_relocs (FILE * file, + unsigned long * nrelasp) + { + Elf_Internal_Rela * relas; +- unsigned long nrelas; ++ size_t nrelas; + unsigned int i; + + if (is_32bit_elf) +@@ -785,7 +875,7 @@ slurp_rel_relocs (FILE * file, + unsigned long * nrelsp) + { + Elf_Internal_Rela * rels; +- unsigned long nrels; ++ size_t nrels; + unsigned int i; + + if (is_32bit_elf) +@@ -1404,8 +1494,7 @@ dump_relocations (FILE * file, + if (ELF_ST_TYPE (psym->st_info) == STT_SECTION) + { + if (psym->st_shndx < elf_header.e_shnum) +- sec_name +- = SECTION_NAME (section_headers + psym->st_shndx); ++ sec_name = SECTION_NAME (section_headers + psym->st_shndx); + else if (psym->st_shndx == SHN_ABS) + sec_name = "ABS"; + else if (psym->st_shndx == SHN_COMMON) +@@ -4100,21 +4189,31 @@ process_file_header (void) + return 1; + } + +- +-static int ++static bfd_boolean + get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) + { + Elf32_External_Phdr * phdrs; + Elf32_External_Phdr * external; + Elf_Internal_Phdr * internal; + unsigned int i; ++ unsigned int size = elf_header.e_phentsize; ++ unsigned int num = elf_header.e_phnum; ++ ++ /* PR binutils/17531: Cope with unexpected section header sizes. */ ++ if (size == 0 || num == 0) ++ return FALSE; ++ if (size < sizeof * phdrs) ++ { ++ error (_("The e_phentsize field in the ELF header is less than the size of an ELF program header\n")); ++ return FALSE; ++ } ++ if (size > sizeof * phdrs) ++ warn (_("The e_phentsize field in the ELF header is larger than the size of an ELF program header\n")); + + phdrs = (Elf32_External_Phdr *) get_data (NULL, file, elf_header.e_phoff, +- elf_header.e_phentsize, +- elf_header.e_phnum, +- _("program headers")); +- if (!phdrs) +- return 0; ++ size, num, _("program headers")); ++ if (phdrs == NULL) ++ return FALSE; + + for (i = 0, internal = pheaders, external = phdrs; + i < elf_header.e_phnum; +@@ -4131,24 +4230,34 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) + } + + free (phdrs); +- +- return 1; ++ return TRUE; + } + +-static int ++static bfd_boolean + get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) + { + Elf64_External_Phdr * phdrs; + Elf64_External_Phdr * external; + Elf_Internal_Phdr * internal; + unsigned int i; ++ unsigned int size = elf_header.e_phentsize; ++ unsigned int num = elf_header.e_phnum; ++ ++ /* PR binutils/17531: Cope with unexpected section header sizes. */ ++ if (size == 0 || num == 0) ++ return FALSE; ++ if (size < sizeof * phdrs) ++ { ++ error (_("The e_phentsize field in the ELF header is less than the size of an ELF program header\n")); ++ return FALSE; ++ } ++ if (size > sizeof * phdrs) ++ warn (_("The e_phentsize field in the ELF header is larger than the size of an ELF program header\n")); + + phdrs = (Elf64_External_Phdr *) get_data (NULL, file, elf_header.e_phoff, +- elf_header.e_phentsize, +- elf_header.e_phnum, +- _("program headers")); ++ size, num, _("program headers")); + if (!phdrs) +- return 0; ++ return FALSE; + + for (i = 0, internal = pheaders, external = phdrs; + i < elf_header.e_phnum; +@@ -4165,8 +4274,7 @@ get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) + } + + free (phdrs); +- +- return 1; ++ return TRUE; + } + + /* Returns 1 if the program headers were read into `program_headers'. */ +@@ -4185,7 +4293,8 @@ get_program_headers (FILE * file) + + if (phdrs == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory reading %u program headers\n"), ++ elf_header.e_phnum); + return 0; + } + +@@ -4341,6 +4450,9 @@ process_program_headers (FILE * file) + } + } + ++ if (do_segments) ++ putc ('\n', stdout); ++ + switch (segment->p_type) + { + case PT_DYNAMIC: +@@ -4351,6 +4463,12 @@ process_program_headers (FILE * file) + section in the DYNAMIC segment. */ + dynamic_addr = segment->p_offset; + dynamic_size = segment->p_filesz; ++ /* PR binutils/17512: Avoid corrupt dynamic section info in the segment. */ ++ if (dynamic_addr + dynamic_size >= current_file_size) ++ { ++ error (_("the dynamic segment offset + size exceeds the size of the file\n")); ++ dynamic_addr = dynamic_size = 0; ++ } + + /* Try to locate the .dynamic section. If there is + a section header table, we can easily locate it. */ +@@ -4404,14 +4522,11 @@ process_program_headers (FILE * file) + error (_("Unable to read program interpreter name\n")); + + if (do_segments) +- printf (_("\n [Requesting program interpreter: %s]"), ++ printf (_(" [Requesting program interpreter: %s]\n"), + program_interpreter); + } + break; + } +- +- if (do_segments) +- putc ('\n', stdout); + } + + if (do_segments && section_headers != NULL && string_table != NULL) +@@ -4433,7 +4548,7 @@ process_program_headers (FILE * file) + { + if (!ELF_TBSS_SPECIAL (section, segment) + && ELF_SECTION_IN_SEGMENT_STRICT (section, segment)) +- printf ("%s ", SECTION_NAME (section)); ++ printf ("%s ", printable_section_name (section)); + } + + putc ('\n',stdout); +@@ -4475,26 +4590,46 @@ offset_from_vma (FILE * file, bfd_vma vma, bfd_size_type size) + } + + +-static int +-get_32bit_section_headers (FILE * file, unsigned int num) ++/* Allocate memory and load the sections headers into the global pointer ++ SECTION_HEADERS. If PROBE is true, this is just a probe and we do not ++ generate any error messages if the load fails. */ ++ ++static bfd_boolean ++get_32bit_section_headers (FILE * file, bfd_boolean probe) + { + Elf32_External_Shdr * shdrs; + Elf_Internal_Shdr * internal; + unsigned int i; ++ unsigned int size = elf_header.e_shentsize; ++ unsigned int num = probe ? 1 : elf_header.e_shnum; ++ ++ /* PR binutils/17531: Cope with unexpected section header sizes. */ ++ if (size == 0 || num == 0) ++ return FALSE; ++ if (size < sizeof * shdrs) ++ { ++ if (! probe) ++ error (_("The e_shentsize field in the ELF header is less than the size of an ELF section header\n")); ++ return FALSE; ++ } ++ if (!probe && size > sizeof * shdrs) ++ warn (_("The e_shentsize field in the ELF header is larger than the size of an ELF section header\n")); + + shdrs = (Elf32_External_Shdr *) get_data (NULL, file, elf_header.e_shoff, +- elf_header.e_shentsize, num, +- _("section headers")); +- if (!shdrs) +- return 0; ++ size, num, ++ probe ? NULL : _("section headers")); ++ if (shdrs == NULL) ++ return FALSE; + ++ if (section_headers != NULL) ++ free (section_headers); + section_headers = (Elf_Internal_Shdr *) cmalloc (num, + sizeof (Elf_Internal_Shdr)); +- + if (section_headers == NULL) + { +- error (_("Out of memory\n")); +- return 0; ++ if (!probe) ++ error (_("Out of memory reading %u section headers\n"), num); ++ return FALSE; + } + + for (i = 0, internal = section_headers; +@@ -4514,30 +4649,45 @@ get_32bit_section_headers (FILE * file, unsigned int num) + } + + free (shdrs); +- +- return 1; ++ return TRUE; + } + +-static int +-get_64bit_section_headers (FILE * file, unsigned int num) ++static bfd_boolean ++get_64bit_section_headers (FILE * file, bfd_boolean probe) + { + Elf64_External_Shdr * shdrs; + Elf_Internal_Shdr * internal; + unsigned int i; ++ unsigned int size = elf_header.e_shentsize; ++ unsigned int num = probe ? 1 : elf_header.e_shnum; ++ ++ /* PR binutils/17531: Cope with unexpected section header sizes. */ ++ if (size == 0 || num == 0) ++ return FALSE; ++ if (size < sizeof * shdrs) ++ { ++ if (! probe) ++ error (_("The e_shentsize field in the ELF header is less than the size of an ELF section header\n")); ++ return FALSE; ++ } ++ if (! probe && size > sizeof * shdrs) ++ warn (_("The e_shentsize field in the ELF header is larger than the size of an ELF section header\n")); + + shdrs = (Elf64_External_Shdr *) get_data (NULL, file, elf_header.e_shoff, +- elf_header.e_shentsize, num, +- _("section headers")); +- if (!shdrs) +- return 0; ++ size, num, ++ probe ? NULL : _("section headers")); ++ if (shdrs == NULL) ++ return FALSE; + ++ if (section_headers != NULL) ++ free (section_headers); + section_headers = (Elf_Internal_Shdr *) cmalloc (num, + sizeof (Elf_Internal_Shdr)); +- + if (section_headers == NULL) + { +- error (_("Out of memory\n")); +- return 0; ++ if (! probe) ++ error (_("Out of memory reading %u section headers\n"), num); ++ return FALSE; + } + + for (i = 0, internal = section_headers; +@@ -4557,8 +4707,7 @@ get_64bit_section_headers (FILE * file, unsigned int num) + } + + free (shdrs); +- +- return 1; ++ return TRUE; + } + + static Elf_Internal_Sym * +@@ -4580,6 +4729,13 @@ get_32bit_elf_symbols (FILE * file, + 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); ++ goto exit_point; ++ } ++ + number = section->sh_size / section->sh_entsize; + + if (number * sizeof (Elf32_External_Sym) > section->sh_size + 1) +@@ -4610,7 +4766,8 @@ get_32bit_elf_symbols (FILE * file, + + if (isyms == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory reading %lu symbols\n"), ++ (unsigned long) number); + goto exit_point; + } + +@@ -4660,6 +4817,13 @@ get_64bit_elf_symbols (FILE * file, + 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); ++ goto exit_point; ++ } ++ + number = section->sh_size / section->sh_entsize; + + if (number * sizeof (Elf64_External_Sym) > section->sh_size + 1) +@@ -4689,7 +4853,8 @@ get_64bit_elf_symbols (FILE * file, + + if (isyms == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory reading %lu symbols\n"), ++ (unsigned long) number); + goto exit_point; + } + +@@ -4977,10 +5142,10 @@ process_section_headers (FILE * file) + + if (is_32bit_elf) + { +- if (! get_32bit_section_headers (file, elf_header.e_shnum)) ++ if (! get_32bit_section_headers (file, FALSE)) + return 0; + } +- else if (! get_64bit_section_headers (file, elf_header.e_shnum)) ++ else if (! get_64bit_section_headers (file, FALSE)) + return 0; + + /* Read in the string table, so that we have names to display. */ +@@ -5182,7 +5347,6 @@ process_section_headers (FILE * file) + ) + request_dump_bynumber (i, DEBUG_DUMP); + } +- + } + + if (! do_sections) +@@ -5239,14 +5403,9 @@ process_section_headers (FILE * file) + { + printf (" [%2u] ", i); + if (do_section_details) +- { +- print_symbol (INT_MAX, SECTION_NAME (section)); +- printf ("\n "); +- } ++ printf ("%s\n ", printable_section_name (section)); + else +- { +- print_symbol (-17, SECTION_NAME (section)); +- } ++ print_symbol (-17, SECTION_NAME (section)); + + printf (do_wide ? " %-15s " : " %-15.15s ", + get_section_type_name (section->sh_type)); +@@ -5479,7 +5638,8 @@ process_section_groups (FILE * file) + + if (section_headers_groups == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory reading %u section group headers\n"), ++ elf_header.e_shnum); + return 0; + } + +@@ -5503,7 +5663,8 @@ process_section_groups (FILE * file) + + if (section_groups == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory reading %lu groups\n"), ++ (unsigned long) group_count); + return 0; + } + +@@ -5519,8 +5680,8 @@ process_section_groups (FILE * file) + { + if (section->sh_type == SHT_GROUP) + { +- char * name = SECTION_NAME (section); +- char * group_name; ++ const char * name = printable_section_name (section); ++ const char * group_name; + unsigned char * start; + unsigned char * indices; + unsigned int entry, j, size; +@@ -5591,9 +5752,10 @@ process_section_groups (FILE * file) + strtab_sec = sec; + if (strtab) + free (strtab); ++ + strtab = (char *) get_data (NULL, file, strtab_sec->sh_offset, +- 1, strtab_sec->sh_size, +- _("string table")); ++ 1, strtab_sec->sh_size, ++ _("string table")); + strtab_size = strtab != NULL ? strtab_sec->sh_size : 0; + } + group_name = sym->st_name < strtab_size +@@ -5664,7 +5826,7 @@ process_section_groups (FILE * file) + if (do_section_groups) + { + sec = section_headers + entry; +- printf (" [%5u] %s\n", entry, SECTION_NAME (sec)); ++ printf (" [%5u] %s\n", entry, printable_section_name (sec)); + } + + g = (struct group_list *) xmalloc (sizeof (struct group_list)); +@@ -5972,7 +6134,7 @@ process_relocs (FILE * file) + if (string_table == NULL) + printf ("%d", section->sh_name); + else +- printf ("'%s'", SECTION_NAME (section)); ++ printf ("'%s'", printable_section_name (section)); + + printf (_(" at offset 0x%lx contains %lu entries:\n"), + rel_offset, (unsigned long) (rel_size / section->sh_entsize)); +@@ -6004,8 +6166,8 @@ process_relocs (FILE * file) + strsec = section_headers + symsec->sh_link; + + strtab = (char *) get_data (NULL, file, strsec->sh_offset, +- 1, strsec->sh_size, +- _("string table")); ++ 1, strsec->sh_size, ++ _("string table")); + strtablen = strtab == NULL ? 0 : strsec->sh_size; + } + +@@ -6310,7 +6472,11 @@ ia64_process_unwind (FILE * file) + aux.symtab = GET_ELF_SYMBOLS (file, sec, & aux.nsyms); + + strsec = section_headers + sec->sh_link; +- assert (aux.strtab == NULL); ++ if (aux.strtab != NULL) ++ { ++ error (_("Multiple auxillary string tables encountered\n")); ++ free (aux.strtab); ++ } + aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, + _("string table")); +@@ -6328,13 +6494,16 @@ ia64_process_unwind (FILE * file) + char * suffix; + size_t len, len2; + +- for (i = unwstart, sec = section_headers + unwstart; ++ for (i = unwstart, sec = section_headers + unwstart, unwsec = NULL; + i < elf_header.e_shnum; ++i, ++sec) + if (sec->sh_type == SHT_IA_64_UNWIND) + { + unwsec = sec; + break; + } ++ /* We have already counted the number of SHT_IA64_UNWIND ++ sections so the loop above should never fail. */ ++ assert (unwsec != NULL); + + unwstart = i + 1; + len = sizeof (ELF_STRING_ia64_unwind_once) - 1; +@@ -6342,18 +6511,26 @@ ia64_process_unwind (FILE * file) + if ((unwsec->sh_flags & SHF_GROUP) != 0) + { + /* We need to find which section group it is in. */ +- struct group_list * g = section_headers_groups [i]->root; ++ struct group_list * g; + +- for (; g != NULL; g = g->next) ++ if (section_headers_groups == NULL ++ || section_headers_groups [i] == NULL) ++ i = elf_header.e_shnum; ++ else + { +- sec = section_headers + g->section_index; ++ g = section_headers_groups [i]->root; + +- if (streq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info)) +- break; +- } ++ for (; g != NULL; g = g->next) ++ { ++ sec = section_headers + g->section_index; + +- if (g == NULL) +- i = elf_header.e_shnum; ++ if (streq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info)) ++ break; ++ } ++ ++ if (g == NULL) ++ i = elf_header.e_shnum; ++ } + } + else if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind_once, len)) + { +@@ -6389,14 +6566,14 @@ ia64_process_unwind (FILE * file) + if (string_table == NULL) + printf ("%d", unwsec->sh_name); + else +- printf (_("'%s'"), SECTION_NAME (unwsec)); ++ printf ("'%s'", printable_section_name (unwsec)); + } + else + { + aux.info_addr = sec->sh_addr; + aux.info = (unsigned char *) get_data (NULL, file, sec->sh_offset, 1, +- sec->sh_size, +- _("unwind info")); ++ sec->sh_size, ++ _("unwind info")); + aux.info_size = aux.info == NULL ? 0 : sec->sh_size; + + printf (_("\nUnwind section ")); +@@ -6404,7 +6581,7 @@ ia64_process_unwind (FILE * file) + if (string_table == NULL) + printf ("%d", unwsec->sh_name); + else +- printf (_("'%s'"), SECTION_NAME (unwsec)); ++ printf ("'%s'", printable_section_name (unwsec)); + + printf (_(" at offset 0x%lx contains %lu entries:\n"), + (unsigned long) unwsec->sh_offset, +@@ -6721,7 +6898,11 @@ hppa_process_unwind (FILE * file) + aux.symtab = GET_ELF_SYMBOLS (file, sec, & aux.nsyms); + + strsec = section_headers + sec->sh_link; +- assert (aux.strtab == NULL); ++ if (aux.strtab != NULL) ++ { ++ error (_("Multiple auxillary string tables encountered\n")); ++ free (aux.strtab); ++ } + aux.strtab = (char *) get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, + _("string table")); +@@ -6738,10 +6919,8 @@ hppa_process_unwind (FILE * file) + { + if (streq (SECTION_NAME (sec), ".PARISC.unwind")) + { +- printf (_("\nUnwind section ")); +- printf (_("'%s'"), SECTION_NAME (sec)); +- +- printf (_(" at offset 0x%lx contains %lu entries:\n"), ++ printf (_("\nUnwind section '%s' at offset 0x%lx contains %lu entries:\n"), ++ printable_section_name (sec), + (unsigned long) sec->sh_offset, + (unsigned long) (sec->sh_size / (2 * eh_addr_size + 8))); + +@@ -6845,6 +7024,9 @@ get_unwind_section_word (struct arm_unw_aux_info * aux, + unsigned int word; + bfd_boolean wrapped; + ++ if (sec == NULL || arm_sec == NULL) ++ return FALSE; ++ + addr->section = SHN_UNDEF; + addr->offset = 0; + +@@ -6900,6 +7082,10 @@ get_unwind_section_word (struct arm_unw_aux_info * aux, + if (arm_sec->data == NULL) + return FALSE; + ++ /* If the offset is invalid then fail. */ ++ if (word_offset > sec->sh_size - 4) ++ return FALSE; ++ + /* Get the word at the required offset. */ + word = byte_get (arm_sec->data + word_offset, 4); + +@@ -6927,7 +7113,9 @@ get_unwind_section_word (struct arm_unw_aux_info * aux, + if (rp->r_offset < word_offset) + continue; + +- sym = aux->symtab + ELF32_R_SYM (rp->r_info); ++ /* PR 17531: file: 027-161405-0.004 */ ++ if (aux->symtab == NULL) ++ continue; + + if (arm_sec->rel_type == SHT_REL) + { +@@ -6938,8 +7126,21 @@ get_unwind_section_word (struct arm_unw_aux_info * aux, + else if (arm_sec->rel_type == SHT_RELA) + offset = rp->r_addend; + else +- abort (); ++ { ++ error (_("Unknown section relocation type %d encountered\n"), ++ arm_sec->rel_type); ++ break; ++ } ++ ++ /* PR 17531 file: 027-1241568-0.004. */ ++ if (ELF32_R_SYM (rp->r_info) >= aux->nsyms) ++ { ++ error (_("Bad symbol index in unwind relocation (%lu > %lu)\n"), ++ (unsigned long) ELF32_R_SYM (rp->r_info), aux->nsyms); ++ break; ++ } + ++ sym = aux->symtab + ELF32_R_SYM (rp->r_info); + offset += sym->st_value; + prelval = offset - (arm_sec->sec->sh_addr + rp->r_offset); + +@@ -6947,38 +7148,54 @@ get_unwind_section_word (struct arm_unw_aux_info * aux, + if (elf_header.e_machine == EM_ARM) + { + relname = elf_arm_reloc_type (ELF32_R_TYPE (rp->r_info)); ++ if (relname == NULL) ++ { ++ warn (_("Skipping unknown ARM relocation type: %d\n"), ++ (int) ELF32_R_TYPE (rp->r_info)); ++ continue; ++ } + + if (streq (relname, "R_ARM_NONE")) + continue; + + if (! streq (relname, "R_ARM_PREL31")) + { +- warn (_("Skipping unexpected relocation type %s\n"), relname); ++ warn (_("Skipping unexpected ARM relocation type %s\n"), relname); + continue; + } + } + else if (elf_header.e_machine == EM_TI_C6000) + { + relname = elf_tic6x_reloc_type (ELF32_R_TYPE (rp->r_info)); ++ if (relname == NULL) ++ { ++ warn (_("Skipping unknown C6000 relocation type: %d\n"), ++ (int) ELF32_R_TYPE (rp->r_info)); ++ continue; ++ } + + if (streq (relname, "R_C6000_NONE")) + continue; + + if (! streq (relname, "R_C6000_PREL31")) + { +- warn (_("Skipping unexpected relocation type %s\n"), relname); ++ warn (_("Skipping unexpected C6000 relocation type %s\n"), relname); + continue; + } + + prelval >>= 1; + } + else +- /* This function currently only supports ARM and TI unwinders. */ +- abort (); ++ { ++ /* This function currently only supports ARM and TI unwinders. */ ++ warn (_("Only TI and ARM unwinders are currently supported\n")); ++ break; ++ } + + word = (word & ~ (bfd_vma) 0x7fffffff) | (prelval & 0x7fffffff); + addr->section = sym->st_shndx; + addr->offset = offset; ++ + if (sym_name) + * sym_name = sym->st_name; + break; +@@ -7166,11 +7383,15 @@ decode_arm_unwind_bytecode (struct arm_unw_aux_info *aux, + if ((buf[i] & 0x80) == 0) + break; + } +- assert (i < sizeof (buf)); +- offset = read_uleb128 (buf, &len, buf + i + 1); +- assert (len == i + 1); +- offset = offset * 4 + 0x204; +- printf ("vsp = vsp + %ld", offset); ++ if (i == sizeof (buf)) ++ printf (_("corrupt change to vsp")); ++ else ++ { ++ offset = read_uleb128 (buf, &len, buf + i + 1); ++ assert (len == i + 1); ++ offset = offset * 4 + 0x204; ++ printf ("vsp = vsp + %ld", offset); ++ } + } + else if (op == 0xb3 || op == 0xc8 || op == 0xc9) + { +@@ -7545,7 +7766,7 @@ decode_arm_unwind (struct arm_unw_aux_info * aux, + break; + + default: +- error (_("Unsupported architecture type %d encountered when decoding unwind table"), ++ error (_("Unsupported architecture type %d encountered when decoding unwind table\n"), + elf_header.e_machine); + } + +@@ -7665,7 +7886,7 @@ arm_process_unwind (FILE *file) + break; + + default: +- error (_("Unsupported architecture type %d encountered when processing unwind table"), ++ error (_("Unsupported architecture type %d encountered when processing unwind table\n"), + elf_header.e_machine); + return; + } +@@ -7683,7 +7904,13 @@ arm_process_unwind (FILE *file) + aux.symtab = GET_ELF_SYMBOLS (file, sec, & aux.nsyms); + + strsec = section_headers + sec->sh_link; +- assert (aux.strtab == NULL); ++ ++ /* PR binutils/17531 file: 011-12666-0.004. */ ++ if (aux.strtab != NULL) ++ { ++ error (_("Multiple string tables found in file.\n")); ++ free (aux.strtab); ++ } + aux.strtab = get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, _("string table")); + aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0; +@@ -7700,7 +7927,7 @@ arm_process_unwind (FILE *file) + if (sec->sh_type == sec_type) + { + printf (_("\nUnwind table index '%s' at offset 0x%lx contains %lu entries:\n"), +- SECTION_NAME (sec), ++ printable_section_name (sec), + (unsigned long) sec->sh_offset, + (unsigned long) (sec->sh_size / (2 * eh_addr_size))); + +@@ -7979,11 +8206,11 @@ get_32bit_dynamic_section (FILE * file) + if (!edyn) + return 0; + +-/* SGI's ELF has more than one section in the DYNAMIC segment, and we +- might not have the luxury of section headers. Look for the DT_NULL +- terminator to determine the number of entries. */ ++ /* SGI's ELF has more than one section in the DYNAMIC segment, and we ++ might not have the luxury of section headers. Look for the DT_NULL ++ terminator to determine the number of entries. */ + for (ext = edyn, dynamic_nent = 0; +- (char *) ext < (char *) edyn + dynamic_size; ++ (char *) ext < (char *) edyn + dynamic_size - sizeof (* entry); + ext++) + { + dynamic_nent++; +@@ -7995,7 +8222,8 @@ get_32bit_dynamic_section (FILE * file) + sizeof (* entry)); + if (dynamic_section == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for %lu dynamic entries\n"), ++ (unsigned long) dynamic_nent); + free (edyn); + return 0; + } +@@ -8020,16 +8248,18 @@ get_64bit_dynamic_section (FILE * file) + Elf64_External_Dyn * ext; + Elf_Internal_Dyn * entry; + ++ /* Read in the data. */ + edyn = (Elf64_External_Dyn *) get_data (NULL, file, dynamic_addr, 1, + dynamic_size, _("dynamic section")); + if (!edyn) + return 0; + +-/* SGI's ELF has more than one section in the DYNAMIC segment, and we +- might not have the luxury of section headers. Look for the DT_NULL +- terminator to determine the number of entries. */ ++ /* SGI's ELF has more than one section in the DYNAMIC segment, and we ++ might not have the luxury of section headers. Look for the DT_NULL ++ terminator to determine the number of entries. */ + for (ext = edyn, dynamic_nent = 0; +- (char *) ext < (char *) edyn + dynamic_size; ++ /* PR 17533 file: 033-67080-0.004 - do not read off the end of the buffer. */ ++ (char *) ext < ((char *) edyn) + dynamic_size - sizeof (* ext); + ext++) + { + dynamic_nent++; +@@ -8041,11 +8271,13 @@ get_64bit_dynamic_section (FILE * file) + sizeof (* entry)); + if (dynamic_section == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for %lu dynamic entries\n"), ++ (unsigned long) dynamic_nent); + free (edyn); + return 0; + } + ++ /* Convert from external to internal formats. */ + for (ext = edyn, entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + ext++, entry++) +@@ -8146,6 +8378,7 @@ process_dynamic_section (FILE * file) + section.sh_entsize = sizeof (Elf32_External_Sym); + else + section.sh_entsize = sizeof (Elf64_External_Sym); ++ section.sh_name = string_table_length; + + dynamic_symbols = GET_ELF_SYMBOLS (file, §ion, & num_dynamic_syms); + if (num_dynamic_syms < 1) +@@ -8215,7 +8448,11 @@ process_dynamic_section (FILE * file) + { + /* Note: these braces are necessary to avoid a syntax + error from the SunOS4 C compiler. */ +- assert (sizeof (Elf_External_Syminfo) == entry->d_un.d_val); ++ /* PR binutils/17531: A corrupt file can trigger this test. ++ So do not use an assert, instead generate an error message. */ ++ if (sizeof (Elf_External_Syminfo) != entry->d_un.d_val) ++ error (_("Bad value (%d) for SYMINENT entry\n"), ++ (int) entry->d_un.d_val); + } + else if (entry->d_tag == DT_SYMINSZ) + syminsz = entry->d_un.d_val; +@@ -8240,7 +8477,8 @@ process_dynamic_section (FILE * file) + dynamic_syminfo = (Elf_Internal_Syminfo *) malloc (syminsz); + if (dynamic_syminfo == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating %lu byte for dynamic symbol info\n"), ++ (unsigned long) syminsz); + return 0; + } + +@@ -8258,8 +8496,8 @@ process_dynamic_section (FILE * file) + } + + if (do_dynamic && dynamic_addr) +- printf (_("\nDynamic section at offset 0x%lx contains %u entries:\n"), +- dynamic_addr, dynamic_nent); ++ printf (_("\nDynamic section at offset 0x%lx contains %lu entries:\n"), ++ dynamic_addr, (unsigned long) dynamic_nent); + if (do_dynamic) + printf (_(" Tag Type Name/Value\n")); + +@@ -8671,9 +8909,14 @@ process_dynamic_section (FILE * file) + time_t atime = entry->d_un.d_val; + + tmp = gmtime (&atime); +- printf ("%04u-%02u-%02uT%02u:%02u:%02u\n", +- tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, +- tmp->tm_hour, tmp->tm_min, tmp->tm_sec); ++ /* PR 17533 file: 041-1244816-0.004. */ ++ if (tmp == NULL) ++ printf (_("tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, ++ tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + } + break; +@@ -8780,17 +9023,15 @@ process_version_sections (FILE * file) + + found = 1; + +- printf +- (_("\nVersion definition section '%s' contains %u entries:\n"), +- SECTION_NAME (section), section->sh_info); ++ printf (_("\nVersion definition section '%s' contains %u entries:\n"), ++ printable_section_name (section), ++ section->sh_info); + + printf (_(" Addr: 0x")); + printf_vma (section->sh_addr); +- printf (_(" Offset: %#08lx Link: %u (%s)\n"), ++ printf (_(" Offset: %#08lx Link: %u (%s)"), + (unsigned long) section->sh_offset, section->sh_link, +- section->sh_link < elf_header.e_shnum +- ? SECTION_NAME (section_headers + section->sh_link) +- : _("")); ++ printable_section_name_from_index (section->sh_link)); + + edefs = (Elf_External_Verdef *) + get_data (NULL, file, section->sh_offset, 1,section->sh_size, +@@ -8898,15 +9139,13 @@ process_version_sections (FILE * file) + found = 1; + + printf (_("\nVersion needs section '%s' contains %u entries:\n"), +- SECTION_NAME (section), section->sh_info); ++ printable_section_name (section), section->sh_info); + + printf (_(" Addr: 0x")); + printf_vma (section->sh_addr); + printf (_(" Offset: %#08lx Link: %u (%s)\n"), + (unsigned long) section->sh_offset, section->sh_link, +- section->sh_link < elf_header.e_shnum +- ? SECTION_NAME (section_headers + section->sh_link) +- : _("")); ++ printable_section_name_from_index (section->sh_link)); + + eneed = (Elf_External_Verneed *) get_data (NULL, file, + section->sh_offset, 1, +@@ -9009,8 +9248,8 @@ process_version_sections (FILE * file) + case SHT_GNU_versym: + { + Elf_Internal_Shdr * link_section; +- int total; +- int cnt; ++ size_t total; ++ unsigned int cnt; + unsigned char * edata; + unsigned short * data; + char * strtab; +@@ -9045,14 +9284,14 @@ process_version_sections (FILE * file) + break; + } + +- printf (_("\nVersion symbols section '%s' contains %d entries:\n"), +- SECTION_NAME (section), total); ++ printf (_("\nVersion symbols section '%s' contains %lu entries:\n"), ++ printable_section_name (section), (unsigned long) total); + + printf (_(" Addr: ")); + printf_vma (section->sh_addr); + printf (_(" Offset: %#08lx Link: %u (%s)\n"), + (unsigned long) section->sh_offset, section->sh_link, +- SECTION_NAME (link_section)); ++ printable_section_name (link_section)); + + off = offset_from_vma (file, + version_info[DT_VERSIONTAGIDX (DT_VERSYM)], +@@ -9201,7 +9440,9 @@ process_version_sections (FILE * file) + _("version def")) == NULL) + { + ivd.vd_next = 0; +- ivd.vd_ndx = 0; ++ /* PR 17531: file: 046-1082287-0.004. */ ++ ivd.vd_ndx = (data[cnt + j] & VERSYM_VERSION) + 1; ++ break; + } + else + { +@@ -9523,7 +9764,7 @@ get_symbol_index_type (unsigned int type) + else if (type >= SHN_LORESERVE) + sprintf (buff, "RSV[0x%04x]", type & 0xffff); + else if (type >= elf_header.e_shnum) +- sprintf (buff, "bad section index[%3d]", type); ++ sprintf (buff, _("bad section index[%3d]"), type); + else + sprintf (buff, "%3d", type); + break; +@@ -9533,30 +9774,41 @@ get_symbol_index_type (unsigned int type) + } + + static bfd_vma * +-get_dynamic_data (FILE * file, unsigned int number, unsigned int ent_size) ++get_dynamic_data (FILE * file, size_t number, unsigned int ent_size) + { + unsigned char * e_data; + bfd_vma * i_data; + +- e_data = (unsigned char *) cmalloc (number, ent_size); ++ /* 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); ++ return NULL; ++ } + ++ e_data = (unsigned char *) cmalloc (number, ent_size); + if (e_data == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory reading %lu dynamic entries\n"), ++ (unsigned long) number); + return NULL; + } + + if (fread (e_data, ent_size, number, file) != number) + { +- error (_("Unable to read in dynamic data\n")); ++ error (_("Unable to read in %lu bytes of dynamic data\n"), ++ (unsigned long) (number * ent_size)); ++ free (e_data); + return NULL; + } + + i_data = (bfd_vma *) cmalloc (number, sizeof (*i_data)); +- + if (i_data == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for %lu dynamic entries\n"), ++ (unsigned long) number); + free (e_data); + return NULL; + } +@@ -9575,12 +9827,19 @@ print_dynamic_symbol (bfd_vma si, unsigned long hn) + Elf_Internal_Sym * psym; + int n; + +- psym = dynamic_symbols + si; +- + n = print_vma (si, DEC_5); + if (n < 5) + fputs (&" "[n], stdout); + printf (" %3lu: ", hn); ++ ++ if (dynamic_symbols == NULL || si >= num_dynamic_syms) ++ { ++ printf (_("\n"), ++ (unsigned long) si); ++ return; ++ } ++ ++ psym = dynamic_symbols + si; + print_vma (psym->st_value, LONG_HEX); + putchar (' '); + print_vma (psym->st_size, DEC_5); +@@ -9607,14 +9866,15 @@ static int + process_symbol_table (FILE * file) + { + Elf_Internal_Shdr * section; +- bfd_vma nbuckets = 0; +- bfd_vma nchains = 0; ++ bfd_size_type nbuckets = 0; ++ bfd_size_type nchains = 0; + bfd_vma * buckets = NULL; + bfd_vma * chains = NULL; + bfd_vma ngnubuckets = 0; + bfd_vma * gnubuckets = NULL; + bfd_vma * gnuchains = NULL; + bfd_vma gnusymidx = 0; ++ bfd_size_type ngnuchains = 0; + + if (!do_syms && !do_dyn_syms && !do_histogram) + return 1; +@@ -9627,7 +9887,7 @@ process_symbol_table (FILE * file) + { + unsigned char nb[8]; + unsigned char nc[8]; +- int hash_ent_size = 4; ++ unsigned int hash_ent_size = 4; + + if ((elf_header.e_machine == EM_ALPHA + || elf_header.e_machine == EM_S390 +@@ -9776,6 +10036,7 @@ process_symbol_table (FILE * file) + } + + gnuchains = get_dynamic_data (file, maxchain, 4); ++ ngnuchains = maxchain; + + no_gnu_hash: + if (gnuchains == NULL) +@@ -9791,7 +10052,8 @@ process_symbol_table (FILE * file) + if ((dynamic_info[DT_HASH] || dynamic_info_DT_GNU_HASH) + && do_syms + && do_using_dynamic +- && dynamic_strings != NULL) ++ && dynamic_strings != NULL ++ && dynamic_symbols != NULL) + { + unsigned long hn; + +@@ -9834,11 +10096,12 @@ process_symbol_table (FILE * file) + print_dynamic_symbol (si, hn); + si++; + } +- while ((gnuchains[off++] & 1) == 0); ++ while (off < ngnuchains && (gnuchains[off++] & 1) == 0); + } + } + } +- else if (do_dyn_syms || (do_syms && !do_using_dynamic)) ++ else if ((do_dyn_syms || (do_syms && !do_using_dynamic)) ++ && section_headers != NULL) + { + unsigned int i; + +@@ -9862,12 +10125,12 @@ process_symbol_table (FILE * file) + if (section->sh_entsize == 0) + { + printf (_("\nSymbol table '%s' has a sh_entsize of zero!\n"), +- SECTION_NAME (section)); ++ printable_section_name (section)); + continue; + } + + printf (_("\nSymbol table '%s' contains %lu entries:\n"), +- SECTION_NAME (section), ++ printable_section_name (section), + (unsigned long) (section->sh_size / section->sh_entsize)); + + if (is_32bit_elf) +@@ -10097,14 +10360,15 @@ process_symbol_table (FILE * file) + + printf (_("\nHistogram for bucket list length (total of %lu buckets):\n"), + (unsigned long) nbuckets); +- printf (_(" Length Number %% of total Coverage\n")); + + lengths = (unsigned long *) calloc (nbuckets, sizeof (*lengths)); + if (lengths == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for histogram buckets\n")); + return 0; + } ++ ++ printf (_(" Length Number %% of total Coverage\n")); + for (hn = 0; hn < nbuckets; ++hn) + { + for (si = buckets[hn]; si > 0 && si < nchains; si = chains[si]) +@@ -10112,6 +10376,15 @@ process_symbol_table (FILE * file) + ++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; ++ } + } + } + +@@ -10119,6 +10392,7 @@ process_symbol_table (FILE * file) + if (counts == NULL) + { ++ free (lengths); +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for histogram counts\n")); + return 0; + } + +@@ -10159,15 +10432,16 @@ process_symbol_table (FILE * file) + unsigned long nzero_counts = 0; + unsigned long nsyms = 0; + ++ printf (_("\nHistogram for `.gnu.hash' bucket list length (total of %lu buckets):\n"), ++ (unsigned long) ngnubuckets); ++ + lengths = (unsigned long *) calloc (ngnubuckets, sizeof (*lengths)); + if (lengths == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for gnu histogram buckets\n")); + return 0; + } + +- printf (_("\nHistogram for `.gnu.hash' bucket list length (total of %lu buckets):\n"), +- (unsigned long) ngnubuckets); + printf (_(" Length Number %% of total Coverage\n")); + + for (hn = 0; hn < ngnubuckets; ++hn) +@@ -10176,7 +10450,9 @@ process_symbol_table (FILE * file) + bfd_vma off, length = 1; + + for (off = gnubuckets[hn] - gnusymidx; +- (gnuchains[off] & 1) == 0; ++off) ++ /* PR 17531 file: 010-77222-0.004. */ ++ off < ngnuchains && (gnuchains[off] & 1) == 0; ++ ++off) + ++length; + lengths[hn] = length; + if (length > maxlength) +@@ -10188,6 +10464,7 @@ process_symbol_table (FILE * file) + if (counts == NULL) + { ++ free (lengths); +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for gnu histogram counts\n")); + return 0; + } + +@@ -10242,7 +10518,9 @@ process_syminfo (FILE * file ATTRIBUTE_UNUSED) + unsigned short int flags = dynamic_syminfo[i].si_flags; + + printf ("%4d: ", i); +- if (VALID_DYNAMIC_NAME (dynamic_symbols[i].st_name)) ++ if (i >= num_dynamic_syms) ++ printf (_("")); ++ else if (VALID_DYNAMIC_NAME (dynamic_symbols[i].st_name)) + print_symbol (30, GET_DYNAMIC_NAME (dynamic_symbols[i].st_name)); + else + printf (_(""), dynamic_symbols[i].st_name); +@@ -10345,7 +10623,7 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + + default: + if (saved_sym != NULL) +- error (_("Unhandled MSP430 reloc type found after SYM_DIFF reloc")); ++ error (_("Unhandled MSP430 reloc type found after SYM_DIFF reloc\n")); + break; + } + break; +@@ -10381,7 +10659,7 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + break; + default: + if (saved_sym != NULL) +- error (_("Unhandled MN10300 reloc type found after SYM_DIFF reloc")); ++ error (_("Unhandled MN10300 reloc type found after SYM_DIFF reloc\n")); + break; + } + break; +@@ -10921,7 +11199,7 @@ apply_relocations (void * file, + else + { + warn (_("unable to apply unsupported reloc type %d to section %s\n"), +- reloc_type, SECTION_NAME (section)); ++ reloc_type, printable_section_name (section)); + continue; + } + +@@ -10930,7 +11208,7 @@ apply_relocations (void * file, + { + warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), + (unsigned long) rp->r_offset, +- SECTION_NAME (section)); ++ printable_section_name (section)); + continue; + } + +@@ -10938,7 +11216,7 @@ apply_relocations (void * file, + if (sym_index >= num_syms) + { + warn (_("skipping invalid relocation symbol index 0x%lx in section %s\n"), +- sym_index, SECTION_NAME (section)); ++ sym_index, printable_section_name (section)); + continue; + } + sym = symtab + sym_index; +@@ -10962,7 +11240,7 @@ apply_relocations (void * file, + warn (_("skipping unexpected symbol type %s in %ld'th relocation in section %s\n"), + get_symbol_type (ELF_ST_TYPE (sym->st_info)), + (long int)(rp - relocs), +- SECTION_NAME (relsec)); ++ printable_section_name (relsec)); + continue; + } + +@@ -11005,10 +11283,9 @@ apply_relocations (void * file, + static int + disassemble_section (Elf_Internal_Shdr * section, FILE * file) + { +- printf (_("\nAssembly dump of section %s\n"), +- SECTION_NAME (section)); ++ printf (_("\nAssembly dump of section %s\n"), printable_section_name (section)); + +- /* XXX -- to be done --- XXX */ ++ /* FIXME: XXX -- to be done --- XXX */ + + return 1; + } +@@ -11027,7 +11304,7 @@ get_section_contents (Elf_Internal_Shdr * section, FILE * file) + if (num_bytes == 0 || section->sh_type == SHT_NOBITS) + { + printf (_("\nSection '%s' has no data to dump.\n"), +- SECTION_NAME (section)); ++ printable_section_name (section)); + return NULL; + } + +@@ -11044,14 +11321,13 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file) + char * data; + char * end; + char * start; +- char * name = SECTION_NAME (section); + bfd_boolean some_strings_shown; + + start = get_section_contents (section, file); + if (start == NULL) + return; + +- printf (_("\nString dump of section '%s':\n"), name); ++ printf (_("\nString dump of section '%s':\n"), printable_section_name (section)); + + /* If the section being dumped has relocations against it the user might + be expecting these relocations to have been applied. Check for this +@@ -11086,15 +11362,26 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file) + + if (data < end) + { ++ size_t maxlen = end - data; ++ + #ifndef __MSVCRT__ + /* PR 11128: Use two separate invocations in order to work + around bugs in the Solaris 8 implementation of printf. */ + printf (" [%6tx] ", data - start); +- printf ("%s\n", data); + #else +- printf (" [%6Ix] %s\n", (size_t) (data - start), data); ++ printf (" [%6Ix] ", (size_t) (data - start)); + #endif +- data += strlen (data); ++ if (maxlen > 0) ++ { ++ print_symbol ((int) maxlen, data); ++ putchar ('\n'); ++ data += strnlen (data, maxlen); ++ } ++ else ++ { ++ printf (_("\n")); ++ data = end; ++ } + some_strings_shown = TRUE; + } + } +@@ -11122,7 +11409,7 @@ dump_section_as_bytes (Elf_Internal_Shdr * section, + if (start == NULL) + return; + +- printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section)); ++ printf (_("\nHex dump of section '%s':\n"), printable_section_name (section)); + + if (relocate) + { +@@ -11353,6 +11640,7 @@ static int + display_debug_section (int shndx, Elf_Internal_Shdr * section, FILE * file) + { + char * name = SECTION_NAME (section); ++ const char * print_name = printable_section_name (section); + bfd_size_type length; + int result = 1; + int i; +@@ -11360,7 +11648,7 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, FILE * file) + length = section->sh_size; + if (length == 0) + { +- printf (_("\nSection '%s' has no debugging data.\n"), name); ++ printf (_("\nSection '%s' has no debugging data.\n"), print_name); + return 0; + } + if (section->sh_type == SHT_NOBITS) +@@ -11369,7 +11657,8 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, FILE * file) + which has the NOBITS type - the bits in the file will be random. + This can happen when a file containing a .eh_frame section is + stripped with the --only-keep-debug command line option. */ +- printf (_("section '%s' has the NOBITS type - its contents are unreliable.\n"), name); ++ printf (_("section '%s' has the NOBITS type - its contents are unreliable.\n"), ++ print_name); + return 0; + } + +@@ -11414,7 +11703,7 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, FILE * file) + + if (i == max) + { +- printf (_("Unrecognized debug section: %s\n"), name); ++ printf (_("Unrecognized debug section: %s\n"), print_name); + result = 0; + } + +@@ -11533,13 +11822,25 @@ display_tag_value (int tag, + + if (p >= end) + { +- warn (_("corrupt tag\n")); ++ warn (_("\n")); + } + else if (tag & 1) + { +- /* FIXME: we could read beyond END here. */ +- printf ("\"%s\"\n", p); +- p += strlen ((char *) p) + 1; ++ /* PR 17531 file: 027-19978-0.004. */ ++ size_t maxlen = (end - p) - 1; ++ ++ putchar ('"'); ++ if (maxlen > 0) ++ { ++ print_symbol ((int) maxlen, (const char *) p); ++ p += strnlen ((char *) p, maxlen) + 1; ++ } ++ else ++ { ++ printf (_("")); ++ p = (unsigned char *) end; ++ } ++ printf ("\"\n"); + } + else + { +@@ -11550,6 +11851,7 @@ display_tag_value (int tag, + printf ("%ld (0x%lx)\n", val, val); + } + ++ assert (p <= end); + return p; + } + +@@ -11757,14 +12059,30 @@ display_arm_attribute (unsigned char * p, + break; + + case 32: /* Tag_compatibility. */ +- val = read_uleb128 (p, &len, end); +- p += len; +- printf (_("flag = %d, vendor = %s\n"), val, p); +- p += strlen ((char *) p) + 1; ++ { ++ val = read_uleb128 (p, &len, end); ++ p += len; ++ printf (_("flag = %d, vendor = "), val); ++ if (p < end - 1) ++ { ++ size_t maxlen = (end - p) - 1; ++ ++ print_symbol ((int) maxlen, (const char *) p); ++ p += strnlen ((char *) p, maxlen) + 1; ++ } ++ else ++ { ++ printf (_("")); ++ p = (unsigned char *) end; ++ } ++ putchar ('\n'); ++ } + break; + + case 64: /* Tag_nodefaults. */ +- p++; ++ /* PR 17531: file: 001-505008-0.01. */ ++ if (p < end) ++ p++; + printf (_("True\n")); + break; + +@@ -11775,14 +12093,15 @@ display_arm_attribute (unsigned char * p, + { + val = read_uleb128 (p, &len, end); + p += len; +- if ((unsigned int)val >= ARRAY_SIZE (arm_attr_tag_CPU_arch)) ++ if ((unsigned int) val >= ARRAY_SIZE (arm_attr_tag_CPU_arch)) + printf ("??? (%d)\n", val); + else + printf ("%s\n", arm_attr_tag_CPU_arch[val]); + } + else + printf ("???\n"); +- while (*(p++) != '\0' /* NUL terminator. */); ++ while (p < end && *(p++) != '\0' /* NUL terminator. */) ++ ; + break; + + default: +@@ -11829,15 +12148,28 @@ display_gnu_attribute (unsigned char * p, + { + val = read_uleb128 (p, &len, end); + p += len; ++ ++ printf (_("flag = %d, vendor = "), val); + if (p == end) + { +- printf (_("flag = %d, vendor = \n"), val); ++ printf (_("\n")); + warn (_("corrupt vendor attribute\n")); + } + else + { +- printf (_("flag = %d, vendor = %s\n"), val, p); +- p += strlen ((char *) p) + 1; ++ if (p < end - 1) ++ { ++ size_t maxlen = (end - p) - 1; ++ ++ print_symbol ((int) maxlen, (const char *) p); ++ p += strnlen ((char *) p, maxlen) + 1; ++ } ++ else ++ { ++ printf (_("")); ++ p = (unsigned char *) end; ++ } ++ putchar ('\n'); + } + return p; + } +@@ -11913,7 +12245,7 @@ display_power_gnu_attribute (unsigned char * p, + { + if (p == end) + { +- warn (_("corrupt Tag_GNU_Power_ABI_Struct_Return")); ++ warn (_("corrupt Tag_GNU_Power_ABI_Struct_Return\n")); + return p; + } + +@@ -12332,18 +12666,45 @@ display_tic6x_attribute (unsigned char * p, + return p; + + case Tag_ABI_compatibility: +- val = read_uleb128 (p, &len, end); +- p += len; +- printf (" Tag_ABI_compatibility: "); +- printf (_("flag = %d, vendor = %s\n"), val, p); +- p += strlen ((char *) p) + 1; +- return p; ++ { ++ val = read_uleb128 (p, &len, end); ++ p += len; ++ printf (" Tag_ABI_compatibility: "); ++ printf (_("flag = %d, vendor = "), val); ++ if (p < end - 1) ++ { ++ size_t maxlen = (end - p) - 1; ++ ++ print_symbol ((int) maxlen, (const char *) p); ++ p += strnlen ((char *) p, maxlen) + 1; ++ } ++ else ++ { ++ printf (_("")); ++ p = (unsigned char *) end; ++ } ++ putchar ('\n'); ++ return p; ++ } + + case Tag_ABI_conformance: +- printf (" Tag_ABI_conformance: "); +- printf ("\"%s\"\n", p); +- p += strlen ((char *) p) + 1; +- return p; ++ { ++ printf (" Tag_ABI_conformance: \""); ++ if (p < end - 1) ++ { ++ size_t maxlen = (end - p) - 1; ++ ++ print_symbol ((int) maxlen, (const char *) p); ++ p += strnlen ((char *) p, maxlen) + 1; ++ } ++ else ++ { ++ printf (_("")); ++ p = (unsigned char *) end; ++ } ++ printf ("\"\n"); ++ return p; ++ } + } + + return display_tag_value (tag, p, end); +@@ -12355,6 +12716,7 @@ display_raw_attribute (unsigned char * p, unsigned char * end) + unsigned long addr = 0; + size_t bytes = end - p; + ++ assert (end > p); + while (bytes) + { + int j; +@@ -12451,8 +12813,20 @@ display_msp430x_attribute (unsigned char * p, + + if (tag & 1) + { +- printf ("\"%s\"\n", p); +- p += strlen ((char *) p) + 1; ++ putchar ('"'); ++ if (p < end - 1) ++ { ++ size_t maxlen = (end - p) - 1; ++ ++ print_symbol ((int) maxlen, (const char *) p); ++ p += strnlen ((char *) p, maxlen) + 1; ++ } ++ else ++ { ++ printf (_("")); ++ p = (unsigned char *) end; ++ } ++ printf ("\"\n"); + } + else + { +@@ -12463,6 +12837,7 @@ display_msp430x_attribute (unsigned char * p, + break; + } + ++ assert (p <= end); + return p; + } + +@@ -12474,11 +12849,6 @@ process_attributes (FILE * file, + unsigned char * (* display_proc_gnu_attribute) (unsigned char *, int, const unsigned char * const)) + { + Elf_Internal_Shdr * sect; +- unsigned char * contents; +- unsigned char * p; +- unsigned char * end; +- bfd_vma section_len; +- bfd_vma len; + unsigned i; + + /* Find the section header so that we get the size. */ +@@ -12486,6 +12856,9 @@ process_attributes (FILE * file, + i < elf_header.e_shnum; + i++, sect++) + { ++ unsigned char * contents; ++ unsigned char * p; ++ + if (sect->sh_type != proc_type && sect->sh_type != SHT_GNU_ATTRIBUTES) + continue; + +@@ -12497,27 +12870,52 @@ process_attributes (FILE * file, + p = contents; + if (*p == 'A') + { +- len = sect->sh_size - 1; ++ bfd_vma section_len; ++ ++ section_len = sect->sh_size - 1; + p++; + +- while (len > 0) ++ while (section_len > 0) + { +- int namelen; ++ bfd_vma attr_len; ++ unsigned int namelen; + bfd_boolean public_section; + bfd_boolean gnu_section; + +- section_len = byte_get (p, 4); ++ if (section_len <= 4) ++ { ++ error (_("Tag section ends prematurely\n")); ++ break; ++ } ++ attr_len = byte_get (p, 4); + p += 4; + +- if (section_len > len) ++ if (attr_len > section_len) + { +- printf (_("ERROR: Bad section length (%d > %d)\n"), +- (int) section_len, (int) len); +- section_len = len; ++ error (_("Bad attribute length (%u > %u)\n"), ++ (unsigned) attr_len, (unsigned) section_len); ++ attr_len = section_len; ++ } ++ /* PR 17531: file: 001-101425-0.004 */ ++ else if (attr_len < 5) ++ { ++ error (_("Attribute length of %u is too small\n"), (unsigned) attr_len); ++ break; + } + +- len -= section_len; +- printf (_("Attribute Section: %s\n"), p); ++ section_len -= attr_len; ++ attr_len -= 4; ++ ++ namelen = strnlen ((char *) p, attr_len) + 1; ++ if (namelen == 0 || namelen >= attr_len) ++ { ++ error (_("Corrupt attribute section name\n")); ++ break; ++ } ++ ++ printf (_("Attribute Section: ")); ++ print_symbol (INT_MAX, (const char *) p); ++ putchar ('\n'); + + if (public_name && streq ((char *) p, public_name)) + public_section = TRUE; +@@ -12539,25 +12928,43 @@ process_attributes (FILE * file, + gnu_section = FALSE; + +- namelen = strlen ((char *) p) + 1; + p += namelen; +- section_len -= namelen + 4; +- +- while (section_len > 0) ++ attr_len -= namelen; ++ ++ while (attr_len > 0 && p < contents + sect->sh_size) + { +- int tag = *(p++); ++ int tag; + int val; + bfd_vma size; ++ unsigned char * end; + ++ /* PR binutils/17531: Safe handling of corrupt files. */ ++ if (attr_len < 6) ++ { ++ error (_("Unused bytes at end of section\n")); ++ section_len = 0; ++ break; ++ } ++ ++ tag = *(p++); + size = byte_get (p, 4); +- if (size > section_len) ++ if (size > attr_len) + { +- printf (_("ERROR: Bad subsection length (%d > %d)\n"), +- (int) size, (int) section_len); +- size = section_len; ++ error (_("Bad subsection length (%u > %u)\n"), ++ (unsigned) size, (unsigned) attr_len); ++ size = attr_len; ++ } ++ /* PR binutils/17531: Safe handling of corrupt files. */ ++ if (size < 6) ++ { ++ error (_("Bad subsection length (%u < 6)\n"), ++ (unsigned) size); ++ section_len = 0; ++ break; + } + +- section_len -= size; ++ attr_len -= size; + end = p + size - 1; ++ assert (end <= contents + sect->sh_size); + p += 4; + + switch (tag) +@@ -12587,24 +12996,28 @@ process_attributes (FILE * file, + break; + } + +- if (public_section) ++ if (public_section && display_pub_attribute != NULL) + { + while (p < end) + p = display_pub_attribute (p, end); ++ assert (p <= end); + } +- else if (gnu_section) ++ else if (gnu_section && display_proc_gnu_attribute != NULL) + { + while (p < end) + p = display_gnu_attribute (p, + display_proc_gnu_attribute, + end); ++ assert (p <= end); + } +- else ++ else if (p < end) + { +- printf (_(" Unknown section contexts\n")); ++ printf (_(" Unknown attribute:\n")); + display_raw_attribute (p, end); + p = end; + } ++ else ++ attr_len = 0; + } + } + } +@@ -12890,7 +13303,10 @@ process_mips_specific (FILE * file) + /* No information available. */ + return 0; + +- for (entry = dynamic_section; entry->d_tag != DT_NULL; ++entry) ++ for (entry = dynamic_section; ++ /* PR 17531 file: 012-50589-0.004. */ ++ entry < dynamic_section + dynamic_nent && entry->d_tag != DT_NULL; ++ ++entry) + switch (entry->d_tag) + { + case DT_MIPS_LIBLIST: +@@ -13031,8 +13447,13 @@ process_mips_specific (FILE * file) + sect = section_headers; + + /* Find the section header so that we get the size. */ +- while (sect->sh_type != SHT_MIPS_OPTIONS) +- ++sect; ++ sect = find_section_by_type (SHT_MIPS_OPTIONS); ++ /* PR 17533 file: 012-277276-0.004. */ ++ if (sect == NULL) ++ { ++ error (_("No MIPS_OPTIONS header found\n")); ++ return 0; ++ } + + eopt = (Elf_External_Options *) get_data (NULL, file, options_offset, 1, + sect->sh_size, _("options")); +@@ -13042,7 +13463,7 @@ process_mips_specific (FILE * file) + cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (* iopt)); + if (iopt == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocatinf space for MIPS options\n")); + return 0; + } + +@@ -13067,7 +13488,7 @@ process_mips_specific (FILE * file) + } + + printf (_("\nSection '%s' contains %d entries:\n"), +- SECTION_NAME (sect), cnt); ++ printable_section_name (sect), cnt); + + option = iopt; + +@@ -13234,7 +13655,7 @@ process_mips_specific (FILE * file) + iconf = (Elf32_Conflict *) cmalloc (conflictsno, sizeof (* iconf)); + if (iconf == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for dynamic conflicts\n")); + return 0; + } + +@@ -13275,15 +13696,22 @@ process_mips_specific (FILE * file) + + for (cnt = 0; cnt < conflictsno; ++cnt) + { +- Elf_Internal_Sym * psym = & dynamic_symbols[iconf[cnt]]; +- + printf ("%5lu: %8lu ", (unsigned long) cnt, iconf[cnt]); +- print_vma (psym->st_value, FULL_HEX); +- putchar (' '); +- if (VALID_DYNAMIC_NAME (psym->st_name)) +- print_symbol (25, GET_DYNAMIC_NAME (psym->st_name)); ++ ++ if (iconf[cnt] >= num_dynamic_syms) ++ printf (_("")); + else +- printf (_(""), psym->st_name); ++ { ++ Elf_Internal_Sym * psym; ++ ++ psym = & dynamic_symbols[iconf[cnt]]; ++ print_vma (psym->st_value, FULL_HEX); ++ putchar (' '); ++ if (VALID_DYNAMIC_NAME (psym->st_name)) ++ print_symbol (25, GET_DYNAMIC_NAME (psym->st_name)); ++ else ++ printf (_(""), psym->st_name); ++ } + putchar ('\n'); + } + +@@ -13300,8 +13728,17 @@ process_mips_specific (FILE * file) + ent = pltgot; + addr_size = (is_32bit_elf ? 4 : 8); + local_end = pltgot + local_gotno * addr_size; +- global_end = local_end + (symtabno - gotsym) * addr_size; + ++ /* PR binutils/17533 file: 012-111227-0.004 */ ++ if (symtabno < gotsym) ++ { ++ error (_("The GOT symbol offset (%lu) is greater than the symbol table size (%lu)\n"), ++ (long) gotsym, (long) symtabno); ++ return 0; ++ } ++ ++ global_end = local_end + (symtabno - gotsym) * addr_size; ++ assert (global_end >= local_end); + offset = offset_from_vma (file, pltgot, global_end - pltgot); + data = (unsigned char *) get_data (NULL, file, offset, + global_end - pltgot, 1, +@@ -13358,21 +13795,32 @@ process_mips_specific (FILE * file) + _("Ndx"), _("Name")); + + sym_width = (is_32bit_elf ? 80 : 160) - 28 - addr_size * 6 - 1; ++ + for (i = gotsym; i < symtabno; i++) + { +- Elf_Internal_Sym * psym; +- +- psym = dynamic_symbols + i; + ent = print_mips_got_entry (data, pltgot, ent); + printf (" "); +- print_vma (psym->st_value, LONG_HEX); +- printf (" %-7s %3s ", +- get_symbol_type (ELF_ST_TYPE (psym->st_info)), +- get_symbol_index_type (psym->st_shndx)); +- if (VALID_DYNAMIC_NAME (psym->st_name)) +- print_symbol (sym_width, GET_DYNAMIC_NAME (psym->st_name)); ++ ++ if (dynamic_symbols == NULL) ++ printf (_("")); ++ else if (i < num_dynamic_syms) ++ { ++ Elf_Internal_Sym * psym = dynamic_symbols + i; ++ ++ print_vma (psym->st_value, LONG_HEX); ++ printf (" %-7s %3s ", ++ get_symbol_type (ELF_ST_TYPE (psym->st_info)), ++ get_symbol_index_type (psym->st_shndx)); ++ ++ if (VALID_DYNAMIC_NAME (psym->st_name)) ++ print_symbol (sym_width, GET_DYNAMIC_NAME (psym->st_name)); ++ else ++ printf (_(""), psym->st_name); ++ } + else +- printf (_(""), psym->st_name); ++ printf (_(""), ++ (unsigned long) i); ++ + printf ("\n"); + } + printf ("\n"); +@@ -13431,19 +13879,26 @@ process_mips_specific (FILE * file) + sym_width = (is_32bit_elf ? 80 : 160) - 17 - addr_size * 6 - 1; + for (i = 0; i < count; i++) + { +- Elf_Internal_Sym * psym; ++ unsigned long idx = get_reloc_symindex (rels[i].r_info); + +- psym = dynamic_symbols + get_reloc_symindex (rels[i].r_info); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); + printf (" "); +- print_vma (psym->st_value, LONG_HEX); +- printf (" %-7s %3s ", +- get_symbol_type (ELF_ST_TYPE (psym->st_info)), +- get_symbol_index_type (psym->st_shndx)); +- if (VALID_DYNAMIC_NAME (psym->st_name)) +- print_symbol (sym_width, GET_DYNAMIC_NAME (psym->st_name)); ++ ++ if (idx >= num_dynamic_syms) ++ printf (_(""), idx); + else +- printf (_(""), psym->st_name); ++ { ++ Elf_Internal_Sym * psym = dynamic_symbols + idx; ++ ++ print_vma (psym->st_value, LONG_HEX); ++ printf (" %-7s %3s ", ++ get_symbol_type (ELF_ST_TYPE (psym->st_info)), ++ get_symbol_index_type (psym->st_shndx)); ++ if (VALID_DYNAMIC_NAME (psym->st_name)) ++ print_symbol (sym_width, GET_DYNAMIC_NAME (psym->st_name)); ++ else ++ printf (_(""), psym->st_name); ++ } + printf ("\n"); + } + printf ("\n"); +@@ -13535,7 +13990,7 @@ process_gnu_liblist (FILE * file) + strtab_size = string_sec->sh_size; + + printf (_("\nLibrary list section '%s' contains %lu entries:\n"), +- SECTION_NAME (section), ++ printable_section_name (section), + (unsigned long) (section->sh_size / sizeof (Elf32_External_Lib))); + + puts (_(" Library Time Stamp Checksum Version Flags")); +@@ -13799,6 +14254,13 @@ print_gnu_note (Elf_Internal_Note *pnote) + unsigned long os, major, minor, subminor; + const char *osname; + ++ /* PR 17531: file: 030-599401-0.004. */ ++ if (pnote->descsz < 16) ++ { ++ printf (_(" \n")); ++ break; ++ } ++ + os = byte_get ((unsigned char *) pnote->descdata, 4); + major = byte_get ((unsigned char *) pnote->descdata + 4, 4); + minor = byte_get ((unsigned char *) pnote->descdata + 8, 4); +@@ -14228,7 +14690,7 @@ process_corefile_note_segment (FILE * file, bfd_vma offset, bfd_vma length) + + if (temp == NULL) + { +- error (_("Out of memory\n")); ++ error (_("Out of memory allocating space for inote name\n")); + res = 0; + break; + } +@@ -14442,9 +14904,9 @@ get_file_header (FILE * file) + /* There may be some extensions in the first section header. Don't + bomb if we can't read it. */ + if (is_32bit_elf) +- get_32bit_section_headers (file, 1); ++ get_32bit_section_headers (file, TRUE); + else +- get_64bit_section_headers (file, 1); ++ get_64bit_section_headers (file, TRUE); + } + + return 1; +@@ -14886,6 +15348,8 @@ process_file (char * file_name) + return 1; + } + ++ current_file_size = (bfd_size_type) statbuf.st_size; ++ + if (memcmp (armag, ARMAG, SARMAG) == 0) + ret = process_archive (file_name, file, FALSE); + else if (memcmp (armag, ARMAGT, SARMAG) == 0) +@@ -14903,6 +15367,7 @@ process_file (char * file_name) + + fclose (file); + ++ current_file_size = 0; + return ret; + } + +diff --git a/binutils/stabs.c b/binutils/stabs.c +index 2a2674d..33159e9 100644 +--- a/binutils/stabs.c ++++ b/binutils/stabs.c +@@ -836,8 +836,6 @@ parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype, + + case 'G': + { +- char leading; +- long c; + asymbol **ps; + + /* A global symbol. The value must be extracted from the +@@ -846,19 +844,27 @@ parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype, + (debug_type **) NULL); + if (dtype == DEBUG_TYPE_NULL) + return FALSE; +- leading = bfd_get_symbol_leading_char (info->abfd); +- for (c = info->symcount, ps = info->syms; c > 0; --c, ++ps) ++ if (name != NULL) + { +- const char *n; ++ char leading; ++ long c; + +- n = bfd_asymbol_name (*ps); +- if (leading != '\0' && *n == leading) +- ++n; +- if (*n == *name && strcmp (n, name) == 0) +- break; ++ leading = bfd_get_symbol_leading_char (info->abfd); ++ for (c = info->symcount, ps = info->syms; c > 0; --c, ++ps) ++ { ++ const char *n; ++ ++ n = bfd_asymbol_name (*ps); ++ if (leading != '\0' && *n == leading) ++ ++n; ++ if (*n == *name && strcmp (n, name) == 0) ++ break; ++ } ++ ++ if (c > 0) ++ value = bfd_asymbol_value (*ps); + } +- if (c > 0) +- value = bfd_asymbol_value (*ps); ++ + if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_GLOBAL, + value)) + return FALSE; +diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c +index 4e7b9b7..9f5a903 100644 +--- a/gas/config/obj-coff.c ++++ b/gas/config/obj-coff.c +@@ -387,6 +387,7 @@ coff_obj_symbol_new_hook (symbolS *symbolP) + + memset (s, 0, sz); + coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s; ++ coffsymbol (symbol_get_bfdsym (symbolP))->native->is_sym = TRUE; + + S_SET_DATA_TYPE (symbolP, T_NULL); + S_SET_STORAGE_CLASS (symbolP, 0); +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/binutils-bz17512_prereqs.patch +++ binutils-2.24/debian/patches/binutils-bz17512_prereqs.patch @@ -0,0 +1,316 @@ +From 49727e46175419c638251b39091f24c575568bee Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Mon, 22 Sep 2014 17:53:15 +0930 +Subject: [PATCH] Readelf: Handle forward references to CIEs + +The linker side of pr16563 was fixed with commit 18cd5bce, but +unfortunately people continue to use older linkers with -flto. This +means we have binaries with working .eh_frame that can't be dumped by +readelf, and I'm seeing internal IBM bug reports about this fact. + + PR 16563 + * dwarf.c (GET): Remove semicolon. + (read_cie): New function, extracted from.. + (display_debug_frames): ..here. Correctly handle signed offset + from FDE to CIE in .eh_frame. Decode forward referenced CIEs too. + +[Ubuntu note: patch is commits that were prequisite commits for the +binutils-bz17512.patch, where it was easier/less error-prone to take a +patch rather than try to backport the bz17512 fixes to the existing +code. + +This patch differs from the upstream commits in that it drops the +changelog updates to reduce patch conflicts. -- sbeattie] + +diff --git a/binutils/dwarf.c b/binutils/dwarf.c +index 348e20f..3f4095a 100644 +--- a/binutils/dwarf.c ++++ b/binutils/dwarf.c +@@ -5232,10 +5232,97 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) + printf ("\n"); + } + +-#define GET(VAR, N) SAFE_BYTE_GET_AND_INC (VAR, start, N, end); ++#define GET(VAR, N) SAFE_BYTE_GET_AND_INC (VAR, start, N, end) + #define LEB() read_uleb128 (start, & length_return, end); start += length_return + #define SLEB() read_sleb128 (start, & length_return, end); start += length_return + ++static unsigned char * ++read_cie (unsigned char *start, unsigned char *end, ++ Frame_Chunk **p_cie, int *p_version, ++ unsigned long *p_aug_len, unsigned char **p_aug) ++{ ++ int version; ++ Frame_Chunk *fc; ++ unsigned int length_return; ++ unsigned char *augmentation_data = NULL; ++ unsigned long augmentation_data_len = 0; ++ ++ fc = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk)); ++ memset (fc, 0, sizeof (Frame_Chunk)); ++ ++ fc->col_type = (short int *) xmalloc (sizeof (short int)); ++ fc->col_offset = (int *) xmalloc (sizeof (int)); ++ ++ version = *start++; ++ ++ fc->augmentation = (char *) start; ++ start = (unsigned char *) strchr ((char *) start, '\0') + 1; ++ ++ if (strcmp (fc->augmentation, "eh") == 0) ++ start += eh_addr_size; ++ ++ if (version >= 4) ++ { ++ GET (fc->ptr_size, 1); ++ GET (fc->segment_size, 1); ++ eh_addr_size = fc->ptr_size; ++ } ++ else ++ { ++ fc->ptr_size = eh_addr_size; ++ fc->segment_size = 0; ++ } ++ fc->code_factor = LEB (); ++ fc->data_factor = SLEB (); ++ if (version == 1) ++ { ++ GET (fc->ra, 1); ++ } ++ else ++ { ++ fc->ra = LEB (); ++ } ++ ++ if (fc->augmentation[0] == 'z') ++ { ++ augmentation_data_len = LEB (); ++ augmentation_data = start; ++ start += augmentation_data_len; ++ } ++ ++ if (augmentation_data_len) ++ { ++ unsigned char *p, *q; ++ p = (unsigned char *) fc->augmentation + 1; ++ q = augmentation_data; ++ ++ while (1) ++ { ++ if (*p == 'L') ++ q++; ++ else if (*p == 'P') ++ q += 1 + size_of_encoded_value (*q); ++ else if (*p == 'R') ++ fc->fde_encoding = *q++; ++ else if (*p == 'S') ++ ; ++ else ++ break; ++ p++; ++ } ++ } ++ ++ *p_cie = fc; ++ if (p_version) ++ *p_version = version; ++ if (p_aug_len) ++ { ++ *p_aug_len = augmentation_data_len; ++ *p_aug = augmentation_data; ++ } ++ return start; ++} ++ + static int + display_debug_frames (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +@@ -5243,7 +5330,7 @@ display_debug_frames (struct dwarf_section *section, + unsigned char *start = section->start; + unsigned char *end = start + section->size; + unsigned char *section_start = start; +- Frame_Chunk *chunks = 0; ++ Frame_Chunk *chunks = 0, *forward_refs = 0; + Frame_Chunk *remembered_state = 0; + Frame_Chunk *rs; + int is_eh = strcmp (section->name, ".eh_frame") == 0; +@@ -5306,55 +5393,20 @@ display_debug_frames (struct dwarf_section *section, + || (offset_size == 8 && cie_id == DW64_CIE_ID))) + { + int version; ++ int mreg; + +- fc = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk)); +- memset (fc, 0, sizeof (Frame_Chunk)); +- ++ start = read_cie (start, end, &cie, &version, ++ &augmentation_data_len, &augmentation_data); ++ fc = cie; + fc->next = chunks; + chunks = fc; + fc->chunk_start = saved_start; +- 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); +- +- version = *start++; +- +- fc->augmentation = (char *) start; +- start = (unsigned char *) strchr ((char *) start, '\0') + 1; +- +- if (strcmp (fc->augmentation, "eh") == 0) +- start += eh_addr_size; +- +- if (version >= 4) +- { +- GET (fc->ptr_size, 1); +- GET (fc->segment_size, 1); +- eh_addr_size = fc->ptr_size; +- } +- else +- { +- fc->ptr_size = eh_addr_size; +- fc->segment_size = 0; +- } +- fc->code_factor = LEB (); +- fc->data_factor = SLEB (); +- if (version == 1) +- { +- GET (fc->ra, 1); +- } +- else +- { +- fc->ra = LEB (); +- } +- +- if (fc->augmentation[0] == 'z') +- { +- augmentation_data_len = LEB (); +- augmentation_data = start; +- start += augmentation_data_len; +- } +- cie = fc; ++ mreg = max_regs - 1; ++ if (mreg < fc->ra) ++ mreg = fc->ra; ++ frame_need_space (fc, mreg); ++ if (fc->fde_encoding) ++ encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); + + printf ("\n%08lx ", (unsigned long) (saved_start - section_start)); + print_dwarf_vma (length, fc->ptr_size); +@@ -5389,33 +5441,6 @@ display_debug_frames (struct dwarf_section *section, + } + putchar ('\n'); + } +- +- if (augmentation_data_len) +- { +- unsigned char *p, *q; +- p = (unsigned char *) fc->augmentation + 1; +- q = augmentation_data; +- +- while (1) +- { +- if (*p == 'L') +- q++; +- else if (*p == 'P') +- q += 1 + size_of_encoded_value (*q); +- else if (*p == 'R') +- fc->fde_encoding = *q++; +- else if (*p == 'S') +- ; +- else +- break; +- p++; +- } +- +- if (fc->fde_encoding) +- encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); +- } +- +- frame_need_space (fc, fc->ra); + } + else + { +@@ -5423,14 +5448,70 @@ display_debug_frames (struct dwarf_section *section, + static Frame_Chunk fde_fc; + unsigned long segment_selector; + +- fc = & fde_fc; +- memset (fc, 0, sizeof (Frame_Chunk)); ++ if (is_eh) ++ { ++ dwarf_vma sign = (dwarf_vma) 1 << (offset_size * 8 - 1); ++ look_for = start - 4 - ((cie_id ^ sign) - sign); ++ } ++ else ++ look_for = section_start + cie_id; ++ ++ if (look_for <= saved_start) ++ { ++ for (cie = chunks; cie ; cie = cie->next) ++ if (cie->chunk_start == look_for) ++ break; ++ } ++ else ++ { ++ for (cie = forward_refs; cie ; cie = cie->next) ++ if (cie->chunk_start == look_for) ++ break; ++ if (!cie) ++ { ++ unsigned int off_size; ++ unsigned char *cie_scan; + +- look_for = is_eh ? start - 4 - cie_id : section_start + cie_id; ++ cie_scan = look_for; ++ off_size = 4; ++ SAFE_BYTE_GET_AND_INC (length, cie_scan, 4, end); ++ if (length == 0xffffffff) ++ { ++ SAFE_BYTE_GET_AND_INC (length, cie_scan, 8, end); ++ off_size = 8; ++ } ++ if (length != 0) ++ { ++ dwarf_vma c_id; + +- for (cie = chunks; cie ; cie = cie->next) +- if (cie->chunk_start == look_for) +- break; ++ SAFE_BYTE_GET_AND_INC (c_id, cie_scan, off_size, end); ++ if (is_eh ++ ? c_id == 0 ++ : ((off_size == 4 && c_id == DW_CIE_ID) ++ || (off_size == 8 && c_id == DW64_CIE_ID))) ++ { ++ int version; ++ int mreg; ++ ++ read_cie (cie_scan, end, &cie, &version, ++ &augmentation_data_len, &augmentation_data); ++ cie->next = forward_refs; ++ forward_refs = cie; ++ cie->chunk_start = look_for; ++ mreg = max_regs - 1; ++ if (mreg < cie->ra) ++ mreg = cie->ra; ++ frame_need_space (cie, mreg); ++ if (cie->fde_encoding) ++ encoded_ptr_size ++ = size_of_encoded_value (cie->fde_encoding); ++ } ++ } ++ } ++ } ++ ++ fc = &fde_fc; ++ memset (fc, 0, sizeof (Frame_Chunk)); + + if (!cie) + { +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/binutils-harden_strings.patch +++ binutils-2.24/debian/patches/binutils-harden_strings.patch @@ -0,0 +1,274 @@ +From b0b93f3592f3d165896e8dc8186a7ba285f0f3e4 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Fri, 31 Oct 2014 10:21:57 +0000 +Subject: [PATCH] Import a security patch from the mainline which changes the default behaviour + of the strings program to be --all rather then --data. This avoids using the + BFD library by default, and so avoids exposing strings to any memory bugs + present in BFD. + + * strings.c: Add new command line option --data to only scan the + initialized, loadable data secions of binaries. Choose the + default behaviour of --all or --data based upon a configure + option. + * doc/binutils.texi (strings): Update documentation. Include + description of why the --data option might be unsafe. + * configure.ac: Add new option --disable-default-strings-all which + restores the old behaviour of strings using --data by default. If + the option is not used make strings use --all by default. + * NEWS: Mention the new behaviour of strings. + * configure: Regenerate. + * config.in: Regenerate. + +[Ubuntu note: patch differs from upstream commit in that it drops the +update to the changelog to avoid patch conflicts. -- sbeattie] + +diff --git a/binutils/NEWS b/binutils/NEWS +index 126219b..9054494 100644 +--- a/binutils/NEWS ++++ b/binutils/NEWS +@@ -1,5 +1,12 @@ + -*- text -*- + ++Changes in 2.24-5ubuntu3.1: ++ ++* Add --data option to strings to only print strings in loadable, initialized ++ data sections. Change the default behaviour to be --all, but add a new ++ configure time option of --disable-default-strings-all to restore the old ++ default behaviour. ++ + Changes in 2.24: + + * Objcopy now supports wildcard characters in command line options that take +diff --git a/binutils/config.in b/binutils/config.in +index d43b748..076f514 100644 +--- a/binutils/config.in ++++ b/binutils/config.in +@@ -18,6 +18,9 @@ + /* Should ar and ranlib use -D behavior by default? */ + #undef DEFAULT_AR_DETERMINISTIC + ++/* Should strings use -a behavior by default? */ ++#undef DEFAULT_STRINGS_ALL ++ + /* Define to 1 if translation of program messages to the user's native + language is requested. */ + #undef ENABLE_NLS +diff --git a/binutils/configure b/binutils/configure +index 063ad72..07551c3 100755 +--- a/binutils/configure ++++ b/binutils/configure +@@ -772,6 +772,7 @@ enable_plugins + enable_libtool_lock + enable_targets + enable_deterministic_archives ++enable_default_strings_all + enable_werror + enable_build_warnings + enable_nls +@@ -1423,6 +1424,8 @@ Optional Features: + --enable-targets alternative target configurations + --enable-deterministic-archives + ar and ranlib default to -D behavior ++ --disable-default-strings-all ++ strings defaults to --data behavior + --enable-werror treat compile warnings as errors + --enable-build-warnings enable build-time compiler warnings + --disable-nls do not use Native Language Support +@@ -11681,6 +11684,25 @@ cat >>confdefs.h <<_ACEOF + _ACEOF + + ++# Check whether --enable-default-strings-all was given. ++if test "${enable_default_strings_all+set}" = set; then : ++ enableval=$enable_default_strings_all; ++if test "${enableval}" = no; then ++ default_strings_all=0 ++else ++ default_strings_all=1 ++fi ++else ++ default_strings_all=1 ++fi ++ ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define DEFAULT_STRINGS_ALL $default_strings_all ++_ACEOF ++ ++ + + GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +diff --git a/binutils/configure.ac b/binutils/configure.in +index c5da20d..c5aadd8 100644 +--- a/binutils/configure.in ++++ b/binutils/configure.in +@@ -55,6 +55,18 @@ fi], [default_ar_deterministic=0]) + AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic, + [Should ar and ranlib use -D behavior by default?]) + ++AC_ARG_ENABLE(default-strings-all, ++[AS_HELP_STRING([--disable-default-strings-all], ++ [strings defaults to --data behavior])], [ ++if test "${enableval}" = no; then ++ default_strings_all=0 ++else ++ default_strings_all=1 ++fi], [default_strings_all=1]) ++ ++AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all, ++ [Should strings use -a behavior by default?]) ++ + AM_BINUTILS_WARNINGS + + AC_CONFIG_HEADERS(config.h:config.in) +diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi +index 3874f25..eee77b1 100644 +--- a/binutils/doc/binutils.texi ++++ b/binutils/doc/binutils.texi +@@ -2672,15 +2672,24 @@ strings [@option{-afovV}] [@option{-}@var{min-len}] + + @c man begin DESCRIPTION strings + +-For each @var{file} given, @sc{gnu} @command{strings} prints the printable +-character sequences that are at least 4 characters long (or the number +-given with the options below) and are followed by an unprintable +-character. By default, it only prints the strings from the initialized +-and loaded sections of object files; for other types of files, it prints +-the strings from the whole file. ++For each @var{file} given, @sc{gnu} @command{strings} prints the ++printable character sequences that are at least 4 characters long (or ++the number given with the options below) and are followed by an ++unprintable character. + +-@command{strings} is mainly useful for determining the contents of non-text +-files. ++Depending upon how the strings program was configured it will default ++to either displaying all the printable sequences that it can find in ++each file, or only those sequences that are in loadable, initialized ++data sections. If the file type in unrecognizable, or if strings is ++reading from stdin then it will always display all of the printable ++sequences that it can find. ++ ++For backwards compatibility any file that occurs after a command line ++option of just @option{-} will also be scanned in full, regardless of ++the presence of any @option{-d} option. ++ ++@command{strings} is mainly useful for determining the contents of ++non-text files. + + @c man end + +@@ -2690,8 +2699,25 @@ files. + @item -a + @itemx --all + @itemx - +-Do not scan only the initialized and loaded sections of object files; +-scan the whole files. ++Scan the whole file, regardless of what sections it contains or ++whether those sections are loaded or initialized. Normally this is ++the default behaviour, but strings can be configured so that the ++@option{-d} is the default instead. ++ ++The @option{-} option is position dependent and forces strings to ++perform full scans of any file that is mentioned after the @option{-} ++on the command line, even if the @option{-d} option has been ++specified. ++ ++@item -d ++@itemx --data ++Only print strings from initialized, loaded data sections in the ++file. This may reduce the amount of garbage in the output, but it ++also exposes the strings program to any security flaws that may be ++present in the BFD library used to scan and load sections. Strings ++can be configured so that this option is the default behaviour. In ++such cases the @option{-a} option can be used to avoid using the BFD ++library and instead just print all of the strings found in the file. + + @item -f + @itemx --print-file-name +diff --git a/binutils/strings.c b/binutils/strings.c +index f92132b..2cf046f 100644 +--- a/binutils/strings.c ++++ b/binutils/strings.c +@@ -21,7 +21,10 @@ + Options: + --all + -a +- - Do not scan only the initialized data section of object files. ++ - Scan each file in its entirety. ++ ++ --data ++ -d Scan only the initialized data section(s) of object files. + + --print-file-name + -f Print the name of the file before each string. +@@ -114,6 +117,7 @@ static int encoding_bytes; + static struct option long_options[] = + { + {"all", no_argument, NULL, 'a'}, ++ {"data", no_argument, NULL, 'd'}, + {"print-file-name", no_argument, NULL, 'f'}, + {"bytes", required_argument, NULL, 'n'}, + {"radix", required_argument, NULL, 't'}, +@@ -136,7 +140,7 @@ typedef struct + + static void strings_a_section (bfd *, asection *, void *); + static bfd_boolean strings_object_file (const char *); +-static bfd_boolean strings_file (char *file); ++static bfd_boolean strings_file (char *); + static void print_strings (const char *, FILE *, file_ptr, int, int, char *); + static void usage (FILE *, int); + static long get_char (FILE *, file_ptr *, int *, char **); +@@ -167,11 +171,14 @@ main (int argc, char **argv) + string_min = 4; + print_addresses = FALSE; + print_filenames = FALSE; +- datasection_only = TRUE; ++ if (DEFAULT_STRINGS_ALL) ++ datasection_only = FALSE; ++ else ++ datasection_only = TRUE; + target = NULL; + encoding = 's'; + +- while ((optc = getopt_long (argc, argv, "afhHn:ot:e:T:Vv0123456789", ++ while ((optc = getopt_long (argc, argv, "adfhHn:ot:e:T:Vv0123456789", + long_options, (int *) 0)) != EOF) + { + switch (optc) +@@ -180,6 +187,10 @@ main (int argc, char **argv) + datasection_only = FALSE; + break; + ++ case 'd': ++ datasection_only = TRUE; ++ break; ++ + case 'f': + print_filenames = TRUE; + break; +@@ -648,8 +659,18 @@ usage (FILE *stream, int status) + { + fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name); + fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n")); +- fprintf (stream, _(" The options are:\n\ ++ fprintf (stream, _(" The options are:\n")); ++ ++ if (DEFAULT_STRINGS_ALL) ++ fprintf (stream, _("\ ++ -a - --all Scan the entire file, not just the data section [default]\n\ ++ -d --data Only scan the data sections in the file\n")); ++ else ++ fprintf (stream, _("\ + -a - --all Scan the entire file, not just the data section\n\ ++ -d --data Only scan the data sections in the file [default]\n")); ++ ++ fprintf (stream, _("\ + -f --print-file-name Print the name of the file before each string\n\ + -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\ + - least [number] characters (default 4).\n\ +-- +1.7.1 + --- binutils-2.24.orig/debian/patches/branch-updates.diff +++ binutils-2.24/debian/patches/branch-updates.diff @@ -0,0 +1,49330 @@ +# DP: updates from the binutils-2.24 branch + +# git diff 237df3fa4a1d939e6fd1af0c3e5029a25a137310 cde98f8566e14f52b896abc92c357cdd14717505 +# exclude bfd/{configure{,.ac},Makefile.{am,in}} + +diff --git a/bfd/ChangeLog b/bfd/ChangeLog +index 2c4719c..fa58423 100644 +--- a/bfd/ChangeLog ++++ b/bfd/ChangeLog +@@ -1,3 +1,261 @@ ++2014-10-24 Tejas Belagod ++ ++ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. ++ * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. ++ * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. ++ (elf_aarch64_stub_type): Add new type ++ aarch64_stub_erratum_835769_veneer. ++ (elf_aarch64_stub_hash_entry): New fields for erratum 835769. ++ (aarch64_erratum_835769_fix): New data struct to record erratum ++ 835769. ++ (elf_aarch64_link_hash_table: Global flags for 835769. ++ (aarch64_build_one_stub): Add case for 835769. ++ (aarch64_size_one_stub): Likewise. ++ (aarch64_mem_op_p, aarch64_mlxl_p, ++ aarch64_erratum_sequence,erratum_835769_scan): ++ New. Decode and scan functions for erratum 835769. ++ (elf_aarch64_create_or_find_stub_sec): New. ++ (elfNN_aarch64_size_stubs): Look for erratum 835769 and record ++ them. ++ (bfd_elfNN_aarch64_set_options: Set global flag for 835769. ++ (erratum_835769_branch_to_stub_data, ++ make_branch_to_erratum_835769_stub):New. Connect up all the ++ erratum stubs to occurances by branches. ++ (elfNN_aarch64_write_section): New hook. ++ (aarch64_map_one_stub): Output erratum stub symbol. ++ (elfNN_aarch64_size_dynamic_sections): Init mapping symbol ++ information for erratum 835769. ++ (elf_backend_write_section): Define. ++ ++2014-08-20 Roland McGrath ++ ++ PR ld/17277 ++ * elf32-arm.c (elf32_arm_check_relocs): Increment P->pc_count for ++ all reloc types with pc_relative set in the howto, not just for ++ R_ARM_REL32 and R_ARM_REL32_NOI. ++ (allocate_dynrelocs_for_symbol): Update comment. ++ (elf32_arm_gc_sweep_hook): For all reloc types with pc_relative ++ set in the howto, set call_reloc_p and may_need_local_target_p but ++ not may_become_dynamic_p; not only for R_ARM_REL32 and R_ARM_REL32_NOI. ++ (elf32_arm_check_relocs): Likewise. ++ ++2014-06-12 Alan Modra ++ ++ Backport mainline patches ++ 2014-06-07 Alan Modra ++ * elf32-ppc.c (ppc_elf_relocate_section): Treat field of cmpli ++ insn as a bitfield; Use complain_overflow_bitfield. ++ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. ++ ++ 2014-06-03 Alan Modra ++ * elf64-ppc.c (ADDIS_R12_R2): Define. ++ (build_plt_stub): Support fusion on ELFv2 stub. ++ (ppc_build_one_stub): Likewise for plt branch stubs. ++ ++ 2014-03-26 Alan Modra ++ * elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly ++ needed plt entries when taking the address of functions for ++ abiversion == 0 (ie. unknown) as well as abiversion == 2. ++ Move opd setup and abiversion checks to.. ++ (ppc64_elf_before_check_relocs): ..here. Renamed from ++ ppc64_elf_process_dot_syms. Set output abiversion from input and ++ input abiversion from output, if either is not set. ++ (ppc64_elf_merge_private_bfd_data): Don't merge flags here. ++ (elf_backend_check_directives): Update. ++ ++ 2014-03-14 Alan Modra ++ * elf32-ppc.c (ppc_elf_relocate_section): Correct overflow ++ handling for VLE_SDA21 relocs. ++ ++ 2014-03-08 Alan Modra ++ * elf32-ppc.c (ppc_elf_howto_raw): Correct overflow check for ++ many relocations. Correct bitsize and rightshift too for a number ++ of VLE relocs. Describe R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO. ++ Correct dst_mask on R_PPC_VLE_SDA21_LO. ++ (ppc_elf_vle_split16): Tidy, delete unnecessary prototype. ++ (ppc_elf_relocate_section): Modify overflow test for 16-bit ++ fields in instructions to signed/unsigned according to whether ++ the field takes a signed or unsigned value. Tidy vle split16 code. ++ Correct R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO handling. ++ ++ 2014-03-08 Alan Modra ++ * elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed ++ for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN, ++ R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS, ++ R_PPC64_REL16 entries. Use complain_overflow_dont for R_PPC64_TOC. ++ (ppc64_elf_relocate_section): Modify overflow test for 16-bit ++ fields in instructions to signed/unsigned according to whether ++ the field takes a signed or unsigned value. ++ ++ 2014-02-19 Alan Modra ++ * elf64-ppc.h (struct ppc64_elf_params): Add save_restore_funcs. ++ * elf64-ppc.c (ppc64_elf_func_desc_adjust): Use it to control ++ provision of out-of-line register save/restore routines. ++ ++ 2014-02-17 Alan Modra ++ * elf64-ppc.h (struct ppc64_elf_params): Define. ++ (ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup, ++ ppc64_elf_setup_section_lists, ppc64_elf_size_stubs, ++ ppc64_elf_build_stubs): Update prototype. ++ * elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other ++ fields now in params. Adjust code throughout file. ++ (ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params". ++ Save params pointer in htab. ++ (ppc64_elf_edit_opd, ppc64_elf_tls_setup, ++ ppc64_elf_setup_section_lists, ppc64_elf_size_stubs, ++ ppc64_elf_build_stubs): Remove parameters now in "params". ++ ++ 2014-02-12 Alan Modra ++ PR gold/15530 ++ * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support ++ --export-dynamic and --dynamic-list marking of symbols. ++ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Reorder ++ cheap tests first. ++ ++ 2014-02-10 H.J. Lu ++ PR gold/16530 ++ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in ++ executables if it matches dynamic_list. ++ ++ 2014-01-13 Alan Modra ++ * elf32-ppc.c (ppc_elf_check_relocs): For @local call to ifunc, ++ error when shared and force a plt call otherwise. ++ (ppc_elf_size_dynamic_sections): Don't emit DT_PPC_GOT unless ++ plt_type == PLT_NEW. ++ (ppc_elf_relocate_section): Add missing test to resolve ifuncs to ++ the appropriate call stub. ++ ++2014-04-16 Alan Modra ++ ++ Apply mainline patches for ppc476 workaround ++ 2014-04-16 Alan Modra ++ * elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area ++ with "ba 0" rather than zeros. ++ ++ 2014-04-14 Alan Modra ++ * elf32-ppc.c (BA): Define ++ (ppc_elf_link_hash_table_create): Correct default_params. ++ (write_glink_stub): Pad small plt call stub with "ba 0" rather ++ than "nop" for ppc476_workaround. ++ (ppc_elf_finish_dynamic_sections): Likewise for branch table ++ and __glink_PLTresolve. Ensure plt call stub at end of page ++ doesn't allow fall-thru prefetch. ++ ++ 2014-04-09 Alan Modra ++ * elf32-ppc.c (ppc_elf_relocate_section): Remove bctr from list ++ of safe ppc476 insns at end of page. Also remove non-branch insns. ++ Expand comments. ++ ++ 2014-02-27 Alan Modra ++ * elf32-ppc.c (ppc_elf_link_hash_table_create): Provide default ++ params for targets that don't use ppc32elf.em. ++ ++ 2014-02-17 Alan Modra ++ * elf32-ppc.c (ppc_elf_relocate_section): Move relocs on insns ++ patched for ppc476 workaround. Reapply branch taken/not taken ++ relocs. ++ ++ 2014-02-12 Alan Modra ++ * elf32-ppc.c (ppc_elf_relax_section): Enable ppc476 workaround ++ for ld -r, when code sections are sufficiently aligned. ++ * elf32-ppc.h (struct ppc_elf_params): Delete pagesize. Add ++ pagesize_p2. ++ ++ 2014-02-03 Alan Modra ++ * elf32-ppc.c (struct ppc_elf_link_hash_table): Add params. ++ Delete emit_stub_syms, no_tls_get_addr_opt. Update all uses. ++ (ppc_elf_link_params): New function. ++ (ppc_elf_create_glink): Align .glink to 64 bytes for ppc476 ++ workaround. ++ (ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms ++ parameters. Use htab->params instead. ++ (ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter. ++ (ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to ++ 64 bytes for ppc476 workaround. ++ (struct ppc_elf_relax_info): New. ++ (ppc_elf_relax_section): Exclude linker created sections and ++ those too small to hold one instruction. Don't add another ++ branch around trampolines on later relax passes. Don't ++ generate trampolines for undefined symbols when !relocatable, ++ nor for plugin symbols. Allocate space for ppc476 workaround ++ patch area. Free fixups on error return path. ++ (ppc_elf_relocate_section): Handle ppc476 workaround patching. ++ * elf32-ppc.h (struct ppc_elf_params): New. ++ (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype. ++ (ppc_elf_link_params): Declare. ++ * section.c (SEC_INFO_TYPE_TARGET): Define. ++ * bfd-in2.h: Regenerate. ++ ++2014-04-15 Marcus Shawcroft ++ ++ * (elfNN_aarch64_tls_relax): Fix instruction mask. ++ ++2014-03-07 Michael Hudson-Doyle ++ Kugan Vivekanandarajah ++ ++ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use correct ++ offset while calculating relocation address. ++ (elfNN_aarch64_create_small_pltn_entry): Likewise. ++ (elfNN_aarch64_init_small_plt0_entry): Likewise. ++ ++2014-02-28 Alan Modra ++ ++ PR ld/16643 ++ * elflink.c (elf_gc_sweep): Call gc_sweep_hook for exactly ++ the same conditions we called check_relocs. ++ ++2014-02-07 Rainer Orth ++ ++ * cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t. ++ ++2014-01-24 Alan Modra ++ ++ * elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed ++ to get_relocs for ELFv2. ++ (STK_LINKER): Comment typo fix. ++ ++ 2013-12-16 Andreas Schwab ++ * elf64-ppc.c (ppc64_elf_relocate_section): Add newline to error ++ message. ++ ++2013-12-20 Alan Modra ++ ++ * elflink.c (_bfd_elf_merge_symbol): If merging a new weak ++ symbol that will be skipped, we don't have a new definition. ++ ++2013-11-26 Will Newton ++ ++ * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): ++ Handle STT_GNU_IFUNC symbols correctly in static links. ++ ++2013-11-26 Will Newton ++ ++ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Ensure ++ PLT_INDEX is calculated using correct header size. ++ ++2013-12-08 Alan Modra ++ ++ * elflink.c (_bfd_elf_add_default_symbol): Set dynamic_def ++ and ref_dynamic_nonweak when chaining together indirect ++ symbols. ++ ++2013-12-05 Alan Modra ++ ++ * elf64-ppc.c (ppc_build_one_stub ): ++ Don't omit saving of r2 for ELFv2. Don't addi 2,2,0. ++ (ppc_size_one_stub ): Adjust to suit. ++ ++2013-12-05 Alan Modra ++ ++ * elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check. ++ Handle ELFv2. ++ ++2013-12-02 Tristan Gingold ++ ++ * configure.in: Bump version to 2.24.0 ++ * Makefile.am (RELEASE): Unset. ++ * configure, Makefile.in: Regenerate. ++ + 2013-12-02 Tristan Gingold + + * configure.in: Bump version to 2.24 +diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h +index 3afd71b..6a5c01c 100644 +--- a/bfd/bfd-in.h ++++ b/bfd/bfd-in.h +@@ -936,10 +936,10 @@ extern void bfd_elf32_aarch64_init_maps + (bfd *); + + extern void bfd_elf64_aarch64_set_options +- (bfd *, struct bfd_link_info *, int, int, int); ++ (bfd *, struct bfd_link_info *, int, int, int, int); + + extern void bfd_elf32_aarch64_set_options +- (bfd *, struct bfd_link_info *, int, int, int); ++ (bfd *, struct bfd_link_info *, int, int, int, int); + + /* ELF AArch64 mapping symbol support. */ + #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) +diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h +index 756af87..f83f6fd 100644 +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -943,10 +943,10 @@ extern void bfd_elf32_aarch64_init_maps + (bfd *); + + extern void bfd_elf64_aarch64_set_options +- (bfd *, struct bfd_link_info *, int, int, int); ++ (bfd *, struct bfd_link_info *, int, int, int, int); + + extern void bfd_elf32_aarch64_set_options +- (bfd *, struct bfd_link_info *, int, int, int); ++ (bfd *, struct bfd_link_info *, int, int, int, int); + + /* ELF AArch64 mapping symbol support. */ + #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) +@@ -1440,6 +1440,7 @@ typedef struct bfd_section + #define SEC_INFO_TYPE_MERGE 2 + #define SEC_INFO_TYPE_EH_FRAME 3 + #define SEC_INFO_TYPE_JUST_SYMS 4 ++#define SEC_INFO_TYPE_TARGET 5 + + /* Nonzero if this section uses RELA relocations, rather than REL. */ + unsigned int use_rela_p:1; +diff --git a/bfd/cache.c b/bfd/cache.c +index 4d46936..4071a02 100644 +--- a/bfd/cache.c ++++ b/bfd/cache.c +@@ -82,7 +82,7 @@ bfd_cache_max_open (void) + #ifdef HAVE_GETRLIMIT + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 +- && rlim.rlim_cur != RLIM_INFINITY) ++ && rlim.rlim_cur != (rlim_t) RLIM_INFINITY) + max = rlim.rlim_cur / 8; + else + #endif /* HAVE_GETRLIMIT */ +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index 5af1643..d406681 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -12360,7 +12360,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd, + && (sec->flags & SEC_ALLOC) != 0) + { + if (h == NULL +- && (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI)) ++ && elf32_arm_howto_from_type (r_type)->pc_relative) + { + call_reloc_p = TRUE; + may_need_local_target_p = TRUE; +@@ -12678,7 +12678,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, + && (sec->flags & SEC_ALLOC) != 0) + { + if (h == NULL +- && (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI)) ++ && elf32_arm_howto_from_type (r_type)->pc_relative) + { + /* In shared libraries and relocatable executables, + we treat local relative references as calls; +@@ -12824,7 +12824,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, + p->pc_count = 0; + } + +- if (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI) ++ if (elf32_arm_howto_from_type (r_type)->pc_relative) + p->pc_count += 1; + p->count += 1; + } +@@ -13405,12 +13405,12 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) + + if (info->shared || htab->root.is_relocatable_executable) + { +- /* The only relocs that use pc_count are R_ARM_REL32 and +- R_ARM_REL32_NOI, which will appear on something like +- ".long foo - .". We want calls to protected symbols to resolve +- directly to the function rather than going via the plt. If people +- want function pointer comparisons to work as expected then they +- should avoid writing assembly like ".long foo - .". */ ++ /* Relocs that use pc_count are PC-relative forms, which will appear ++ on something like ".long foo - ." or "movw REG, foo - .". We want ++ calls to protected symbols to resolve directly to the function ++ rather than going via the plt. If people want function pointer ++ comparisons to work as expected then they should avoid writing ++ assembly like ".long foo - .". */ + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf_dyn_relocs **pp; +diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c +index 63928dc..75fcf6e 100644 +--- a/bfd/elf32-ppc.c ++++ b/bfd/elf32-ppc.c +@@ -52,8 +52,6 @@ static bfd_reloc_status_type ppc_elf_addr16_ha_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + static bfd_reloc_status_type ppc_elf_unhandled_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +-static void ppc_elf_vle_split16 +- (bfd *, bfd_byte *, bfd_vma, bfd_vma, split16_format_type); + + /* Branch prediction bit for branch taken relocs. */ + #define BRANCH_PREDICT_BIT 0x200000 +@@ -151,6 +149,7 @@ static const bfd_vma ppc_elf_vxworks_pic_plt0_entry + #define ADD_3_12_2 0x7c6c1214 + #define ADD_11_0_11 0x7d605a14 + #define B 0x48000000 ++#define BA 0x48000002 + #define BCL_20_31 0x429f0005 + #define BCTR 0x4e800420 + #define BEQLR 0x4d820020 +@@ -194,7 +193,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_NONE", /* name */ + FALSE, /* partial_inplace */ +@@ -209,7 +208,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_ADDR32", /* name */ + FALSE, /* partial_inplace */ +@@ -225,7 +224,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 26, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_ADDR24", /* name */ + FALSE, /* partial_inplace */ +@@ -302,7 +301,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_ADDR14", /* name */ + FALSE, /* partial_inplace */ +@@ -319,7 +318,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_ADDR14_BRTAKEN",/* name */ + FALSE, /* partial_inplace */ +@@ -336,7 +335,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_ADDR14_BRNTAKEN",/* name */ + FALSE, /* partial_inplace */ +@@ -448,7 +447,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* 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_PPC_GOT16_HI", /* name */ + FALSE, /* partial_inplace */ +@@ -464,7 +463,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + ppc_elf_addr16_ha_reloc, /* special_function */ + "R_PPC_GOT16_HA", /* name */ + FALSE, /* partial_inplace */ +@@ -499,7 +498,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_COPY", /* name */ + FALSE, /* partial_inplace */ +@@ -515,7 +514,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ +@@ -530,7 +529,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_JMP_SLOT", /* name */ + FALSE, /* partial_inplace */ +@@ -547,7 +546,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_RELATIVE", /* name */ + FALSE, /* partial_inplace */ +@@ -579,7 +578,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_UADDR32", /* name */ + FALSE, /* partial_inplace */ +@@ -609,7 +608,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_REL32", /* name */ + FALSE, /* partial_inplace */ +@@ -625,7 +624,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_PLT32", /* name */ + FALSE, /* partial_inplace */ +@@ -641,7 +640,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_PLTREL32", /* name */ + FALSE, /* partial_inplace */ +@@ -673,7 +672,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* 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_PPC_PLT16_HI", /* name */ + FALSE, /* partial_inplace */ +@@ -689,7 +688,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + ppc_elf_addr16_ha_reloc, /* special_function */ + "R_PPC_PLT16_HA", /* name */ + FALSE, /* partial_inplace */ +@@ -720,7 +719,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_SECTOFF", /* name */ + FALSE, /* partial_inplace */ +@@ -750,7 +749,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* 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_PPC_SECTOFF_HI", /* name */ + FALSE, /* partial_inplace */ +@@ -765,7 +764,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + ppc_elf_addr16_ha_reloc, /* special_function */ + "R_PPC_SECTOFF_HA", /* name */ + FALSE, /* partial_inplace */ +@@ -1241,7 +1240,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_EMB_NADDR32", /* name */ + FALSE, /* partial_inplace */ +@@ -1256,7 +1255,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_EMB_NADDR16", /* name */ + FALSE, /* partial_inplace */ +@@ -1451,10 +1450,10 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + HOWTO (R_PPC_VLE_LO16A, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_LO16A", /* name */ + FALSE, /* partial_inplace */ +@@ -1466,10 +1465,10 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + HOWTO (R_PPC_VLE_LO16D, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_LO16D", /* name */ + FALSE, /* partial_inplace */ +@@ -1479,12 +1478,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 split16a format. */ + HOWTO (R_PPC_VLE_HI16A, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_HI16A", /* name */ + FALSE, /* partial_inplace */ +@@ -1494,12 +1493,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 split16d format. */ + HOWTO (R_PPC_VLE_HI16D, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_HI16D", /* name */ + FALSE, /* partial_inplace */ +@@ -1509,12 +1508,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 (High Adjusted) in split16a format. */ + HOWTO (R_PPC_VLE_HA16A, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_HA16A", /* name */ + FALSE, /* partial_inplace */ +@@ -1524,12 +1523,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 (High Adjusted) in split16d format. */ + HOWTO (R_PPC_VLE_HA16D, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_HA16D", /* name */ + FALSE, /* partial_inplace */ +@@ -1537,14 +1536,16 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 0x1f07ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +- /* This reloc does nothing. */ +- HOWTO (R_PPC_VLE_SDA21, /* type */ ++ /* This reloc is like R_PPC_EMB_SDA21 but only applies to e_add16i ++ instructions. If the register base is 0 then the linker changes ++ the e_add16i to an e_li instruction. */ ++ HOWTO (R_PPC_VLE_SDA21, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_VLE_SDA21", /* name */ + FALSE, /* partial_inplace */ +@@ -1552,29 +1553,29 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +- /* This reloc does nothing. */ ++ /* Like R_PPC_VLE_SDA21 but ignore overflow. */ + HOWTO (R_PPC_VLE_SDA21_LO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDA21_LO", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ +- 0, /* dst_mask */ ++ 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The 16 LSBS relative to _SDA_BASE_ in split16a format. */ + HOWTO (R_PPC_VLE_SDAREL_LO16A,/* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDAREL_LO16A", /* name */ + FALSE, /* partial_inplace */ +@@ -1583,14 +1584,13 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + FALSE), /* pcrel_offset */ + + /* The 16 LSBS relative to _SDA_BASE_ in split16d format. */ +- /* This reloc does nothing. */ + HOWTO (R_PPC_VLE_SDAREL_LO16D, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDAREL_LO16D", /* name */ + FALSE, /* partial_inplace */ +@@ -1600,12 +1600,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 relative to _SDA_BASE_ in split16a format. */ + HOWTO (R_PPC_VLE_SDAREL_HI16A, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDAREL_HI16A", /* name */ + FALSE, /* partial_inplace */ +@@ -1615,12 +1615,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 relative to _SDA_BASE_ in split16d format. */ + HOWTO (R_PPC_VLE_SDAREL_HI16D, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDAREL_HI16D", /* name */ + FALSE, /* partial_inplace */ +@@ -1630,12 +1630,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 (HA) relative to _SDA_BASE split16a format. */ + HOWTO (R_PPC_VLE_SDAREL_HA16A, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDAREL_HA16A", /* name */ + FALSE, /* partial_inplace */ +@@ -1645,12 +1645,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + + /* Bits 16-31 (HA) relative to _SDA_BASE split16d format. */ + HOWTO (R_PPC_VLE_SDAREL_HA16D, /* type */ +- 0, /* rightshift */ ++ 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ +- 32, /* bitsize */ ++ 16, /* 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_PPC_VLE_SDAREL_HA16D", /* name */ + FALSE, /* partial_inplace */ +@@ -1664,7 +1664,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 32, /* 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_PPC_IRELATIVE", /* name */ + FALSE, /* partial_inplace */ +@@ -1679,7 +1679,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_REL16", /* name */ + FALSE, /* partial_inplace */ +@@ -3139,6 +3139,9 @@ struct ppc_elf_link_hash_table + { + struct elf_link_hash_table elf; + ++ /* Various options passed from the linker. */ ++ struct ppc_elf_params *params; ++ + /* Short-cuts to get to dynamic linker sections. */ + asection *got; + asection *relgot; +@@ -3184,12 +3187,6 @@ struct ppc_elf_link_hash_table + /* The type of PLT we have chosen to use. */ + enum ppc_elf_plt_type plt_type; + +- /* Set if we should emit symbols for stubs. */ +- unsigned int emit_stub_syms:1; +- +- /* Set if __tls_get_addr optimization should not be done. */ +- unsigned int no_tls_get_addr_opt:1; +- + /* True if the target system is VxWorks. */ + unsigned int is_vxworks:1; + +@@ -3255,6 +3252,7 @@ static struct bfd_link_hash_table * + ppc_elf_link_hash_table_create (bfd *abfd) + { + struct ppc_elf_link_hash_table *ret; ++ static struct ppc_elf_params default_params = { PLT_OLD, 0, 1, 0, 0, 12 }; + + ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table)); + if (ret == NULL) +@@ -3274,6 +3272,8 @@ ppc_elf_link_hash_table_create (bfd *abfd) + ret->elf.init_plt_offset.offset = 0; + ret->elf.init_plt_offset.glist = NULL; + ++ ret->params = &default_params; ++ + ret->sdata[0].name = ".sdata"; + ret->sdata[0].sym_name = "_SDA_BASE_"; + ret->sdata[0].bss_name = ".sbss"; +@@ -3289,6 +3289,17 @@ ppc_elf_link_hash_table_create (bfd *abfd) + return &ret->elf.root; + } + ++/* Hook linker params into hash table. */ ++ ++void ++ppc_elf_link_params (struct bfd_link_info *info, struct ppc_elf_params *params) ++{ ++ struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info); ++ ++ if (htab) ++ htab->params = params; ++} ++ + /* Create .got and the related sections. */ + + static bfd_boolean +@@ -3341,7 +3352,8 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) + s = bfd_make_section_anyway_with_flags (abfd, ".glink", flags); + htab->glink = s; + if (s == NULL +- || !bfd_set_section_alignment (abfd, s, 4)) ++ || !bfd_set_section_alignment (abfd, s, ++ htab->params->ppc476_workaround ? 6 : 4)) + return FALSE; + + if (!info->no_ld_generated_unwind_info) +@@ -4283,6 +4295,20 @@ ppc_elf_check_relocs (bfd *abfd, + htab->plt_type = PLT_OLD; + htab->old_bfd = abfd; + } ++ if (h != NULL && h->type == STT_GNU_IFUNC) ++ { ++ if (info->shared) ++ { ++ info->callbacks->einfo (_("%P: %H: @local call to ifunc %s\n"), ++ abfd, sec, rel->r_offset, ++ h->root.root.string); ++ bfd_set_error (bfd_error_bad_value); ++ return FALSE; ++ } ++ h->needs_plt = 1; ++ if (!update_plt_info (abfd, &h->plt.plist, NULL, 0)) ++ return FALSE; ++ } + break; + + /* This relocation describes the C++ object vtable hierarchy. +@@ -4766,20 +4792,19 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) + } + + static void +-ppc_elf_vle_split16 (bfd *output_bfd, bfd_byte *contents, +- bfd_vma offset, bfd_vma relocation, +- split16_format_type split16_format) ++ppc_elf_vle_split16 (bfd *output_bfd, bfd_byte *loc, ++ bfd_vma value, ++ split16_format_type split16_format) + + { +- bfd_vma insn, top5, bottom11; ++ unsigned int insn, top5; + +- insn = bfd_get_32 (output_bfd, contents + offset); +- top5 = relocation >> 11; +- top5 = top5 << (split16_format == split16a_type ? 20 : 16); +- bottom11 = relocation & 0x7ff; ++ insn = bfd_get_32 (output_bfd, loc); ++ top5 = value & 0xf800; ++ top5 = top5 << (split16_format == split16a_type ? 9 : 5); + insn |= top5; +- insn |= bottom11; +- bfd_put_32 (output_bfd, insn, contents + offset); ++ insn |= value & 0x7ff; ++ bfd_put_32 (output_bfd, insn, loc); + } + + +@@ -4787,22 +4812,18 @@ ppc_elf_vle_split16 (bfd *output_bfd, bfd_byte *contents, + Returns -1 on error, 0 for old PLT, 1 for new PLT. */ + int + ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, +- struct bfd_link_info *info, +- enum ppc_elf_plt_type plt_style, +- int emit_stub_syms) ++ struct bfd_link_info *info) + { + struct ppc_elf_link_hash_table *htab; + flagword flags; + + htab = ppc_elf_hash_table (info); + +- htab->emit_stub_syms = emit_stub_syms; +- + if (htab->plt_type == PLT_UNSET) + { + struct elf_link_hash_entry *h; + +- if (plt_style == PLT_OLD) ++ if (htab->params->plt_style == PLT_OLD) + htab->plt_type = PLT_OLD; + else if (info->shared + && htab->elf.dynamic_sections_created +@@ -4824,7 +4845,7 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, + else + { + bfd *ibfd; +- enum ppc_elf_plt_type plt_type = plt_style; ++ enum ppc_elf_plt_type plt_type = htab->params->plt_style; + + /* Look through the reloc flags left by ppc_elf_check_relocs. + Use the old style bss plt if a file makes plt calls +@@ -4847,7 +4868,7 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, + htab->plt_type = plt_type; + } + } +- if (htab->plt_type == PLT_OLD && plt_style == PLT_NEW) ++ if (htab->plt_type == PLT_OLD && htab->params->plt_style == PLT_NEW) + { + if (htab->old_bfd != NULL) + info->callbacks->einfo (_("%P: bss-plt forced due to %B\n"), +@@ -5083,16 +5104,14 @@ ppc_elf_gc_sweep_hook (bfd *abfd, + generic ELF tls_setup function. */ + + asection * +-ppc_elf_tls_setup (bfd *obfd, +- struct bfd_link_info *info, +- int no_tls_get_addr_opt) ++ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) + { + struct ppc_elf_link_hash_table *htab; + + htab = ppc_elf_hash_table (info); + htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", + FALSE, FALSE, TRUE); +- if (!no_tls_get_addr_opt) ++ if (!htab->params->no_tls_get_addr_opt) + { + struct elf_link_hash_entry *opt, *tga; + opt = elf_link_hash_lookup (&htab->elf, "__tls_get_addr_opt", +@@ -5137,9 +5156,8 @@ ppc_elf_tls_setup (bfd *obfd, + } + } + else +- no_tls_get_addr_opt = TRUE; ++ htab->params->no_tls_get_addr_opt = TRUE; + } +- htab->no_tls_get_addr_opt = no_tls_get_addr_opt; + if (htab->plt_type == PLT_NEW + && htab->plt != NULL + && htab->plt->output_section != NULL) +@@ -5770,7 +5788,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + glink_offset = s->size; + s->size += GLINK_ENTRY_SIZE; + if (h == htab->tls_get_addr +- && !htab->no_tls_get_addr_opt) ++ && !htab->params->no_tls_get_addr_opt) + s->size += TLS_GET_ADDR_GLINK_SIZE - GLINK_ENTRY_SIZE; + } + if (!doneone +@@ -5783,7 +5801,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + } + ent->glink_offset = glink_offset; + +- if (htab->emit_stub_syms ++ if (htab->params->emit_stub_syms + && !add_stub_sym (ent, h, info)) + return FALSE; + } +@@ -6325,10 +6343,11 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + /* Space for the branch table. */ + htab->glink->size += htab->glink->size / (GLINK_ENTRY_SIZE / 4) - 4; + /* Pad out to align the start of PLTresolve. */ +- htab->glink->size += -htab->glink->size & 15; ++ htab->glink->size += -htab->glink->size & (htab->params->ppc476_workaround ++ ? 63 : 15); + htab->glink->size += GLINK_PLTRESOLVE; + +- if (htab->emit_stub_syms) ++ if (htab->params->emit_stub_syms) + { + struct elf_link_hash_entry *sh; + sh = elf_link_hash_lookup (&htab->elf, "__glink", +@@ -6481,11 +6500,13 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + return FALSE; + } + +- if (htab->glink != NULL && htab->glink->size != 0) ++ if (htab->plt_type == PLT_NEW ++ && htab->glink != NULL ++ && htab->glink->size != 0) + { + if (!add_dynamic_entry (DT_PPC_GOT, 0)) + return FALSE; +- if (!htab->no_tls_get_addr_opt ++ if (!htab->params->no_tls_get_addr_opt + && htab->tls_get_addr != NULL + && htab->tls_get_addr->plt.plist != NULL + && !add_dynamic_entry (DT_PPC_OPT, PPC_OPT_TLS)) +@@ -6618,6 +6639,19 @@ static const int stub_entry[] = + 0x4e800420, /* bctr */ + }; + ++struct ppc_elf_relax_info ++{ ++ unsigned int workaround_size; ++}; ++ ++/* This function implements long branch trampolines, and the ppc476 ++ icache bug workaround. Any section needing trampolines or patch ++ space for the workaround has its size extended so that we can ++ add trampolines at the end of the section. FIXME: We write out ++ trampoline templates here and later modify them in ++ relocate_section. We'd save a realloc if we left writing the ++ templates to relocate_section. */ ++ + static bfd_boolean + ppc_elf_relax_section (bfd *abfd, + asection *isec, +@@ -6638,384 +6672,458 @@ ppc_elf_relax_section (bfd *abfd, + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + Elf_Internal_Rela *internal_relocs = NULL; +- Elf_Internal_Rela *irel, *irelend; ++ Elf_Internal_Rela *irel, *irelend = NULL; + struct one_fixup *fixups = NULL; ++ struct ppc_elf_relax_info *relax_info = NULL; + unsigned changes = 0; ++ bfd_boolean workaround_change; + struct ppc_elf_link_hash_table *htab; +- bfd_size_type trampoff; ++ bfd_size_type trampbase, trampoff, newsize; + asection *got2; + bfd_boolean maybe_pasted; + + *again = FALSE; + +- /* Nothing to do if there are no relocations, and no need to do +- anything with non-alloc or non-code sections. */ ++ /* No need to do anything with non-alloc or non-code sections. */ + if ((isec->flags & SEC_ALLOC) == 0 + || (isec->flags & SEC_CODE) == 0 +- || (isec->flags & SEC_RELOC) == 0 +- || isec->reloc_count == 0) ++ || (isec->flags & SEC_LINKER_CREATED) != 0 ++ || isec->size < 4) + return TRUE; + + /* We cannot represent the required PIC relocs in the output, so don't + do anything. The linker doesn't support mixing -shared and -r + anyway. */ + if (link_info->relocatable && link_info->shared) +- return TRUE; ++ return TRUE; ++ ++ htab = ppc_elf_hash_table (link_info); ++ if (htab == NULL) ++ return TRUE; ++ ++ isec->size = (isec->size + 3) & -4; ++ if (isec->rawsize == 0) ++ isec->rawsize = isec->size; ++ trampbase = isec->size; ++ ++ if (htab->params->ppc476_workaround) ++ { ++ if (elf_section_data (isec)->sec_info == NULL) ++ { ++ BFD_ASSERT (isec->sec_info_type == SEC_INFO_TYPE_NONE); ++ isec->sec_info_type = SEC_INFO_TYPE_TARGET; ++ elf_section_data (isec)->sec_info ++ = bfd_zalloc (abfd, sizeof (struct ppc_elf_relax_info)); ++ if (elf_section_data (isec)->sec_info == NULL) ++ return FALSE; ++ } ++ relax_info = elf_section_data (isec)->sec_info; ++ trampbase -= relax_info->workaround_size; ++ } + +- trampoff = (isec->size + 3) & (bfd_vma) -4; + maybe_pasted = (strcmp (isec->output_section->name, ".init") == 0 + || strcmp (isec->output_section->name, ".fini") == 0); + /* Space for a branch around any trampolines. */ +- if (maybe_pasted) ++ trampoff = trampbase; ++ if (maybe_pasted && trampbase == isec->rawsize) + trampoff += 4; + + symtab_hdr = &elf_symtab_hdr (abfd); + +- /* Get a copy of the native relocations. */ +- internal_relocs = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, +- link_info->keep_memory); +- if (internal_relocs == NULL) +- goto error_return; +- +- htab = ppc_elf_hash_table (link_info); +- got2 = bfd_get_section_by_name (abfd, ".got2"); +- +- irelend = internal_relocs + isec->reloc_count; +- for (irel = internal_relocs; irel < irelend; irel++) ++ if (htab->params->branch_trampolines) + { +- unsigned long r_type = ELF32_R_TYPE (irel->r_info); +- bfd_vma toff, roff; +- asection *tsec; +- struct one_fixup *f; +- size_t insn_offset = 0; +- bfd_vma max_branch_offset, val; +- bfd_byte *hit_addr; +- unsigned long t0; +- struct elf_link_hash_entry *h; +- struct plt_entry **plist; +- unsigned char sym_type; +- +- switch (r_type) ++ /* Get a copy of the native relocations. */ ++ if (isec->reloc_count != 0) + { +- case R_PPC_REL24: +- case R_PPC_LOCAL24PC: +- case R_PPC_PLTREL24: +- max_branch_offset = 1 << 25; +- break; +- +- case R_PPC_REL14: +- case R_PPC_REL14_BRTAKEN: +- case R_PPC_REL14_BRNTAKEN: +- max_branch_offset = 1 << 15; +- break; +- +- default: +- continue; ++ internal_relocs = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, ++ link_info->keep_memory); ++ if (internal_relocs == NULL) ++ goto error_return; + } + +- /* Get the value of the symbol referred to by the reloc. */ +- h = NULL; +- if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) ++ got2 = bfd_get_section_by_name (abfd, ".got2"); ++ ++ irelend = internal_relocs + isec->reloc_count; ++ for (irel = internal_relocs; irel < irelend; irel++) + { +- /* A local symbol. */ +- Elf_Internal_Sym *isym; ++ unsigned long r_type = ELF32_R_TYPE (irel->r_info); ++ bfd_vma toff, roff; ++ asection *tsec; ++ struct one_fixup *f; ++ size_t insn_offset = 0; ++ bfd_vma max_branch_offset, val; ++ bfd_byte *hit_addr; ++ unsigned long t0; ++ struct elf_link_hash_entry *h; ++ struct plt_entry **plist; ++ unsigned char sym_type; ++ ++ switch (r_type) ++ { ++ case R_PPC_REL24: ++ case R_PPC_LOCAL24PC: ++ case R_PPC_PLTREL24: ++ max_branch_offset = 1 << 25; ++ break; ++ ++ case R_PPC_REL14: ++ case R_PPC_REL14_BRTAKEN: ++ case R_PPC_REL14_BRNTAKEN: ++ max_branch_offset = 1 << 15; ++ break; ++ ++ default: ++ continue; ++ } + +- /* Read this BFD's local symbols. */ +- if (isymbuf == NULL) ++ /* Get the value of the symbol referred to by the reloc. */ ++ h = NULL; ++ if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { +- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; ++ /* A local symbol. */ ++ Elf_Internal_Sym *isym; ++ ++ /* Read this BFD's local symbols. */ + if (isymbuf == NULL) +- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, +- symtab_hdr->sh_info, 0, +- NULL, NULL, NULL); +- if (isymbuf == 0) +- goto error_return; ++ { ++ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; ++ if (isymbuf == NULL) ++ isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, ++ symtab_hdr->sh_info, 0, ++ NULL, NULL, NULL); ++ if (isymbuf == 0) ++ goto error_return; ++ } ++ isym = isymbuf + ELF32_R_SYM (irel->r_info); ++ if (isym->st_shndx == SHN_UNDEF) ++ tsec = bfd_und_section_ptr; ++ else if (isym->st_shndx == SHN_ABS) ++ tsec = bfd_abs_section_ptr; ++ else if (isym->st_shndx == SHN_COMMON) ++ tsec = bfd_com_section_ptr; ++ else ++ tsec = bfd_section_from_elf_index (abfd, isym->st_shndx); ++ ++ toff = isym->st_value; ++ sym_type = ELF_ST_TYPE (isym->st_info); + } +- isym = isymbuf + ELF32_R_SYM (irel->r_info); +- if (isym->st_shndx == SHN_UNDEF) +- tsec = bfd_und_section_ptr; +- else if (isym->st_shndx == SHN_ABS) +- tsec = bfd_abs_section_ptr; +- else if (isym->st_shndx == SHN_COMMON) +- tsec = bfd_com_section_ptr; + else +- tsec = bfd_section_from_elf_index (abfd, isym->st_shndx); ++ { ++ /* Global symbol handling. */ ++ unsigned long indx; + +- toff = isym->st_value; +- sym_type = ELF_ST_TYPE (isym->st_info); +- } +- else +- { +- /* Global symbol handling. */ +- unsigned long indx; ++ indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; ++ h = elf_sym_hashes (abfd)[indx]; + +- indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; +- h = elf_sym_hashes (abfd)[indx]; ++ while (h->root.type == bfd_link_hash_indirect ++ || h->root.type == bfd_link_hash_warning) ++ h = (struct elf_link_hash_entry *) h->root.u.i.link; + +- while (h->root.type == bfd_link_hash_indirect +- || h->root.type == bfd_link_hash_warning) +- h = (struct elf_link_hash_entry *) h->root.u.i.link; ++ if (h->root.type == bfd_link_hash_defined ++ || h->root.type == bfd_link_hash_defweak) ++ { ++ tsec = h->root.u.def.section; ++ toff = h->root.u.def.value; ++ } ++ else if (h->root.type == bfd_link_hash_undefined ++ || h->root.type == bfd_link_hash_undefweak) ++ { ++ tsec = bfd_und_section_ptr; ++ toff = link_info->relocatable ? indx : 0; ++ } ++ else ++ continue; ++ ++ sym_type = h->type; ++ } + +- if (h->root.type == bfd_link_hash_defined +- || h->root.type == bfd_link_hash_defweak) ++ /* The condition here under which we call find_plt_ent must ++ match that in relocate_section. If we call find_plt_ent here ++ but not in relocate_section, or vice versa, then the branch ++ destination used here may be incorrect. */ ++ plist = NULL; ++ if (h != NULL) + { +- tsec = h->root.u.def.section; +- toff = h->root.u.def.value; ++ /* We know is_branch_reloc (r_type) is true. */ ++ if (h->type == STT_GNU_IFUNC ++ || r_type == R_PPC_PLTREL24) ++ plist = &h->plt.plist; + } +- else if (h->root.type == bfd_link_hash_undefined +- || h->root.type == bfd_link_hash_undefweak) ++ else if (sym_type == STT_GNU_IFUNC ++ && elf_local_got_offsets (abfd) != NULL) + { +- tsec = bfd_und_section_ptr; +- toff = link_info->relocatable ? indx : 0; ++ bfd_vma *local_got_offsets = elf_local_got_offsets (abfd); ++ struct plt_entry **local_plt = (struct plt_entry **) ++ (local_got_offsets + symtab_hdr->sh_info); ++ plist = local_plt + ELF32_R_SYM (irel->r_info); + } +- else +- continue; +- +- sym_type = h->type; +- } +- +- /* The condition here under which we call find_plt_ent must +- match that in relocate_section. If we call find_plt_ent here +- but not in relocate_section, or vice versa, then the branch +- destination used here may be incorrect. */ +- plist = NULL; +- if (h != NULL) +- { +- /* We know is_branch_reloc (r_type) is true. */ +- if (h->type == STT_GNU_IFUNC +- || r_type == R_PPC_PLTREL24) +- plist = &h->plt.plist; +- } +- else if (sym_type == STT_GNU_IFUNC +- && elf_local_got_offsets (abfd) != NULL) +- { +- bfd_vma *local_got_offsets = elf_local_got_offsets (abfd); +- struct plt_entry **local_plt = (struct plt_entry **) +- (local_got_offsets + symtab_hdr->sh_info); +- plist = local_plt + ELF32_R_SYM (irel->r_info); +- } +- if (plist != NULL) +- { +- bfd_vma addend = 0; +- struct plt_entry *ent; +- +- if (r_type == R_PPC_PLTREL24 && link_info->shared) +- addend = irel->r_addend; +- ent = find_plt_ent (plist, got2, addend); +- if (ent != NULL) ++ if (plist != NULL) + { +- if (htab->plt_type == PLT_NEW +- || h == NULL +- || !htab->elf.dynamic_sections_created +- || h->dynindx == -1) +- { +- tsec = htab->glink; +- toff = ent->glink_offset; +- } +- else ++ bfd_vma addend = 0; ++ struct plt_entry *ent; ++ ++ if (r_type == R_PPC_PLTREL24 && link_info->shared) ++ addend = irel->r_addend; ++ ent = find_plt_ent (plist, got2, addend); ++ if (ent != NULL) + { +- tsec = htab->plt; +- toff = ent->plt.offset; ++ if (htab->plt_type == PLT_NEW ++ || h == NULL ++ || !htab->elf.dynamic_sections_created ++ || h->dynindx == -1) ++ { ++ tsec = htab->glink; ++ toff = ent->glink_offset; ++ } ++ else ++ { ++ tsec = htab->plt; ++ toff = ent->plt.offset; ++ } + } + } +- } + +- /* If the branch and target are in the same section, you have +- no hope of adding stubs. We'll error out later should the +- branch overflow. */ +- if (tsec == isec) +- continue; ++ /* If the branch and target are in the same section, you have ++ no hope of adding stubs. We'll error out later should the ++ branch overflow. */ ++ if (tsec == isec) ++ continue; + +- /* There probably isn't any reason to handle symbols in +- SEC_MERGE sections; SEC_MERGE doesn't seem a likely +- attribute for a code section, and we are only looking at +- branches. However, implement it correctly here as a +- reference for other target relax_section functions. */ +- if (0 && tsec->sec_info_type == SEC_INFO_TYPE_MERGE) +- { +- /* At this stage in linking, no SEC_MERGE symbol has been +- adjusted, so all references to such symbols need to be +- passed through _bfd_merged_section_offset. (Later, in +- relocate_section, all SEC_MERGE symbols *except* for +- section symbols have been adjusted.) +- +- gas may reduce relocations against symbols in SEC_MERGE +- sections to a relocation against the section symbol when +- the original addend was zero. When the reloc is against +- a section symbol we should include the addend in the +- offset passed to _bfd_merged_section_offset, since the +- location of interest is the original symbol. On the +- other hand, an access to "sym+addend" where "sym" is not +- a section symbol should not include the addend; Such an +- access is presumed to be an offset from "sym"; The +- location of interest is just "sym". */ +- if (sym_type == STT_SECTION) ++ /* There probably isn't any reason to handle symbols in ++ SEC_MERGE sections; SEC_MERGE doesn't seem a likely ++ attribute for a code section, and we are only looking at ++ branches. However, implement it correctly here as a ++ reference for other target relax_section functions. */ ++ if (0 && tsec->sec_info_type == SEC_INFO_TYPE_MERGE) ++ { ++ /* At this stage in linking, no SEC_MERGE symbol has been ++ adjusted, so all references to such symbols need to be ++ passed through _bfd_merged_section_offset. (Later, in ++ relocate_section, all SEC_MERGE symbols *except* for ++ section symbols have been adjusted.) ++ ++ gas may reduce relocations against symbols in SEC_MERGE ++ sections to a relocation against the section symbol when ++ the original addend was zero. When the reloc is against ++ a section symbol we should include the addend in the ++ offset passed to _bfd_merged_section_offset, since the ++ location of interest is the original symbol. On the ++ other hand, an access to "sym+addend" where "sym" is not ++ a section symbol should not include the addend; Such an ++ access is presumed to be an offset from "sym"; The ++ location of interest is just "sym". */ ++ if (sym_type == STT_SECTION) ++ toff += irel->r_addend; ++ ++ toff ++ = _bfd_merged_section_offset (abfd, &tsec, ++ elf_section_data (tsec)->sec_info, ++ toff); ++ ++ if (sym_type != STT_SECTION) ++ toff += irel->r_addend; ++ } ++ /* PLTREL24 addends are special. */ ++ else if (r_type != R_PPC_PLTREL24) + toff += irel->r_addend; + +- toff = _bfd_merged_section_offset (abfd, &tsec, +- elf_section_data (tsec)->sec_info, +- toff); +- +- if (sym_type != STT_SECTION) +- toff += irel->r_addend; +- } +- /* PLTREL24 addends are special. */ +- else if (r_type != R_PPC_PLTREL24) +- toff += irel->r_addend; ++ /* Attempted -shared link of non-pic code loses. */ ++ if ((!link_info->relocatable ++ && tsec == bfd_und_section_ptr) ++ || tsec->output_section == NULL ++ || (tsec->owner != NULL ++ && (tsec->owner->flags & BFD_PLUGIN) != 0)) ++ continue; + +- /* Attempted -shared link of non-pic code loses. */ +- if (tsec->output_section == NULL) +- continue; ++ roff = irel->r_offset; + +- roff = irel->r_offset; ++ /* If the branch is in range, no need to do anything. */ ++ if (tsec != bfd_und_section_ptr ++ && (!link_info->relocatable ++ /* A relocatable link may have sections moved during ++ final link, so do not presume they remain in range. */ ++ || tsec->output_section == isec->output_section)) ++ { ++ bfd_vma symaddr, reladdr; + +- /* If the branch is in range, no need to do anything. */ +- if (tsec != bfd_und_section_ptr +- && (!link_info->relocatable +- /* A relocatable link may have sections moved during +- final link, so do not presume they remain in range. */ +- || tsec->output_section == isec->output_section)) +- { +- bfd_vma symaddr, reladdr; ++ symaddr = tsec->output_section->vma + tsec->output_offset + toff; ++ reladdr = isec->output_section->vma + isec->output_offset + roff; ++ if (symaddr - reladdr + max_branch_offset ++ < 2 * max_branch_offset) ++ continue; ++ } + +- symaddr = tsec->output_section->vma + tsec->output_offset + toff; +- reladdr = isec->output_section->vma + isec->output_offset + roff; +- if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset) +- continue; +- } ++ /* Look for an existing fixup to this address. */ ++ for (f = fixups; f ; f = f->next) ++ if (f->tsec == tsec && f->toff == toff) ++ break; + +- /* Look for an existing fixup to this address. */ +- for (f = fixups; f ; f = f->next) +- if (f->tsec == tsec && f->toff == toff) +- break; ++ if (f == NULL) ++ { ++ size_t size; ++ unsigned long stub_rtype; + +- if (f == NULL) +- { +- size_t size; +- unsigned long stub_rtype; ++ val = trampoff - roff; ++ if (val >= max_branch_offset) ++ /* Oh dear, we can't reach a trampoline. Don't try to add ++ one. We'll report an error later. */ ++ continue; + +- val = trampoff - roff; +- if (val >= max_branch_offset) +- /* Oh dear, we can't reach a trampoline. Don't try to add +- one. We'll report an error later. */ +- continue; ++ if (link_info->shared) ++ { ++ size = 4 * ARRAY_SIZE (shared_stub_entry); ++ insn_offset = 12; ++ } ++ else ++ { ++ size = 4 * ARRAY_SIZE (stub_entry); ++ insn_offset = 0; ++ } ++ stub_rtype = R_PPC_RELAX; ++ if (tsec == htab->plt ++ || tsec == htab->glink) ++ { ++ stub_rtype = R_PPC_RELAX_PLT; ++ if (r_type == R_PPC_PLTREL24) ++ stub_rtype = R_PPC_RELAX_PLTREL24; ++ } + +- if (link_info->shared) +- { +- size = 4 * ARRAY_SIZE (shared_stub_entry); +- insn_offset = 12; ++ /* Hijack the old relocation. Since we need two ++ relocations for this use a "composite" reloc. */ ++ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), ++ stub_rtype); ++ irel->r_offset = trampoff + insn_offset; ++ if (r_type == R_PPC_PLTREL24 ++ && stub_rtype != R_PPC_RELAX_PLTREL24) ++ irel->r_addend = 0; ++ ++ /* Record the fixup so we don't do it again this section. */ ++ f = bfd_malloc (sizeof (*f)); ++ f->next = fixups; ++ f->tsec = tsec; ++ f->toff = toff; ++ f->trampoff = trampoff; ++ fixups = f; ++ ++ trampoff += size; ++ changes++; + } + else + { +- size = 4 * ARRAY_SIZE (stub_entry); +- insn_offset = 0; +- } +- stub_rtype = R_PPC_RELAX; +- if (tsec == htab->plt +- || tsec == htab->glink) +- { +- stub_rtype = R_PPC_RELAX_PLT; +- if (r_type == R_PPC_PLTREL24) +- stub_rtype = R_PPC_RELAX_PLTREL24; +- } +- +- /* Hijack the old relocation. Since we need two +- relocations for this use a "composite" reloc. */ +- irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), +- stub_rtype); +- irel->r_offset = trampoff + insn_offset; +- if (r_type == R_PPC_PLTREL24 +- && stub_rtype != R_PPC_RELAX_PLTREL24) +- irel->r_addend = 0; +- +- /* Record the fixup so we don't do it again this section. */ +- f = bfd_malloc (sizeof (*f)); +- f->next = fixups; +- f->tsec = tsec; +- f->toff = toff; +- f->trampoff = trampoff; +- fixups = f; +- +- trampoff += size; +- changes++; +- } +- else +- { +- val = f->trampoff - roff; +- if (val >= max_branch_offset) +- continue; ++ val = f->trampoff - roff; ++ if (val >= max_branch_offset) ++ continue; + +- /* Nop out the reloc, since we're finalizing things here. */ +- irel->r_info = ELF32_R_INFO (0, R_PPC_NONE); +- } ++ /* Nop out the reloc, since we're finalizing things here. */ ++ irel->r_info = ELF32_R_INFO (0, R_PPC_NONE); ++ } + +- /* Get the section contents. */ +- if (contents == NULL) +- { +- /* Get cached copy if it exists. */ +- if (elf_section_data (isec)->this_hdr.contents != NULL) +- contents = elf_section_data (isec)->this_hdr.contents; +- else ++ /* Get the section contents. */ ++ if (contents == NULL) + { ++ /* Get cached copy if it exists. */ ++ if (elf_section_data (isec)->this_hdr.contents != NULL) ++ contents = elf_section_data (isec)->this_hdr.contents; + /* Go get them off disk. */ +- if (!bfd_malloc_and_get_section (abfd, isec, &contents)) ++ else if (!bfd_malloc_and_get_section (abfd, isec, &contents)) + goto error_return; + } +- } + +- /* Fix up the existing branch to hit the trampoline. */ +- hit_addr = contents + roff; +- switch (r_type) +- { +- case R_PPC_REL24: +- case R_PPC_LOCAL24PC: +- case R_PPC_PLTREL24: +- t0 = bfd_get_32 (abfd, hit_addr); +- t0 &= ~0x3fffffc; +- t0 |= val & 0x3fffffc; +- bfd_put_32 (abfd, t0, hit_addr); +- break; ++ /* Fix up the existing branch to hit the trampoline. */ ++ hit_addr = contents + roff; ++ switch (r_type) ++ { ++ case R_PPC_REL24: ++ case R_PPC_LOCAL24PC: ++ case R_PPC_PLTREL24: ++ t0 = bfd_get_32 (abfd, hit_addr); ++ t0 &= ~0x3fffffc; ++ t0 |= val & 0x3fffffc; ++ bfd_put_32 (abfd, t0, hit_addr); ++ break; + +- case R_PPC_REL14: +- case R_PPC_REL14_BRTAKEN: +- case R_PPC_REL14_BRNTAKEN: +- t0 = bfd_get_32 (abfd, hit_addr); +- t0 &= ~0xfffc; +- t0 |= val & 0xfffc; +- bfd_put_32 (abfd, t0, hit_addr); +- break; ++ case R_PPC_REL14: ++ case R_PPC_REL14_BRTAKEN: ++ case R_PPC_REL14_BRNTAKEN: ++ t0 = bfd_get_32 (abfd, hit_addr); ++ t0 &= ~0xfffc; ++ t0 |= val & 0xfffc; ++ bfd_put_32 (abfd, t0, hit_addr); ++ break; ++ } + } +- } + +- /* Write out the trampolines. */ +- if (fixups != NULL) +- { +- const int *stub; +- bfd_byte *dest; +- int i, size; +- +- do ++ while (fixups != NULL) + { + struct one_fixup *f = fixups; + fixups = fixups->next; + free (f); + } +- while (fixups); ++ } ++ ++ workaround_change = FALSE; ++ newsize = trampoff; ++ if (htab->params->ppc476_workaround ++ && (!link_info->relocatable ++ || isec->output_section->alignment_power >= htab->params->pagesize_p2)) ++ { ++ bfd_vma addr, end_addr; ++ unsigned int crossings; ++ bfd_vma pagesize = (bfd_vma) 1 << htab->params->pagesize_p2; ++ ++ addr = isec->output_section->vma + isec->output_offset; ++ end_addr = addr + trampoff - 1; ++ addr &= -pagesize; ++ crossings = ((end_addr & -pagesize) - addr) >> htab->params->pagesize_p2; ++ if (crossings != 0) ++ { ++ /* Keep space aligned, to ensure the patch code itself does ++ not cross a page. Don't decrease size calculated on a ++ previous pass as otherwise we might never settle on a layout. */ ++ newsize = 15 - (end_addr & 15); ++ newsize += crossings * 16; ++ if (relax_info->workaround_size < newsize) ++ { ++ relax_info->workaround_size = newsize; ++ workaround_change = TRUE; ++ if (contents == NULL) ++ { ++ if (elf_section_data (isec)->this_hdr.contents != NULL) ++ contents = elf_section_data (isec)->this_hdr.contents; ++ else if (!bfd_malloc_and_get_section (abfd, isec, &contents)) ++ goto error_return; ++ } ++ } ++ /* Ensure relocate_section is called. */ ++ isec->flags |= SEC_RELOC; ++ } ++ newsize = trampoff + relax_info->workaround_size; ++ } + +- contents = bfd_realloc_or_free (contents, trampoff); ++ if (changes || workaround_change) ++ { ++ contents = bfd_realloc_or_free (contents, newsize); + if (contents == NULL) + goto error_return; + +- isec->size = (isec->size + 3) & (bfd_vma) -4; +- dest = contents + isec->size; + /* Branch around the trampolines. */ + if (maybe_pasted) + { +- bfd_vma val = B + trampoff - isec->size; +- bfd_put_32 (abfd, val, dest); +- dest += 4; ++ bfd_vma val = B + newsize - isec->rawsize; ++ bfd_put_32 (abfd, val, contents + isec->rawsize); + } +- isec->size = trampoff; ++ } ++ ++ /* Write out the trampolines. */ ++ if (changes) ++ { ++ const int *stub; ++ bfd_byte *dest; ++ int i, size; ++ ++ dest = contents + trampbase; ++ if (maybe_pasted && trampbase == isec->rawsize) ++ dest += 4; + + if (link_info->shared) + { +@@ -7040,6 +7148,9 @@ ppc_elf_relax_section (bfd *abfd, + BFD_ASSERT (i == 0); + } + ++ if (changes || workaround_change) ++ isec->size = newsize; ++ + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { +@@ -7055,7 +7166,7 @@ ppc_elf_relax_section (bfd *abfd, + if (contents != NULL + && elf_section_data (isec)->this_hdr.contents != contents) + { +- if (!changes && !link_info->keep_memory) ++ if (!changes && !workaround_change && !link_info->keep_memory) + free (contents); + else + { +@@ -7090,11 +7201,12 @@ ppc_elf_relax_section (bfd *abfd, + rel_hdr = _bfd_elf_single_rel_hdr (isec); + rel_hdr->sh_size += changes * rel_hdr->sh_entsize; + } +- else if (elf_section_data (isec)->relocs != internal_relocs) ++ else if (internal_relocs != NULL ++ && elf_section_data (isec)->relocs != internal_relocs) + free (internal_relocs); + +- *again = changes != 0; +- if (!*again && link_info->relocatable) ++ *again = changes != 0 || workaround_change; ++ if (!*again && link_info->relocatable && htab->params->branch_trampolines) + { + /* Convert the internal relax relocs to external form. */ + for (irel = internal_relocs; irel < irelend; irel++) +@@ -7118,6 +7230,12 @@ ppc_elf_relax_section (bfd *abfd, + return TRUE; + + error_return: ++ while (fixups != NULL) ++ { ++ struct one_fixup *f = fixups; ++ fixups = fixups->next; ++ free (f); ++ } + if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents) + free (isymbuf); + if (contents != NULL +@@ -7242,7 +7360,7 @@ write_glink_stub (struct plt_entry *ent, asection *plt_sec, unsigned char *p, + p += 4; + bfd_put_32 (output_bfd, BCTR, p); + p += 4; +- bfd_put_32 (output_bfd, NOP, p); ++ bfd_put_32 (output_bfd, htab->params->ppc476_workaround ? BA : NOP, p); + p += 4; + } + else +@@ -7474,6 +7592,7 @@ ppc_elf_relocate_section (bfd *output_bfd, + bfd_boolean warned; + unsigned int tls_type, tls_mask, tls_gd; + struct plt_entry **ifunc; ++ struct reloc_howto_struct alt_howto; + + r_type = ELF32_R_TYPE (rel->r_info); + sym = NULL; +@@ -7861,7 +7980,8 @@ ppc_elf_relocate_section (bfd *output_bfd, + unresolved_reloc = FALSE; + if (htab->plt_type == PLT_NEW + || !htab->elf.dynamic_sections_created +- || h == NULL) ++ || h == NULL ++ || h->dynindx == -1) + relocation = (htab->glink->output_section->vma + + htab->glink->output_offset + + (ent->glink_offset & ~1)); +@@ -8150,9 +8270,9 @@ ppc_elf_relocate_section (bfd *output_bfd, + howto->name, + sym_name); + } +- break; ++ break; + +- /* Relocations that need no special processing. */ ++ /* Relocations that need no special processing. */ + case R_PPC_LOCAL24PC: + /* It makes no sense to point a local relocation + at a symbol not in this object. */ +@@ -8618,45 +8738,39 @@ ppc_elf_relocate_section (bfd *output_bfd, + break; + + case R_PPC_VLE_LO16A: +- relocation = (relocation + addend) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- relocation, split16a_type); ++ relocation = relocation + addend; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ relocation, split16a_type); + continue; + + case R_PPC_VLE_LO16D: +- relocation = (relocation + addend) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- relocation, split16d_type); ++ relocation = relocation + addend; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ relocation, split16d_type); + continue; + + case R_PPC_VLE_HI16A: +- relocation = ((relocation + addend) >> 16) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- relocation, split16a_type); ++ relocation = (relocation + addend) >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ relocation, split16a_type); + continue; + + case R_PPC_VLE_HI16D: +- relocation = ((relocation + addend) >> 16) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- relocation, split16d_type); ++ relocation = (relocation + addend) >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ relocation, split16d_type); + continue; + + case R_PPC_VLE_HA16A: +- { +- bfd_vma value = relocation + addend; +- value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff); +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16a_type); +- } ++ relocation = (relocation + addend + 0x8000) >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ relocation, split16a_type); + continue; + + case R_PPC_VLE_HA16D: +- { +- bfd_vma value = relocation + addend; +- value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff); +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16d_type); +- } ++ relocation = (relocation + addend + 0x8000) >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ relocation, split16d_type); + continue; + + /* Relocate against either _SDA_BASE_, _SDA2_BASE_, or 0. */ +@@ -8667,6 +8781,7 @@ ppc_elf_relocate_section (bfd *output_bfd, + { + const char *name; + int reg; ++ unsigned int insn; + struct elf_link_hash_entry *sda = NULL; + + if (sec == NULL || sec->output_section == NULL) +@@ -8720,32 +8835,41 @@ ppc_elf_relocate_section (bfd *output_bfd, + addend -= SYM_VAL (sda); + } + ++ insn = bfd_get_32 (output_bfd, contents + rel->r_offset); + if (reg == 0 + && (r_type == R_PPC_VLE_SDA21 + || r_type == R_PPC_VLE_SDA21_LO)) + { +- /* Use the split20 format. */ +- bfd_vma insn, bits12to15, bits21to31; +- bfd_vma value = (relocation + rel->r_offset) & 0xffff; +- /* Propagate sign bit, if necessary. */ +- insn = (value & 0x8000) ? 0x70107800 : 0x70000000; +- bits12to15 = value & 0x700; +- bits21to31 = value & 0x7ff; +- insn |= bits12to15; +- insn |= bits21to31; +- bfd_put_32 (output_bfd, insn, contents + rel->r_offset); ++ relocation = relocation + addend; ++ addend = 0; ++ ++ /* Force e_li insn, keeping RT from original insn. */ ++ insn &= 0x1f << 21; ++ insn |= 28u << 26; ++ ++ /* We have an li20 field, bits 17..20, 11..15, 21..31. */ ++ /* Top 4 bits of value to 17..20. */ ++ insn |= (relocation & 0xf0000) >> 5; ++ /* Next 5 bits of the value to 11..15. */ ++ insn |= (relocation & 0xf800) << 5; ++ /* And the final 11 bits of the value to bits 21 to 31. */ ++ insn |= relocation & 0x7ff; ++ ++ bfd_put_32 (output_bfd, insn, contents + rel->r_offset); ++ ++ if (r_type == R_PPC_VLE_SDA21 ++ && ((relocation + 0x80000) & 0xffffffff) > 0x100000) ++ goto overflow; + continue; + } + else if (r_type == R_PPC_EMB_SDA21 + || r_type == R_PPC_VLE_SDA21 + || r_type == R_PPC_VLE_SDA21_LO) + { +- bfd_vma insn; /* Fill in register field. */ +- +- insn = bfd_get_32 (output_bfd, contents + rel->r_offset); ++ /* Fill in register field. */ + insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT); +- bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + } ++ bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + } + break; + +@@ -8806,46 +8930,39 @@ ppc_elf_relocate_section (bfd *output_bfd, + } + } + +- value = sda->root.u.def.section->output_section->vma +- + sda->root.u.def.section->output_offset; +- +- if (r_type == R_PPC_VLE_SDAREL_LO16A) ++ value = (sda->root.u.def.section->output_section->vma ++ + sda->root.u.def.section->output_offset ++ + addend); ++ ++ if (r_type == R_PPC_VLE_SDAREL_LO16A) ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ value, split16a_type); ++ else if (r_type == R_PPC_VLE_SDAREL_LO16D) ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ value, split16d_type); ++ else if (r_type == R_PPC_VLE_SDAREL_HI16A) + { +- value = (value + addend) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16a_type); ++ value = value >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ value, split16a_type); + } +- else if (r_type == R_PPC_VLE_SDAREL_LO16D) ++ else if (r_type == R_PPC_VLE_SDAREL_HI16D) + { +- value = (value + addend) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16d_type); ++ value = value >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ value, split16d_type); + } +- else if (r_type == R_PPC_VLE_SDAREL_HI16A) ++ else if (r_type == R_PPC_VLE_SDAREL_HA16A) + { +- value = ((value + addend) >> 16) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16a_type); ++ value = (value + 0x8000) >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ value, split16a_type); + } +- else if (r_type == R_PPC_VLE_SDAREL_HI16D) ++ else if (r_type == R_PPC_VLE_SDAREL_HA16D) + { +- value = ((value + addend) >> 16) & 0xffff; +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16d_type); +- } +- else if (r_type == R_PPC_VLE_SDAREL_HA16A) +- { +- value += addend; +- value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff); +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16a_type); +- } +- else if (r_type == R_PPC_VLE_SDAREL_HA16D) +- { +- value += addend; +- value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff); +- ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset, +- value, split16d_type); ++ value = (value + 0x8000) >> 16; ++ ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset, ++ value, split16d_type); + } + } + continue; +@@ -9005,18 +9122,43 @@ ppc_elf_relocate_section (bfd *output_bfd, + ret = FALSE; + } + +- r = _bfd_final_link_relocate (howto, +- input_bfd, +- input_section, +- contents, +- rel->r_offset, +- relocation, +- addend); ++ /* 16-bit fields in insns mostly have signed values, but a ++ few insns have 16-bit unsigned values. Really, we should ++ have different reloc types. */ ++ if (howto->complain_on_overflow != complain_overflow_dont ++ && howto->dst_mask == 0xffff ++ && (input_section->flags & SEC_CODE) != 0) ++ { ++ enum complain_overflow complain = complain_overflow_signed; ++ ++ if ((elf_section_flags (input_section) & SHF_PPC_VLE) == 0) ++ { ++ unsigned int insn; ++ ++ insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3)); ++ if ((insn & (0x3f << 26)) == 10u << 26 /* cmpli */) ++ complain = complain_overflow_bitfield; ++ else if ((insn & (0x3f << 26)) == 28u << 26 /* andi */ ++ || (insn & (0x3f << 26)) == 24u << 26 /* ori */ ++ || (insn & (0x3f << 26)) == 26u << 26 /* xori */) ++ complain = complain_overflow_unsigned; ++ } ++ if (howto->complain_on_overflow != complain) ++ { ++ alt_howto = *howto; ++ alt_howto.complain_on_overflow = complain; ++ howto = &alt_howto; ++ } ++ } ++ ++ r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, ++ rel->r_offset, relocation, addend); + + if (r != bfd_reloc_ok) + { + if (r == bfd_reloc_overflow) + { ++ overflow: + if (warned) + continue; + if (h != NULL +@@ -9057,6 +9199,237 @@ ppc_elf_relocate_section (bfd *output_bfd, + fprintf (stderr, "\n"); + #endif + ++ if (htab->params->ppc476_workaround ++ && input_section->sec_info_type == SEC_INFO_TYPE_TARGET ++ && (!info->relocatable ++ || (input_section->output_section->alignment_power ++ >= htab->params->pagesize_p2))) ++ { ++ struct ppc_elf_relax_info *relax_info; ++ bfd_vma start_addr, end_addr, addr; ++ bfd_vma pagesize = (bfd_vma) 1 << htab->params->pagesize_p2; ++ ++ relax_info = elf_section_data (input_section)->sec_info; ++ if (relax_info->workaround_size != 0) ++ { ++ bfd_byte *p; ++ unsigned int n; ++ bfd_byte fill[4]; ++ ++ bfd_put_32 (input_bfd, BA, fill); ++ p = contents + input_section->size - relax_info->workaround_size; ++ n = relax_info->workaround_size >> 2; ++ while (n--) ++ { ++ memcpy (p, fill, 4); ++ p += 4; ++ } ++ } ++ ++ /* The idea is: Replace the last instruction on a page with a ++ branch to a patch area. Put the insn there followed by a ++ branch back to the next page. Complicated a little by ++ needing to handle moved conditional branches, and by not ++ wanting to touch data-in-text. */ ++ ++ start_addr = (input_section->output_section->vma ++ + input_section->output_offset); ++ end_addr = (start_addr + input_section->size ++ - relax_info->workaround_size); ++ for (addr = ((start_addr & -pagesize) + pagesize - 4); ++ addr < end_addr; ++ addr += pagesize) ++ { ++ bfd_vma offset = addr - start_addr; ++ Elf_Internal_Rela *lo, *hi; ++ bfd_boolean is_data; ++ bfd_vma patch_off, patch_addr; ++ unsigned int insn; ++ ++ /* Do we have a data reloc at this offset? If so, leave ++ the word alone. */ ++ is_data = FALSE; ++ lo = relocs; ++ hi = relend; ++ rel = NULL; ++ while (lo < hi) ++ { ++ rel = lo + (hi - lo) / 2; ++ if (rel->r_offset < offset) ++ lo = rel + 1; ++ else if (rel->r_offset > offset + 3) ++ hi = rel; ++ else ++ { ++ switch (ELF32_R_TYPE (rel->r_info)) ++ { ++ case R_PPC_ADDR32: ++ case R_PPC_UADDR32: ++ case R_PPC_REL32: ++ case R_PPC_ADDR30: ++ is_data = TRUE; ++ break; ++ default: ++ break; ++ } ++ break; ++ } ++ } ++ if (is_data) ++ continue; ++ ++ /* Some instructions can be left alone too. Unconditional ++ branches, except for bcctr with BO=0x14 (bctr, bctrl), ++ avoid the icache failure. ++ ++ The problem occurs due to prefetch across a page boundary ++ where stale instructions can be fetched from the next ++ page, and the mechanism for flushing these bad ++ instructions fails under certain circumstances. The ++ unconditional branches: ++ 1) Branch: b, bl, ba, bla, ++ 2) Branch Conditional: bc, bca, bcl, bcla, ++ 3) Branch Conditional to Link Register: bclr, bclrl, ++ where (2) and (3) have BO=0x14 making them unconditional, ++ prevent the bad prefetch because the prefetch itself is ++ affected by these instructions. This happens even if the ++ instruction is not executed. ++ ++ A bctr example: ++ . ++ . lis 9,new_page@ha ++ . addi 9,9,new_page@l ++ . mtctr 9 ++ . bctr ++ . nop ++ . nop ++ . new_page: ++ . ++ The bctr is not predicted taken due to ctr not being ++ ready, so prefetch continues on past the bctr into the ++ new page which might have stale instructions. If they ++ fail to be flushed, then they will be executed after the ++ bctr executes. Either of the following modifications ++ prevent the bad prefetch from happening in the first ++ place: ++ . ++ . lis 9,new_page@ha lis 9,new_page@ha ++ . addi 9,9,new_page@l addi 9,9,new_page@l ++ . mtctr 9 mtctr 9 ++ . bctr bctr ++ . nop b somewhere_else ++ . b somewhere_else nop ++ . new_page: new_page: ++ . */ ++ insn = bfd_get_32 (input_bfd, contents + offset); ++ if ((insn & (0x3f << 26)) == (18u << 26) /* b,bl,ba,bla */ ++ || ((insn & (0x3f << 26)) == (16u << 26) /* bc,bcl,bca,bcla*/ ++ && (insn & (0x14 << 21)) == (0x14 << 21)) /* with BO=0x14 */ ++ || ((insn & (0x3f << 26)) == (19u << 26) ++ && (insn & (0x3ff << 1)) == (16u << 1) /* bclr,bclrl */ ++ && (insn & (0x14 << 21)) == (0x14 << 21)))/* with BO=0x14 */ ++ continue; ++ ++ patch_addr = (start_addr + input_section->size ++ - relax_info->workaround_size); ++ patch_addr = (patch_addr + 15) & -16; ++ patch_off = patch_addr - start_addr; ++ bfd_put_32 (input_bfd, B + patch_off - offset, contents + offset); ++ ++ if (rel != NULL ++ && rel->r_offset >= offset ++ && rel->r_offset < offset + 4) ++ { ++ /* If the insn we are patching had a reloc, adjust the ++ reloc r_offset so that the reloc applies to the moved ++ location. This matters for -r and --emit-relocs. */ ++ if (rel + 1 != relend) ++ { ++ Elf_Internal_Rela tmp = *rel; ++ ++ /* Keep the relocs sorted by r_offset. */ ++ memmove (rel, rel + 1, (relend - (rel + 1)) * sizeof (*rel)); ++ relend[-1] = tmp; ++ } ++ relend[-1].r_offset += patch_off - offset; ++ } ++ else ++ rel = NULL; ++ ++ if ((insn & (0x3f << 26)) == (16u << 26) /* bc */ ++ && (insn & 2) == 0 /* relative */) ++ { ++ bfd_vma delta = ((insn & 0xfffc) ^ 0x8000) - 0x8000; ++ ++ delta += offset - patch_off; ++ if (info->relocatable && rel != NULL) ++ delta = 0; ++ if (!info->relocatable && rel != NULL) ++ { ++ enum elf_ppc_reloc_type r_type; ++ ++ r_type = ELF32_R_TYPE (relend[-1].r_info); ++ if (r_type == R_PPC_REL14_BRTAKEN) ++ insn |= BRANCH_PREDICT_BIT; ++ else if (r_type == R_PPC_REL14_BRNTAKEN) ++ insn &= ~BRANCH_PREDICT_BIT; ++ else ++ BFD_ASSERT (r_type == R_PPC_REL14); ++ ++ if ((r_type == R_PPC_REL14_BRTAKEN ++ || r_type == R_PPC_REL14_BRNTAKEN) ++ && delta + 0x8000 < 0x10000 ++ && (bfd_signed_vma) delta < 0) ++ insn ^= BRANCH_PREDICT_BIT; ++ } ++ if (delta + 0x8000 < 0x10000) ++ { ++ bfd_put_32 (input_bfd, ++ (insn & ~0xfffc) | (delta & 0xfffc), ++ contents + patch_off); ++ patch_off += 4; ++ bfd_put_32 (input_bfd, ++ B | ((offset + 4 - patch_off) & 0x3fffffc), ++ contents + patch_off); ++ patch_off += 4; ++ } ++ else ++ { ++ if (rel != NULL) ++ { ++ unsigned int r_sym = ELF32_R_SYM (relend[-1].r_info); ++ ++ relend[-1].r_offset += 8; ++ relend[-1].r_info = ELF32_R_INFO (r_sym, R_PPC_REL24); ++ } ++ bfd_put_32 (input_bfd, ++ (insn & ~0xfffc) | 8, ++ contents + patch_off); ++ patch_off += 4; ++ bfd_put_32 (input_bfd, ++ B | ((offset + 4 - patch_off) & 0x3fffffc), ++ contents + patch_off); ++ patch_off += 4; ++ bfd_put_32 (input_bfd, ++ B | ((delta - 8) & 0x3fffffc), ++ contents + patch_off); ++ patch_off += 4; ++ } ++ } ++ else ++ { ++ bfd_put_32 (input_bfd, insn, contents + patch_off); ++ patch_off += 4; ++ bfd_put_32 (input_bfd, ++ B | ((offset + 4 - patch_off) & 0x3fffffc), ++ contents + patch_off); ++ patch_off += 4; ++ } ++ BFD_ASSERT (patch_off <= input_section->size); ++ relax_info->workaround_size = input_section->size - patch_off; ++ } ++ } ++ + return ret; + } + +@@ -9331,7 +9704,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd, + + p = (unsigned char *) htab->glink->contents + ent->glink_offset; + +- if (h == htab->tls_get_addr && !htab->no_tls_get_addr_opt) ++ if (h == htab->tls_get_addr && !htab->params->no_tls_get_addr_opt) + { + bfd_put_32 (output_bfd, LWZ_11_3, p); + p += 4; +@@ -9741,7 +10114,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + p += htab->glink_pltresolve; + endp = htab->glink->contents; + endp += htab->glink->size - GLINK_PLTRESOLVE; +- while (p < endp - 8 * 4) ++ while (p < endp - (htab->params->ppc476_workaround ? 0 : 8 * 4)) + { + bfd_put_32 (output_bfd, B + endp - p, p); + p += 4; +@@ -9756,6 +10129,39 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + + htab->glink->output_section->vma + + htab->glink->output_offset); + ++ if (htab->params->ppc476_workaround) ++ { ++ /* Ensure that a call stub at the end of a page doesn't ++ result in prefetch over the end of the page into the ++ glink branch table. */ ++ bfd_vma pagesize = (bfd_vma) 1 << htab->params->pagesize_p2; ++ bfd_vma page_addr; ++ bfd_vma glink_start = (htab->glink->output_section->vma ++ + htab->glink->output_offset); ++ ++ for (page_addr = res0 & -pagesize; ++ page_addr > glink_start; ++ page_addr -= pagesize) ++ { ++ /* We have a plt call stub that may need fixing. */ ++ bfd_byte *loc; ++ unsigned int insn; ++ ++ loc = htab->glink->contents + page_addr - 4 - glink_start; ++ insn = bfd_get_32 (output_bfd, loc); ++ if (insn == BCTR) ++ { ++ /* By alignment, we know that there must be at least ++ one other call stub before this one. */ ++ insn = bfd_get_32 (output_bfd, loc - 16); ++ if (insn == BCTR) ++ bfd_put_32 (output_bfd, B | (-16 & 0x3fffffc), loc); ++ else ++ bfd_put_32 (output_bfd, B | (-20 & 0x3fffffc), loc); ++ } ++ } ++ } ++ + /* Last comes the PLTresolve stub. */ + if (info->shared) + { +@@ -9763,7 +10169,11 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + + for (i = 0; i < ARRAY_SIZE (pic_plt_resolve); i++) + { +- bfd_put_32 (output_bfd, pic_plt_resolve[i], p); ++ unsigned int insn = pic_plt_resolve[i]; ++ ++ if (htab->params->ppc476_workaround && insn == NOP) ++ insn = BA + 0; ++ bfd_put_32 (output_bfd, insn, p); + p += 4; + } + p -= 4 * ARRAY_SIZE (pic_plt_resolve); +@@ -9797,7 +10207,11 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, + { + for (i = 0; i < ARRAY_SIZE (plt_resolve); i++) + { +- bfd_put_32 (output_bfd, plt_resolve[i], p); ++ unsigned int insn = plt_resolve[i]; ++ ++ if (htab->params->ppc476_workaround && insn == NOP) ++ insn = BA + 0; ++ bfd_put_32 (output_bfd, insn, p); + p += 4; + } + p -= 4 * ARRAY_SIZE (plt_resolve); +diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h +index 0bf973c..fef177a 100644 +--- a/bfd/elf32-ppc.h ++++ b/bfd/elf32-ppc.h +@@ -26,9 +26,29 @@ enum ppc_elf_plt_type + PLT_VXWORKS + }; + +-int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *, +- enum ppc_elf_plt_type, int); +-asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *, int); ++/* Various options passed from the linker to bfd backend. */ ++struct ppc_elf_params ++{ ++ /* Chooses the type of .plt. */ ++ enum ppc_elf_plt_type plt_style; ++ ++ /* Whether to emit symbols for stubs. */ ++ int emit_stub_syms; ++ ++ /* Whether to emit special stub for __tls_get_addr calls. */ ++ int no_tls_get_addr_opt; ++ ++ /* Insert trampolines for branches that won't reach their destination. */ ++ int branch_trampolines; ++ ++ /* Avoid execution falling into new page. */ ++ int ppc476_workaround; ++ unsigned int pagesize_p2; ++}; ++ ++void ppc_elf_link_params (struct bfd_link_info *, struct ppc_elf_params *); ++int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *); ++asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *); + bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *); + void ppc_elf_set_sdata_syms (bfd *, struct bfd_link_info *); + extern bfd_boolean ppc_elf_modify_segment_map (bfd *, +diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c +index bf13a5d..b3466d7 100644 +--- a/bfd/elf64-ppc.c ++++ b/bfd/elf64-ppc.c +@@ -96,7 +96,7 @@ static bfd_vma opd_entry_value + #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections + #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol + #define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook +-#define elf_backend_check_directives ppc64_elf_process_dot_syms ++#define elf_backend_check_directives ppc64_elf_before_check_relocs + #define elf_backend_notice_as_needed ppc64_elf_notice_as_needed + #define elf_backend_archive_symbol_lookup ppc64_elf_archive_symbol_lookup + #define elf_backend_check_relocs ppc64_elf_check_relocs +@@ -134,7 +134,7 @@ static bfd_vma opd_entry_value + /* Offsets to some stack save slots. */ + #define STK_LR 16 + #define STK_TOC(htab) (htab->opd_abi ? 40 : 24) +-/* This one is dodgy. ABIv2 does not have a linker word, so use the ++/* This one is dodgy. ELFv2 does not have a linker word, so use the + CR save slot. Used only by optimised __tls_get_addr call stub, + relying on __tls_get_addr_opt not saving CR.. */ + #define STK_LINKER(htab) (htab->opd_abi ? 32 : 8) +@@ -175,6 +175,7 @@ static bfd_vma opd_entry_value + + #define LD_R2_0R1 0xe8410000 /* ld %r2,0(%r1) */ + ++#define ADDIS_R12_R2 0x3d820000 /* addis %r12,%r2,xxx@ha */ + #define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,xxx@ha */ + #define LD_R12_0R12 0xe98c0000 /* ld %r12,xxx@l(%r12) */ + +@@ -359,7 +360,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + ppc64_elf_branch_reloc, /* special_function */ + "R_PPC64_ADDR14", /* name */ + FALSE, /* partial_inplace */ +@@ -376,7 +377,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + ppc64_elf_brtaken_reloc, /* special_function */ + "R_PPC64_ADDR14_BRTAKEN",/* name */ + FALSE, /* partial_inplace */ +@@ -393,7 +394,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + ppc64_elf_brtaken_reloc, /* special_function */ + "R_PPC64_ADDR14_BRNTAKEN",/* name */ + FALSE, /* partial_inplace */ +@@ -634,7 +635,6 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ +- /* FIXME: Verify. Was complain_overflow_bitfield. */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC64_REL32", /* name */ +@@ -729,7 +729,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + ppc64_elf_sectoff_reloc, /* special_function */ + "R_PPC64_SECTOFF", /* name */ + FALSE, /* partial_inplace */ +@@ -1017,7 +1017,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_dont, /* complain_on_overflow */ + ppc64_elf_toc64_reloc, /* special_function */ + "R_PPC64_TOC", /* name */ + FALSE, /* partial_inplace */ +@@ -1105,7 +1105,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC64_ADDR16_DS", /* name */ + FALSE, /* partial_inplace */ +@@ -1180,7 +1180,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + ppc64_elf_sectoff_reloc, /* special_function */ + "R_PPC64_SECTOFF_DS", /* name */ + FALSE, /* partial_inplace */ +@@ -1952,7 +1952,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ +- complain_overflow_bitfield, /* complain_on_overflow */ ++ complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC64_REL16", /* name */ + FALSE, /* partial_inplace */ +@@ -3874,12 +3874,8 @@ struct ppc_link_hash_table + /* Hash table for function prologue tocsave. */ + htab_t tocsave_htab; + +- /* Linker stub bfd. */ +- bfd *stub_bfd; +- +- /* Linker call-backs. */ +- asection * (*add_stub_section) (const char *, asection *); +- void (*layout_sections_again) (void); ++ /* Various options and other info passed from the linker. */ ++ struct ppc64_elf_params *params; + + /* Array to keep track of which stub sections have been created, and + information on stub grouping. */ +@@ -3931,24 +3927,9 @@ struct ppc_link_hash_table + /* Number of stubs against global syms. */ + unsigned long stub_globals; + +- /* Alignment of PLT call stubs. */ +- unsigned int plt_stub_align:4; +- + /* Set if we're linking code with function descriptors. */ + unsigned int opd_abi:1; + +- /* Set if PLT call stubs should load r11. */ +- unsigned int plt_static_chain:1; +- +- /* Set if PLT call stubs need a read-read barrier. */ +- unsigned int plt_thread_safe:1; +- +- /* Set if we should emit symbols for stubs. */ +- unsigned int emit_stub_syms:1; +- +- /* Set if __tls_get_addr optimization should not be done. */ +- unsigned int no_tls_get_addr_opt:1; +- + /* Support for multiple toc sections. */ + unsigned int do_multi_toc:1; + unsigned int multi_toc_needed:1; +@@ -3958,7 +3939,7 @@ struct ppc_link_hash_table + /* Set on error. */ + unsigned int stub_error:1; + +- /* Temp used by ppc64_elf_process_dot_syms. */ ++ /* Temp used by ppc64_elf_before_check_relocs. */ + unsigned int twiddled_syms:1; + + /* Incremented every time we size stubs. */ +@@ -4292,11 +4273,12 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) + /* Satisfy the ELF linker by filling in some fields in our fake bfd. */ + + bfd_boolean +-ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info) ++ppc64_elf_init_stub_bfd (struct bfd_link_info *info, ++ struct ppc64_elf_params *params) + { + struct ppc_link_hash_table *htab; + +- elf_elfheader (abfd)->e_ident[EI_CLASS] = ELFCLASS64; ++ elf_elfheader (params->stub_bfd)->e_ident[EI_CLASS] = ELFCLASS64; + + /* Always hook our dynamic sections into the first bfd, which is the + linker created stub bfd. This ensures that the GOT header is at +@@ -4304,8 +4286,8 @@ ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info) + htab = ppc_hash_table (info); + if (htab == NULL) + return FALSE; +- htab->stub_bfd = abfd; +- htab->elf.dynobj = abfd; ++ htab->elf.dynobj = params->stub_bfd; ++ htab->params = params; + + if (info->relocatable) + return TRUE; +@@ -4430,13 +4412,13 @@ ppc_add_stub (const char *stub_name, + + namelen = strlen (link_sec->name); + len = namelen + sizeof (STUB_SUFFIX); +- s_name = bfd_alloc (htab->stub_bfd, len); ++ s_name = bfd_alloc (htab->params->stub_bfd, len); + if (s_name == NULL) + return NULL; + + memcpy (s_name, link_sec->name, namelen); + memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX)); +- stub_sec = (*htab->add_stub_section) (s_name, link_sec); ++ stub_sec = (*htab->params->add_stub_section) (s_name, link_sec); + if (stub_sec == NULL) + return NULL; + htab->stub_group[link_sec->id].stub_sec = stub_sec; +@@ -4922,10 +4904,11 @@ add_symbol_adjust (struct ppc_link_hash_entry *eh, struct bfd_link_info *info) + return TRUE; + } + +-/* Process list of dot-symbols we made in link_hash_newfunc. */ ++/* Set up opd section info and abiversion for IBFD, and process list ++ of dot-symbols we made in link_hash_newfunc. */ + + static bfd_boolean +-ppc64_elf_process_dot_syms (bfd *ibfd, struct bfd_link_info *info) ++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; +@@ -4938,6 +4921,57 @@ ppc64_elf_process_dot_syms (bfd *ibfd, struct bfd_link_info *info) + + if (is_ppc64_elf (ibfd)) + { ++ 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) ++ { ++ 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; ++ } ++ } ++ ++ /* 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) + { +@@ -5001,10 +5035,8 @@ ppc64_elf_link_just_syms (asection *sec, struct bfd_link_info *info) + && (sec->owner->flags & (EXEC_P | DYNAMIC)) != 0 + && is_ppc64_elf (sec->owner)) + { +- asection *got = bfd_get_section_by_name (sec->owner, ".got"); +- if (got != NULL +- && got->size >= elf_backend_got_header_size +- && bfd_get_section_by_name (sec->owner, ".opd") != NULL) ++ if (abiversion (sec->owner) >= 2 ++ || bfd_get_section_by_name (sec->owner, ".opd") != NULL) + sec->has_toc_reloc = 1; + } + _bfd_elf_link_just_syms (sec, info); +@@ -5143,34 +5175,9 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + sym_hashes = elf_sym_hashes (abfd); + sreloc = NULL; + opd_sym_map = NULL; +- if (strcmp (sec->name, ".opd") == 0) +- { +- /* 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; +- +- if (abiversion (abfd) == 0) +- set_abiversion (abfd, 1); +- else if (abiversion (abfd) == 2) +- { +- info->callbacks->einfo (_("%P: .opd not allowed in ABI version %d\n"), +- abiversion (abfd)); +- bfd_set_error (bfd_error_bad_value); +- return FALSE; +- } +- amt = sec->size * sizeof (*opd_sym_map) / 8; +- opd_sym_map = bfd_zalloc (abfd, amt); +- if (opd_sym_map == NULL) +- return FALSE; +- ppc64_elf_section_data (sec)->u.opd.func_sec = opd_sym_map; +- BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal); +- ppc64_elf_section_data (sec)->sec_type = sec_opd; +- } ++ if (ppc64_elf_section_data (sec) != NULL ++ && ppc64_elf_section_data (sec)->sec_type == sec_opd) ++ opd_sym_map = ppc64_elf_section_data (sec)->u.opd.func_sec; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) +@@ -5344,7 +5351,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + + /* We may also need a plt entry if the symbol turns out to be + an ifunc. */ +- if (h != NULL && !info->shared && abiversion (abfd) == 2) ++ if (h != NULL && !info->shared && abiversion (abfd) != 1) + { + if (!update_plt_info (abfd, &h->plt.plist, rel->r_addend)) + return FALSE; +@@ -5613,7 +5620,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + case R_PPC64_ADDR16_HIGHESTA: + case R_PPC64_ADDR16_LO: + case R_PPC64_ADDR16_LO_DS: +- if (h != NULL && !info->shared && abiversion (abfd) == 2 ++ if (h != NULL && !info->shared && abiversion (abfd) != 1 + && rel->r_addend == 0) + { + /* We may need a .plt entry if this reloc refers to a +@@ -5787,21 +5794,14 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) + iflags = elf_elfheader (ibfd)->e_flags; + oflags = elf_elfheader (obfd)->e_flags; + +- if (!elf_flags_init (obfd) || oflags == 0) +- { +- elf_flags_init (obfd) = TRUE; +- elf_elfheader (obfd)->e_flags = iflags; +- } +- else if (iflags == oflags || iflags == 0) +- ; +- else if (iflags & ~EF_PPC64_ABI) ++ if (iflags & ~EF_PPC64_ABI) + { + (*_bfd_error_handler) + (_("%B uses unknown e_flags 0x%lx"), ibfd, iflags); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } +- else ++ else if (iflags != oflags && iflags != 0) + { + (*_bfd_error_handler) + (_("%B: ABI version %ld is not compatible with ABI version %ld output"), +@@ -6144,6 +6144,7 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf) + struct bfd_link_info *info = (struct bfd_link_info *) inf; + struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h; + struct ppc_link_hash_entry *fdh; ++ struct bfd_elf_dynamic_list *d = info->dynamic_list; + + /* Dynamic linking info is on the func descriptor sym. */ + fdh = defined_func_desc (eh); +@@ -6153,10 +6154,14 @@ 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 +- || (!info->executable +- && eh->elf.def_regular ++ || (eh->elf.def_regular + && ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL + && ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN ++ && (!info->executable ++ || info->export_dynamic ++ || (eh->elf.dynamic ++ && d != NULL ++ && (*d->match) (&d->head, NULL, eh->elf.root.root.string))) + && (strchr (eh->elf.root.root.string, ELF_VER_CHR) != NULL + || !bfd_hide_sym_by_version (info->version_info, + eh->elf.root.root.string))))) +@@ -6856,7 +6861,7 @@ ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED, + + /* Provide any missing _save* and _rest* functions. */ + htab->sfpr->size = 0; +- if (!info->relocatable) ++ if (htab->params->save_restore_funcs) + for (i = 0; i < sizeof (funcs) / sizeof (funcs[0]); i++) + if (!sfpr_define (info, &funcs[i])) + return FALSE; +@@ -7500,11 +7505,16 @@ dec_dynrel_count (bfd_vma r_info, + applications. */ + + bfd_boolean +-ppc64_elf_edit_opd (struct bfd_link_info *info, bfd_boolean non_overlapping) ++ppc64_elf_edit_opd (struct bfd_link_info *info) + { + bfd *ibfd; + bfd_boolean some_edited = FALSE; + asection *need_pad = NULL; ++ struct ppc_link_hash_table *htab; ++ ++ htab = ppc_hash_table (info); ++ if (htab == NULL) ++ return FALSE; + + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { +@@ -7657,7 +7667,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info, bfd_boolean non_overlapping) + goto broken_opd; + } + +- add_aux_fields = non_overlapping && cnt_16b > 0; ++ add_aux_fields = htab->params->non_overlapping_opd && cnt_16b > 0; + + if (need_edit || add_aux_fields) + { +@@ -7748,12 +7758,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info, bfd_boolean non_overlapping) + if (h != NULL + && h->root.root.string[0] == '.') + { +- struct ppc_link_hash_table *htab; +- +- htab = ppc_hash_table (info); +- if (htab != NULL) +- fdh = lookup_fdh ((struct ppc_link_hash_entry *) h, +- htab); ++ 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) +@@ -7902,9 +7907,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info, bfd_boolean non_overlapping) + /* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ + + asection * +-ppc64_elf_tls_setup (struct bfd_link_info *info, +- int no_tls_get_addr_opt, +- int *no_multi_toc) ++ppc64_elf_tls_setup (struct bfd_link_info *info) + { + struct ppc_link_hash_table *htab; + +@@ -7915,10 +7918,10 @@ ppc64_elf_tls_setup (struct bfd_link_info *info, + if (abiversion (info->output_bfd) == 1) + htab->opd_abi = 1; + +- if (*no_multi_toc) ++ if (htab->params->no_multi_toc) + htab->do_multi_toc = 0; + else if (!htab->do_multi_toc) +- *no_multi_toc = 1; ++ htab->params->no_multi_toc = 1; + + htab->tls_get_addr = ((struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, ".__tls_get_addr", +@@ -7929,7 +7932,7 @@ ppc64_elf_tls_setup (struct bfd_link_info *info, + htab->tls_get_addr_fd = ((struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, "__tls_get_addr", + FALSE, FALSE, TRUE)); +- if (!no_tls_get_addr_opt) ++ if (!htab->params->no_tls_get_addr_opt) + { + struct elf_link_hash_entry *opt, *opt_fd, *tga, *tga_fd; + +@@ -7997,9 +8000,8 @@ ppc64_elf_tls_setup (struct bfd_link_info *info, + } + } + else +- no_tls_get_addr_opt = TRUE; ++ htab->params->no_tls_get_addr_opt = TRUE; + } +- htab->no_tls_get_addr_opt = no_tls_get_addr_opt; + return _bfd_elf_tls_setup (info->output_bfd, info); + } + +@@ -9910,7 +9912,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd, + return FALSE; + } + +- tls_opt = (!htab->no_tls_get_addr_opt ++ tls_opt = (!htab->params->no_tls_get_addr_opt + && htab->tls_get_addr_fd != NULL + && htab->tls_get_addr_fd->elf.plt.plist != NULL); + if (tls_opt || !htab->opd_abi) +@@ -10082,17 +10084,17 @@ plt_stub_size (struct ppc_link_hash_table *htab, + if (htab->opd_abi) + { + size += 4; +- if (htab->plt_static_chain) ++ if (htab->params->plt_static_chain) + size += 4; +- if (htab->plt_thread_safe) ++ if (htab->params->plt_thread_safe) + size += 8; +- if (PPC_HA (off + 8 + 8 * htab->plt_static_chain) != PPC_HA (off)) ++ if (PPC_HA (off + 8 + 8 * htab->params->plt_static_chain) != PPC_HA (off)) + size += 4; + } + if (stub_entry->h != NULL + && (stub_entry->h == htab->tls_get_addr_fd + || stub_entry->h == htab->tls_get_addr) +- && !htab->no_tls_get_addr_opt) ++ && !htab->params->no_tls_get_addr_opt) + size += 13 * 4; + return size; + } +@@ -10104,7 +10106,7 @@ plt_stub_pad (struct ppc_link_hash_table *htab, + struct ppc_stub_hash_entry *stub_entry, + bfd_vma plt_off) + { +- int stub_align = 1 << htab->plt_stub_align; ++ int stub_align = 1 << htab->params->plt_stub_align; + unsigned stub_size = plt_stub_size (htab, stub_entry, plt_off); + bfd_vma stub_off = stub_entry->stub_sec->size; + +@@ -10121,10 +10123,10 @@ build_plt_stub (struct ppc_link_hash_table *htab, + struct ppc_stub_hash_entry *stub_entry, + bfd_byte *p, bfd_vma offset, Elf_Internal_Rela *r) + { +- bfd *obfd = htab->stub_bfd; ++ bfd *obfd = htab->params->stub_bfd; + bfd_boolean plt_load_toc = htab->opd_abi; +- bfd_boolean plt_static_chain = htab->plt_static_chain; +- bfd_boolean plt_thread_safe = htab->plt_thread_safe; ++ bfd_boolean plt_static_chain = htab->params->plt_static_chain; ++ bfd_boolean plt_thread_safe = htab->params->plt_thread_safe; + bfd_boolean use_fake_dep = plt_thread_safe; + bfd_vma cmp_branch_off = 0; + +@@ -10134,7 +10136,7 @@ build_plt_stub (struct ppc_link_hash_table *htab, + && !(stub_entry->h != NULL + && (stub_entry->h == htab->tls_get_addr_fd + || stub_entry->h == htab->tls_get_addr) +- && !htab->no_tls_get_addr_opt)) ++ && !htab->params->no_tls_get_addr_opt)) + { + bfd_vma pltoff = stub_entry->plt_ent->plt.offset & ~1; + bfd_vma pltindex = ((pltoff - PLT_INITIAL_ENTRY_SIZE (htab)) +@@ -10197,8 +10199,16 @@ build_plt_stub (struct ppc_link_hash_table *htab, + if (ALWAYS_EMIT_R2SAVE + || stub_entry->stub_type == ppc_stub_plt_call_r2save) + bfd_put_32 (obfd, STD_R2_0R1 + STK_TOC (htab), p), p += 4; +- bfd_put_32 (obfd, ADDIS_R11_R2 | PPC_HA (offset), p), p += 4; +- bfd_put_32 (obfd, LD_R12_0R11 | PPC_LO (offset), p), p += 4; ++ if (plt_load_toc) ++ { ++ bfd_put_32 (obfd, ADDIS_R11_R2 | PPC_HA (offset), p), p += 4; ++ bfd_put_32 (obfd, LD_R12_0R11 | PPC_LO (offset), p), p += 4; ++ } ++ else ++ { ++ bfd_put_32 (obfd, ADDIS_R12_R2 | PPC_HA (offset), p), p += 4; ++ bfd_put_32 (obfd, LD_R12_0R12 | PPC_LO (offset), p), p += 4; ++ } + if (plt_load_toc + && PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset)) + { +@@ -10301,7 +10311,7 @@ build_tls_get_addr_stub (struct ppc_link_hash_table *htab, + struct ppc_stub_hash_entry *stub_entry, + bfd_byte *p, bfd_vma offset, Elf_Internal_Rela *r) + { +- bfd *obfd = htab->stub_bfd; ++ bfd *obfd = htab->params->stub_bfd; + + bfd_put_32 (obfd, LD_R11_0R3 + 0, p), p += 4; + bfd_put_32 (obfd, LD_R12_0R3 + 8, p), p += 4; +@@ -10443,20 +10453,21 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + htab->stub_error = TRUE; + return FALSE; + } +- bfd_put_32 (htab->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc); ++ bfd_put_32 (htab->params->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc); + loc += 4; + size = 12; + if (PPC_HA (r2off) != 0) + { + size = 16; +- bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc); ++ bfd_put_32 (htab->params->stub_bfd, ++ ADDIS_R2_R2 | PPC_HA (r2off), loc); + loc += 4; + } +- bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc); ++ bfd_put_32 (htab->params->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc); + loc += 4; + off -= size - 4; + } +- bfd_put_32 (htab->stub_bfd, B_DOT | (off & 0x3fffffc), loc); ++ bfd_put_32 (htab->params->stub_bfd, B_DOT | (off & 0x3fffffc), loc); + + if (off + (1 << 25) >= (bfd_vma) (1 << 26)) + { +@@ -10481,16 +10492,16 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + unsigned long symndx; + struct ppc_link_hash_entry *h; + +- hashes = elf_sym_hashes (htab->stub_bfd); ++ hashes = elf_sym_hashes (htab->params->stub_bfd); + if (hashes == NULL) + { + bfd_size_type hsize; + + hsize = (htab->stub_globals + 1) * sizeof (*hashes); +- hashes = bfd_zalloc (htab->stub_bfd, hsize); ++ hashes = bfd_zalloc (htab->params->stub_bfd, hsize); + if (hashes == NULL) + return FALSE; +- elf_sym_hashes (htab->stub_bfd) = hashes; ++ elf_sym_hashes (htab->params->stub_bfd) = hashes; + htab->stub_globals = 1; + } + symndx = htab->stub_globals++; +@@ -10599,8 +10610,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + r[0].r_offset = loc - stub_entry->stub_sec->contents; + if (bfd_big_endian (info->output_bfd)) + r[0].r_offset += 2; +- if (stub_entry->stub_type == ppc_stub_plt_branch_r2off +- && htab->opd_abi) ++ if (stub_entry->stub_type == ppc_stub_plt_branch_r2off) + r[0].r_offset += 4; + r[0].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS); + r[0].r_addend = dest; +@@ -10613,61 +10623,68 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + } + } + +- if (stub_entry->stub_type != ppc_stub_plt_branch_r2off +- || !htab->opd_abi) ++ if (stub_entry->stub_type != ppc_stub_plt_branch_r2off) + { + if (PPC_HA (off) != 0) + { + size = 16; +- bfd_put_32 (htab->stub_bfd, ADDIS_R11_R2 | PPC_HA (off), loc); ++ bfd_put_32 (htab->params->stub_bfd, ++ ADDIS_R12_R2 | PPC_HA (off), loc); + loc += 4; +- bfd_put_32 (htab->stub_bfd, LD_R12_0R11 | PPC_LO (off), loc); ++ bfd_put_32 (htab->params->stub_bfd, ++ LD_R12_0R12 | PPC_LO (off), loc); + } + else + { + size = 12; +- bfd_put_32 (htab->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc); ++ bfd_put_32 (htab->params->stub_bfd, ++ LD_R12_0R2 | PPC_LO (off), loc); + } + } + else + { + bfd_vma r2off = get_r2off (info, stub_entry); + +- if (r2off == 0) ++ if (r2off == 0 && htab->opd_abi) + { + htab->stub_error = TRUE; + return FALSE; + } + +- bfd_put_32 (htab->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc); ++ bfd_put_32 (htab->params->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc); + loc += 4; +- size = 20; ++ size = 16; + if (PPC_HA (off) != 0) + { + size += 4; +- bfd_put_32 (htab->stub_bfd, ADDIS_R11_R2 | PPC_HA (off), loc); +- loc += 4; +- bfd_put_32 (htab->stub_bfd, LD_R12_0R11 | PPC_LO (off), loc); ++ bfd_put_32 (htab->params->stub_bfd, ++ ADDIS_R12_R2 | PPC_HA (off), loc); + loc += 4; ++ bfd_put_32 (htab->params->stub_bfd, ++ LD_R12_0R12 | PPC_LO (off), loc); + } + else ++ bfd_put_32 (htab->params->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc); ++ ++ if (PPC_HA (r2off) != 0) + { +- bfd_put_32 (htab->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc); ++ size += 4; + loc += 4; ++ bfd_put_32 (htab->params->stub_bfd, ++ ADDIS_R2_R2 | PPC_HA (r2off), loc); + } +- +- if (PPC_HA (r2off) != 0) ++ if (PPC_LO (r2off) != 0) + { + size += 4; +- bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc); + loc += 4; ++ bfd_put_32 (htab->params->stub_bfd, ++ ADDI_R2_R2 | PPC_LO (r2off), loc); + } +- bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc); + } + loc += 4; +- bfd_put_32 (htab->stub_bfd, MTCTR_R12, loc); ++ bfd_put_32 (htab->params->stub_bfd, MTCTR_R12, loc); + loc += 4; +- bfd_put_32 (htab->stub_bfd, BCTR, loc); ++ bfd_put_32 (htab->params->stub_bfd, BCTR, loc); + break; + + case ppc_stub_plt_call: +@@ -10741,7 +10758,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + return FALSE; + } + +- if (htab->plt_stub_align != 0) ++ if (htab->params->plt_stub_align != 0) + { + unsigned pad = plt_stub_pad (htab, stub_entry, off); + +@@ -10754,10 +10771,11 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + if (info->emitrelocations) + { + r = get_relocs (stub_entry->stub_sec, +- (2 +- + (PPC_HA (off) != 0) +- + (htab->plt_static_chain +- && PPC_HA (off + 16) == PPC_HA (off)))); ++ ((PPC_HA (off) != 0) ++ + (htab->opd_abi ++ ? 2 + (htab->params->plt_static_chain ++ && PPC_HA (off + 16) == PPC_HA (off)) ++ : 1))); + if (r == NULL) + return FALSE; + r[0].r_offset = loc - stub_entry->stub_sec->contents; +@@ -10768,7 +10786,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + if (stub_entry->h != NULL + && (stub_entry->h == htab->tls_get_addr_fd + || stub_entry->h == htab->tls_get_addr) +- && !htab->no_tls_get_addr_opt) ++ && !htab->params->no_tls_get_addr_opt) + p = build_tls_get_addr_stub (htab, stub_entry, loc, off, r); + else + p = build_plt_stub (htab, stub_entry, loc, off, r); +@@ -10782,7 +10800,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + + stub_entry->stub_sec->size += size; + +- if (htab->emit_stub_syms) ++ if (htab->params->emit_stub_syms) + { + struct elf_link_hash_entry *h; + size_t len1, len2; +@@ -10860,14 +10878,14 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + - htab->stub_group[stub_entry->id_sec->id].toc_off); + + size = plt_stub_size (htab, stub_entry, off); +- if (htab->plt_stub_align) ++ if (htab->params->plt_stub_align) + size += plt_stub_pad (htab, stub_entry, off); + if (info->emitrelocations) + { + stub_entry->stub_sec->reloc_count + += ((PPC_HA (off) != 0) + + (htab->opd_abi +- ? 2 + (htab->plt_static_chain ++ ? 2 + (htab->params->plt_static_chain + && PPC_HA (off + 16) == PPC_HA (off)) + : 1)); + stub_entry->stub_sec->flags |= SEC_RELOC; +@@ -10956,8 +10974,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + stub_entry->stub_sec->flags |= SEC_RELOC; + } + +- if (stub_entry->stub_type != ppc_stub_plt_branch_r2off +- || !htab->opd_abi) ++ if (stub_entry->stub_type != ppc_stub_plt_branch_r2off) + { + size = 12; + if (PPC_HA (off) != 0) +@@ -10965,12 +10982,14 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + } + else + { +- size = 20; ++ size = 16; + if (PPC_HA (off) != 0) + size += 4; + + if (PPC_HA (r2off) != 0) + size += 4; ++ if (PPC_LO (r2off) != 0) ++ size += 4; + } + } + else if (info->emitrelocations) +@@ -10989,10 +11008,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) + 0 when no stubs will be needed, and 1 on success. */ + + int +-ppc64_elf_setup_section_lists +- (struct bfd_link_info *info, +- asection *(*add_stub_section) (const char *, asection *), +- void (*layout_sections_again) (void)) ++ppc64_elf_setup_section_lists (struct bfd_link_info *info) + { + bfd *input_bfd; + int top_id, top_index, id; +@@ -11003,9 +11019,6 @@ ppc64_elf_setup_section_lists + + if (htab == NULL) + return -1; +- /* Stash our params away. */ +- htab->add_stub_section = add_stub_section; +- htab->layout_sections_again = layout_sections_again; + + /* Find the top input section id. */ + for (input_bfd = info->input_bfds, top_id = 3; +@@ -11342,7 +11355,7 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info) + } + + if (done_something) +- (*htab->layout_sections_again) (); ++ (*htab->params->layout_sections_again) (); + + /* Set up for second pass over toc sections to recalculate elf_gp + on input sections. */ +@@ -11829,9 +11842,7 @@ maybe_strip_output (struct bfd_link_info *info, asection *isec) + instruction. */ + + bfd_boolean +-ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, +- bfd_boolean plt_static_chain, int plt_thread_safe, +- int plt_stub_align) ++ppc64_elf_size_stubs (struct bfd_link_info *info) + { + bfd_size_type stub_group_size; + bfd_boolean stubs_always_before_branch; +@@ -11840,13 +11851,11 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, + if (htab == NULL) + return FALSE; + +- htab->plt_static_chain = plt_static_chain; +- htab->plt_stub_align = plt_stub_align; +- if (plt_thread_safe == -1 && !info->executable) +- plt_thread_safe = 1; ++ if (htab->params->plt_thread_safe == -1 && !info->executable) ++ htab->params->plt_thread_safe = 1; + if (!htab->opd_abi) +- plt_thread_safe = 0; +- else if (plt_thread_safe == -1) ++ htab->params->plt_thread_safe = 0; ++ else if (htab->params->plt_thread_safe == -1) + { + static const char *const thread_starter[] = + { +@@ -11873,17 +11882,16 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, + struct elf_link_hash_entry *h; + h = elf_link_hash_lookup (&htab->elf, thread_starter[i], + FALSE, FALSE, TRUE); +- plt_thread_safe = h != NULL && h->ref_regular; +- if (plt_thread_safe) ++ htab->params->plt_thread_safe = h != NULL && h->ref_regular; ++ if (htab->params->plt_thread_safe) + break; + } + } +- htab->plt_thread_safe = plt_thread_safe; +- stubs_always_before_branch = group_size < 0; +- if (group_size < 0) +- stub_group_size = -group_size; ++ stubs_always_before_branch = htab->params->group_size < 0; ++ if (htab->params->group_size < 0) ++ stub_group_size = -htab->params->group_size; + else +- stub_group_size = group_size; ++ stub_group_size = htab->params->group_size; + + group_sections (htab, stub_group_size, stubs_always_before_branch); + +@@ -12199,7 +12207,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, + + /* We may have added some stubs. Find out the new size of the + stub sections. */ +- for (stub_sec = htab->stub_bfd->sections; ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) +@@ -12231,7 +12239,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, + { + size_t size = 0, align; + +- for (stub_sec = htab->stub_bfd->sections; ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) +@@ -12248,15 +12256,16 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, + htab->glink_eh_frame->size = size; + } + +- if (htab->plt_stub_align != 0) +- for (stub_sec = htab->stub_bfd->sections; ++ if (htab->params->plt_stub_align != 0) ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) +- stub_sec->size = ((stub_sec->size + (1 << htab->plt_stub_align) - 1) +- & (-1 << htab->plt_stub_align)); ++ stub_sec->size = ((stub_sec->size ++ + (1 << htab->params->plt_stub_align) - 1) ++ & (-1 << htab->params->plt_stub_align)); + +- for (stub_sec = htab->stub_bfd->sections; ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0 +@@ -12271,7 +12280,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, + break; + + /* Ask the linker to do its stuff. */ +- (*htab->layout_sections_again) (); ++ (*htab->params->layout_sections_again) (); + } + + maybe_strip_output (info, htab->brlt); +@@ -12423,8 +12432,7 @@ build_global_entry_stubs (struct elf_link_hash_entry *h, void *inf) + hash table. This function is called via gldelf64ppc_finish. */ + + bfd_boolean +-ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, +- struct bfd_link_info *info, ++ppc64_elf_build_stubs (struct bfd_link_info *info, + char **stats) + { + struct ppc_link_hash_table *htab = ppc_hash_table (info); +@@ -12435,16 +12443,14 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, + if (htab == NULL) + return FALSE; + +- htab->emit_stub_syms = emit_stub_syms; +- + /* Allocate memory to hold the linker stubs. */ +- for (stub_sec = htab->stub_bfd->sections; ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0 + && stub_sec->size != 0) + { +- stub_sec->contents = bfd_zalloc (htab->stub_bfd, stub_sec->size); ++ stub_sec->contents = bfd_zalloc (htab->params->stub_bfd, stub_sec->size); + if (stub_sec->contents == NULL) + return FALSE; + /* We want to check that built size is the same as calculated +@@ -12459,7 +12465,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, + bfd_vma plt0; + + /* Build the .glink plt call stub. */ +- if (htab->emit_stub_syms) ++ if (htab->params->emit_stub_syms) + { + struct elf_link_hash_entry *h; + h = elf_link_hash_lookup (&htab->elf, "__glink_PLTresolve", +@@ -12620,7 +12626,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, + bfd_put_32 (htab->elf.dynobj, last_fde_len, p); + p += sizeof (glink_eh_frame_cie); + +- for (stub_sec = htab->stub_bfd->sections; ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) +@@ -12716,15 +12722,16 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, + if (htab->relbrlt != NULL) + htab->relbrlt->reloc_count = 0; + +- if (htab->plt_stub_align != 0) +- for (stub_sec = htab->stub_bfd->sections; ++ if (htab->params->plt_stub_align != 0) ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) +- stub_sec->size = ((stub_sec->size + (1 << htab->plt_stub_align) - 1) +- & (-1 << htab->plt_stub_align)); ++ stub_sec->size = ((stub_sec->size ++ + (1 << htab->params->plt_stub_align) - 1) ++ & (-1 << htab->params->plt_stub_align)); + +- for (stub_sec = htab->stub_bfd->sections; ++ for (stub_sec = htab->params->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) +@@ -12878,7 +12885,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, + return FALSE; + + /* Don't relocate stub sections. */ +- if (input_section->owner == htab->stub_bfd) ++ if (input_section->owner == htab->params->stub_bfd) + return TRUE; + + BFD_ASSERT (is_ppc64_elf (input_bfd)); +@@ -12916,6 +12923,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, + bfd_vma max_br_offset; + bfd_vma from; + const Elf_Internal_Rela orig_rel = *rel; ++ reloc_howto_type *howto; ++ struct reloc_howto_struct alt_howto; + + r_type = ELF64_R_TYPE (rel->r_info); + r_symndx = ELF64_R_SYM (rel->r_info); +@@ -13597,7 +13606,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, + if (h != NULL + && (h == htab->tls_get_addr_fd + || h == htab->tls_get_addr) +- && !htab->no_tls_get_addr_opt) ++ && !htab->params->no_tls_get_addr_opt) + { + /* Special stub used, leave nop alone. */ + } +@@ -13655,7 +13664,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, + { + info->callbacks->einfo + (_("%P: %H: call to `%T' lacks nop, can't restore toc; " +- "recompile with -fPIC"), ++ "recompile with -fPIC\n"), + input_bfd, input_section, rel->r_offset, sym_name); + + bfd_set_error (bfd_error_bad_value); +@@ -14472,6 +14481,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, + } + + /* Do any further special processing. */ ++ howto = ppc64_elf_howto_table[(int) r_type]; + switch (r_type) + { + default: +@@ -14546,7 +14556,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, + info->callbacks->einfo + (_("%P: %H: error: %s not a multiple of %u\n"), + input_bfd, input_section, rel->r_offset, +- ppc64_elf_howto_table[r_type]->name, ++ howto->name, + mask + 1); + bfd_set_error (bfd_error_bad_value); + ret = FALSE; +@@ -14567,23 +14577,46 @@ ppc64_elf_relocate_section (bfd *output_bfd, + info->callbacks->einfo + (_("%P: %H: unresolvable %s against `%T'\n"), + input_bfd, input_section, rel->r_offset, +- ppc64_elf_howto_table[(int) r_type]->name, ++ howto->name, + h->elf.root.root.string); + ret = FALSE; + } + +- r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type], +- input_bfd, +- input_section, +- contents, +- rel->r_offset, +- relocation, +- addend); ++ /* 16-bit fields in insns mostly have signed values, but a ++ few insns have 16-bit unsigned values. Really, we should ++ have different reloc types. */ ++ if (howto->complain_on_overflow != complain_overflow_dont ++ && howto->dst_mask == 0xffff ++ && (input_section->flags & SEC_CODE) != 0) ++ { ++ enum complain_overflow complain = complain_overflow_signed; ++ ++ insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3)); ++ if ((insn & (0x3f << 26)) == 10u << 26 /* cmpli */) ++ complain = complain_overflow_bitfield; ++ else if (howto->rightshift == 0 ++ ? ((insn & (0x3f << 26)) == 28u << 26 /* andi */ ++ || (insn & (0x3f << 26)) == 24u << 26 /* ori */ ++ || (insn & (0x3f << 26)) == 26u << 26 /* xori */) ++ : ((insn & (0x3f << 26)) == 29u << 26 /* andis */ ++ || (insn & (0x3f << 26)) == 25u << 26 /* oris */ ++ || (insn & (0x3f << 26)) == 27u << 26 /* xoris */)) ++ complain = complain_overflow_unsigned; ++ if (howto->complain_on_overflow != complain) ++ { ++ alt_howto = *howto; ++ alt_howto.complain_on_overflow = complain; ++ howto = &alt_howto; ++ } ++ } ++ ++ r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, ++ rel->r_offset, relocation, addend); + + if (r != bfd_reloc_ok) + { + char *more_info = NULL; +- const char *reloc_name = ppc64_elf_howto_table[r_type]->name; ++ const char *reloc_name = howto->name; + + if (reloc_dest != DEST_NORMAL) + { +@@ -14603,7 +14636,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, + continue; + if (h != NULL + && h->elf.root.type == bfd_link_hash_undefweak +- && ppc64_elf_howto_table[r_type]->pc_relative) ++ && howto->pc_relative) + { + /* Assume this is a call protected by other code that + detects the symbol is undefined. If this is the case, +diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h +index 06c655f..c4c7688 100644 +--- a/bfd/elf64-ppc.h ++++ b/bfd/elf64-ppc.h +@@ -19,12 +19,53 @@ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + ++/* Used to pass info between ld and bfd. */ ++struct ppc64_elf_params ++{ ++ /* Linker stub bfd. */ ++ bfd *stub_bfd; ++ ++ /* Linker call-backs. */ ++ asection * (*add_stub_section) (const char *, asection *); ++ void (*layout_sections_again) (void); ++ ++ /* Maximum size of a group of input sections that can be handled by ++ one stub section. A value of +/-1 indicates the bfd back-end ++ should use a suitable default size. */ ++ bfd_signed_vma group_size; ++ ++ /* Whether to use a special call stub for __tls_get_addr. */ ++ int no_tls_get_addr_opt; ++ ++ /* Whether to allow multiple toc sections. */ ++ int no_multi_toc; ++ ++ /* Set if PLT call stubs should load r11. */ ++ int plt_static_chain; ++ ++ /* Set if PLT call stubs need to be thread safe on power7+. */ ++ int plt_thread_safe; ++ ++ /* Set if individual PLT call stubs should be aligned. */ ++ int plt_stub_align; ++ ++ /* Whether to canonicalize .opd so that there are no overlapping ++ .opd entries. */ ++ int non_overlapping_opd; ++ ++ /* Whether to emit symbols for stubs. */ ++ int emit_stub_syms; ++ ++ /* Whether to generate out-of-line register save/restore for gcc -Os code. */ ++ int save_restore_funcs; ++}; ++ + bfd_boolean ppc64_elf_init_stub_bfd +- (bfd *, struct bfd_link_info *); ++ (struct bfd_link_info *, struct ppc64_elf_params *); + bfd_boolean ppc64_elf_edit_opd +- (struct bfd_link_info *, bfd_boolean); ++ (struct bfd_link_info *); + asection *ppc64_elf_tls_setup +- (struct bfd_link_info *, int, int *); ++ (struct bfd_link_info *); + bfd_boolean ppc64_elf_tls_optimize + (struct bfd_link_info *); + bfd_boolean ppc64_elf_edit_toc +@@ -32,10 +73,9 @@ bfd_boolean ppc64_elf_edit_toc + bfd_boolean ppc64_elf_has_small_toc_reloc + (asection *); + bfd_vma ppc64_elf_set_toc +- (struct bfd_link_info *, bfd *); ++(struct bfd_link_info *, bfd *); + int ppc64_elf_setup_section_lists +- (struct bfd_link_info *, asection *(*) (const char *, asection *), +- void (*) (void)); ++ (struct bfd_link_info *); + void ppc64_elf_start_multitoc_partition + (struct bfd_link_info *); + bfd_boolean ppc64_elf_next_toc_section +@@ -49,8 +89,8 @@ bfd_boolean ppc64_elf_check_init_fini + bfd_boolean ppc64_elf_next_input_section + (struct bfd_link_info *, asection *); + bfd_boolean ppc64_elf_size_stubs +-(struct bfd_link_info *, bfd_signed_vma, bfd_boolean, int, int); ++(struct bfd_link_info *); + bfd_boolean ppc64_elf_build_stubs +- (bfd_boolean, struct bfd_link_info *, char **); ++ (struct bfd_link_info *, char **); + void ppc64_elf_restore_symbols + (struct bfd_link_info *info); +diff --git a/bfd/elflink.c b/bfd/elflink.c +index 99b7ca1..923f853 100644 +--- a/bfd/elflink.c ++++ b/bfd/elflink.c +@@ -1437,7 +1437,10 @@ _bfd_elf_merge_symbol (bfd *abfd, + if (!(oldbfd != NULL + && (oldbfd->flags & BFD_PLUGIN) != 0 + && (abfd->flags & BFD_PLUGIN) == 0)) +- *skip = TRUE; ++ { ++ newdef = FALSE; ++ *skip = TRUE; ++ } + + /* Merge st_other. If the symbol already has a dynamic index, + but visibility says it should not be visible, turn it into a +@@ -1702,6 +1705,12 @@ _bfd_elf_add_default_symbol (bfd *abfd, + ht = (struct elf_link_hash_entry *) hi->root.u.i.link; + (*bed->elf_backend_copy_indirect_symbol) (info, ht, hi); + ++ /* A reference to the SHORTNAME symbol from a dynamic library ++ will be satisfied by the versioned symbol at runtime. In ++ effect, we have a reference to the versioned symbol. */ ++ ht->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak; ++ hi->dynamic_def |= ht->dynamic_def; ++ + /* See if the new flags lead us to realize that the symbol must + be dynamic. */ + if (! *dynsym) +@@ -1771,6 +1780,8 @@ nondefault: + if (hi->root.type == bfd_link_hash_indirect) + { + (*bed->elf_backend_copy_indirect_symbol) (info, h, hi); ++ h->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak; ++ hi->dynamic_def |= h->dynamic_def; + + /* See if the new flags lead us to realize that the symbol + must be dynamic. */ +@@ -11968,7 +11979,9 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) + info we collected before. */ + if (gc_sweep_hook + && (o->flags & SEC_RELOC) != 0 +- && o->reloc_count > 0 ++ && o->reloc_count != 0 ++ && !((info->strip == strip_all || info->strip == strip_debugger) ++ && (o->flags & SEC_DEBUGGING) != 0) + && !bfd_is_abs_section (o->output_section)) + { + Elf_Internal_Rela *internal_relocs; +@@ -12116,14 +12129,19 @@ bfd_boolean + bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; ++ struct bfd_elf_dynamic_list *d = info->dynamic_list; + + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->ref_dynamic +- || ((!info->executable || info->export_dynamic) +- && h->def_regular ++ || (h->def_regular + && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN ++ && (!info->executable ++ || info->export_dynamic ++ || (h->dynamic ++ && d != NULL ++ && (*d->match) (&d->head, NULL, h->root.root.string))) + && (strchr (h->root.root.string, ELF_VER_CHR) != NULL + || !bfd_hide_sym_by_version (info->version_info, + h->root.root.string))))) +diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c +index 6bc414e..9fc734f 100644 +--- a/bfd/elfnn-aarch64.c ++++ b/bfd/elfnn-aarch64.c +@@ -1611,6 +1611,12 @@ static const uint32_t aarch64_long_branch_stub[] = + 0x00000000, + }; + ++static const uint32_t aarch64_erratum_835769_stub[] = ++{ ++ 0x00000000, /* Placeholder for multiply accumulate. */ ++ 0x14000000, /* b