binutils: backport patch to for Cortex A-53 erratum 835769

This backports another patch to for Cortex A-53 erratum 835769

The original commit is as follows
commit 5387e7a81fcd3e033a29eccece64e02f96e7f960
Author: Tejas Belagod <tejas.belagod@arm.com>
Date:   Tue Nov 25 14:51:24 2014 +0800

    Fixed Cortex-A53 Erratum 835769 -- LD segfaults with unordered maps.

    The BFD/LD patch for Cortex-A53 erratum 835769
    (https://sourceware.org/ml/binutils/2014-10/msg00199.html)
    does not handle a particular case of the AArch64 ELF ABI where mapping
    symbols are allowed to be unordered in the symbol table (not in address order).
    The unordering causes section maps to be traversed with incorrect span boundaries
    (in the erratum scanning function) which causes memory faults. The attached
    patch fixes this issue by ordering the section maps by their 'vma' before
    starting to traverse them.

    While this is not an issue with a the GNU toolchain, it is a potential issue
    with Clang/LLVM. We have observed at least one case where LLVM generates an
    ELF object with mapping symbols unordered in the symbol table and causes a fault.
    We have been unable to construct a test case with the GNU toolchain. We have verified
    by manual inspection the correctness of the traversal with this patch for an
    LLVM-generated ELF object which triggered this issue. This patch has been bootstrapped
    on aarch64-linux and regressed.

BUG=chromium:430666
TEST=cbuildbot daisy-release

Change-Id: Ibdb56f5d6b20a4e9b1f7cf0a7c403015bc81f1b5
Reviewed-on: https://chromium-review.googlesource.com/233230
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
1 file changed