Cherry pick some binutils NaCl strip/objcopy fixes in pnacl 2.23 branch.

Otherwise it is left in a broken state.

Commits:

commit 1098fd41ac4a8efe7ed5a96487e89f53ff79165d
Author: Roland McGrath <roland@gnu.org>
Date:   Mon Aug 26 22:18:07 2013 +0000

    bfd/
        * archures.c (bfd_mach_i386_nacl, bfd_mach_i386_i386_nacl): New macros.
        (bfd_mach_x86_64_nacl, bfd_mach_x64_32_nacl): New macros.
        * cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): New function.
        (bfd_i386_nacl_arch): New variable.
        (bfd_x86_64_nacl_arch, bfd_x64_32_nacl_arch): New variables.
        (bfd_x64_32_arch_intel_syntax): Link them into the list.
        * bfd-in2.h: Regenerate.

    ld/
        * emulparams/elf_i386_nacl.sh (ARCH): Set to i386:nacl.
        * emulparams/elf_x86_64_nacl.sh (ARCH): Set to i386:x86-64:nacl.
        * emulparams/elf32_x86_64_nacl.sh (ARCH): Set to i386:x64-32:nacl.

    ld/testsuite/
        * ld-x86-64/x86-64.exp (Mixed x86_64 and i386 input test 1):
        Loosen string match to admit i386:x86-64*.
        (Mixed x86_64 and i386 input test 2): Likewise.
        * ld-x86-64/ilp32-2.d: Likewise.
        * ld-x86-64/ilp32-3.d: Likewise.
        * ld-x86-64/lp64-2.d: Likewise.
        * ld-x86-64/lp64-3.d: Likewise.
        * ld-x86-64/ia32-2.d: Likewise, and i386.* too.
        * ld-x86-64/ia32-3.d: Likewise.

commit 268121417c4844cbb1d533cd5e0a2e273442d718
Author: Roland McGrath <mcgrathr@google.com>
Date:   Wed Nov 6 14:47:05 2013 -0800

    Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets

    bfd/
        * archures.c (bfd_mach_i386_nacl): Fix definition so it doesn't
        collide with bfd_mach_l1om.
        * bfd-in2.h: Regenerate.

        * elf32-i386.c (elf32_i386_nacl_elf_object_p): New function.
        (elf_backend_object_p): Use that in elf32-i386-nacl definition.
        * elf64-x86-64.c (elf64_x86_64_nacl_elf_object_p): New function.
        (elf_backend_object_p): Use that in elf64-x86-64-nacl definition.
        (elf32_x86_64_nacl_elf_object_p): New function.
        (elf_backend_object_p): Use that in elf32-x86-64-nacl definition.

    binutils/
        * objdump.c (dump_dwarf): Grok bfd_mach_x86_64_nacl and
        bfd_mach_x64_32_nacl as equivalent to bfd_mach_x86_64.

    ld/testsuite/
        * ld-x86-64/x86-64.exp (mixed1, mixed2): Loosen error string match
        so it accepts "i386:nacl" in place of "i386".
        * ld-x86-64/ilp32-2.d: Likewise.
        * ld-x86-64/ilp32-3.d: Likewise.
        * ld-x86-64/lp64-2.d: Likewise.
        * ld-x86-64/lp64-3.d: Likewise.

    (cherry picked from commit 64b384e1e821cedccefa24f6d5bb82d353546ca1)

commit 33aa641a5d20d54adaac9b21b5a3e19b03f0bd4f
Author: Roland McGrath <mcgrathr@google.com>
Date:   Tue Nov 19 14:57:54 2013 -0800

    Fix *-nacl* target objcopy/strip of binary made with custom linker script

    bfd/
        * elf-nacl.c (nacl_modify_segment_map): Calculate SIZEOF_HEADERS
        when not doing linking (i.e. INFO is a null pointer).

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3873
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/256623012
21 files changed