Upgrade GDB from 7.4.1 to 7.6.1 on the vendor branch origin/vendor/GDB
authorJohn Marino <draco@marino.st>
Sat, 5 Oct 2013 17:18:38 +0000 (19:18 +0200)
committerJohn Marino <draco@marino.st>
Sat, 5 Oct 2013 22:49:16 +0000 (00:49 +0200)
747 files changed:
contrib/gdb-7/bfd/README
contrib/gdb-7/bfd/archive.c
contrib/gdb-7/bfd/archive64.c
contrib/gdb-7/bfd/archures.c
contrib/gdb-7/bfd/bfd-in.h
contrib/gdb-7/bfd/bfd-in2.h
contrib/gdb-7/bfd/bfd.c
contrib/gdb-7/bfd/bfdio.c
contrib/gdb-7/bfd/cache.c
contrib/gdb-7/bfd/coffgen.c
contrib/gdb-7/bfd/compress.c
contrib/gdb-7/bfd/config.bfd
contrib/gdb-7/bfd/corefile.c
contrib/gdb-7/bfd/cpu-i386.c
contrib/gdb-7/bfd/cpu-l1om.c
contrib/gdb-7/bfd/dwarf2.c
contrib/gdb-7/bfd/elf-attrs.c
contrib/gdb-7/bfd/elf-bfd.h
contrib/gdb-7/bfd/elf-eh-frame.c
contrib/gdb-7/bfd/elf-ifunc.c
contrib/gdb-7/bfd/elf-linux-psinfo.h [new file with mode: 0644]
contrib/gdb-7/bfd/elf-nacl.c [new file with mode: 0644]
contrib/gdb-7/bfd/elf-nacl.h [copied from contrib/gdb-7/gdb/inf-child.h with 55% similarity]
contrib/gdb-7/bfd/elf-strtab.c
contrib/gdb-7/bfd/elf-vxworks.c
contrib/gdb-7/bfd/elf.c
contrib/gdb-7/bfd/elf32-i386.c
contrib/gdb-7/bfd/elf64-x86-64.c
contrib/gdb-7/bfd/elfcode.h
contrib/gdb-7/bfd/elfcore.h
contrib/gdb-7/bfd/elflink.c
contrib/gdb-7/bfd/elfxx-target.h
contrib/gdb-7/bfd/format.c
contrib/gdb-7/bfd/hash.c
contrib/gdb-7/bfd/libbfd.c
contrib/gdb-7/bfd/libbfd.h
contrib/gdb-7/bfd/libcoff.h
contrib/gdb-7/bfd/linker.c
contrib/gdb-7/bfd/merge.c
contrib/gdb-7/bfd/opncls.c
contrib/gdb-7/bfd/reloc.c
contrib/gdb-7/bfd/section.c
contrib/gdb-7/bfd/stab-syms.c
contrib/gdb-7/bfd/syms.c
contrib/gdb-7/bfd/sysdep.h
contrib/gdb-7/bfd/targets.c
contrib/gdb-7/bfd/tekhex.c
contrib/gdb-7/bfd/version.h
contrib/gdb-7/gdb/README
contrib/gdb-7/gdb/ada-exp.c [new file with mode: 0644]
contrib/gdb-7/gdb/ada-exp.y
contrib/gdb-7/gdb/ada-lang.c
contrib/gdb-7/gdb/ada-lang.h
contrib/gdb-7/gdb/ada-lex.c
contrib/gdb-7/gdb/ada-operator.def
contrib/gdb-7/gdb/ada-tasks.c
contrib/gdb-7/gdb/ada-typeprint.c
contrib/gdb-7/gdb/ada-valprint.c
contrib/gdb-7/gdb/ada-varobj.c [new file with mode: 0644]
contrib/gdb-7/gdb/ada-varobj.h [new file with mode: 0644]
contrib/gdb-7/gdb/addrmap.c
contrib/gdb-7/gdb/addrmap.h
contrib/gdb-7/gdb/agent.c [new file with mode: 0644]
contrib/gdb-7/gdb/amd64-nat.c
contrib/gdb-7/gdb/amd64-nat.h
contrib/gdb-7/gdb/amd64-tdep.c
contrib/gdb-7/gdb/amd64-tdep.h
contrib/gdb-7/gdb/amd64bsd-nat.c
contrib/gdb-7/gdb/amd64bsd-nat.h [copied from contrib/gdb-7/gdb/gdb_select.h with 57% similarity]
contrib/gdb-7/gdb/annotate.c
contrib/gdb-7/gdb/annotate.h
contrib/gdb-7/gdb/arch-utils.c
contrib/gdb-7/gdb/arch-utils.h
contrib/gdb-7/gdb/auto-load.c [new file with mode: 0644]
contrib/gdb-7/gdb/auto-load.h [new file with mode: 0644]
contrib/gdb-7/gdb/auxv.c
contrib/gdb-7/gdb/auxv.h
contrib/gdb-7/gdb/ax-gdb.c
contrib/gdb-7/gdb/ax-gdb.h
contrib/gdb-7/gdb/ax-general.c
contrib/gdb-7/gdb/ax.h
contrib/gdb-7/gdb/bcache.c
contrib/gdb-7/gdb/bcache.h
contrib/gdb-7/gdb/bfd-target.c
contrib/gdb-7/gdb/bfd-target.h
contrib/gdb-7/gdb/block.c
contrib/gdb-7/gdb/block.h
contrib/gdb-7/gdb/blockframe.c
contrib/gdb-7/gdb/break-catch-sig.c [new file with mode: 0644]
contrib/gdb-7/gdb/breakpoint.c
contrib/gdb-7/gdb/breakpoint.h
contrib/gdb-7/gdb/bsd-kvm.c
contrib/gdb-7/gdb/bsd-kvm.h
contrib/gdb-7/gdb/bsd-uthread.c
contrib/gdb-7/gdb/bsd-uthread.h
contrib/gdb-7/gdb/btrace.c [new file with mode: 0644]
contrib/gdb-7/gdb/btrace.h [new file with mode: 0644]
contrib/gdb-7/gdb/buildsym.c
contrib/gdb-7/gdb/buildsym.h
contrib/gdb-7/gdb/c-exp.y
contrib/gdb-7/gdb/c-lang.c
contrib/gdb-7/gdb/c-lang.h
contrib/gdb-7/gdb/c-typeprint.c
contrib/gdb-7/gdb/c-valprint.c
contrib/gdb-7/gdb/call-cmds.h [deleted file]
contrib/gdb-7/gdb/cc-with-index.sh [deleted file]
contrib/gdb-7/gdb/charset-list.h
contrib/gdb-7/gdb/charset.c
contrib/gdb-7/gdb/charset.h
contrib/gdb-7/gdb/cleanups.c [new file with mode: 0644]
contrib/gdb-7/gdb/cleanups.h [new file with mode: 0644]
contrib/gdb-7/gdb/cli-out.c
contrib/gdb-7/gdb/cli-out.h
contrib/gdb-7/gdb/cli/cli-cmds.c
contrib/gdb-7/gdb/cli/cli-cmds.h
contrib/gdb-7/gdb/cli/cli-decode.c
contrib/gdb-7/gdb/cli/cli-decode.h
contrib/gdb-7/gdb/cli/cli-dump.c
contrib/gdb-7/gdb/cli/cli-dump.h
contrib/gdb-7/gdb/cli/cli-interp.c
contrib/gdb-7/gdb/cli/cli-logging.c
contrib/gdb-7/gdb/cli/cli-script.c
contrib/gdb-7/gdb/cli/cli-script.h
contrib/gdb-7/gdb/cli/cli-setshow.c
contrib/gdb-7/gdb/cli/cli-setshow.h
contrib/gdb-7/gdb/cli/cli-utils.c
contrib/gdb-7/gdb/cli/cli-utils.h
contrib/gdb-7/gdb/coff-pe-read.c
contrib/gdb-7/gdb/coff-pe-read.h
contrib/gdb-7/gdb/coffread.c
contrib/gdb-7/gdb/command.h
contrib/gdb-7/gdb/common/agent.c [new file with mode: 0644]
contrib/gdb-7/gdb/common/agent.h [new file with mode: 0644]
contrib/gdb-7/gdb/common/ax.def
contrib/gdb-7/gdb/common/btrace-common.h [new file with mode: 0644]
contrib/gdb-7/gdb/common/buffer.c
contrib/gdb-7/gdb/common/buffer.h
contrib/gdb-7/gdb/common/common-utils.c
contrib/gdb-7/gdb/common/common-utils.h
contrib/gdb-7/gdb/common/format.c [new file with mode: 0644]
contrib/gdb-7/gdb/common/format.h [new file with mode: 0644]
contrib/gdb-7/gdb/common/gdb_assert.h
contrib/gdb-7/gdb/common/gdb_dirent.h
contrib/gdb-7/gdb/common/gdb_locale.h
contrib/gdb-7/gdb/common/gdb_signals.h
contrib/gdb-7/gdb/common/gdb_stat.h [moved from contrib/gdb-7/gdb/gdb_stat.h with 88% similarity]
contrib/gdb-7/gdb/common/gdb_string.h [moved from contrib/gdb-7/gdb/gdb_string.h with 95% similarity]
contrib/gdb-7/gdb/common/gdb_thread_db.h
contrib/gdb-7/gdb/common/gdb_vecs.c [new file with mode: 0644]
contrib/gdb-7/gdb/common/gdb_vecs.h [copied from contrib/gdb-7/gdb/mi/mi-main.h with 53% similarity]
contrib/gdb-7/gdb/common/gdb_wait.h [moved from contrib/gdb-7/gdb/gdb_wait.h with 98% similarity]
contrib/gdb-7/gdb/common/host-defs.h [copied from contrib/gdb-7/gdb/gdb_select.h with 60% similarity]
contrib/gdb-7/gdb/common/i386-xstate.h
contrib/gdb-7/gdb/common/linux-btrace.c [new file with mode: 0644]
contrib/gdb-7/gdb/common/linux-btrace.h [new file with mode: 0644]
contrib/gdb-7/gdb/common/linux-osdata.c
contrib/gdb-7/gdb/common/linux-osdata.h
contrib/gdb-7/gdb/common/linux-procfs.c
contrib/gdb-7/gdb/common/linux-procfs.h
contrib/gdb-7/gdb/common/linux-ptrace.c [new file with mode: 0644]
contrib/gdb-7/gdb/common/linux-ptrace.h
contrib/gdb-7/gdb/common/ptid.c
contrib/gdb-7/gdb/common/ptid.h
contrib/gdb-7/gdb/common/queue.h [new file with mode: 0644]
contrib/gdb-7/gdb/common/signals.c
contrib/gdb-7/gdb/common/vec.c [moved from contrib/gdb-7/gdb/vec.c with 96% similarity]
contrib/gdb-7/gdb/common/vec.h [moved from contrib/gdb-7/gdb/vec.h with 92% similarity]
contrib/gdb-7/gdb/common/xml-utils.c
contrib/gdb-7/gdb/common/xml-utils.h
contrib/gdb-7/gdb/complaints.c
contrib/gdb-7/gdb/complaints.h
contrib/gdb-7/gdb/completer.c
contrib/gdb-7/gdb/completer.h
contrib/gdb-7/gdb/config.in
contrib/gdb-7/gdb/config/aarch64/linux.mh [new file with mode: 0644]
contrib/gdb-7/gdb/config/i386/cygwin64.mh [new file with mode: 0644]
contrib/gdb-7/gdb/config/tilegx/linux.mh [new file with mode: 0644]
contrib/gdb-7/gdb/configure.ac
contrib/gdb-7/gdb/configure.host
contrib/gdb-7/gdb/configure.tgt
contrib/gdb-7/gdb/continuations.c
contrib/gdb-7/gdb/continuations.h
contrib/gdb-7/gdb/copying.c
contrib/gdb-7/gdb/copyright.py
contrib/gdb-7/gdb/corefile.c
contrib/gdb-7/gdb/corelow.c
contrib/gdb-7/gdb/cp-abi.c
contrib/gdb-7/gdb/cp-abi.h
contrib/gdb-7/gdb/cp-name-parser.y
contrib/gdb-7/gdb/cp-namespace.c
contrib/gdb-7/gdb/cp-support.c
contrib/gdb-7/gdb/cp-support.h
contrib/gdb-7/gdb/cp-valprint.c
contrib/gdb-7/gdb/d-lang.c
contrib/gdb-7/gdb/d-lang.h
contrib/gdb-7/gdb/d-valprint.c
contrib/gdb-7/gdb/data-directory/Makefile.in
contrib/gdb-7/gdb/dbxread.c
contrib/gdb-7/gdb/dcache.c
contrib/gdb-7/gdb/dcache.h
contrib/gdb-7/gdb/defs.h
contrib/gdb-7/gdb/demangle.c
contrib/gdb-7/gdb/dfp.c
contrib/gdb-7/gdb/dfp.h
contrib/gdb-7/gdb/dictionary.c
contrib/gdb-7/gdb/dictionary.h
contrib/gdb-7/gdb/disasm.c
contrib/gdb-7/gdb/disasm.h
contrib/gdb-7/gdb/doc/agentexpr.texi
contrib/gdb-7/gdb/doc/all-cfg.texi
contrib/gdb-7/gdb/doc/annotate.texinfo
contrib/gdb-7/gdb/doc/gdb.texinfo
contrib/gdb-7/gdb/doc/gdbint.texinfo
contrib/gdb-7/gdb/doc/observer.texi
contrib/gdb-7/gdb/doc/stabs.texinfo
contrib/gdb-7/gdb/doublest.c
contrib/gdb-7/gdb/doublest.h
contrib/gdb-7/gdb/dummy-frame.c
contrib/gdb-7/gdb/dummy-frame.h
contrib/gdb-7/gdb/dwarf2-frame-tailcall.c
contrib/gdb-7/gdb/dwarf2-frame-tailcall.h
contrib/gdb-7/gdb/dwarf2-frame.c
contrib/gdb-7/gdb/dwarf2-frame.h
contrib/gdb-7/gdb/dwarf2expr.c
contrib/gdb-7/gdb/dwarf2expr.h
contrib/gdb-7/gdb/dwarf2loc.c
contrib/gdb-7/gdb/dwarf2loc.h
contrib/gdb-7/gdb/dwarf2read.c
contrib/gdb-7/gdb/elfread.c
contrib/gdb-7/gdb/environ.c
contrib/gdb-7/gdb/environ.h
contrib/gdb-7/gdb/eval.c
contrib/gdb-7/gdb/event-loop.c
contrib/gdb-7/gdb/event-loop.h
contrib/gdb-7/gdb/event-top.c
contrib/gdb-7/gdb/event-top.h
contrib/gdb-7/gdb/exceptions.c
contrib/gdb-7/gdb/exceptions.h
contrib/gdb-7/gdb/exec.c
contrib/gdb-7/gdb/exec.h
contrib/gdb-7/gdb/expprint.c
contrib/gdb-7/gdb/expression.h
contrib/gdb-7/gdb/f-exp.y
contrib/gdb-7/gdb/f-lang.c
contrib/gdb-7/gdb/f-lang.h
contrib/gdb-7/gdb/f-typeprint.c
contrib/gdb-7/gdb/f-valprint.c
contrib/gdb-7/gdb/fbsd-nat.c
contrib/gdb-7/gdb/fbsd-nat.h
contrib/gdb-7/gdb/features/btrace.dtd [new file with mode: 0644]
contrib/gdb-7/gdb/features/feature_to_c.sh
contrib/gdb-7/gdb/features/gdb-target.dtd
contrib/gdb-7/gdb/features/i386/32bit-avx.xml
contrib/gdb-7/gdb/features/i386/32bit-core.xml
contrib/gdb-7/gdb/features/i386/32bit-linux.xml
contrib/gdb-7/gdb/features/i386/32bit-sse.xml
contrib/gdb-7/gdb/features/i386/64bit-avx.xml
contrib/gdb-7/gdb/features/i386/64bit-core.xml
contrib/gdb-7/gdb/features/i386/64bit-linux.xml
contrib/gdb-7/gdb/features/i386/64bit-sse.xml
contrib/gdb-7/gdb/features/i386/amd64-avx-linux.c
contrib/gdb-7/gdb/features/i386/amd64-avx-linux.xml
contrib/gdb-7/gdb/features/i386/amd64-avx.c
contrib/gdb-7/gdb/features/i386/amd64-avx.xml
contrib/gdb-7/gdb/features/i386/amd64-linux.c
contrib/gdb-7/gdb/features/i386/amd64-linux.xml
contrib/gdb-7/gdb/features/i386/amd64.c
contrib/gdb-7/gdb/features/i386/amd64.xml
contrib/gdb-7/gdb/features/i386/i386-avx-linux.c
contrib/gdb-7/gdb/features/i386/i386-avx-linux.xml
contrib/gdb-7/gdb/features/i386/i386-avx.c
contrib/gdb-7/gdb/features/i386/i386-avx.xml
contrib/gdb-7/gdb/features/i386/i386-linux.c
contrib/gdb-7/gdb/features/i386/i386-linux.xml
contrib/gdb-7/gdb/features/i386/i386-mmx-linux.c
contrib/gdb-7/gdb/features/i386/i386-mmx-linux.xml
contrib/gdb-7/gdb/features/i386/i386-mmx.c
contrib/gdb-7/gdb/features/i386/i386-mmx.xml
contrib/gdb-7/gdb/features/i386/i386.c
contrib/gdb-7/gdb/features/i386/i386.xml
contrib/gdb-7/gdb/features/i386/x32-avx-linux.c [copied from contrib/gdb-7/gdb/features/i386/amd64-avx-linux.c with 93% similarity]
contrib/gdb-7/gdb/features/i386/x32-avx-linux.xml [copied from contrib/gdb-7/gdb/features/i386/amd64-avx-linux.xml with 66% similarity]
contrib/gdb-7/gdb/features/i386/x32-avx.c [copied from contrib/gdb-7/gdb/features/i386/amd64-avx.c with 93% similarity]
contrib/gdb-7/gdb/features/i386/x32-avx.xml [copied from contrib/gdb-7/gdb/features/i386/amd64-avx.xml with 68% similarity]
contrib/gdb-7/gdb/features/i386/x32-core.xml [copied from contrib/gdb-7/gdb/features/i386/64bit-core.xml with 93% similarity]
contrib/gdb-7/gdb/features/i386/x32-linux.c [copied from contrib/gdb-7/gdb/features/i386/amd64-linux.c with 93% similarity]
contrib/gdb-7/gdb/features/i386/x32-linux.xml [copied from contrib/gdb-7/gdb/features/i386/amd64-linux.xml with 65% similarity]
contrib/gdb-7/gdb/features/i386/x32.c [copied from contrib/gdb-7/gdb/features/i386/amd64.c with 93% similarity]
contrib/gdb-7/gdb/features/i386/x32.xml [copied from contrib/gdb-7/gdb/features/i386/amd64.xml with 67% similarity]
contrib/gdb-7/gdb/features/library-list-svr4.dtd
contrib/gdb-7/gdb/features/library-list.dtd
contrib/gdb-7/gdb/features/osdata.dtd
contrib/gdb-7/gdb/features/threads.dtd
contrib/gdb-7/gdb/features/traceframe-info.dtd
contrib/gdb-7/gdb/features/xinclude.dtd
contrib/gdb-7/gdb/filesystem.c
contrib/gdb-7/gdb/filesystem.h
contrib/gdb-7/gdb/findcmd.c
contrib/gdb-7/gdb/findvar.c
contrib/gdb-7/gdb/fork-child.c
contrib/gdb-7/gdb/frame-base.c
contrib/gdb-7/gdb/frame-base.h
contrib/gdb-7/gdb/frame-unwind.c
contrib/gdb-7/gdb/frame-unwind.h
contrib/gdb-7/gdb/frame.c
contrib/gdb-7/gdb/frame.h
contrib/gdb-7/gdb/gcore.c
contrib/gdb-7/gdb/gcore.h
contrib/gdb-7/gdb/gdb-code-style.el [new file with mode: 0644]
contrib/gdb-7/gdb/gdb-demangle.h
contrib/gdb-7/gdb/gdb-dlfcn.c
contrib/gdb-7/gdb/gdb-dlfcn.h
contrib/gdb-7/gdb/gdb-gdb.gdb.in [moved from contrib/gdb-7/gdb/gdbinit.in with 53% similarity]
contrib/gdb-7/gdb/gdb-gdb.py
contrib/gdb-7/gdb/gdb-stabs.h
contrib/gdb-7/gdb/gdb.1
contrib/gdb-7/gdb/gdb.c
contrib/gdb-7/gdb/gdb.h
contrib/gdb-7/gdb/gdb_bfd.c [new file with mode: 0644]
contrib/gdb-7/gdb/gdb_bfd.h [new file with mode: 0644]
contrib/gdb-7/gdb/gdb_curses.h
contrib/gdb-7/gdb/gdb_obstack.c [moved from contrib/gdb-7/gdb/tui/tui-main.c with 52% similarity]
contrib/gdb-7/gdb/gdb_obstack.h
contrib/gdb-7/gdb/gdb_ptrace.h
contrib/gdb-7/gdb/gdb_regex.h
contrib/gdb-7/gdb/gdb_select.h
contrib/gdb-7/gdb/gdb_usleep.c
contrib/gdb-7/gdb/gdb_usleep.h
contrib/gdb-7/gdb/gdb_vfork.h
contrib/gdb-7/gdb/gdb_wchar.h
contrib/gdb-7/gdb/gdbarch.c
contrib/gdb-7/gdb/gdbarch.h
contrib/gdb-7/gdb/gdbcmd.h
contrib/gdb-7/gdb/gdbcore.h
contrib/gdb-7/gdb/gdbthread.h
contrib/gdb-7/gdb/gdbtypes.c
contrib/gdb-7/gdb/gdbtypes.h
contrib/gdb-7/gdb/gnu-v2-abi.c
contrib/gdb-7/gdb/gnu-v3-abi.c
contrib/gdb-7/gdb/gnulib/import/fnmatch.c [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/fnmatch_loop.c [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/localcharset.c [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/localcharset.h [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/memmem.c [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/str-two-way.h [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/strnlen1.c [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/strnlen1.h [new file with mode: 0644]
contrib/gdb-7/gdb/gnulib/import/wctype-h.c [new file with mode: 0644]
contrib/gdb-7/gdb/go-exp.c [new file with mode: 0644]
contrib/gdb-7/gdb/go-exp.y [new file with mode: 0644]
contrib/gdb-7/gdb/go-lang.c [new file with mode: 0644]
contrib/gdb-7/gdb/go-lang.h [new file with mode: 0644]
contrib/gdb-7/gdb/go-typeprint.c [new file with mode: 0644]
contrib/gdb-7/gdb/go-valprint.c [new file with mode: 0644]
contrib/gdb-7/gdb/gregset.h [new file with mode: 0644]
contrib/gdb-7/gdb/i386-nat.c
contrib/gdb-7/gdb/i386-nat.h
contrib/gdb-7/gdb/i386-tdep.c
contrib/gdb-7/gdb/i386-tdep.h
contrib/gdb-7/gdb/i386bsd-nat.c
contrib/gdb-7/gdb/i386bsd-nat.h
contrib/gdb-7/gdb/i386bsd-tdep.c
contrib/gdb-7/gdb/i386fbsd-tdep.c
contrib/gdb-7/gdb/i387-tdep.c
contrib/gdb-7/gdb/i387-tdep.h
contrib/gdb-7/gdb/inf-child.c
contrib/gdb-7/gdb/inf-child.h
contrib/gdb-7/gdb/inf-loop.c
contrib/gdb-7/gdb/inf-loop.h
contrib/gdb-7/gdb/inf-ptrace.c
contrib/gdb-7/gdb/inf-ptrace.h
contrib/gdb-7/gdb/infcall.c
contrib/gdb-7/gdb/infcall.h
contrib/gdb-7/gdb/infcmd.c
contrib/gdb-7/gdb/inferior.c
contrib/gdb-7/gdb/inferior.h
contrib/gdb-7/gdb/inflow.c
contrib/gdb-7/gdb/inflow.h
contrib/gdb-7/gdb/infrun.c
contrib/gdb-7/gdb/inline-frame.c
contrib/gdb-7/gdb/inline-frame.h
contrib/gdb-7/gdb/interps.c
contrib/gdb-7/gdb/interps.h
contrib/gdb-7/gdb/jit-reader.in
contrib/gdb-7/gdb/jit.c
contrib/gdb-7/gdb/jit.h
contrib/gdb-7/gdb/jv-exp.y
contrib/gdb-7/gdb/jv-lang.c
contrib/gdb-7/gdb/jv-lang.h
contrib/gdb-7/gdb/jv-typeprint.c
contrib/gdb-7/gdb/jv-valprint.c
contrib/gdb-7/gdb/language.c
contrib/gdb-7/gdb/language.h
contrib/gdb-7/gdb/linespec.c
contrib/gdb-7/gdb/linespec.h
contrib/gdb-7/gdb/m2-exp.y
contrib/gdb-7/gdb/m2-lang.c
contrib/gdb-7/gdb/m2-lang.h
contrib/gdb-7/gdb/m2-typeprint.c
contrib/gdb-7/gdb/m2-valprint.c
contrib/gdb-7/gdb/machoread.c [new file with mode: 0644]
contrib/gdb-7/gdb/macrocmd.c
contrib/gdb-7/gdb/macroexp.c
contrib/gdb-7/gdb/macroexp.h
contrib/gdb-7/gdb/macroscope.c
contrib/gdb-7/gdb/macroscope.h
contrib/gdb-7/gdb/macrotab.c
contrib/gdb-7/gdb/macrotab.h
contrib/gdb-7/gdb/main.c
contrib/gdb-7/gdb/main.h
contrib/gdb-7/gdb/maint.c
contrib/gdb-7/gdb/mdebugread.c
contrib/gdb-7/gdb/mdebugread.h
contrib/gdb-7/gdb/mem-break.c
contrib/gdb-7/gdb/memattr.c
contrib/gdb-7/gdb/memattr.h
contrib/gdb-7/gdb/memory-map.c
contrib/gdb-7/gdb/memory-map.h
contrib/gdb-7/gdb/memrange.c
contrib/gdb-7/gdb/memrange.h
contrib/gdb-7/gdb/mi/mi-cmd-break.c
contrib/gdb-7/gdb/mi/mi-cmd-break.h [copied from contrib/gdb-7/gdb/common/xml-utils.h with 67% similarity]
contrib/gdb-7/gdb/mi/mi-cmd-catch.c [new file with mode: 0644]
contrib/gdb-7/gdb/mi/mi-cmd-disas.c
contrib/gdb-7/gdb/mi/mi-cmd-env.c
contrib/gdb-7/gdb/mi/mi-cmd-file.c
contrib/gdb-7/gdb/mi/mi-cmd-info.c [copied from contrib/gdb-7/gdb/gdb.c with 62% similarity]
contrib/gdb-7/gdb/mi/mi-cmd-stack.c
contrib/gdb-7/gdb/mi/mi-cmd-target.c
contrib/gdb-7/gdb/mi/mi-cmd-var.c
contrib/gdb-7/gdb/mi/mi-cmds.c
contrib/gdb-7/gdb/mi/mi-cmds.h
contrib/gdb-7/gdb/mi/mi-common.c
contrib/gdb-7/gdb/mi/mi-common.h
contrib/gdb-7/gdb/mi/mi-console.c
contrib/gdb-7/gdb/mi/mi-console.h
contrib/gdb-7/gdb/mi/mi-getopt.c
contrib/gdb-7/gdb/mi/mi-getopt.h
contrib/gdb-7/gdb/mi/mi-interp.c
contrib/gdb-7/gdb/mi/mi-main.c
contrib/gdb-7/gdb/mi/mi-main.h
contrib/gdb-7/gdb/mi/mi-out.c
contrib/gdb-7/gdb/mi/mi-out.h
contrib/gdb-7/gdb/mi/mi-parse.c
contrib/gdb-7/gdb/mi/mi-parse.h
contrib/gdb-7/gdb/mi/mi-symbol-cmds.c
contrib/gdb-7/gdb/minidebug.c [new file with mode: 0644]
contrib/gdb-7/gdb/minsyms.c
contrib/gdb-7/gdb/minsyms.h [new file with mode: 0644]
contrib/gdb-7/gdb/mipsread.c
contrib/gdb-7/gdb/objc-exp.y [deleted file]
contrib/gdb-7/gdb/objc-lang.c
contrib/gdb-7/gdb/objc-lang.h
contrib/gdb-7/gdb/objfiles.c
contrib/gdb-7/gdb/objfiles.h
contrib/gdb-7/gdb/observer.c
contrib/gdb-7/gdb/observer.sh
contrib/gdb-7/gdb/opencl-lang.c
contrib/gdb-7/gdb/osabi.c
contrib/gdb-7/gdb/osabi.h
contrib/gdb-7/gdb/osdata.c
contrib/gdb-7/gdb/osdata.h
contrib/gdb-7/gdb/p-exp.y
contrib/gdb-7/gdb/p-lang.c
contrib/gdb-7/gdb/p-lang.h
contrib/gdb-7/gdb/p-typeprint.c
contrib/gdb-7/gdb/p-valprint.c
contrib/gdb-7/gdb/parse.c
contrib/gdb-7/gdb/parser-defs.h
contrib/gdb-7/gdb/posix-hdep.c
contrib/gdb-7/gdb/ppc-ravenscar-thread.c [new file with mode: 0644]
contrib/gdb-7/gdb/ppc-ravenscar-thread.h [copied from contrib/gdb-7/gdb/tui/tui-command.h with 69% similarity]
contrib/gdb-7/gdb/printcmd.c
contrib/gdb-7/gdb/probe.c [new file with mode: 0644]
contrib/gdb-7/gdb/probe.h [new file with mode: 0644]
contrib/gdb-7/gdb/proc-service.list
contrib/gdb-7/gdb/progspace.c
contrib/gdb-7/gdb/progspace.h
contrib/gdb-7/gdb/prologue-value.c
contrib/gdb-7/gdb/prologue-value.h
contrib/gdb-7/gdb/psympriv.h
contrib/gdb-7/gdb/psymtab.c
contrib/gdb-7/gdb/psymtab.h
contrib/gdb-7/gdb/python/lib/gdb/__init__.py
contrib/gdb-7/gdb/python/lib/gdb/command/__init__.py
contrib/gdb-7/gdb/python/lib/gdb/command/explore.py [new file with mode: 0644]
contrib/gdb-7/gdb/python/lib/gdb/command/pretty_printers.py
contrib/gdb-7/gdb/python/lib/gdb/command/prompt.py
contrib/gdb-7/gdb/python/lib/gdb/command/type_printers.py [new file with mode: 0644]
contrib/gdb-7/gdb/python/lib/gdb/function/__init__.py [copied from contrib/gdb-7/gdb/python/lib/gdb/command/__init__.py with 91% similarity]
contrib/gdb-7/gdb/python/lib/gdb/function/strfns.py [new file with mode: 0644]
contrib/gdb-7/gdb/python/lib/gdb/printing.py
contrib/gdb-7/gdb/python/lib/gdb/prompt.py
contrib/gdb-7/gdb/python/lib/gdb/types.py
contrib/gdb-7/gdb/python/py-arch.c [new file with mode: 0644]
contrib/gdb-7/gdb/python/py-auto-load.c
contrib/gdb-7/gdb/python/py-block.c
contrib/gdb-7/gdb/python/py-bpevent.c
contrib/gdb-7/gdb/python/py-breakpoint.c
contrib/gdb-7/gdb/python/py-cmd.c
contrib/gdb-7/gdb/python/py-continueevent.c
contrib/gdb-7/gdb/python/py-event.c
contrib/gdb-7/gdb/python/py-event.h
contrib/gdb-7/gdb/python/py-events.h
contrib/gdb-7/gdb/python/py-evtregistry.c
contrib/gdb-7/gdb/python/py-evts.c
contrib/gdb-7/gdb/python/py-exitedevent.c
contrib/gdb-7/gdb/python/py-finishbreakpoint.c
contrib/gdb-7/gdb/python/py-frame.c
contrib/gdb-7/gdb/python/py-function.c
contrib/gdb-7/gdb/python/py-gdb-readline.c [new file with mode: 0644]
contrib/gdb-7/gdb/python/py-inferior.c
contrib/gdb-7/gdb/python/py-infthread.c
contrib/gdb-7/gdb/python/py-lazy-string.c
contrib/gdb-7/gdb/python/py-newobjfileevent.c
contrib/gdb-7/gdb/python/py-objfile.c
contrib/gdb-7/gdb/python/py-param.c
contrib/gdb-7/gdb/python/py-prettyprint.c
contrib/gdb-7/gdb/python/py-progspace.c
contrib/gdb-7/gdb/python/py-signalevent.c
contrib/gdb-7/gdb/python/py-stopevent.c
contrib/gdb-7/gdb/python/py-stopevent.h
contrib/gdb-7/gdb/python/py-symbol.c
contrib/gdb-7/gdb/python/py-symtab.c
contrib/gdb-7/gdb/python/py-threadevent.c
contrib/gdb-7/gdb/python/py-type.c
contrib/gdb-7/gdb/python/py-utils.c
contrib/gdb-7/gdb/python/py-value.c
contrib/gdb-7/gdb/python/python-config.py
contrib/gdb-7/gdb/python/python-internal.h
contrib/gdb-7/gdb/python/python.c
contrib/gdb-7/gdb/python/python.h
contrib/gdb-7/gdb/ravenscar-thread.c
contrib/gdb-7/gdb/ravenscar-thread.h
contrib/gdb-7/gdb/record-btrace.c [new file with mode: 0644]
contrib/gdb-7/gdb/record-full.c [copied from contrib/gdb-7/gdb/record.c with 51% similarity]
contrib/gdb-7/gdb/record-full.h [copied from contrib/gdb-7/gdb/record.h with 60% similarity]
contrib/gdb-7/gdb/record.c
contrib/gdb-7/gdb/record.h
contrib/gdb-7/gdb/regcache.c
contrib/gdb-7/gdb/regcache.h
contrib/gdb-7/gdb/regformats/i386/x32-avx-linux.dat [new file with mode: 0644]
contrib/gdb-7/gdb/regformats/i386/x32-avx.dat [new file with mode: 0644]
contrib/gdb-7/gdb/regformats/i386/x32-linux.dat [new file with mode: 0644]
contrib/gdb-7/gdb/regformats/i386/x32.dat [new file with mode: 0644]
contrib/gdb-7/gdb/regformats/regdat.sh
contrib/gdb-7/gdb/regformats/regdef.h
contrib/gdb-7/gdb/reggroups.c
contrib/gdb-7/gdb/reggroups.h
contrib/gdb-7/gdb/registry.c [new file with mode: 0644]
contrib/gdb-7/gdb/registry.h [new file with mode: 0644]
contrib/gdb-7/gdb/regset.c
contrib/gdb-7/gdb/regset.h
contrib/gdb-7/gdb/remote-fileio.c
contrib/gdb-7/gdb/remote-fileio.h
contrib/gdb-7/gdb/remote-notif.c [new file with mode: 0644]
contrib/gdb-7/gdb/remote-notif.h [new file with mode: 0644]
contrib/gdb-7/gdb/remote.c
contrib/gdb-7/gdb/remote.h
contrib/gdb-7/gdb/reverse.c
contrib/gdb-7/gdb/sentinel-frame.c
contrib/gdb-7/gdb/sentinel-frame.h
contrib/gdb-7/gdb/ser-base.c
contrib/gdb-7/gdb/ser-base.h
contrib/gdb-7/gdb/ser-pipe.c
contrib/gdb-7/gdb/ser-tcp.c
contrib/gdb-7/gdb/ser-tcp.h
contrib/gdb-7/gdb/ser-unix.c
contrib/gdb-7/gdb/ser-unix.h
contrib/gdb-7/gdb/serial.c
contrib/gdb-7/gdb/serial.h
contrib/gdb-7/gdb/sim-regno.h
contrib/gdb-7/gdb/skip.c
contrib/gdb-7/gdb/skip.h
contrib/gdb-7/gdb/solib-svr4.c
contrib/gdb-7/gdb/solib-svr4.h
contrib/gdb-7/gdb/solib-target.c
contrib/gdb-7/gdb/solib-target.h
contrib/gdb-7/gdb/solib.c
contrib/gdb-7/gdb/solib.h
contrib/gdb-7/gdb/solist.h
contrib/gdb-7/gdb/somread.c [new file with mode: 0644]
contrib/gdb-7/gdb/source.c
contrib/gdb-7/gdb/source.h
contrib/gdb-7/gdb/sparc-ravenscar-thread.c [moved from contrib/gdb-7/gdb/ravenscar-sparc-thread.c with 85% similarity]
contrib/gdb-7/gdb/sparc-ravenscar-thread.h [copied from contrib/gdb-7/gdb/gdb_vfork.h with 73% similarity]
contrib/gdb-7/gdb/stabsread.c
contrib/gdb-7/gdb/stabsread.h
contrib/gdb-7/gdb/stack.c
contrib/gdb-7/gdb/stack.h
contrib/gdb-7/gdb/stap-probe.c [new file with mode: 0644]
contrib/gdb-7/gdb/stap-probe.h [new file with mode: 0644]
contrib/gdb-7/gdb/std-operator.def
contrib/gdb-7/gdb/std-regs.c
contrib/gdb-7/gdb/stubs/ChangeLog [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/buildvms.com [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/i386-stub.c [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/ia64vms-stub.c [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/m32r-stub.c [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/m68k-stub.c [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/sh-stub.c [new file with mode: 0644]
contrib/gdb-7/gdb/stubs/sparc-stub.c [new file with mode: 0644]
contrib/gdb-7/gdb/symfile.c
contrib/gdb-7/gdb/symfile.h
contrib/gdb-7/gdb/symmisc.c
contrib/gdb-7/gdb/symtab.c
contrib/gdb-7/gdb/symtab.h
contrib/gdb-7/gdb/syscalls/gdb-syscalls.dtd
contrib/gdb-7/gdb/target-descriptions.c
contrib/gdb-7/gdb/target-descriptions.h
contrib/gdb-7/gdb/target-memory.c
contrib/gdb-7/gdb/target.c
contrib/gdb-7/gdb/target.h
contrib/gdb-7/gdb/terminal.h
contrib/gdb-7/gdb/thread.c
contrib/gdb-7/gdb/top.c
contrib/gdb-7/gdb/top.h
contrib/gdb-7/gdb/tracepoint.c
contrib/gdb-7/gdb/tracepoint.h
contrib/gdb-7/gdb/trad-frame.c
contrib/gdb-7/gdb/trad-frame.h
contrib/gdb-7/gdb/tramp-frame.c
contrib/gdb-7/gdb/tramp-frame.h
contrib/gdb-7/gdb/tui/tui-command.c
contrib/gdb-7/gdb/tui/tui-command.h
contrib/gdb-7/gdb/tui/tui-data.c
contrib/gdb-7/gdb/tui/tui-data.h
contrib/gdb-7/gdb/tui/tui-disasm.c
contrib/gdb-7/gdb/tui/tui-disasm.h
contrib/gdb-7/gdb/tui/tui-file.c
contrib/gdb-7/gdb/tui/tui-file.h
contrib/gdb-7/gdb/tui/tui-hooks.c
contrib/gdb-7/gdb/tui/tui-hooks.h
contrib/gdb-7/gdb/tui/tui-interp.c
contrib/gdb-7/gdb/tui/tui-io.c
contrib/gdb-7/gdb/tui/tui-io.h
contrib/gdb-7/gdb/tui/tui-layout.c
contrib/gdb-7/gdb/tui/tui-layout.h
contrib/gdb-7/gdb/tui/tui-out.c
contrib/gdb-7/gdb/tui/tui-regs.c
contrib/gdb-7/gdb/tui/tui-regs.h
contrib/gdb-7/gdb/tui/tui-source.c
contrib/gdb-7/gdb/tui/tui-source.h
contrib/gdb-7/gdb/tui/tui-stack.c
contrib/gdb-7/gdb/tui/tui-stack.h
contrib/gdb-7/gdb/tui/tui-win.c
contrib/gdb-7/gdb/tui/tui-win.h
contrib/gdb-7/gdb/tui/tui-windata.c
contrib/gdb-7/gdb/tui/tui-windata.h
contrib/gdb-7/gdb/tui/tui-wingeneral.c
contrib/gdb-7/gdb/tui/tui-wingeneral.h
contrib/gdb-7/gdb/tui/tui-winsource.c
contrib/gdb-7/gdb/tui/tui-winsource.h
contrib/gdb-7/gdb/tui/tui.c
contrib/gdb-7/gdb/tui/tui.h
contrib/gdb-7/gdb/typeprint.c
contrib/gdb-7/gdb/typeprint.h
contrib/gdb-7/gdb/ui-file.c
contrib/gdb-7/gdb/ui-file.h
contrib/gdb-7/gdb/ui-out.c
contrib/gdb-7/gdb/ui-out.h
contrib/gdb-7/gdb/unwind_stop_reasons.def
contrib/gdb-7/gdb/user-regs.c
contrib/gdb-7/gdb/user-regs.h
contrib/gdb-7/gdb/utils.c
contrib/gdb-7/gdb/utils.h [new file with mode: 0644]
contrib/gdb-7/gdb/valarith.c
contrib/gdb-7/gdb/valops.c
contrib/gdb-7/gdb/valprint.c
contrib/gdb-7/gdb/valprint.h
contrib/gdb-7/gdb/value.c
contrib/gdb-7/gdb/value.h
contrib/gdb-7/gdb/varobj.c
contrib/gdb-7/gdb/varobj.h
contrib/gdb-7/gdb/version.h
contrib/gdb-7/gdb/version.in
contrib/gdb-7/gdb/wrapper.c [deleted file]
contrib/gdb-7/gdb/wrapper.h [deleted file]
contrib/gdb-7/gdb/xcoffsolib.h
contrib/gdb-7/gdb/xml-support.c
contrib/gdb-7/gdb/xml-support.h
contrib/gdb-7/gdb/xml-syscall.c
contrib/gdb-7/gdb/xml-syscall.h
contrib/gdb-7/gdb/xml-tdesc.c
contrib/gdb-7/gdb/xml-tdesc.h
contrib/gdb-7/include/ansidecl.h
contrib/gdb-7/include/bfdlink.h
contrib/gdb-7/include/demangle.h
contrib/gdb-7/include/dis-asm.h
contrib/gdb-7/include/dwarf2.def [new file with mode: 0644]
contrib/gdb-7/include/dwarf2.h
contrib/gdb-7/include/elf/common.h
contrib/gdb-7/include/elf/i386.h
contrib/gdb-7/include/elf/mips.h
contrib/gdb-7/include/elf/x86-64.h
contrib/gdb-7/include/filenames.h
contrib/gdb-7/include/fopen-bin.h
contrib/gdb-7/include/fopen-same.h
contrib/gdb-7/include/gdb/fileio.h
contrib/gdb-7/include/gdb/gdb-index.h [new file with mode: 0644]
contrib/gdb-7/include/gdb/signals.def
contrib/gdb-7/include/gdb/signals.h
contrib/gdb-7/include/gdb/sim-bfin.h
contrib/gdb-7/include/leb128.h [new file with mode: 0644]
contrib/gdb-7/include/mach-o/ChangeLog
contrib/gdb-7/include/mach-o/external.h
contrib/gdb-7/include/mach-o/loader.h
contrib/gdb-7/include/mach-o/reloc.h
contrib/gdb-7/include/objalloc.h
contrib/gdb-7/include/opcode/i386.h
contrib/gdb-7/include/splay-tree.h
contrib/gdb-7/libdecnumber/dconfig.h
contrib/gdb-7/libdecnumber/decContext.c
contrib/gdb-7/libdecnumber/decContext.h
contrib/gdb-7/libdecnumber/decDPD.h
contrib/gdb-7/libdecnumber/decNumber.c
contrib/gdb-7/libdecnumber/decNumber.h
contrib/gdb-7/libdecnumber/decNumberLocal.h
contrib/gdb-7/libdecnumber/dpd/decimal128.c
contrib/gdb-7/libdecnumber/dpd/decimal128.h
contrib/gdb-7/libdecnumber/dpd/decimal128Local.h
contrib/gdb-7/libdecnumber/dpd/decimal32.c
contrib/gdb-7/libdecnumber/dpd/decimal32.h
contrib/gdb-7/libdecnumber/dpd/decimal64.c
contrib/gdb-7/libdecnumber/dpd/decimal64.h
contrib/gdb-7/libiberty/argv.c
contrib/gdb-7/libiberty/cp-demangle.c
contrib/gdb-7/libiberty/dwarfnames.c [new file with mode: 0644]
contrib/gdb-7/libiberty/filename_cmp.c
contrib/gdb-7/libiberty/floatformat.c
contrib/gdb-7/libiberty/make-relative-prefix.c
contrib/gdb-7/libiberty/objalloc.c
contrib/gdb-7/libiberty/pex-unix.c
contrib/gdb-7/libiberty/regex.c
contrib/gdb-7/libiberty/simple-object-common.h
contrib/gdb-7/libiberty/simple-object-mach-o.c
contrib/gdb-7/libiberty/simple-object-xcoff.c [new file with mode: 0644]
contrib/gdb-7/libiberty/simple-object.c
contrib/gdb-7/libiberty/stack-limit.c
contrib/gdb-7/libiberty/strnlen.c [new file with mode: 0644]
contrib/gdb-7/opcodes/disassemble.c
contrib/gdb-7/opcodes/i386-dis.c
contrib/gdb-7/opcodes/i386-opc.h
contrib/gdb-7/opcodes/i386-tbl.h
contrib/gdb-7/opcodes/sysdep.h
contrib/gdb-7/readline/signals.c
contrib/gdb-7/readline/terminal.c

index fe6b6f3..5ecfd29 100644 (file)
@@ -47,3 +47,9 @@ gcc manual.
 
 Bug reports without patches will be remembered, but they may never get
 fixed until somebody volunteers to fix them.
+\f
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
index 3e333c7..8cc6bf2 100644 (file)
@@ -1,7 +1,5 @@
 /* BFD back-end for archive files (libraries).
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
    Written by Cygnus Support.  Mostly Gumby Henkel-Wallace's fault.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -42,11 +40,17 @@ DESCRIPTION
        have to read the entire archive if you don't want
        to!  Read it until you find what you want.
 
+       A BFD returned by <<bfd_openr_next_archived_file>> can be
+       closed manually with <<bfd_close>>.  If you do not close it,
+       then a second iteration through the members of an archive may
+       return the same BFD.  If you close the archive BFD, then all
+       the member BFDs will automatically be closed as well.
+
        Archive contents of output BFDs are chained through the
-       <<next>> pointer in a BFD.  The first one is findable through
-       the <<archive_head>> slot of the archive.  Set it with
-       <<bfd_set_archive_head>> (q.v.).  A given BFD may be in only one
-       open output archive at a time.
+       <<archive_next>> pointer in a BFD.  The first one is findable
+       through the <<archive_head>> slot of the archive.  Set it with
+       <<bfd_set_archive_head>> (q.v.).  A given BFD may be in only
+       one open output archive at a time.
 
        As expected, the BFD archive code is more general than the
        archive code of any given environment.  BFD archives may
@@ -147,7 +151,8 @@ extern int errno;
    it's generally short enough to search linearly.
    Note that the pointers here point to the front of the ar_hdr, not
    to the front of the contents!  */
-struct ar_cache {
+struct ar_cache
+{
   file_ptr ptr;
   bfd *arbfd;
 };
@@ -168,6 +173,7 @@ _bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
 {
   static char buf[20];
   size_t len;
+
   snprintf (buf, sizeof (buf), fmt, val);
   len = strlen (buf);
   if (len < n)
@@ -178,6 +184,29 @@ _bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
   else
     memcpy (p, buf, n);
 }
+
+bfd_boolean
+_bfd_ar_sizepad (char *p, size_t n, bfd_size_type size)
+{
+  static char buf[21];
+  size_t len;
+
+  snprintf (buf, sizeof (buf), "%-10" BFD_VMA_FMT "u", size);
+  len = strlen (buf);
+  if (len > n)
+    {
+      bfd_set_error (bfd_error_file_too_big);
+      return FALSE;
+    }
+  if (len < n)
+    {
+      memcpy (p, buf, len);
+      memset (p + len, ' ', n - len);
+    }
+  else
+    memcpy (p, buf, n);
+  return TRUE;
+}
 \f
 bfd_boolean
 _bfd_generic_mkarchive (bfd *abfd)
@@ -273,6 +302,7 @@ _bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos)
 {
   htab_t hash_table = bfd_ardata (arch_bfd)->cache;
   struct ar_cache m;
+
   m.ptr = filepos;
 
   if (hash_table)
@@ -288,7 +318,7 @@ _bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos)
 }
 
 static hashval_t
-hash_file_ptr (const PTR p)
+hash_file_ptr (const void * p)
 {
   return (hashval_t) (((struct ar_cache *) p)->ptr);
 }
@@ -296,7 +326,7 @@ hash_file_ptr (const PTR p)
 /* Returns non-zero if P1 and P2 are equal.  */
 
 static int
-eq_file_ptr (const PTR p1, const PTR p2)
+eq_file_ptr (const void * p1, const void * p2)
 {
   struct ar_cache *arc1 = (struct ar_cache *) p1;
   struct ar_cache *arc2 = (struct ar_cache *) p2;
@@ -336,6 +366,10 @@ _bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt)
   cache->arbfd = new_elt;
   *htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;
 
+  /* Provide a means of accessing this from child.  */
+  arch_eltdata (new_elt)->parent_cache = hash_table;
+  arch_eltdata (new_elt)->key = filepos;
+
   return TRUE;
 }
 \f
@@ -345,12 +379,19 @@ _bfd_find_nested_archive (bfd *arch_bfd, const char *filename)
   bfd *abfd;
   const char *target;
 
+  /* PR 15140: Don't allow a nested archive pointing to itself.  */
+  if (filename_cmp (filename, arch_bfd->filename) == 0)
+    {
+      bfd_set_error (bfd_error_malformed_archive);
+      return NULL;
+    }
+
   for (abfd = arch_bfd->nested_archives;
        abfd != NULL;
        abfd = abfd->archive_next)
     {
       if (filename_cmp (filename, abfd->filename) == 0)
-        return abfd;
+       return abfd;
     }
   target = NULL;
   if (!arch_bfd->target_defaulted)
@@ -390,10 +431,10 @@ get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp)
       file_ptr origin = strtol (endp + 1, NULL, 10);
 
       if (errno != 0)
-        {
-          bfd_set_error (bfd_error_malformed_archive);
-          return NULL;
-        }
+       {
+         bfd_set_error (bfd_error_malformed_archive);
+         return NULL;
+       }
       *originp = origin;
     }
   else
@@ -424,7 +465,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
 {
   struct ar_hdr hdr;
   char *hdrp = (char *) &hdr;
-  size_t parsed_size;
+  bfd_size_type parsed_size;
   struct areltdata *ared;
   char *filename = NULL;
   bfd_size_type namelen = 0;
@@ -432,6 +473,8 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
   char *allocptr = 0;
   file_ptr origin = 0;
   unsigned int extra_size = 0;
+  char fmag_save;
+  int scan;
 
   if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
     {
@@ -448,8 +491,11 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
     }
 
   errno = 0;
-  parsed_size = strtol (hdr.ar_size, NULL, 10);
-  if (errno != 0)
+  fmag_save = hdr.ar_fmag[0];
+  hdr.ar_fmag[0] = 0;
+  scan = sscanf (hdr.ar_size, "%" BFD_VMA_FMT "u", &parsed_size);
+  hdr.ar_fmag[0] = fmag_save;
+  if (scan != 1)
     {
       bfd_set_error (bfd_error_malformed_archive);
       return NULL;
@@ -476,7 +522,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
       parsed_size -= namelen;
       extra_size = namelen;
 
-      allocptr = (char *) bfd_zalloc (abfd, allocsize);
+      allocptr = (char *) bfd_zmalloc (allocsize);
       if (allocptr == NULL)
        return NULL;
       filename = (allocptr
@@ -484,6 +530,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
                  + sizeof (struct ar_hdr));
       if (bfd_bread (filename, namelen, abfd) != namelen)
        {
+         free (allocptr);
          if (bfd_get_error () != bfd_error_system_call)
            bfd_set_error (bfd_error_no_more_archived_files);
          return NULL;
@@ -519,7 +566,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
 
   if (!allocptr)
     {
-      allocptr = (char *) bfd_zalloc (abfd, allocsize);
+      allocptr = (char *) bfd_zmalloc (allocsize);
       if (allocptr == NULL)
        return NULL;
     }
@@ -581,12 +628,6 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
   bfd *n_nfd;
   char *filename;
 
-  if (archive->my_archive)
-    {
-      filepos += archive->origin;
-      archive = archive->my_archive;
-    }
-
   n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
   if (n_nfd)
     return n_nfd;
@@ -605,35 +646,38 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
 
       /* This is a proxy entry for an external file.  */
       if (! IS_ABSOLUTE_PATH (filename))
-        {
-          filename = _bfd_append_relative_path (archive, filename);
-          if (filename == NULL)
-            return NULL;
-        }
+       {
+         filename = _bfd_append_relative_path (archive, filename);
+         if (filename == NULL)
+           {
+             free (new_areldata);
+             return NULL;
+           }
+       }
 
       if (new_areldata->origin > 0)
-        {
-          /* This proxy entry refers to an element of a nested archive.
-             Locate the member of that archive and return a bfd for it.  */
-          bfd *ext_arch = _bfd_find_nested_archive (archive, filename);
-
-          if (ext_arch == NULL
-              || ! bfd_check_format (ext_arch, bfd_archive))
-            {
-              bfd_release (archive, new_areldata);
-              return NULL;
-            }
-          n_nfd = _bfd_get_elt_at_filepos (ext_arch, new_areldata->origin);
-          if (n_nfd == NULL)
-            {
-              bfd_release (archive, new_areldata);
-              return NULL;
-            }
-          n_nfd->proxy_origin = bfd_tell (archive);
-          return n_nfd;
-        }
+       {
+         /* This proxy entry refers to an element of a nested archive.
+            Locate the member of that archive and return a bfd for it.  */
+         bfd *ext_arch = _bfd_find_nested_archive (archive, filename);
+
+         if (ext_arch == NULL
+             || ! bfd_check_format (ext_arch, bfd_archive))
+           {
+             free (new_areldata);
+             return NULL;
+           }
+         n_nfd = _bfd_get_elt_at_filepos (ext_arch, new_areldata->origin);
+         if (n_nfd == NULL)
+           {
+             free (new_areldata);
+             return NULL;
+           }
+         n_nfd->proxy_origin = bfd_tell (archive);
+         return n_nfd;
+       }
       /* It's not an element of a nested archive;
-         open the external file as a bfd.  */
+        open the external file as a bfd.  */
       target = NULL;
       if (!archive->target_defaulted)
        target = archive->xvec->name;
@@ -648,7 +692,7 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
 
   if (n_nfd == NULL)
     {
-      bfd_release (archive, new_areldata);
+      free (new_areldata);
       return NULL;
     }
 
@@ -672,7 +716,8 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
   if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
     return n_nfd;
 
-  bfd_release (archive, new_areldata);
+  free (new_areldata);
+  n_nfd->arelt_data = NULL;
   return NULL;
 }
 
@@ -727,13 +772,11 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
     filestart = bfd_ardata (archive)->first_file_filepos;
   else
     {
-      unsigned int size = arelt_size (last_file);
+      bfd_size_type size = arelt_size (last_file);
 
       filestart = last_file->proxy_origin;
       if (! bfd_is_thin_archive (archive))
-        filestart += size;
-      if (archive->my_archive)
-       filestart -= archive->origin;
+       filestart += size;
       /* Pad to an even boundary...
         Note that last_file->origin can be odd in the case of
         BSD-4.4-style element with a long odd size.  */
@@ -814,11 +857,7 @@ bfd_generic_archive_p (bfd *abfd)
          first->target_defaulted = FALSE;
          if (bfd_check_format (first, bfd_object)
              && first->xvec != abfd->xvec)
-           {
-             bfd_set_error (bfd_error_wrong_object_format);
-             bfd_ardata (abfd) = tdata_hold;
-             return NULL;
-           }
+           bfd_set_error (bfd_error_wrong_object_format);
          /* And we ought to close `first' here too.  */
        }
     }
@@ -861,7 +900,7 @@ do_slurp_bsd_armap (bfd *abfd)
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, mapdata); /* Don't need it any more.  */
+  free (mapdata);
 
   raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
   if (raw_armap == NULL)
@@ -925,7 +964,7 @@ do_slurp_coff_armap (bfd *abfd)
   struct artdata *ardata = bfd_ardata (abfd);
   char *stringbase;
   bfd_size_type stringsize;
-  unsigned int parsed_size;
+  bfd_size_type parsed_size;
   carsym *carsyms;
   bfd_size_type nsymz;         /* Number of symbols in armap.  */
   bfd_vma (*swap) (const void *);
@@ -937,7 +976,7 @@ do_slurp_coff_armap (bfd *abfd)
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, mapdata); /* Don't need it any more.  */
+  free (mapdata);
 
   if (bfd_bread (int_buf, 4, abfd) != 4)
     {
@@ -979,7 +1018,7 @@ do_slurp_coff_armap (bfd *abfd)
     return FALSE;
 
   ardata->symdefs = (struct carsym *) bfd_zalloc (abfd,
-                                                  carsym_size + stringsize + 1);
+                                                 carsym_size + stringsize + 1);
   if (ardata->symdefs == NULL)
     return FALSE;
   carsyms = ardata->symdefs;
@@ -1030,7 +1069,7 @@ do_slurp_coff_armap (bfd *abfd)
            ardata->first_file_filepos +=
              (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
          }
-       bfd_release (abfd, tmp);
+       free (tmp);
       }
   }
 
@@ -1079,21 +1118,21 @@ bfd_slurp_armap (bfd *abfd)
   else if (CONST_STRNEQ (nextname, "#1/20           "))
     {
       /* Mach-O has a special name for armap when the map is sorted by name.
-         However because this name has a space it is slightly more difficult
-         to check it.  */
+        However because this name has a space it is slightly more difficult
+        to check it.  */
       struct ar_hdr hdr;
       char extname[21];
 
       if (bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
-        return FALSE;
+       return FALSE;
       /* Read the extended name.  We know its length.  */
       if (bfd_bread (extname, 20, abfd) != 20)
-        return FALSE;
-      if (bfd_seek (abfd, (file_ptr) -(sizeof (hdr) + 20), SEEK_CUR) != 0)
-        return FALSE;
+       return FALSE;
+      if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0)
+       return FALSE;
       if (CONST_STRNEQ (extname, "__.SYMDEF SORTED")
-          || CONST_STRNEQ (extname, "__.SYMDEF"))
-        return do_slurp_bsd_armap (abfd);
+         || CONST_STRNEQ (extname, "__.SYMDEF"))
+       return do_slurp_bsd_armap (abfd);
     }
 
   bfd_has_map (abfd) = FALSE;
@@ -1147,15 +1186,17 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
 
   if (mapdata->parsed_size < HPUX_SYMDEF_COUNT_SIZE + BSD_STRING_COUNT_SIZE)
     {
+      free (mapdata);
     wrong_format:
       bfd_set_error (bfd_error_wrong_format);
     byebye:
-      bfd_release (abfd, mapdata);
       return FALSE;
     }
   left = mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE - BSD_STRING_COUNT_SIZE;
 
   amt = mapdata->parsed_size;
+  free (mapdata);
+
   raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
   if (raw_armap == NULL)
     goto byebye;
@@ -1250,14 +1291,14 @@ _bfd_slurp_extended_name_table (bfd *abfd)
 
       amt = namedata->parsed_size;
       if (amt + 1 == 0)
-        goto byebye;
+       goto byebye;
 
       bfd_ardata (abfd)->extended_names_size = amt;
       bfd_ardata (abfd)->extended_names = (char *) bfd_zalloc (abfd, amt + 1);
       if (bfd_ardata (abfd)->extended_names == NULL)
        {
        byebye:
-         bfd_release (abfd, namedata);
+         free (namedata);
          return FALSE;
        }
 
@@ -1276,7 +1317,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
         trailing '/'.  DOS/NT created archive often have \ in them
         We'll fix all problems here..  */
       {
-        char *ext_names = bfd_ardata (abfd)->extended_names;
+       char *ext_names = bfd_ardata (abfd)->extended_names;
        char *temp = ext_names;
        char *limit = temp + namedata->parsed_size;
        for (; temp < limit; ++temp)
@@ -1294,8 +1335,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
       bfd_ardata (abfd)->first_file_filepos +=
        (bfd_ardata (abfd)->first_file_filepos) % 2;
 
-      /* FIXME, we can't release namedata here because it was allocated
-        below extended_names on the objalloc...  */
+      free (namedata);
     }
   return TRUE;
 }
@@ -1366,7 +1406,7 @@ normalize (bfd *abfd ATTRIBUTE_UNUSED, const char *file)
    the autogenerated bfd.h header...
 
    Note - the string is returned in a static buffer.  */
-   
+
 static const char *
 adjust_relative_path (const char * path, const char * ref_path)
 {
@@ -1389,7 +1429,7 @@ adjust_relative_path (const char * path, const char * ref_path)
 
   rpath = lrealpath (ref_path);
   refp = rpath == NULL ? ref_path : rpath;
+
   /* Remove common leading path elements.  */
   for (;;)
     {
@@ -1415,7 +1455,7 @@ adjust_relative_path (const char * path, const char * ref_path)
       {
        /* PR 12710:  If the path element is "../" then instead of
           inserting "../" we need to insert the name of the directory
-          at the current level.  */    
+          at the current level.  */
        if (refp > ref_path + 1
            && refp[-1] == '.'
            && refp[-2] == '.')
@@ -1426,7 +1466,7 @@ adjust_relative_path (const char * path, const char * ref_path)
 
   /* If the lrealpath calls above succeeded then we should never
      see dir_up and dir_down both being non-zero.  */
-  
+
   len += 3 * dir_up;
 
   if (dir_down)
@@ -1531,40 +1571,40 @@ _bfd_construct_extended_name_table (bfd *abfd,
       unsigned int thislen;
 
       if (bfd_is_thin_archive (abfd))
-        {
-          const char *filename = current->filename;
-
-          /* If the element being added is a member of another archive
-             (i.e., we are flattening), use the containing archive's name.  */
-          if (current->my_archive
-              && ! bfd_is_thin_archive (current->my_archive))
-            filename = current->my_archive->filename;
-
-          /* If the path is the same as the previous path seen,
-             reuse it.  This can happen when flattening a thin
-             archive that contains other archives.  */
-          if (last_filename && filename_cmp (last_filename, filename) == 0)
-            continue;
-
-          last_filename = filename;
-
-          /* If the path is relative, adjust it relative to
-             the containing archive. */
-          if (! IS_ABSOLUTE_PATH (filename)
-              && ! IS_ABSOLUTE_PATH (abfd->filename))
-            normal = adjust_relative_path (filename, abfd->filename);
-          else
-            normal = filename;
-
-          /* In a thin archive, always store the full pathname
-             in the extended name table.  */
-          total_namelen += strlen (normal) + 1;
+       {
+         const char *filename = current->filename;
+
+         /* If the element being added is a member of another archive
+            (i.e., we are flattening), use the containing archive's name.  */
+         if (current->my_archive
+             && ! bfd_is_thin_archive (current->my_archive))
+           filename = current->my_archive->filename;
+
+         /* If the path is the same as the previous path seen,
+            reuse it.  This can happen when flattening a thin
+            archive that contains other archives.  */
+         if (last_filename && filename_cmp (last_filename, filename) == 0)
+           continue;
+
+         last_filename = filename;
+
+         /* If the path is relative, adjust it relative to
+            the containing archive. */
+         if (! IS_ABSOLUTE_PATH (filename)
+             && ! IS_ABSOLUTE_PATH (abfd->filename))
+           normal = adjust_relative_path (filename, abfd->filename);
+         else
+           normal = filename;
+
+         /* In a thin archive, always store the full pathname
+            in the extended name table.  */
+         total_namelen += strlen (normal) + 1;
          if (trailing_slash)
            /* Leave room for trailing slash.  */
            ++total_namelen;
 
-          continue;
-        }
+         continue;
+       }
 
       normal = normalize (current, current->filename);
       if (normal == NULL)
@@ -1594,7 +1634,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
                  && hdr->ar_name[thislen] != ar_padchar (current)))
            {
              /* Must have been using extended format even though it
-                didn't need to.  Fix it to use normal format.  */
+                didn't need to.  Fix it to use normal format.  */
              memcpy (hdr->ar_name, normal, thislen);
              if (thislen < maxname
                  || (thislen == maxname && thislen < sizeof hdr->ar_name))
@@ -1626,31 +1666,31 @@ _bfd_construct_extended_name_table (bfd *abfd,
       const char *filename = current->filename;
 
       if (bfd_is_thin_archive (abfd))
-        {
-          /* If the element being added is a member of another archive
-             (i.e., we are flattening), use the containing archive's name.  */
-          if (current->my_archive
-              && ! bfd_is_thin_archive (current->my_archive))
-            filename = current->my_archive->filename;
-          /* If the path is the same as the previous path seen,
-             reuse it.  This can happen when flattening a thin
-             archive that contains other archives.
-             If the path is relative, adjust it relative to
-             the containing archive.  */
-          if (last_filename && filename_cmp (last_filename, filename) == 0)
-            normal = last_filename;
-          else if (! IS_ABSOLUTE_PATH (filename)
-                   && ! IS_ABSOLUTE_PATH (abfd->filename))
-            normal = adjust_relative_path (filename, abfd->filename);
-          else
-            normal = filename;
-        }
+       {
+         /* If the element being added is a member of another archive
+            (i.e., we are flattening), use the containing archive's name.  */
+         if (current->my_archive
+             && ! bfd_is_thin_archive (current->my_archive))
+           filename = current->my_archive->filename;
+         /* If the path is the same as the previous path seen,
+            reuse it.  This can happen when flattening a thin
+            archive that contains other archives.
+            If the path is relative, adjust it relative to
+            the containing archive.  */
+         if (last_filename && filename_cmp (last_filename, filename) == 0)
+           normal = last_filename;
+         else if (! IS_ABSOLUTE_PATH (filename)
+                  && ! IS_ABSOLUTE_PATH (abfd->filename))
+           normal = adjust_relative_path (filename, abfd->filename);
+         else
+           normal = filename;
+       }
       else
-        {
-          normal = normalize (current, filename);
-          if (normal == NULL)
-            return FALSE;
-        }
+       {
+         normal = normalize (current, filename);
+         if (normal == NULL)
+           return FALSE;
+       }
 
       thislen = strlen (normal);
       if (thislen > maxname || bfd_is_thin_archive (abfd))
@@ -1661,16 +1701,16 @@ _bfd_construct_extended_name_table (bfd *abfd,
          struct ar_hdr *hdr = arch_hdr (current);
          if (normal == last_filename)
            stroff = last_stroff;
-          else
-            {
+         else
+           {
              strcpy (strptr, normal);
              if (! trailing_slash)
-               strptr[thislen] = ARFMAG[1];
+               strptr[thislen] = ARFMAG[1];
              else
-               {
-                 strptr[thislen] = '/';
-                 strptr[thislen + 1] = ARFMAG[1];
-               }
+               {
+                 strptr[thislen] = '/';
+                 strptr[thislen + 1] = ARFMAG[1];
+               }
              stroff = strptr - *tabloc;
              last_stroff = stroff;
            }
@@ -1678,19 +1718,19 @@ _bfd_construct_extended_name_table (bfd *abfd,
          if (bfd_is_thin_archive (abfd) && current->origin > 0)
            {
              int len = snprintf (hdr->ar_name + 1, maxname - 1, "%-ld:",
-                                 stroff);
+                                 stroff);
              _bfd_ar_spacepad (hdr->ar_name + 1 + len, maxname - 1 - len,
-                                "%-ld",
-                                current->origin - sizeof (struct ar_hdr));
+                               "%-ld",
+                               current->origin - sizeof (struct ar_hdr));
            }
          else
-            _bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld", stroff);
-          if (normal != last_filename)
-            {
+           _bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld", stroff);
+         if (normal != last_filename)
+           {
              strptr += thislen + 1;
              if (trailing_slash)
-               ++strptr;
-              last_filename = filename;
+               ++strptr;
+             last_filename = filename;
            }
        }
     }
@@ -1703,9 +1743,9 @@ _bfd_construct_extended_name_table (bfd *abfd,
 
 bfd_boolean
 _bfd_archive_bsd44_construct_extended_name_table (bfd *abfd,
-                                                  char **tabloc,
-                                                  bfd_size_type *tablen,
-                                                  const char **name)
+                                                 char **tabloc,
+                                                 bfd_size_type *tablen,
+                                                 const char **name)
 {
   unsigned int maxname = ar_maxnamelen (abfd);
   bfd *current;
@@ -1726,16 +1766,16 @@ _bfd_archive_bsd44_construct_extended_name_table (bfd *abfd,
        return FALSE;
 
       for (len = 0; normal[len]; len++)
-        if (normal[len] == ' ')
-          has_space = 1;
+       if (normal[len] == ' ')
+         has_space = 1;
 
       if (len > maxname || has_space)
        {
-          struct ar_hdr *hdr = arch_hdr (current);
+         struct ar_hdr *hdr = arch_hdr (current);
 
-          len = (len + 3) & ~3;
-          arch_eltdata (current)->extra_size = len;
-          _bfd_ar_spacepad (hdr->ar_name, maxname, "#1/%lu", len);
+         len = (len + 3) & ~3;
+         arch_eltdata (current)->extra_size = len;
+         _bfd_ar_spacepad (hdr->ar_name, maxname, "#1/%lu", len);
        }
     }
 
@@ -1770,27 +1810,29 @@ _bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd)
 
       BFD_ASSERT (padded_len == arch_eltdata (abfd)->extra_size);
 
-      _bfd_ar_spacepad (hdr->ar_size, sizeof (hdr->ar_size), "%-10ld",
-                        arch_eltdata (abfd)->parsed_size + padded_len);
+      if (!_bfd_ar_sizepad (hdr->ar_size, sizeof (hdr->ar_size),
+                           arch_eltdata (abfd)->parsed_size + padded_len))
+       return FALSE;
 
       if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
-        return FALSE;
+       return FALSE;
 
       if (bfd_bwrite (fullname, len, archive) != len)
-        return FALSE;
+       return FALSE;
+
       if (len & 3)
-        {
-          static const char pad[3] = { 0, 0, 0 };
+       {
+         static const char pad[3] = { 0, 0, 0 };
 
-          len = 4 - (len & 3);
-          if (bfd_bwrite (pad, len, archive) != len)
-            return FALSE;
-        }
+         len = 4 - (len & 3);
+         if (bfd_bwrite (pad, len, archive) != len)
+           return FALSE;
+       }
     }
   else
     {
       if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
-        return FALSE;
+       return FALSE;
     }
   return TRUE;
 }
@@ -1861,7 +1903,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
     }
 
   amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
-  ared = (struct areltdata *) bfd_zalloc (abfd, amt);
+  ared = (struct areltdata *) bfd_zmalloc (amt);
   if (ared == NULL)
     return NULL;
   hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
@@ -1870,7 +1912,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
   memset (hdr, ' ', sizeof (struct ar_hdr));
 
   _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
-                    status.st_mtime);
+                   status.st_mtime);
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
      > 99999.  */
@@ -1879,7 +1921,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
   else
 #endif
     _bfd_ar_spacepad (hdr->ar_uid, sizeof (hdr->ar_uid), "%ld",
-                      status.st_uid);
+                     status.st_uid);
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
      > 99999.  */
@@ -1888,11 +1930,14 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
   else
 #endif
     _bfd_ar_spacepad (hdr->ar_gid, sizeof (hdr->ar_gid), "%ld",
-                      status.st_gid);
+                     status.st_gid);
   _bfd_ar_spacepad (hdr->ar_mode, sizeof (hdr->ar_mode), "%-8lo",
-                    status.st_mode);
-  _bfd_ar_spacepad (hdr->ar_size, sizeof (hdr->ar_size), "%-10ld",
-                    status.st_size);
+                   status.st_mode);
+  if (!_bfd_ar_sizepad (hdr->ar_size, sizeof (hdr->ar_size), status.st_size))
+    {
+      free (ared);
+      return NULL;
+    }
   memcpy (hdr->ar_fmag, ARFMAG, 2);
   ared->parsed_size = status.st_size;
   ared->arch_header = (char *) hdr;
@@ -2132,8 +2177,9 @@ _bfd_write_archive_contents (bfd *arch)
       memset (&hdr, ' ', sizeof (struct ar_hdr));
       memcpy (hdr.ar_name, ename, strlen (ename));
       /* Round size up to even number in archive header.  */
-      _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
-                        (elength + 1) & ~(bfd_size_type) 1);
+      if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size),
+                           (elength + 1) & ~(bfd_size_type) 1))
+       return FALSE;
       memcpy (hdr.ar_fmag, ARFMAG, 2);
       if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
           != sizeof (struct ar_hdr))
@@ -2151,13 +2197,13 @@ _bfd_write_archive_contents (bfd *arch)
        current = current->archive_next)
     {
       char buffer[DEFAULT_BUFFERSIZE];
-      unsigned int remaining = arelt_size (current);
+      bfd_size_type remaining = arelt_size (current);
 
       /* Write ar header.  */
       if (!_bfd_write_ar_hdr (arch, current))
-        return FALSE;
+       return FALSE;
       if (bfd_is_thin_archive (arch))
-        continue;
+       continue;
       if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
        goto input_err;
 
@@ -2282,16 +2328,16 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
                goto error_return;
 
              /* Now map over all the symbols, picking out the ones we
-                 want.  */
+                want.  */
              for (src_count = 0; src_count < symcount; src_count++)
                {
                  flagword flags = (syms[src_count])->flags;
                  asection *sec = syms[src_count]->section;
 
-                 if ((flags & BSF_GLOBAL
-                      || flags & BSF_WEAK
-                      || flags & BSF_INDIRECT
-                      || flags & BSF_GNU_UNIQUE
+                 if (((flags & (BSF_GLOBAL
+                                | BSF_WEAK
+                                | BSF_INDIRECT
+                                | BSF_GNU_UNIQUE)) != 0
                       || bfd_is_com_section (sec))
                      && ! bfd_is_und_section (sec))
                    {
@@ -2316,7 +2362,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
                      if (map[orl_count].name == NULL)
                        goto error_return;
                      *(map[orl_count].name) = (char *) bfd_alloc (arch,
-                                                                   namelen + 1);
+                                                                  namelen + 1);
                      if (*(map[orl_count].name) == NULL)
                        goto error_return;
                      strcpy (*(map[orl_count].name), syms[src_count]->name);
@@ -2406,10 +2452,11 @@ bsd_write_armap (bfd *arch,
   bfd_ardata (arch)->armap_datepos = (SARMAG
                                      + offsetof (struct ar_hdr, ar_date[0]));
   _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
-                    bfd_ardata (arch)->armap_timestamp);
+                   bfd_ardata (arch)->armap_timestamp);
   _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", uid);
   _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", gid);
-  _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", mapsize);
+  if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize))
+    return FALSE;
   memcpy (hdr.ar_fmag, ARFMAG, 2);
   if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
       != sizeof (struct ar_hdr))
@@ -2420,22 +2467,33 @@ bsd_write_armap (bfd *arch,
 
   for (count = 0; count < orl_count; count++)
     {
+      unsigned int offset;
       bfd_byte buf[BSD_SYMDEF_SIZE];
 
       if (map[count].u.abfd != last_elt)
        {
          do
            {
-              struct areltdata *ared = arch_eltdata (current);
+             struct areltdata *ared = arch_eltdata (current);
 
              firstreal += (ared->parsed_size + ared->extra_size
-                            + sizeof (struct ar_hdr));
+                           + sizeof (struct ar_hdr));
              firstreal += firstreal % 2;
              current = current->archive_next;
            }
          while (current != map[count].u.abfd);
        }
 
+      /* The archive file format only has 4 bytes to store the offset
+        of the member.  Check to make sure that firstreal has not grown
+        too big.  */
+      offset = (unsigned int) firstreal;
+      if (firstreal != (file_ptr) offset)
+       {
+         bfd_set_error (bfd_error_file_truncated);
+         return FALSE;
+       }
+
       last_elt = current;
       H_PUT_32 (arch, map[count].namidx, buf);
       H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
@@ -2503,7 +2561,7 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
   /* Prepare an ASCII version suitable for writing.  */
   memset (hdr.ar_date, ' ', sizeof (hdr.ar_date));
   _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
-                    bfd_ardata (arch)->armap_timestamp);
+                   bfd_ardata (arch)->armap_timestamp);
 
   /* Write it into the file.  */
   bfd_ardata (arch)->armap_datepos = (SARMAG
@@ -2547,7 +2605,7 @@ coff_write_armap (bfd *arch,
   unsigned int ranlibsize = (symbol_count * 4) + 4;
   unsigned int stringsize = stridx;
   unsigned int mapsize = stringsize + ranlibsize;
-  unsigned int archive_member_file_ptr;
+  file_ptr archive_member_file_ptr;
   bfd *current = arch->archive_head;
   unsigned int count;
   struct ar_hdr hdr;
@@ -2564,11 +2622,11 @@ coff_write_armap (bfd *arch,
 
   memset (&hdr, ' ', sizeof (struct ar_hdr));
   hdr.ar_name[0] = '/';
-  _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
-                    mapsize);
+  if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize))
+    return FALSE;
   _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
-                    ((arch->flags & BFD_DETERMINISTIC_OUTPUT) == 0
-                     ? time (NULL) : 0));
+                   ((arch->flags & BFD_DETERMINISTIC_OUTPUT) == 0
+                    ? time (NULL) : 0));
   /* This, at least, is what Intel coff sets the values to.  */
   _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
   _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
@@ -2598,18 +2656,26 @@ coff_write_armap (bfd *arch,
 
       while (count < symbol_count && map[count].u.abfd == current)
        {
-         if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
+         unsigned int offset = (unsigned int) archive_member_file_ptr;
+
+         /* Catch an attempt to grow an archive past its 4Gb limit.  */
+         if (archive_member_file_ptr != (file_ptr) offset)
+           {
+             bfd_set_error (bfd_error_file_truncated);
+             return FALSE;
+           }
+         if (!bfd_write_bigendian_4byte_int (arch, offset))
            return FALSE;
          count++;
        }
       archive_member_file_ptr += sizeof (struct ar_hdr);
       if (! bfd_is_thin_archive (arch))
-        {
-          /* Add size of this archive entry.  */
-          archive_member_file_ptr += arelt_size (current);
-          /* Remember about the even alignment.  */
-          archive_member_file_ptr += archive_member_file_ptr % 2;
-        }
+       {
+         /* Add size of this archive entry.  */
+         archive_member_file_ptr += arelt_size (current);
+         /* Remember about the even alignment.  */
+         archive_member_file_ptr += archive_member_file_ptr % 2;
+       }
       current = current->archive_next;
     }
 
@@ -2632,3 +2698,58 @@ coff_write_armap (bfd *arch,
 
   return TRUE;
 }
+
+static int
+archive_close_worker (void **slot, void *inf ATTRIBUTE_UNUSED)
+{
+  struct ar_cache *ent = (struct ar_cache *) *slot;
+
+  bfd_close_all_done (ent->arbfd);
+  return 1;
+}
+
+bfd_boolean
+_bfd_archive_close_and_cleanup (bfd *abfd)
+{
+  if (bfd_read_p (abfd) && abfd->format == bfd_archive)
+    {
+      bfd *nbfd;
+      bfd *next;
+      htab_t htab;
+
+      /* Close nested archives (if this bfd is a thin archive).  */
+      for (nbfd = abfd->nested_archives; nbfd; nbfd = next)
+       {
+         next = nbfd->archive_next;
+         bfd_close (nbfd);
+       }
+
+      htab = bfd_ardata (abfd)->cache;
+      if (htab)
+       {
+         htab_traverse_noresize (htab, archive_close_worker, NULL);
+         htab_delete (htab);
+         bfd_ardata (abfd)->cache = NULL;
+       }
+    }
+  else if (arch_eltdata (abfd) != NULL)
+    {
+      struct areltdata *ared = arch_eltdata (abfd);
+      htab_t htab = (htab_t) ared->parent_cache;
+
+      if (htab)
+       {
+         struct ar_cache ent;
+         void **slot;
+
+         ent.ptr = ared->key;
+         slot = htab_find_slot (htab, &ent, NO_INSERT);
+         if (slot != NULL)
+           {
+             BFD_ASSERT (((struct ar_cache *) *slot)->arbfd == abfd);
+             htab_clear_slot (htab, slot);
+           }
+       }
+    }
+  return TRUE;
+}
index bbc4c3f..be64e0d 100644 (file)
@@ -1,6 +1,5 @@
-/* MIPS-specific support for 64-bit ELF
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007,
-   2010  Free Software Foundation, Inc.
+/* Support for 64-bit ELF archives.
+   Copyright 1996-2013 Free Software Foundation, Inc.
    Ian Lance Taylor, Cygnus Support
    Linker support added by Mark Mitchell, CodeSourcery, LLC.
    <mark@codesourcery.com>
@@ -77,7 +76,7 @@ bfd_elf64_archive_slurp_armap (bfd *abfd)
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, mapdata);
+  free (mapdata);
 
   if (bfd_bread (int_buf, 8, abfd) != 8)
     {
@@ -169,8 +168,8 @@ bfd_elf64_archive_write_armap (bfd *arch,
 
   memset (&hdr, ' ', sizeof (struct ar_hdr));
   memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/"));
-  _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
-                    mapsize);
+  if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize))
+    return FALSE;
   _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
                     time (NULL));
   /* This, at least, is what Intel coff sets the values to.: */
@@ -200,7 +199,7 @@ bfd_elf64_archive_write_armap (bfd *arch,
        current = current->archive_next)
     {
       /* For each symbol which is used defined in this object, write out
-        the object file's address in the archive */
+        the object file's address in the archive */
 
       for (;
           count < symbol_count && map[count].u.abfd == current;
@@ -210,9 +209,11 @@ bfd_elf64_archive_write_armap (bfd *arch,
          if (bfd_bwrite (buf, 8, arch) != 8)
            return FALSE;
        }
+
       /* Add size of this archive entry */
-      archive_member_file_ptr += (arelt_size (current)
-                                 + sizeof (struct ar_hdr));
+      archive_member_file_ptr += sizeof (struct ar_hdr);
+      if (! bfd_is_thin_archive (arch))
+       archive_member_file_ptr += arelt_size (current);
       /* remember about the even alignment */
       archive_member_file_ptr += archive_member_file_ptr % 2;
     }
index f609534..0be72da 100644 (file)
@@ -1,7 +1,7 @@
 /* BFD library support routines for architectures.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+   2012, 2013 Free Software Foundation, Inc.
    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -145,7 +145,7 @@ DESCRIPTION
 .#define bfd_mach_sparc_64bit_p(mach) \
 .  ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
 .  bfd_arch_spu,       {* PowerPC SPU *}
-.#define bfd_mach_spu          256 
+.#define bfd_mach_spu          256
 .  bfd_arch_mips,      {* MIPS Rxxxx *}
 .#define bfd_mach_mips3000             3000
 .#define bfd_mach_mips3900             3900
@@ -161,6 +161,7 @@ DESCRIPTION
 .#define bfd_mach_mips5000             5000
 .#define bfd_mach_mips5400             5400
 .#define bfd_mach_mips5500             5500
+.#define bfd_mach_mips5900             5900
 .#define bfd_mach_mips6000             6000
 .#define bfd_mach_mips7000             7000
 .#define bfd_mach_mips8000             8000
@@ -241,7 +242,10 @@ DESCRIPTION
 .#define bfd_mach_ppc_e500      500
 .#define bfd_mach_ppc_e500mc    5001
 .#define bfd_mach_ppc_e500mc64  5005
+.#define bfd_mach_ppc_e5500     5006
+.#define bfd_mach_ppc_e6500     5007
 .#define bfd_mach_ppc_titan     83
+.#define bfd_mach_ppc_vle       84
 .  bfd_arch_rs6000,    {* IBM RS/6000 *}
 .#define bfd_mach_rs6k         6000
 .#define bfd_mach_rs6k_rs1     6001
@@ -263,6 +267,8 @@ DESCRIPTION
 .#define bfd_mach_m6812_default 0
 .#define bfd_mach_m6812         1
 .#define bfd_mach_m6812s        2
+.  bfd_arch_m9s12x,   {* Freescale S12X *}
+.  bfd_arch_m9s12xg,  {* Freescale XGATE *}
 .  bfd_arch_z8k,       {* Zilog Z8000 *}
 .#define bfd_mach_z8001                1
 .#define bfd_mach_z8002                2
@@ -318,11 +324,13 @@ DESCRIPTION
 .  bfd_arch_tic6x,     {* Texas Instruments TMS320C6X *}
 .  bfd_arch_tic80,     {* TI TMS320c80 (MVP) *}
 .  bfd_arch_v850,      {* NEC V850 *}
+.  bfd_arch_v850_rh850,{* NEC V850 (using RH850 ABI) *}
 .#define bfd_mach_v850          1
 .#define bfd_mach_v850e        'E'
 .#define bfd_mach_v850e1        '1'
 .#define bfd_mach_v850e2        0x4532
 .#define bfd_mach_v850e2v3      0x45325633
+.#define bfd_mach_v850e3v5      0x45335635 {* ('E'|'3'|'V'|'5') *}
 .  bfd_arch_arc,       {* ARC Cores *}
 .#define bfd_mach_arc_5         5
 .#define bfd_mach_arc_6         6
@@ -358,6 +366,8 @@ DESCRIPTION
 .#define bfd_mach_mep          1
 .#define bfd_mach_mep_h1       0x6831
 .#define bfd_mach_mep_c5       0x6335
+.  bfd_arch_metag,
+.#define bfd_mach_metag                1
 .  bfd_arch_ia64,      {* HP/Intel ia64 *}
 .#define bfd_mach_ia64_elf64   64
 .#define bfd_mach_ia64_elf32   32
@@ -412,7 +422,7 @@ DESCRIPTION
 .  bfd_arch_s390,      {* IBM s390 *}
 .#define bfd_mach_s390_31       31
 .#define bfd_mach_s390_64       64
-.  bfd_arch_score,     {* Sunplus score *} 
+.  bfd_arch_score,     {* Sunplus score *}
 .#define bfd_mach_score3         3
 .#define bfd_mach_score7         7
 .  bfd_arch_openrisc,  {* OpenRISC *}
@@ -438,7 +448,9 @@ DESCRIPTION
 .  bfd_arch_xc16x,     {* Infineon's XC16X Series.               *}
 .#define bfd_mach_xc16x         1
 .#define bfd_mach_xc16xl        2
-.#define bfd_mach_xc16xs         3
+.#define bfd_mach_xc16xs        3
+.  bfd_arch_xgate,   {* Freescale XGATE *}
+.#define bfd_mach_xgate         1
 .  bfd_arch_xtensa,    {* Tensilica's Xtensa cores.  *}
 .#define bfd_mach_xtensa       1
 .  bfd_arch_z80,
@@ -453,6 +465,11 @@ DESCRIPTION
 .  bfd_arch_tilegx, {* Tilera TILE-Gx *}
 .#define bfd_mach_tilepro   1
 .#define bfd_mach_tilegx    1
+.#define bfd_mach_tilegx32  2
+.  bfd_arch_aarch64,   {* AArch64  *}
+.#define bfd_mach_aarch64 0
+.  bfd_arch_nios2,
+.#define bfd_mach_nios2        0
 .  bfd_arch_last
 .  };
 */
@@ -485,12 +502,19 @@ DESCRIPTION
 .
 .  bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
 .
+.  {* Allocate via bfd_malloc and return a fill buffer of size COUNT.  If
+.     IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If CODE is
+.     TRUE, the buffer contains code.  *}
+.  void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
+.                bfd_boolean code);
+.
 .  const struct bfd_arch_info *next;
 .}
 .bfd_arch_info_type;
 .
 */
 
+extern const bfd_arch_info_type bfd_aarch64_arch;
 extern const bfd_arch_info_type bfd_alpha_arch;
 extern const bfd_arch_info_type bfd_arc_arch;
 extern const bfd_arch_info_type bfd_arm_arch;
@@ -523,10 +547,13 @@ extern const bfd_arch_info_type bfd_m32c_arch;
 extern const bfd_arch_info_type bfd_m32r_arch;
 extern const bfd_arch_info_type bfd_m68hc11_arch;
 extern const bfd_arch_info_type bfd_m68hc12_arch;
+extern const bfd_arch_info_type bfd_m9s12x_arch;
+extern const bfd_arch_info_type bfd_m9s12xg_arch;
 extern const bfd_arch_info_type bfd_m68k_arch;
 extern const bfd_arch_info_type bfd_m88k_arch;
 extern const bfd_arch_info_type bfd_mcore_arch;
 extern const bfd_arch_info_type bfd_mep_arch;
+extern const bfd_arch_info_type bfd_metag_arch;
 extern const bfd_arch_info_type bfd_mips_arch;
 extern const bfd_arch_info_type bfd_microblaze_arch;
 extern const bfd_arch_info_type bfd_mmix_arch;
@@ -535,6 +562,7 @@ extern const bfd_arch_info_type bfd_mn10300_arch;
 extern const bfd_arch_info_type bfd_moxie_arch;
 extern const bfd_arch_info_type bfd_msp430_arch;
 extern const bfd_arch_info_type bfd_mt_arch;
+extern const bfd_arch_info_type bfd_nios2_arch;
 extern const bfd_arch_info_type bfd_ns32k_arch;
 extern const bfd_arch_info_type bfd_openrisc_arch;
 extern const bfd_arch_info_type bfd_or32_arch;
@@ -559,12 +587,14 @@ extern const bfd_arch_info_type bfd_tic80_arch;
 extern const bfd_arch_info_type bfd_tilegx_arch;
 extern const bfd_arch_info_type bfd_tilepro_arch;
 extern const bfd_arch_info_type bfd_v850_arch;
+extern const bfd_arch_info_type bfd_v850_rh850_arch;
 extern const bfd_arch_info_type bfd_vax_arch;
 extern const bfd_arch_info_type bfd_w65_arch;
 extern const bfd_arch_info_type bfd_we32k_arch;
 extern const bfd_arch_info_type bfd_xstormy16_arch;
 extern const bfd_arch_info_type bfd_xtensa_arch;
 extern const bfd_arch_info_type bfd_xc16x_arch;
+extern const bfd_arch_info_type bfd_xgate_arch;
 extern const bfd_arch_info_type bfd_z80_arch;
 extern const bfd_arch_info_type bfd_z8k_arch;
 
@@ -573,6 +603,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
 #ifdef SELECT_ARCHITECTURES
     SELECT_ARCHITECTURES,
 #else
+    &bfd_aarch64_arch,
     &bfd_alpha_arch,
     &bfd_arc_arch,
     &bfd_arm_arch,
@@ -605,10 +636,13 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_m32r_arch,
     &bfd_m68hc11_arch,
     &bfd_m68hc12_arch,
+    &bfd_m9s12x_arch,
+    &bfd_m9s12xg_arch,
     &bfd_m68k_arch,
     &bfd_m88k_arch,
     &bfd_mcore_arch,
     &bfd_mep_arch,
+    &bfd_metag_arch,
     &bfd_microblaze_arch,
     &bfd_mips_arch,
     &bfd_mmix_arch,
@@ -617,6 +651,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_moxie_arch,
     &bfd_msp430_arch,
     &bfd_mt_arch,
+    &bfd_nios2_arch,
     &bfd_ns32k_arch,
     &bfd_openrisc_arch,
     &bfd_or32_arch,
@@ -638,12 +673,14 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_tilegx_arch,
     &bfd_tilepro_arch,
     &bfd_v850_arch,
+    &bfd_v850_rh850_arch,
     &bfd_vax_arch,
     &bfd_w65_arch,
     &bfd_we32k_arch,
     &bfd_xstormy16_arch,
     &bfd_xtensa_arch,
     &bfd_xc16x_arch,
+    &bfd_xgate_arch,
     &bfd_z80_arch,
     &bfd_z8k_arch,
 #endif
@@ -814,6 +851,7 @@ const bfd_arch_info_type bfd_default_arch_struct = {
   32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0,
 };
 
@@ -1309,3 +1347,29 @@ bfd_arch_mach_octets_per_byte (enum bfd_architecture arch,
     return ap->bits_per_byte / 8;
   return 1;
 }
+
+/*
+INTERNAL_FUNCTION
+       bfd_arch_default_fill
+
+SYNOPSIS
+       void *bfd_arch_default_fill (bfd_size_type count,
+                                    bfd_boolean is_bigendian,
+                                    bfd_boolean code);
+
+DESCRIPTION
+       Allocate via bfd_malloc and return a fill buffer of size COUNT.
+       If IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If
+       CODE is TRUE, the buffer contains code.
+*/
+
+void *
+bfd_arch_default_fill (bfd_size_type count,
+                      bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
+                      bfd_boolean code ATTRIBUTE_UNUSED)
+{
+  void *fill = bfd_malloc (count);
+  if (fill != NULL)
+    memset (fill, 0, count);
+  return fill;
+}
index 40ed786..1d51932 100644 (file)
@@ -1,8 +1,8 @@
 /* Main header file for the bfd library -- portable access to object files.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
 #ifndef __BFD_H_SEEN__
 #define __BFD_H_SEEN__
 
+/* PR 14072: Ensure that config.h is included first.  */
+#if !defined PACKAGE && !defined PACKAGE_VERSION
+#error config.h must be included before this header
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -57,7 +62,7 @@ extern "C" {
    problem for example when trying to use STRING_COMMA_LEN to build
    the arguments to the strncmp() macro.  Hence this alternative
    definition of strncmp is provided here.
-   
+
    Note - these macros do NOT work if STR2 is not a constant string.  */
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
   /* strcpy() can have a similar problem, but since we know we are
@@ -273,18 +278,19 @@ alent;
 
 typedef struct bfd_section *sec_ptr;
 
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
+#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name)
+#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma)
+#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma)
+#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \
+                                            (ptr)->alignment_power)
 #define bfd_section_name(bfd, ptr) ((ptr)->name)
 #define bfd_section_size(bfd, ptr) ((ptr)->size)
 #define bfd_get_section_size(ptr) ((ptr)->size)
 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
+#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags)
+#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata)
 
 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
 
@@ -297,11 +303,11 @@ typedef struct bfd_section *sec_ptr;
     ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
 
 /* Return TRUE if input section SEC has been discarded.  */
-#define elf_discarded_section(sec)                             \
+#define discarded_section(sec)                         \
   (!bfd_is_abs_section (sec)                                   \
    && bfd_is_abs_section ((sec)->output_section)               \
-   && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE              \
-   && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+   && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE              \
+   && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS)
 \f
 typedef enum bfd_print_symbol
 {
@@ -642,6 +648,8 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean bfd_elf_get_bfd_needed_list
   (bfd *, struct bfd_link_needed_list **);
+extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+                                              const char *, bfd_vma);
 extern bfd_boolean bfd_elf_size_dynamic_sections
   (bfd *, const char *, const char *, const char *, const char *, const char *,
    const char * const *, struct bfd_link_info *, struct bfd_section **);
@@ -692,19 +700,15 @@ extern int bfd_get_elf_phdrs
    the remote memory.  */
 extern bfd *bfd_elf_bfd_from_remote_memory
   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
-   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
-
-/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
-extern int bfd_get_arch_size
-  (bfd *);
-
-/* Return TRUE if address "naturally" sign extends, or -1 if not elf.  */
-extern int bfd_get_sign_extend_vma
-  (bfd *);
+   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
+                             bfd_size_type len));
 
 extern struct bfd_section *_bfd_elf_tls_setup
   (bfd *, struct bfd_link_info *);
 
+extern struct bfd_section *
+_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
+
 extern void _bfd_fix_excluded_sec_syms
   (bfd *, struct bfd_link_info *);
 
@@ -926,6 +930,32 @@ extern unsigned int _bfd_elf_ppc_at_tls_transform
 extern unsigned int _bfd_elf_ppc_at_tprel_transform
   (unsigned int, unsigned int);
 
+extern void bfd_elf64_aarch64_init_maps
+  (bfd *);
+
+void bfd_elf64_aarch64_set_options
+  (bfd *, struct bfd_link_info *, int, int, int);
+
+/* ELF AArch64 mapping symbol support.  */
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP       (1 << 0)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG       (1 << 1)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER     (1 << 2)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY       (~0)
+extern bfd_boolean bfd_is_aarch64_special_symbol_name
+  (const char * name, int type);
+
+/* AArch64 stub generation support.  Called from the linker.  */
+extern int elf64_aarch64_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+extern void elf64_aarch64_next_input_section
+  (struct bfd_link_info *, struct bfd_section *);
+extern bfd_boolean elf64_aarch64_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   struct bfd_section * (*) (const char *, struct bfd_section *),
+   void (*) (void));
+extern bfd_boolean elf64_aarch64_build_stubs
+  (struct bfd_link_info *);
+
 /* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   (struct bfd_section *, int);
index 2bb0ec7..524e97e 100644 (file)
@@ -8,8 +8,8 @@
 /* Main header file for the bfd library -- portable access to object files.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
 #ifndef __BFD_H_SEEN__
 #define __BFD_H_SEEN__
 
+/* PR 14072: Ensure that config.h is included first.  */
+#if !defined PACKAGE && !defined PACKAGE_VERSION
+#error config.h must be included before this header
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -64,7 +69,7 @@ extern "C" {
    problem for example when trying to use STRING_COMMA_LEN to build
    the arguments to the strncmp() macro.  Hence this alternative
    definition of strncmp is provided here.
-   
+
    Note - these macros do NOT work if STR2 is not a constant string.  */
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
   /* strcpy() can have a similar problem, but since we know we are
@@ -280,18 +285,19 @@ alent;
 
 typedef struct bfd_section *sec_ptr;
 
-#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
-#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
-#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
-#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
+#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name)
+#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma)
+#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma)
+#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \
+                                            (ptr)->alignment_power)
 #define bfd_section_name(bfd, ptr) ((ptr)->name)
 #define bfd_section_size(bfd, ptr) ((ptr)->size)
 #define bfd_get_section_size(ptr) ((ptr)->size)
 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
-#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
+#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags)
+#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata)
 
 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
 
@@ -304,11 +310,11 @@ typedef struct bfd_section *sec_ptr;
     ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
 
 /* Return TRUE if input section SEC has been discarded.  */
-#define elf_discarded_section(sec)                             \
+#define discarded_section(sec)                         \
   (!bfd_is_abs_section (sec)                                   \
    && bfd_is_abs_section ((sec)->output_section)               \
-   && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE              \
-   && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+   && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE              \
+   && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS)
 \f
 typedef enum bfd_print_symbol
 {
@@ -649,6 +655,8 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean bfd_elf_get_bfd_needed_list
   (bfd *, struct bfd_link_needed_list **);
+extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+                                              const char *, bfd_vma);
 extern bfd_boolean bfd_elf_size_dynamic_sections
   (bfd *, const char *, const char *, const char *, const char *, const char *,
    const char * const *, struct bfd_link_info *, struct bfd_section **);
@@ -699,19 +707,15 @@ extern int bfd_get_elf_phdrs
    the remote memory.  */
 extern bfd *bfd_elf_bfd_from_remote_memory
   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
-   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
-
-/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
-extern int bfd_get_arch_size
-  (bfd *);
-
-/* Return TRUE if address "naturally" sign extends, or -1 if not elf.  */
-extern int bfd_get_sign_extend_vma
-  (bfd *);
+   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
+                             bfd_size_type len));
 
 extern struct bfd_section *_bfd_elf_tls_setup
   (bfd *, struct bfd_link_info *);
 
+extern struct bfd_section *
+_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
+
 extern void _bfd_fix_excluded_sec_syms
   (bfd *, struct bfd_link_info *);
 
@@ -933,6 +937,32 @@ extern unsigned int _bfd_elf_ppc_at_tls_transform
 extern unsigned int _bfd_elf_ppc_at_tprel_transform
   (unsigned int, unsigned int);
 
+extern void bfd_elf64_aarch64_init_maps
+  (bfd *);
+
+void bfd_elf64_aarch64_set_options
+  (bfd *, struct bfd_link_info *, int, int, int);
+
+/* ELF AArch64 mapping symbol support.  */
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP       (1 << 0)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG       (1 << 1)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER     (1 << 2)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY       (~0)
+extern bfd_boolean bfd_is_aarch64_special_symbol_name
+  (const char * name, int type);
+
+/* AArch64 stub generation support.  Called from the linker.  */
+extern int elf64_aarch64_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+extern void elf64_aarch64_next_input_section
+  (struct bfd_link_info *, struct bfd_section *);
+extern bfd_boolean elf64_aarch64_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   struct bfd_section * (*) (const char *, struct bfd_section *),
+   void (*) (void));
+extern bfd_boolean elf64_aarch64_build_stubs
+  (struct bfd_link_info *);
+
 /* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   (struct bfd_section *, int);
@@ -1383,11 +1413,11 @@ typedef struct bfd_section
 
   /* Type of sec_info information.  */
   unsigned int sec_info_type:3;
-#define ELF_INFO_TYPE_NONE      0
-#define ELF_INFO_TYPE_STABS     1
-#define ELF_INFO_TYPE_MERGE     2
-#define ELF_INFO_TYPE_EH_FRAME  3
-#define ELF_INFO_TYPE_JUST_SYMS 4
+#define SEC_INFO_TYPE_NONE      0
+#define SEC_INFO_TYPE_STABS     1
+#define SEC_INFO_TYPE_MERGE     2
+#define SEC_INFO_TYPE_EH_FRAME  3
+#define SEC_INFO_TYPE_JUST_SYMS 4
 
   /* Nonzero if this section uses RELA relocations, rather than REL.  */
   unsigned int use_rela_p:1;
@@ -1517,9 +1547,6 @@ typedef struct bfd_section
   /* The BFD which owns the section.  */
   bfd *owner;
 
-  /* INPUT_SECTION_FLAGS if specified in the linker script.  */
-  struct flag_info *section_flag_info;
-
   /* A symbol which points at this section only.  */
   struct bfd_symbol *symbol;
   struct bfd_symbol **symbol_ptr_ptr;
@@ -1535,40 +1562,37 @@ typedef struct bfd_section
 } asection;
 
 /* Relax table contains information about instructions which can
-   be removed by relaxation -- replacing a long address with a 
+   be removed by relaxation -- replacing a long address with a
    short address.  */
 struct relax_table {
   /* Address where bytes may be deleted. */
   bfd_vma addr;
-  
+
   /* Number of bytes to be deleted.  */
   int size;
 };
 
 /* These sections are global, and are managed by BFD.  The application
    and target back end are not permitted to change the values in
-   these sections.  New code should use the section_ptr macros rather
-   than referring directly to the const sections.  The const sections
-   may eventually vanish.  */
+   these sections.  */
+extern asection _bfd_std_section[4];
+
 #define BFD_ABS_SECTION_NAME "*ABS*"
 #define BFD_UND_SECTION_NAME "*UND*"
 #define BFD_COM_SECTION_NAME "*COM*"
 #define BFD_IND_SECTION_NAME "*IND*"
 
-/* The absolute section.  */
-extern asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-/* Pointer to the undefined section.  */
-extern asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
 /* Pointer to the common section.  */
-extern asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
+#define bfd_com_section_ptr (&_bfd_std_section[0])
+/* Pointer to the undefined section.  */
+#define bfd_und_section_ptr (&_bfd_std_section[1])
+/* Pointer to the absolute section.  */
+#define bfd_abs_section_ptr (&_bfd_std_section[2])
 /* Pointer to the indirect section.  */
-extern asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
+#define bfd_ind_section_ptr (&_bfd_std_section[3])
+
+#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
+#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
 #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
 
 #define bfd_is_const_section(SEC)              \
@@ -1683,8 +1707,8 @@ extern asection bfd_ind_section;
   /* vma, lma, size, rawsize, compressed_size, relax, relax_count, */  \
      0,   0,   0,    0,       0,               0,     0,               \
                                                                        \
-  /* output_offset, output_section,              alignment_power,  */  \
-     0,             (struct bfd_section *) &SEC, 0,                    \
+  /* output_offset, output_section, alignment_power,               */  \
+     0,             &SEC,           0,                                 \
                                                                        \
   /* relocation, orelocation, reloc_count, filepos, rel_filepos,   */  \
      NULL,       NULL,        0,           0,       0,                 \
@@ -1698,9 +1722,6 @@ extern asection bfd_ind_section;
   /* target_index, used_by_bfd, constructor_chain, owner,          */  \
      0,            NULL,        NULL,              NULL,               \
                                                                        \
-  /* flag_info,                                                    */  \
-     NULL,                                                             \
-                                                                       \
   /* symbol,                    symbol_ptr_ptr,                    */  \
      (struct bfd_symbol *) SYM, &SEC.symbol,                           \
                                                                        \
@@ -1712,6 +1733,10 @@ void bfd_section_list_clear (bfd *);
 
 asection *bfd_get_section_by_name (bfd *abfd, const char *name);
 
+asection *bfd_get_next_section_by_name (asection *sec);
+
+asection *bfd_get_linker_section (bfd *abfd, const char *name);
+
 asection *bfd_get_section_by_name_if
    (bfd *abfd,
     const char *name,
@@ -1851,7 +1876,7 @@ enum bfd_architecture
 #define bfd_mach_sparc_64bit_p(mach) \
   ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
   bfd_arch_spu,       /* PowerPC SPU */
-#define bfd_mach_spu           256 
+#define bfd_mach_spu           256
   bfd_arch_mips,      /* MIPS Rxxxx */
 #define bfd_mach_mips3000              3000
 #define bfd_mach_mips3900              3900
@@ -1867,6 +1892,7 @@ enum bfd_architecture
 #define bfd_mach_mips5000              5000
 #define bfd_mach_mips5400              5400
 #define bfd_mach_mips5500              5500
+#define bfd_mach_mips5900              5900
 #define bfd_mach_mips6000              6000
 #define bfd_mach_mips7000              7000
 #define bfd_mach_mips8000              8000
@@ -1947,7 +1973,10 @@ enum bfd_architecture
 #define bfd_mach_ppc_e500      500
 #define bfd_mach_ppc_e500mc    5001
 #define bfd_mach_ppc_e500mc64  5005
+#define bfd_mach_ppc_e5500     5006
+#define bfd_mach_ppc_e6500     5007
 #define bfd_mach_ppc_titan     83
+#define bfd_mach_ppc_vle       84
   bfd_arch_rs6000,    /* IBM RS/6000 */
 #define bfd_mach_rs6k          6000
 #define bfd_mach_rs6k_rs1      6001
@@ -1969,6 +1998,8 @@ enum bfd_architecture
 #define bfd_mach_m6812_default 0
 #define bfd_mach_m6812         1
 #define bfd_mach_m6812s        2
+  bfd_arch_m9s12x,   /* Freescale S12X */
+  bfd_arch_m9s12xg,  /* Freescale XGATE */
   bfd_arch_z8k,       /* Zilog Z8000 */
 #define bfd_mach_z8001         1
 #define bfd_mach_z8002         2
@@ -2024,11 +2055,13 @@ enum bfd_architecture
   bfd_arch_tic6x,     /* Texas Instruments TMS320C6X */
   bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
   bfd_arch_v850,      /* NEC V850 */
+  bfd_arch_v850_rh850,/* NEC V850 (using RH850 ABI) */
 #define bfd_mach_v850          1
 #define bfd_mach_v850e         'E'
 #define bfd_mach_v850e1        '1'
 #define bfd_mach_v850e2        0x4532
 #define bfd_mach_v850e2v3      0x45325633
+#define bfd_mach_v850e3v5      0x45335635 /* ('E'|'3'|'V'|'5') */
   bfd_arch_arc,       /* ARC Cores */
 #define bfd_mach_arc_5         5
 #define bfd_mach_arc_6         6
@@ -2064,6 +2097,8 @@ enum bfd_architecture
 #define bfd_mach_mep           1
 #define bfd_mach_mep_h1        0x6831
 #define bfd_mach_mep_c5        0x6335
+  bfd_arch_metag,
+#define bfd_mach_metag         1
   bfd_arch_ia64,      /* HP/Intel ia64 */
 #define bfd_mach_ia64_elf64    64
 #define bfd_mach_ia64_elf32    32
@@ -2118,7 +2153,7 @@ enum bfd_architecture
   bfd_arch_s390,      /* IBM s390 */
 #define bfd_mach_s390_31       31
 #define bfd_mach_s390_64       64
-  bfd_arch_score,     /* Sunplus score */ 
+  bfd_arch_score,     /* Sunplus score */
 #define bfd_mach_score3         3
 #define bfd_mach_score7         7
   bfd_arch_openrisc,  /* OpenRISC */
@@ -2144,7 +2179,9 @@ enum bfd_architecture
   bfd_arch_xc16x,     /* Infineon's XC16X Series.               */
 #define bfd_mach_xc16x         1
 #define bfd_mach_xc16xl        2
-#define bfd_mach_xc16xs         3
+#define bfd_mach_xc16xs        3
+  bfd_arch_xgate,   /* Freescale XGATE */
+#define bfd_mach_xgate         1
   bfd_arch_xtensa,    /* Tensilica's Xtensa cores.  */
 #define bfd_mach_xtensa        1
   bfd_arch_z80,
@@ -2159,6 +2196,11 @@ enum bfd_architecture
   bfd_arch_tilegx, /* Tilera TILE-Gx */
 #define bfd_mach_tilepro   1
 #define bfd_mach_tilegx    1
+#define bfd_mach_tilegx32  2
+  bfd_arch_aarch64,   /* AArch64  */
+#define bfd_mach_aarch64 0
+  bfd_arch_nios2,
+#define bfd_mach_nios2 0
   bfd_arch_last
   };
 
@@ -2181,6 +2223,12 @@ typedef struct bfd_arch_info
 
   bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
 
+  /* Allocate via bfd_malloc and return a fill buffer of size COUNT.  If
+     IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If CODE is
+     TRUE, the buffer contains code.  */
+  void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
+                 bfd_boolean code);
+
   const struct bfd_arch_info *next;
 }
 bfd_arch_info_type;
@@ -2478,6 +2526,10 @@ The 24-bit relocation is used in some Intel 960 configurations.  */
   BFD_RELOC_HI16_S_PLTOFF,
   BFD_RELOC_8_PLTOFF,
 
+/* Size relocations.  */
+  BFD_RELOC_SIZE32,
+  BFD_RELOC_SIZE64,
+
 /* Relocations used by 68K ELF.  */
   BFD_RELOC_68K_GLOB_DAT,
   BFD_RELOC_68K_JMP_SLOT,
@@ -2591,6 +2643,10 @@ relocation types already defined.  */
   BFD_RELOC_SPARC_M44,
   BFD_RELOC_SPARC_L44,
   BFD_RELOC_SPARC_REGISTER,
+  BFD_RELOC_SPARC_H34,
+  BFD_RELOC_SPARC_SIZE32,
+  BFD_RELOC_SPARC_SIZE64,
+  BFD_RELOC_SPARC_WDISP10,
 
 /* SPARC little endian relocation  */
   BFD_RELOC_SPARC_REV32,
@@ -2786,6 +2842,15 @@ to compensate for the borrow when the low bits are added.  */
 /* MIPS16 low 16 bits.  */
   BFD_RELOC_MIPS16_LO16,
 
+/* MIPS16 TLS relocations  */
+  BFD_RELOC_MIPS16_TLS_GD,
+  BFD_RELOC_MIPS16_TLS_LDM,
+  BFD_RELOC_MIPS16_TLS_DTPREL_HI16,
+  BFD_RELOC_MIPS16_TLS_DTPREL_LO16,
+  BFD_RELOC_MIPS16_TLS_GOTTPREL,
+  BFD_RELOC_MIPS16_TLS_TPREL_HI16,
+  BFD_RELOC_MIPS16_TLS_TPREL_LO16,
+
 /* Relocation against a MIPS literal section.  */
   BFD_RELOC_MIPS_LITERAL,
   BFD_RELOC_MICROMIPS_LITERAL,
@@ -2947,6 +3012,25 @@ be honoured at the offset's location, regardless of linker
 relaxation.  */
   BFD_RELOC_MN10300_ALIGN,
 
+/* Various TLS-related relocations.  */
+  BFD_RELOC_MN10300_TLS_GD,
+  BFD_RELOC_MN10300_TLS_LD,
+  BFD_RELOC_MN10300_TLS_LDO,
+  BFD_RELOC_MN10300_TLS_GOTIE,
+  BFD_RELOC_MN10300_TLS_IE,
+  BFD_RELOC_MN10300_TLS_LE,
+  BFD_RELOC_MN10300_TLS_DTPMOD,
+  BFD_RELOC_MN10300_TLS_DTPOFF,
+  BFD_RELOC_MN10300_TLS_TPOFF,
+
+/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
+instruction.  */
+  BFD_RELOC_MN10300_32_PCREL,
+
+/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
+instruction.  */
+  BFD_RELOC_MN10300_16_PCREL,
+
 
 /* i386/elf relocations  */
   BFD_RELOC_386_GOT32,
@@ -3060,6 +3144,23 @@ relaxation.  */
   BFD_RELOC_PPC_EMB_RELST_HA,
   BFD_RELOC_PPC_EMB_BIT_FLD,
   BFD_RELOC_PPC_EMB_RELSDA,
+  BFD_RELOC_PPC_VLE_REL8,
+  BFD_RELOC_PPC_VLE_REL15,
+  BFD_RELOC_PPC_VLE_REL24,
+  BFD_RELOC_PPC_VLE_LO16A,
+  BFD_RELOC_PPC_VLE_LO16D,
+  BFD_RELOC_PPC_VLE_HI16A,
+  BFD_RELOC_PPC_VLE_HI16D,
+  BFD_RELOC_PPC_VLE_HA16A,
+  BFD_RELOC_PPC_VLE_HA16D,
+  BFD_RELOC_PPC_VLE_SDA21,
+  BFD_RELOC_PPC_VLE_SDA21_LO,
+  BFD_RELOC_PPC_VLE_SDAREL_LO16A,
+  BFD_RELOC_PPC_VLE_SDAREL_LO16D,
+  BFD_RELOC_PPC_VLE_SDAREL_HI16A,
+  BFD_RELOC_PPC_VLE_SDAREL_HI16D,
+  BFD_RELOC_PPC_VLE_SDAREL_HA16A,
+  BFD_RELOC_PPC_VLE_SDAREL_HA16D,
   BFD_RELOC_PPC64_HIGHER,
   BFD_RELOC_PPC64_HIGHER_S,
   BFD_RELOC_PPC64_HIGHEST,
@@ -3782,14 +3883,6 @@ instructions.  */
 /* start data in text.  */
   BFD_RELOC_V850_DATA,
 
-/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.  */
-  BFD_RELOC_MN10300_32_PCREL,
-
-/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.  */
-  BFD_RELOC_MN10300_16_PCREL,
-
 /* This is a 8bit DP reloc for the tms320c30, where the most
 significant 8 bits of a 24 bit word are placed into the least
 significant 8 bits of the opcode.  */
@@ -3912,6 +4005,46 @@ short offset into 11 bits.  */
   BFD_RELOC_MEP_GNU_VTENTRY,
 
 
+/* Imagination Technologies Meta relocations.  */
+  BFD_RELOC_METAG_HIADDR16,
+  BFD_RELOC_METAG_LOADDR16,
+  BFD_RELOC_METAG_RELBRANCH,
+  BFD_RELOC_METAG_GETSETOFF,
+  BFD_RELOC_METAG_HIOG,
+  BFD_RELOC_METAG_LOOG,
+  BFD_RELOC_METAG_REL8,
+  BFD_RELOC_METAG_REL16,
+  BFD_RELOC_METAG_HI16_GOTOFF,
+  BFD_RELOC_METAG_LO16_GOTOFF,
+  BFD_RELOC_METAG_GETSET_GOTOFF,
+  BFD_RELOC_METAG_GETSET_GOT,
+  BFD_RELOC_METAG_HI16_GOTPC,
+  BFD_RELOC_METAG_LO16_GOTPC,
+  BFD_RELOC_METAG_HI16_PLT,
+  BFD_RELOC_METAG_LO16_PLT,
+  BFD_RELOC_METAG_RELBRANCH_PLT,
+  BFD_RELOC_METAG_GOTOFF,
+  BFD_RELOC_METAG_PLT,
+  BFD_RELOC_METAG_COPY,
+  BFD_RELOC_METAG_JMP_SLOT,
+  BFD_RELOC_METAG_RELATIVE,
+  BFD_RELOC_METAG_GLOB_DAT,
+  BFD_RELOC_METAG_TLS_GD,
+  BFD_RELOC_METAG_TLS_LDM,
+  BFD_RELOC_METAG_TLS_LDO_HI16,
+  BFD_RELOC_METAG_TLS_LDO_LO16,
+  BFD_RELOC_METAG_TLS_LDO,
+  BFD_RELOC_METAG_TLS_IE,
+  BFD_RELOC_METAG_TLS_IENONPIC,
+  BFD_RELOC_METAG_TLS_IENONPIC_HI16,
+  BFD_RELOC_METAG_TLS_IENONPIC_LO16,
+  BFD_RELOC_METAG_TLS_TPOFF,
+  BFD_RELOC_METAG_TLS_DTPMOD,
+  BFD_RELOC_METAG_TLS_DTPOFF,
+  BFD_RELOC_METAG_TLS_LE,
+  BFD_RELOC_METAG_TLS_LE_HI16,
+  BFD_RELOC_METAG_TLS_LE_LO16,
+
 /* These are relocations for the GETA instruction.  */
   BFD_RELOC_MMIX_GETA,
   BFD_RELOC_MMIX_GETA_1,
@@ -4011,7 +4144,7 @@ of 32 bit value) into 8 bit immediate value of LDI insn.  */
 command address) into 8 bit immediate value of LDI insn.  */
   BFD_RELOC_AVR_LO8_LDI_PM,
 
-/* This is a 16 bit reloc for the AVR that stores 8 bit value 
+/* This is a 16 bit reloc for the AVR that stores 8 bit value
 (command address) into 8 bit immediate value of LDI insn. If the address
 is beyond the 128k boundary, the linker inserts a jump stub for this reloc
 in the lower 128k.  */
@@ -4061,6 +4194,18 @@ instructions  */
 instructions  */
   BFD_RELOC_AVR_6_ADIW,
 
+/* This is a 8 bit reloc for the AVR that stores bits 0..7 of a symbol
+in .byte lo8(symbol)  */
+  BFD_RELOC_AVR_8_LO,
+
+/* This is a 8 bit reloc for the AVR that stores bits 8..15 of a symbol
+in .byte hi8(symbol)  */
+  BFD_RELOC_AVR_8_HI,
+
+/* This is a 8 bit reloc for the AVR that stores bits 16..23 of a symbol
+in .byte hlo8(symbol)  */
+  BFD_RELOC_AVR_8_HLO,
+
 /* Renesas RL78 Relocations.  */
   BFD_RELOC_RL78_NEG8,
   BFD_RELOC_RL78_NEG16,
@@ -4094,6 +4239,7 @@ instructions  */
   BFD_RELOC_RL78_HI16,
   BFD_RELOC_RL78_HI8,
   BFD_RELOC_RL78_LO16,
+  BFD_RELOC_RL78_CODE,
 
 /* Renesas RX Relocations.  */
   BFD_RELOC_RX_NEG8,
@@ -4230,6 +4376,9 @@ instructions  */
   BFD_RELOC_390_GOTPLT20,
   BFD_RELOC_390_TLS_GOTIE20,
 
+/* STT_GNU_IFUNC relocation.  */
+  BFD_RELOC_390_IRELATIVE,
+
 /* Score relocations
 Low 16 bit for load/store  */
   BFD_RELOC_SCORE_GPREL15,
@@ -4444,6 +4593,83 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window).  */
 This is the 5 bits of a value.  */
   BFD_RELOC_M68HC12_5B,
 
+/* Freescale XGATE reloc.
+This reloc marks the beginning of a bra/jal instruction.  */
+  BFD_RELOC_XGATE_RL_JUMP,
+
+/* Freescale XGATE reloc.
+This reloc marks a group of several instructions that gcc generates
+and for which the linker relaxation pass can modify and/or remove
+some of them.  */
+  BFD_RELOC_XGATE_RL_GROUP,
+
+/* Freescale XGATE reloc.
+This is the 16-bit lower part of an address.  It is used for the '16-bit'
+instructions.  */
+  BFD_RELOC_XGATE_LO16,
+
+/* Freescale XGATE reloc.  */
+  BFD_RELOC_XGATE_GPAGE,
+
+/* Freescale XGATE reloc.  */
+  BFD_RELOC_XGATE_24,
+
+/* Freescale XGATE reloc.
+This is a 9-bit pc-relative reloc.  */
+  BFD_RELOC_XGATE_PCREL_9,
+
+/* Freescale XGATE reloc.
+This is a 10-bit pc-relative reloc.  */
+  BFD_RELOC_XGATE_PCREL_10,
+
+/* Freescale XGATE reloc.
+This is the 16-bit lower part of an address.  It is used for the '16-bit'
+instructions.  */
+  BFD_RELOC_XGATE_IMM8_LO,
+
+/* Freescale XGATE reloc.
+This is the 16-bit higher part of an address.  It is used for the '16-bit'
+instructions.  */
+  BFD_RELOC_XGATE_IMM8_HI,
+
+/* Freescale XGATE reloc.
+This is a 3-bit pc-relative reloc.  */
+  BFD_RELOC_XGATE_IMM3,
+
+/* Freescale XGATE reloc.
+This is a 4-bit pc-relative reloc.  */
+  BFD_RELOC_XGATE_IMM4,
+
+/* Freescale XGATE reloc.
+This is a 5-bit pc-relative reloc.  */
+  BFD_RELOC_XGATE_IMM5,
+
+/* Motorola 68HC12 reloc.
+This is the 9 bits of a value.  */
+  BFD_RELOC_M68HC12_9B,
+
+/* Motorola 68HC12 reloc.
+This is the 16 bits of a value.  */
+  BFD_RELOC_M68HC12_16B,
+
+/* Motorola 68HC12/XGATE reloc.
+This is a PCREL9 branch.  */
+  BFD_RELOC_M68HC12_9_PCREL,
+
+/* Motorola 68HC12/XGATE reloc.
+This is a PCREL10 branch.  */
+  BFD_RELOC_M68HC12_10_PCREL,
+
+/* Motorola 68HC12/XGATE reloc.
+This is the 8 bit low part of an absolute address and immediately precedes
+a matching HI8XG part.  */
+  BFD_RELOC_M68HC12_LO8XG,
+
+/* Motorola 68HC12/XGATE reloc.
+This is the 8 bit high part of an absolute address and immediately follows
+a matching LO8XG part.  */
+  BFD_RELOC_M68HC12_HI8XG,
+
 /* NS CR16C Relocations.  */
   BFD_RELOC_16C_NUM08,
   BFD_RELOC_16C_NUM08_C,
@@ -4690,6 +4916,42 @@ This is the 5 bits of a value.  */
   BFD_RELOC_MSP430_2X_PCREL,
   BFD_RELOC_MSP430_RL_PCREL,
 
+/* Relocations used by the Altera Nios II core.  */
+  BFD_RELOC_NIOS2_S16,
+  BFD_RELOC_NIOS2_U16,
+  BFD_RELOC_NIOS2_CALL26,
+  BFD_RELOC_NIOS2_IMM5,
+  BFD_RELOC_NIOS2_CACHE_OPX,
+  BFD_RELOC_NIOS2_IMM6,
+  BFD_RELOC_NIOS2_IMM8,
+  BFD_RELOC_NIOS2_HI16,
+  BFD_RELOC_NIOS2_LO16,
+  BFD_RELOC_NIOS2_HIADJ16,
+  BFD_RELOC_NIOS2_GPREL,
+  BFD_RELOC_NIOS2_UJMP,
+  BFD_RELOC_NIOS2_CJMP,
+  BFD_RELOC_NIOS2_CALLR,
+  BFD_RELOC_NIOS2_ALIGN,
+  BFD_RELOC_NIOS2_GOT16,
+  BFD_RELOC_NIOS2_CALL16,
+  BFD_RELOC_NIOS2_GOTOFF_LO,
+  BFD_RELOC_NIOS2_GOTOFF_HA,
+  BFD_RELOC_NIOS2_PCREL_LO,
+  BFD_RELOC_NIOS2_PCREL_HA,
+  BFD_RELOC_NIOS2_TLS_GD16,
+  BFD_RELOC_NIOS2_TLS_LDM16,
+  BFD_RELOC_NIOS2_TLS_LDO16,
+  BFD_RELOC_NIOS2_TLS_IE16,
+  BFD_RELOC_NIOS2_TLS_LE16,
+  BFD_RELOC_NIOS2_TLS_DTPMOD,
+  BFD_RELOC_NIOS2_TLS_DTPREL,
+  BFD_RELOC_NIOS2_TLS_TPREL,
+  BFD_RELOC_NIOS2_COPY,
+  BFD_RELOC_NIOS2_GLOB_DAT,
+  BFD_RELOC_NIOS2_JUMP_SLOT,
+  BFD_RELOC_NIOS2_RELATIVE,
+  BFD_RELOC_NIOS2_GOTOFF,
+
 /* IQ2000 Relocations.  */
   BFD_RELOC_IQ2000_OFFSET_16,
   BFD_RELOC_IQ2000_OFFSET_21,
@@ -4810,6 +5072,9 @@ BFD_RELOC_XTENSA_ASM_EXPAND.  */
 BFD_RELOC_MACH_O_PAIR.  */
   BFD_RELOC_MACH_O_SECTDIFF,
 
+/* Like BFD_RELOC_MACH_O_SECTDIFF but with a local symbol.  */
+  BFD_RELOC_MACH_O_LOCAL_SECTDIFF,
+
 /* Pair of relocation.  Contains the first symbol.  */
   BFD_RELOC_MACH_O_PAIR,
 
@@ -4840,52 +5105,52 @@ the linker could optimize the movq to a leaq if possible.  */
 /* Same as BFD_RELOC_32_PCREL but with an implicit -4 addend.  */
   BFD_RELOC_MACH_O_X86_64_PCREL32_4,
 
-/* This is a 32 bit reloc for the microblaze that stores the 
+/* This is a 32 bit reloc for the microblaze that stores the
 low 16 bits of a value  */
   BFD_RELOC_MICROBLAZE_32_LO,
 
-/* This is a 32 bit pc-relative reloc for the microblaze that 
+/* This is a 32 bit pc-relative reloc for the microblaze that
 stores the low 16 bits of a value  */
   BFD_RELOC_MICROBLAZE_32_LO_PCREL,
 
-/* This is a 32 bit reloc for the microblaze that stores a 
+/* This is a 32 bit reloc for the microblaze that stores a
 value relative to the read-only small data area anchor  */
   BFD_RELOC_MICROBLAZE_32_ROSDA,
 
-/* This is a 32 bit reloc for the microblaze that stores a 
+/* This is a 32 bit reloc for the microblaze that stores a
 value relative to the read-write small data area anchor  */
   BFD_RELOC_MICROBLAZE_32_RWSDA,
 
-/* This is a 32 bit reloc for the microblaze to handle 
+/* This is a 32 bit reloc for the microblaze to handle
 expressions of the form "Symbol Op Symbol"  */
   BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
-value in two words (with an imm instruction).  No relocation is 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
+value in two words (with an imm instruction).  No relocation is
 done here - only used for relaxing  */
   BFD_RELOC_MICROBLAZE_64_NONE,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
 value in two words (with an imm instruction).  The relocation is
 PC-relative GOT offset  */
   BFD_RELOC_MICROBLAZE_64_GOTPC,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
 value in two words (with an imm instruction).  The relocation is
 GOT offset  */
   BFD_RELOC_MICROBLAZE_64_GOT,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
 value in two words (with an imm instruction).  The relocation is
 PC-relative offset into PLT  */
   BFD_RELOC_MICROBLAZE_64_PLT,
 
-/* This is a 64 bit reloc that stores the 32 bit GOT relative 
+/* This is a 64 bit reloc that stores the 32 bit GOT relative
 value in two words (with an imm instruction).  The relocation is
 relative offset from _GLOBAL_OFFSET_TABLE_  */
   BFD_RELOC_MICROBLAZE_64_GOTOFF,
 
-/* This is a 32 bit reloc that stores the 32 bit GOT relative 
+/* This is a 32 bit reloc that stores the 32 bit GOT relative
 value in a word.  The relocation is relative offset from  */
   BFD_RELOC_MICROBLAZE_32_GOTOFF,
 
@@ -4893,6 +5158,258 @@ value in a word.  The relocation is relative offset from  */
 the dynamic object into the runtime process image.  */
   BFD_RELOC_MICROBLAZE_COPY,
 
+/* Unused Reloc  */
+  BFD_RELOC_MICROBLAZE_64_TLS,
+
+/* This is a 64 bit reloc that stores the 32 bit GOT relative value
+of the GOT TLS GD info entry in two words (with an imm instruction). The
+relocation is GOT offset.  */
+  BFD_RELOC_MICROBLAZE_64_TLSGD,
+
+/* This is a 64 bit reloc that stores the 32 bit GOT relative value
+of the GOT TLS LD info entry in two words (with an imm instruction). The
+relocation is GOT offset.  */
+  BFD_RELOC_MICROBLAZE_64_TLSLD,
+
+/* This is a 32 bit reloc that stores the Module ID to GOT(n).  */
+  BFD_RELOC_MICROBLAZE_32_TLSDTPMOD,
+
+/* This is a 32 bit reloc that stores TLS offset to GOT(n+1).  */
+  BFD_RELOC_MICROBLAZE_32_TLSDTPREL,
+
+/* This is a 32 bit reloc for storing TLS offset to two words (uses imm
+instruction)  */
+  BFD_RELOC_MICROBLAZE_64_TLSDTPREL,
+
+/* This is a 64 bit reloc that stores 32-bit thread pointer relative offset
+to two words (uses imm instruction).  */
+  BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL,
+
+/* This is a 64 bit reloc that stores 32-bit thread pointer relative offset
+to two words (uses imm instruction).  */
+  BFD_RELOC_MICROBLAZE_64_TLSTPREL,
+
+/* AArch64 ADD immediate instruction, holding bits 0 to 11 of the address.
+Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_ADD_LO12,
+
+/* AArch64 Load Literal instruction, holding a 19 bit PC relative word
+offset of the global offset table entry for a symbol.  The lowest two
+bits must be zero and are not stored in the instruction, giving a 21
+bit signed byte offset.  This relocation type requires signed overflow
+checking.  */
+  BFD_RELOC_AARCH64_GOT_LD_PREL19,
+
+/* Get to the page base of the global offset table entry for a symbol as
+part of an ADRP instruction using a 21 bit PC relative value.Used in
+conjunction with BFD_RELOC_AARCH64_LD64_GOT_LO12_NC.  */
+  BFD_RELOC_AARCH64_ADR_GOT_PAGE,
+
+/* AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page
+offset, giving a 4KB aligned page base address.  */
+  BFD_RELOC_AARCH64_ADR_HI21_PCREL,
+
+/* AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page
+offset, giving a 4KB aligned page base address, but with no overflow
+checking.  */
+  BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL,
+
+/* AArch64 ADR instruction, holding a simple 21 bit pc-relative byte offset.  */
+  BFD_RELOC_AARCH64_ADR_LO21_PCREL,
+
+/* AArch64 19 bit pc-relative conditional branch and compare & branch.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 21 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_BRANCH19,
+
+/* AArch64 26 bit pc-relative unconditional branch and link.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 28 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_CALL26,
+
+/* AArch64 pseudo relocation code to be used internally by the AArch64
+assembler and not (currently) written to any object files.  */
+  BFD_RELOC_AARCH64_GAS_INTERNAL_FIXUP,
+
+/* AArch64 26 bit pc-relative unconditional branch.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 28 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_JUMP26,
+
+/* AArch64 Load Literal instruction, holding a 19 bit pc-relative word
+offset.  The lowest two bits must be zero and are not stored in the
+instruction, giving a 21 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_LD_LO19_PCREL,
+
+/* Unsigned 12 bit byte offset for 64 bit load/store from the page of
+the GOT entry for this symbol.  Used in conjunction with
+BFD_RELOC_AARCH64_ADR_GOTPAGE.  */
+  BFD_RELOC_AARCH64_LD64_GOT_LO12_NC,
+
+/* AArch64 unspecified load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST_LO12,
+
+/* AArch64 8-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST8_LO12,
+
+/* AArch64 16-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST16_LO12,
+
+/* AArch64 32-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST32_LO12,
+
+/* AArch64 64-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST64_LO12,
+
+/* AArch64 128-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST128_LO12,
+
+/* AArch64 MOV[NZK] instruction with most significant bits 0 to 15
+of an unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G0,
+
+/* AArch64 MOV[NZ] instruction with most significant bits 0 to 15
+of a signed value.  Changes instruction to MOVZ or MOVN depending on the
+value's sign.  */
+  BFD_RELOC_AARCH64_MOVW_G0_S,
+
+/* AArch64 MOV[NZK] instruction with less significant bits 0 to 15 of
+an address/value.  No overflow checking.  */
+  BFD_RELOC_AARCH64_MOVW_G0_NC,
+
+/* AArch64 MOV[NZK] instruction with most significant bits 16 to 31
+of an unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G1,
+
+/* AArch64 MOV[NZK] instruction with less significant bits 16 to 31
+of an address/value.  No overflow checking.  */
+  BFD_RELOC_AARCH64_MOVW_G1_NC,
+
+/* AArch64 MOV[NZ] instruction with most significant bits 16 to 31
+of a signed value.  Changes instruction to MOVZ or MOVN depending on the
+value's sign.  */
+  BFD_RELOC_AARCH64_MOVW_G1_S,
+
+/* AArch64 MOV[NZK] instruction with most significant bits 32 to 47
+of an unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G2,
+
+/* AArch64 MOV[NZK] instruction with less significant bits 32 to 47
+of an address/value.  No overflow checking.  */
+  BFD_RELOC_AARCH64_MOVW_G2_NC,
+
+/* AArch64 MOV[NZ] instruction with most significant bits 32 to 47
+of a signed value.  Changes instruction to MOVZ or MOVN depending on the
+value's sign.  */
+  BFD_RELOC_AARCH64_MOVW_G2_S,
+
+/* AArch64 MOV[NZK] instruction with most signficant bits 48 to 64
+of a signed or unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G3,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADD,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_CALL,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LD64_PREL19,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LDR,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_OFF_G1,
+
+/* Unsigned 12 bit byte offset to global offset table entry for a symbols
+tls_index structure.  Used in conjunction with
+BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21.  */
+  BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC,
+
+/* Get to the page base of the global offset table entry for a symbols
+tls_index structure as part of an adrp instruction using a 21 bit PC
+relative value.  Used in conjunction with
+BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC.  */
+  BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLS_DTPMOD64,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLS_DTPREL64,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLS_TPREL64,
+
+/* AArch64 14 bit pc-relative test bit and branch.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 16 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_TSTBR14,
+
 /* Tilera TILEPro Relocations.  */
   BFD_RELOC_TILEPRO_COPY,
   BFD_RELOC_TILEPRO_GLOB_DAT,
@@ -4940,6 +5457,12 @@ the dynamic object into the runtime process image.  */
   BFD_RELOC_TILEPRO_SHAMT_X1,
   BFD_RELOC_TILEPRO_SHAMT_Y0,
   BFD_RELOC_TILEPRO_SHAMT_Y1,
+  BFD_RELOC_TILEPRO_TLS_GD_CALL,
+  BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD,
+  BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD,
+  BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD,
+  BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD,
+  BFD_RELOC_TILEPRO_TLS_IE_LOAD,
   BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD,
   BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD,
   BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_LO,
@@ -4959,6 +5482,14 @@ the dynamic object into the runtime process image.  */
   BFD_RELOC_TILEPRO_TLS_DTPMOD32,
   BFD_RELOC_TILEPRO_TLS_DTPOFF32,
   BFD_RELOC_TILEPRO_TLS_TPOFF32,
+  BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE,
+  BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE,
+  BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO,
+  BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO,
+  BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI,
+  BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI,
+  BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA,
+  BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA,
 
 /* Tilera TILE-Gx Relocations.  */
   BFD_RELOC_TILEGX_HW0,
@@ -5018,52 +5549,58 @@ the dynamic object into the runtime process image.  */
   BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_GOT,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_GOT,
-  BFD_RELOC_TILEGX_IMM16_X0_HW1_GOT,
-  BFD_RELOC_TILEGX_IMM16_X1_HW1_GOT,
-  BFD_RELOC_TILEGX_IMM16_X0_HW2_GOT,
-  BFD_RELOC_TILEGX_IMM16_X1_HW2_GOT,
-  BFD_RELOC_TILEGX_IMM16_X0_HW3_GOT,
-  BFD_RELOC_TILEGX_IMM16_X1_HW3_GOT,
+  BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_GOT,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_GOT,
   BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_GOT,
   BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_GOT,
-  BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_GOT,
-  BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_GOT,
+  BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_GD,
+  BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE,
+  BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE,
+  BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE,
+  BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE,
+  BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE,
+  BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_GD,
-  BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_IE,
+  BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_IE,
-  BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_IE,
   BFD_RELOC_TILEGX_TLS_DTPMOD64,
   BFD_RELOC_TILEGX_TLS_DTPOFF64,
   BFD_RELOC_TILEGX_TLS_TPOFF64,
   BFD_RELOC_TILEGX_TLS_DTPMOD32,
   BFD_RELOC_TILEGX_TLS_DTPOFF32,
   BFD_RELOC_TILEGX_TLS_TPOFF32,
+  BFD_RELOC_TILEGX_TLS_GD_CALL,
+  BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD,
+  BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD,
+  BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD,
+  BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD,
+  BFD_RELOC_TILEGX_TLS_IE_LOAD,
+  BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD,
+  BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD,
+  BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD,
+  BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD,
 
 /* Adapteva EPIPHANY - 8 bit signed pc-relative displacement  */
   BFD_RELOC_EPIPHANY_SIMM8,
@@ -5600,6 +6137,15 @@ void bfd_set_error_program_name (const char *);
 
 bfd_error_handler_type bfd_get_error_handler (void);
 
+typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
+                                         const char *bfd_version,
+                                         const char *bfd_file,
+                                         int bfd_line);
+
+bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type);
+
+bfd_assert_handler_type bfd_get_assert_handler (void);
+
 long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
 
 long bfd_canonicalize_reloc
@@ -5648,6 +6194,11 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
        BFD_SEND (abfd, _bfd_find_nearest_line, \
                  (abfd, sec, syms, off, file, func, line))
 
+#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
+                                            line, disc) \
+       BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \
+                 (abfd, sec, syms, off, file, func, line, disc))
+
 #define bfd_find_line(abfd, syms, sym, file, line) \
        BFD_SEND (abfd, _bfd_find_line, \
                  (abfd, syms, sym, file, line))
@@ -5680,8 +6231,8 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
 #define bfd_gc_sections(abfd, link_info) \
        BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
 
-#define bfd_lookup_section_flags(link_info, flag_info) \
-       BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info))
+#define bfd_lookup_section_flags(link_info, flag_info, section) \
+       BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section))
 
 #define bfd_merge_sections(abfd, link_info) \
        BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
@@ -5735,24 +6286,6 @@ extern bfd_byte *bfd_get_relocated_section_contents
 
 bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
 
-struct bfd_preserve
-{
-  void *marker;
-  void *tdata;
-  flagword flags;
-  const struct bfd_arch_info *arch_info;
-  struct bfd_section *sections;
-  struct bfd_section *section_last;
-  unsigned int section_count;
-  struct bfd_hash_table section_htab;
-};
-
-bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-
-void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-
-void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-
 bfd_vma bfd_emul_get_maxpagesize (const char *);
 
 void bfd_emul_set_maxpagesize (const char *, bfd_vma);
@@ -6029,6 +6562,7 @@ typedef struct bfd_target
   NAME##_bfd_is_target_special_symbol, \
   NAME##_get_lineno, \
   NAME##_find_nearest_line, \
+  _bfd_generic_find_nearest_line_discriminator, \
   _bfd_generic_find_line, \
   NAME##_find_inliner_info, \
   NAME##_bfd_make_debug_symbol, \
@@ -6052,6 +6586,9 @@ typedef struct bfd_target
   bfd_boolean (*_bfd_find_nearest_line)
     (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
      const char **, const char **, unsigned int *);
+  bfd_boolean (*_bfd_find_nearest_line_discriminator)
+    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
+     const char **, const char **, unsigned int *, unsigned int *);
   bfd_boolean (*_bfd_find_line)
     (bfd *, struct bfd_symbol **, struct bfd_symbol *,
      const char **, unsigned int *);
@@ -6157,8 +6694,9 @@ typedef struct bfd_target
   bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
 
   /* Sets the bitmask of allowed and disallowed section flags.  */
-  void (*_bfd_lookup_section_flags) (struct bfd_link_info *,
-                                     struct flag_info *);
+  bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *,
+                                            struct flag_info *,
+                                            asection *);
 
   /* Attempt to merge SEC_MERGE sections.  */
   bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
@@ -6274,6 +6812,9 @@ bfd_boolean bfd_compress_section_contents
 bfd_boolean bfd_get_full_section_contents
    (bfd *abfd, asection *section, bfd_byte **ptr);
 
+void bfd_cache_section_contents
+   (asection *sec, void *contents);
+
 bfd_boolean bfd_is_section_compressed
    (bfd *abfd, asection *section);
 
index 7c14c7a..d77b90f 100644 (file)
@@ -797,6 +797,88 @@ bfd_get_error_handler (void)
 {
   return _bfd_error_handler;
 }
+
+/*
+SUBSECTION
+       BFD assert handler
+
+       If BFD finds an internal inconsistency, the bfd assert
+       handler is called with information on the BFD version, BFD
+       source file and line.  If this happens, most programs linked
+       against BFD are expected to want to exit with an error, or mark
+       the current BFD operation as failed, so it is recommended to
+       override the default handler, which just calls
+       _bfd_error_handler and continues.
+
+CODE_FRAGMENT
+.
+.typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
+.                                         const char *bfd_version,
+.                                         const char *bfd_file,
+.                                         int bfd_line);
+.
+*/
+
+/* Note the use of bfd_ prefix on the parameter names above: we want to
+   show which one is the message and which is the version by naming the
+   parameters, but avoid polluting the program-using-bfd namespace as
+   the typedef is visible in the exported headers that the program
+   includes.  Below, it's just for consistency.  */
+
+static void
+_bfd_default_assert_handler (const char *bfd_formatmsg,
+                            const char *bfd_version,
+                            const char *bfd_file,
+                            int bfd_line)
+
+{
+  (*_bfd_error_handler) (bfd_formatmsg, bfd_version, bfd_file, bfd_line);
+}
+
+/* Similar to _bfd_error_handler, a program can decide to exit on an
+   internal BFD error.  We use a non-variadic type to simplify passing
+   on parameters to other functions, e.g. _bfd_error_handler.  */
+
+bfd_assert_handler_type _bfd_assert_handler = _bfd_default_assert_handler;
+
+/*
+FUNCTION
+       bfd_set_assert_handler
+
+SYNOPSIS
+       bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type);
+
+DESCRIPTION
+       Set the BFD assert handler function.  Returns the previous
+       function.
+*/
+
+bfd_assert_handler_type
+bfd_set_assert_handler (bfd_assert_handler_type pnew)
+{
+  bfd_assert_handler_type pold;
+
+  pold = _bfd_assert_handler;
+  _bfd_assert_handler = pnew;
+  return pold;
+}
+
+/*
+FUNCTION
+       bfd_get_assert_handler
+
+SYNOPSIS
+       bfd_assert_handler_type bfd_get_assert_handler (void);
+
+DESCRIPTION
+       Return the BFD assert handler function.
+*/
+
+bfd_assert_handler_type
+bfd_get_assert_handler (void)
+{
+  return _bfd_assert_handler;
+}
 \f
 /*
 SECTION
@@ -942,8 +1024,8 @@ bfd_set_file_flags (bfd *abfd, flagword flags)
 void
 bfd_assert (const char *file, int line)
 {
-  (*_bfd_error_handler) (_("BFD %s assertion fail %s:%d"),
-                        BFD_VERSION_STRING, file, line);
+  (*_bfd_assert_handler) (_("BFD %s assertion fail %s:%d"),
+                         BFD_VERSION_STRING, file, line);
 }
 
 /* A more or less friendly abort message.  In libbfd.h abort is
@@ -1342,6 +1424,11 @@ DESCRIPTION
 .       BFD_SEND (abfd, _bfd_find_nearest_line, \
 .                 (abfd, sec, syms, off, file, func, line))
 .
+.#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
+.                                            line, disc) \
+.       BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \
+.                 (abfd, sec, syms, off, file, func, line, disc))
+.
 .#define bfd_find_line(abfd, syms, sym, file, line) \
 .       BFD_SEND (abfd, _bfd_find_line, \
 .                 (abfd, syms, sym, file, line))
@@ -1374,8 +1461,8 @@ DESCRIPTION
 .#define bfd_gc_sections(abfd, link_info) \
 .      BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
 .
-.#define bfd_lookup_section_flags(link_info, flag_info) \
-.      BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info))
+.#define bfd_lookup_section_flags(link_info, flag_info, section) \
+.      BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section))
 .
 .#define bfd_merge_sections(abfd, link_info) \
 .      BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
@@ -1493,7 +1580,7 @@ bfd_record_phdr (bfd *abfd,
   if (count > 0)
     memcpy (m->sections, secs, count * sizeof (asection *));
 
-  for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+  for (pm = &elf_seg_map (abfd); *pm != NULL; pm = &(*pm)->next)
     ;
   *pm = m;
 
@@ -1599,128 +1686,6 @@ bfd_alt_mach_code (bfd *abfd, int alternative)
   return FALSE;
 }
 
-/*
-CODE_FRAGMENT
-
-.struct bfd_preserve
-.{
-.  void *marker;
-.  void *tdata;
-.  flagword flags;
-.  const struct bfd_arch_info *arch_info;
-.  struct bfd_section *sections;
-.  struct bfd_section *section_last;
-.  unsigned int section_count;
-.  struct bfd_hash_table section_htab;
-.};
-.
-*/
-
-/*
-FUNCTION
-       bfd_preserve_save
-
-SYNOPSIS
-       bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
-       When testing an object for compatibility with a particular
-       target back-end, the back-end object_p function needs to set
-       up certain fields in the bfd on successfully recognizing the
-       object.  This typically happens in a piecemeal fashion, with
-       failures possible at many points.  On failure, the bfd is
-       supposed to be restored to its initial state, which is
-       virtually impossible.  However, restoring a subset of the bfd
-       state works in practice.  This function stores the subset and
-       reinitializes the bfd.
-
-*/
-
-bfd_boolean
-bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
-{
-  preserve->tdata = abfd->tdata.any;
-  preserve->arch_info = abfd->arch_info;
-  preserve->flags = abfd->flags;
-  preserve->sections = abfd->sections;
-  preserve->section_last = abfd->section_last;
-  preserve->section_count = abfd->section_count;
-  preserve->section_htab = abfd->section_htab;
-
-  if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc,
-                            sizeof (struct section_hash_entry)))
-    return FALSE;
-
-  abfd->tdata.any = NULL;
-  abfd->arch_info = &bfd_default_arch_struct;
-  abfd->flags &= BFD_FLAGS_SAVED;
-  abfd->sections = NULL;
-  abfd->section_last = NULL;
-  abfd->section_count = 0;
-
-  return TRUE;
-}
-
-/*
-FUNCTION
-       bfd_preserve_restore
-
-SYNOPSIS
-       void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
-       This function restores bfd state saved by bfd_preserve_save.
-       If MARKER is non-NULL in struct bfd_preserve then that block
-       and all subsequently bfd_alloc'd memory is freed.
-
-*/
-
-void
-bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
-{
-  bfd_hash_table_free (&abfd->section_htab);
-
-  abfd->tdata.any = preserve->tdata;
-  abfd->arch_info = preserve->arch_info;
-  abfd->flags = preserve->flags;
-  abfd->section_htab = preserve->section_htab;
-  abfd->sections = preserve->sections;
-  abfd->section_last = preserve->section_last;
-  abfd->section_count = preserve->section_count;
-
-  /* bfd_release frees all memory more recently bfd_alloc'd than
-     its arg, as well as its arg.  */
-  if (preserve->marker != NULL)
-    {
-      bfd_release (abfd, preserve->marker);
-      preserve->marker = NULL;
-    }
-}
-
-/*
-FUNCTION
-       bfd_preserve_finish
-
-SYNOPSIS
-       void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
-       This function should be called when the bfd state saved by
-       bfd_preserve_save is no longer needed.  ie. when the back-end
-       object_p function returns with success.
-
-*/
-
-void
-bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
-{
-  /* It would be nice to be able to free more memory here, eg. old
-     tdata, but that's not possible since these blocks are sitting
-     inside bfd_alloc'd memory.  The section hash is on a separate
-     objalloc.  */
-  bfd_hash_table_free (&preserve->section_htab);
-}
-
 /*
 FUNCTION
        bfd_emul_get_maxpagesize
index 841c781..be05581 100644 (file)
@@ -87,7 +87,6 @@ FILE *
 real_fopen (const char *filename, const char *modes)
 {
 #ifdef VMS
-  char vms_modes[4];
   char *vms_attr;
 
   /* On VMS, fopen allows file attributes as optionnal arguments.
@@ -185,7 +184,8 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
      this element.  */
   if (abfd->arelt_data != NULL)
     {
-      size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size;
+      bfd_size_type maxbytes = arelt_size (abfd);
+
       if (abfd->where + size > maxbytes)
         {
           if (abfd->where >= maxbytes)
@@ -233,10 +233,14 @@ bfd_tell (bfd *abfd)
 
   if (abfd->iovec)
     {
+      bfd *parent_bfd = abfd;
       ptr = abfd->iovec->btell (abfd);
 
-      if (abfd->my_archive)
-       ptr -= abfd->origin;
+      while (parent_bfd->my_archive != NULL)
+       {
+         ptr -= parent_bfd->origin;
+         parent_bfd = parent_bfd->my_archive;
+       }
     }
   else
     ptr = 0;
@@ -308,8 +312,16 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
     }
 
   file_position = position;
-  if (direction == SEEK_SET && abfd->my_archive != NULL)
-    file_position += abfd->origin;
+  if (direction == SEEK_SET)
+    {
+      bfd *parent_bfd = abfd;
+
+      while (parent_bfd->my_archive != NULL)
+        {
+          file_position += parent_bfd->origin;
+          parent_bfd = parent_bfd->my_archive;
+        }
+    }
 
   if (abfd->iovec)
     result = abfd->iovec->bseek (abfd, file_position, direction);
@@ -574,7 +586,7 @@ memory_bclose (struct bfd *abfd)
   free (bim);
   abfd->iostream = NULL;
 
-  return TRUE;
+  return 0;
 }
 
 static int
index 5ddbbe4..5226816 100644 (file)
@@ -198,7 +198,7 @@ bfd_cache_lookup_worker (bfd *abfd, enum cache_flag flag)
   if ((abfd->flags & BFD_IN_MEMORY) != 0)
     abort ();
 
-  if (abfd->my_archive)
+  while (abfd->my_archive)
     abfd = abfd->my_archive;
 
   if (abfd->iostream != NULL)
@@ -362,7 +362,7 @@ cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes)
 static int
 cache_bclose (struct bfd *abfd)
 {
-  return bfd_cache_close (abfd);
+  return bfd_cache_close (abfd) - 1;
 }
 
 static int
@@ -437,7 +437,7 @@ cache_bmmap (struct bfd *abfd ATTRIBUTE_UNUSED,
         {
           *map_addr = ret;
           *map_len = pg_len;
-          ret += offset & pagesize_m1;
+          ret = (char *) ret + (offset & pagesize_m1);
         }
     }
 #endif
@@ -563,15 +563,15 @@ bfd_open_file (bfd *abfd)
     {
     case read_direction:
     case no_direction:
-      abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB);
+      abfd->iostream = real_fopen (abfd->filename, FOPEN_RB);
       break;
     case both_direction:
     case write_direction:
       if (abfd->opened_once)
        {
-         abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB);
+         abfd->iostream = real_fopen (abfd->filename, FOPEN_RUB);
          if (abfd->iostream == NULL)
-           abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
+           abfd->iostream = real_fopen (abfd->filename, FOPEN_WUB);
        }
       else
        {
@@ -601,7 +601,7 @@ bfd_open_file (bfd *abfd)
          if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
            unlink_if_ordinary (abfd->filename);
 #endif
-         abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
+         abfd->iostream = real_fopen (abfd->filename, FOPEN_WUB);
          abfd->opened_once = TRUE;
        }
       break;
index c0505c6..7d48ea9 100644 (file)
@@ -91,7 +91,7 @@ make_a_section_from_file (bfd *abfd,
              don't know the length of the string table.  */
          strings += strindex;
          name = (char *) bfd_alloc (abfd,
-                                     (bfd_size_type) strlen (strings) + 1);
+                                     (bfd_size_type) strlen (strings) + 1 + 1);
          if (name == NULL)
            return FALSE;
          strcpy (name, strings);
@@ -102,7 +102,7 @@ make_a_section_from_file (bfd *abfd,
     {
       /* Assorted wastage to null-terminate the name, thanks AT&T! */
       name = (char *) bfd_alloc (abfd,
-                                 (bfd_size_type) sizeof (hdr->s_name) + 1);
+                                 (bfd_size_type) sizeof (hdr->s_name) + 1 + 1);
       if (name == NULL)
        return FALSE;
       strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
@@ -146,6 +146,76 @@ make_a_section_from_file (bfd *abfd,
   if (hdr->s_scnptr != 0)
     return_section->flags |= SEC_HAS_CONTENTS;
 
+  /* Compress/decompress DWARF debug sections with names: .debug_* and
+     .zdebug_*, after the section flags is set.  */
+  if ((flags & SEC_DEBUGGING)
+      && ((name[1] == 'd' && name[6] == '_')
+         || (name[1] == 'z' && name[7] == '_')))
+    {
+      enum { nothing, compress, decompress } action = nothing;
+      char *new_name = NULL;
+
+      if (bfd_is_section_compressed (abfd, return_section))
+       {
+         /* Compressed section.  Check if we should decompress.  */
+         if ((abfd->flags & BFD_DECOMPRESS))
+           action = decompress;
+       }
+      else if (!bfd_is_section_compressed (abfd, return_section))
+       {
+         /* Normal section.  Check if we should compress.  */
+         if ((abfd->flags & BFD_COMPRESS) && return_section->size != 0)
+           action = compress;
+       }
+
+      switch (action)
+       {
+       case nothing:
+         break;
+       case compress:
+         if (!bfd_init_section_compress_status (abfd, return_section))
+           {
+             (*_bfd_error_handler)
+               (_("%B: unable to initialize compress status for section %s"),
+                abfd, name);
+             return FALSE;
+           }
+         if (name[1] != 'z')
+           {
+             unsigned int len = strlen (name);
+
+             new_name = bfd_alloc (abfd, len + 2);
+             if (new_name == NULL)
+               return FALSE;
+             new_name[0] = '.';
+             new_name[1] = 'z';
+             memcpy (new_name + 2, name + 1, len);
+           }
+         break;
+       case decompress:
+         if (!bfd_init_section_decompress_status (abfd, return_section))
+           {
+             (*_bfd_error_handler)
+               (_("%B: unable to initialize decompress status for section %s"),
+                abfd, name);
+             return FALSE;
+           }
+         if (name[1] == 'z')
+           {
+             unsigned int len = strlen (name);
+
+             new_name = bfd_alloc (abfd, len);
+             if (new_name == NULL)
+               return FALSE;
+             new_name[0] = '.';
+             memcpy (new_name + 1, name + 2, len - 1);
+           }
+         break;
+       }
+      if (new_name != NULL)
+       bfd_rename_section (abfd, return_section, new_name);
+    }
+
   return result;
 }
 
@@ -577,7 +647,7 @@ fixup_symbol_value (bfd *abfd,
                    struct internal_syment *syment)
 {
   /* Normalize the symbol flags.  */
-  if (coff_symbol_ptr->symbol.section 
+  if (coff_symbol_ptr->symbol.section
       && bfd_is_com_section (coff_symbol_ptr->symbol.section))
     {
       /* A common symbol is undefined with a value.  */
@@ -1449,7 +1519,7 @@ coff_pointerize_aux (bfd *abfd,
   /* Otherwise patch up.  */
 #define N_TMASK coff_data  (abfd)->local_n_tmask
 #define N_BTSHFT coff_data (abfd)->local_n_btshft
-  
+
   if ((ISFCN (type) || ISTAG (n_sclass) || n_sclass == C_BLOCK
        || n_sclass == C_FCN)
       && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
@@ -1872,7 +1942,7 @@ coff_bfd_make_debug_symbol (bfd *abfd,
   new_symbol->lineno = NULL;
   new_symbol->done_lineno = FALSE;
   new_symbol->symbol.the_bfd = abfd;
-  
+
   return & new_symbol->symbol;
 }
 
@@ -2153,7 +2223,7 @@ coff_find_nearest_line_with_names (bfd *abfd,
   if (_bfd_dwarf2_find_nearest_line (abfd, debug_sections,
                                      section, symbols, offset,
                                     filename_ptr, functionname_ptr,
-                                    line_ptr, 0,
+                                    line_ptr, NULL, 0,
                                     &coff_data(abfd)->dwarf2_find_line_info))
     return TRUE;
 
@@ -2348,6 +2418,24 @@ coff_find_nearest_line (bfd *abfd,
                                             line_ptr);
 }
 
+bfd_boolean
+coff_find_nearest_line_discriminator (bfd *abfd,
+                                     asection *section,
+                                     asymbol **symbols,
+                                     bfd_vma offset,
+                                     const char **filename_ptr,
+                                     const char **functionname_ptr,
+                                     unsigned int *line_ptr,
+                                     unsigned int *discriminator)
+{
+  *discriminator = 0;
+  return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections,
+                                            section, symbols, offset,
+                                            filename_ptr, functionname_ptr,
+                                            line_ptr);
+}
+
+
 bfd_boolean
 coff_find_inliner_info (bfd *abfd,
                        const char **filename_ptr,
index a82a8bc..eb3bc53 100644 (file)
@@ -1,5 +1,5 @@
 /* Compressed section support (intended for debug sections).
-   Copyright 2008, 2010, 2011
+   Copyright 2008, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -19,7 +19,6 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-#include "config.h"
 #include "sysdep.h"
 #include "bfd.h"
 #include "libbfd.h"
@@ -47,7 +46,7 @@ decompress_contents (bfd_byte *compressed_buffer,
   strm.avail_out = uncompressed_size;
 
   rc = inflateInit (&strm);
-  while (strm.avail_in > 0)
+  while (strm.avail_in > 0 && strm.avail_out > 0)
     {
       if (rc != Z_OK)
        return FALSE;
@@ -80,7 +79,7 @@ DESCRIPTION
        field was allocated using bfd_malloc() or equivalent.  If zlib
        is not installed on this machine, the input is unmodified.
 
-       Return @code{TRUE} if the full section contents is compressed 
+       Return @code{TRUE} if the full section contents is compressed
        successfully.
 */
 
@@ -149,7 +148,7 @@ SYNOPSIS
 DESCRIPTION
        Read all data from @var{section} in BFD @var{abfd}, decompress
        if needed, and store in @var{*ptr}.  If @var{*ptr} is NULL,
-       return @var{*ptr} with memory malloc'd by this function.  
+       return @var{*ptr} with memory malloc'd by this function.
 
        Return @code{TRUE} if the full section contents is retrieved
        successfully.
@@ -162,11 +161,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
   bfd_byte *p = *ptr;
 #ifdef HAVE_ZLIB_H
   bfd_boolean ret;
-  bfd_size_type compressed_size;
-  bfd_size_type uncompressed_size;
-  bfd_size_type rawsize;
+  bfd_size_type save_size;
+  bfd_size_type save_rawsize;
   bfd_byte *compressed_buffer;
-  bfd_byte *uncompressed_buffer;
 #endif
 
   if (abfd->direction != write_direction && sec->rawsize != 0)
@@ -200,45 +197,44 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
       return FALSE;
 #else
       /* Read in the full compressed section contents.  */
-      uncompressed_size = sec->size;
-      compressed_size = sec->compressed_size;
-      compressed_buffer = (bfd_byte *) bfd_malloc (compressed_size);
+      compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size);
       if (compressed_buffer == NULL)
        return FALSE;
-      rawsize = sec->rawsize;
+      save_rawsize = sec->rawsize;
+      save_size = sec->size;
       /* Clear rawsize, set size to compressed size and set compress_status
         to COMPRESS_SECTION_NONE.  If the compressed size is bigger than
         the uncompressed size, bfd_get_section_contents will fail.  */
       sec->rawsize = 0;
-      sec->size = compressed_size;
+      sec->size = sec->compressed_size;
       sec->compress_status = COMPRESS_SECTION_NONE;
       ret = bfd_get_section_contents (abfd, sec, compressed_buffer,
-                                     0, compressed_size);
+                                     0, sec->compressed_size);
       /* Restore rawsize and size.  */
-      sec->rawsize = rawsize;
-      sec->size = uncompressed_size;
+      sec->rawsize = save_rawsize;
+      sec->size = save_size;
       sec->compress_status = DECOMPRESS_SECTION_SIZED;
       if (!ret)
        goto fail_compressed;
 
-      uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
-      if (uncompressed_buffer == NULL)
+      if (p == NULL)
+       p = (bfd_byte *) bfd_malloc (sz);
+      if (p == NULL)
        goto fail_compressed;
 
-      if (!decompress_contents (compressed_buffer, compressed_size,
-                               uncompressed_buffer, uncompressed_size))
+      if (!decompress_contents (compressed_buffer, sec->compressed_size, p, sz))
        {
          bfd_set_error (bfd_error_bad_value);
-         free (uncompressed_buffer);
+         if (p != *ptr)
+           free (p);
        fail_compressed:
          free (compressed_buffer);
          return FALSE;
        }
 
       free (compressed_buffer);
-      sec->contents = uncompressed_buffer;
-      sec->compress_status = COMPRESS_SECTION_DONE;
-      /* Fall thru */
+      *ptr = p;
+      return TRUE;
 #endif
 
     case COMPRESS_SECTION_DONE:
@@ -257,6 +253,29 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
     }
 }
 
+/*
+FUNCTION
+       bfd_cache_section_contents
+
+SYNOPSIS
+       void bfd_cache_section_contents
+         (asection *sec, void *contents);
+
+DESCRIPTION
+       Stash @var(contents) so any following reads of @var(sec) do
+       not need to decompress again.
+*/
+
+void
+bfd_cache_section_contents (asection *sec, void *contents)
+{
+  if (sec->compress_status == DECOMPRESS_SECTION_SIZED)
+    sec->compress_status = COMPRESS_SECTION_DONE;
+  sec->contents = contents;
+  sec->flags |= SEC_IN_MEMORY;
+}
+
+
 /*
 FUNCTION
        bfd_is_section_compressed
@@ -273,11 +292,20 @@ bfd_boolean
 bfd_is_section_compressed (bfd *abfd, sec_ptr sec)
 {
   bfd_byte compressed_buffer [12];
+  unsigned int saved = sec->compress_status;
+  bfd_boolean compressed;
+
+  /* Don't decompress the section.  */
+  sec->compress_status = COMPRESS_SECTION_NONE;
 
   /* Read the zlib header.  In this case, it should be "ZLIB" followed
      by the uncompressed section size, 8 bytes in big-endian order.  */
-  return (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
-         && CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+  compressed = (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
+               && CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+
+  /* Restore compress_status.  */
+  sec->compress_status = saved;
+  return compressed;
 }
 
 /*
index 5337ce5..10820e2 100644 (file)
@@ -1,4 +1,21 @@
 # config.bfd
+#
+#   Copyright 2012, 2013 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
 # Convert a canonical host type into a BFD host type.
 # Set shell variable targ to canonical target name, and run
 # using ``. config.bfd''.
@@ -69,6 +86,7 @@ esac
 
 targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 case "${targ_cpu}" in
+aarch64*)       targ_archs="bfd_aarch64_arch bfd_arm_arch";;
 alpha*)                 targ_archs=bfd_alpha_arch ;;
 am34*|am33_2.0*) targ_archs=bfd_mn10300_arch ;;
 arm*)           targ_archs=bfd_arm_arch ;;
@@ -85,12 +103,13 @@ hppa*)              targ_archs=bfd_hppa_arch ;;
 i[3-7]86)       targ_archs=bfd_i386_arch ;;
 i370)           targ_archs=bfd_i370_arch ;;
 lm32)           targ_archs=bfd_lm32_arch ;;
-m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
-m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
+m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
+m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
 m68*)           targ_archs=bfd_m68k_arch ;;
 m88*)           targ_archs=bfd_m88k_arch ;;
 microblaze*)    targ_archs=bfd_microblaze_arch ;;
 mips*)          targ_archs=bfd_mips_arch ;;
+nios2*)          targ_archs=bfd_nios2_arch ;;
 or32*)          targ_archs=bfd_or32_arch ;;
 pdp11*)                 targ_archs=bfd_pdp11_arch ;;
 pj*)            targ_archs="bfd_pj_arch bfd_i386_arch";;
@@ -102,9 +121,10 @@ sparc*)             targ_archs=bfd_sparc_arch ;;
 spu*)            targ_archs=bfd_spu_arch ;;
 tilegx*)        targ_archs=bfd_tilegx_arch ;;
 tilepro*)       targ_archs=bfd_tilepro_arch ;;
-v850*)          targ_archs=bfd_v850_arch ;;
+v850*)          targ_archs="bfd_v850_arch bfd_v850_rh850_arch" ;;
 x86_64*)        targ_archs=bfd_i386_arch ;;
 xtensa*)        targ_archs=bfd_xtensa_arch ;;
+xgate)          targ_archs=bfd_xgate_arch ;;
 z80|r800)       targ_archs=bfd_z80_arch ;;
 z8k*)           targ_archs=bfd_z8k_arch ;;
 *)              targ_archs=bfd_${targ_cpu}_arch ;;
@@ -142,6 +162,26 @@ case "${targ}" in
 
 # START OF targmatch.h
 #ifdef BFD64
+  aarch64-*-elf)
+    targ_defvec=bfd_elf64_littleaarch64_vec
+    targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
+    want64=true
+    ;;
+  aarch64_be-*-elf)
+    targ_defvec=bfd_elf64_bigaarch64_vec
+    targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
+    want64=true
+    ;;
+  aarch64-*-linux*)
+    targ_defvec=bfd_elf64_littleaarch64_vec
+    targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
+    want64=true
+    ;;
+  aarch64_be-*-linux*)
+    targ_defvec=bfd_elf64_bigaarch64_vec
+    targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
+    want64=true
+    ;;
   alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
     targ_defvec=bfd_elf64_alpha_freebsd_vec
     targ_selvecs="bfd_elf64_alpha_vec ecoffalpha_little_vec"
@@ -216,6 +256,18 @@ case "${targ}" in
     targ_selvecs=bfd_elf32_bigarc_vec
     ;;
 
+  arm-*-nacl*)
+    targ_defvec=bfd_elf32_littlearm_nacl_vec
+    targ_selvecs="bfd_elf32_bigarm_nacl_vec bfd_elf32_i386_nacl_vec"
+    targ64_selvecs="bfd_elf32_x86_64_nacl_vec bfd_elf64_x86_64_nacl_vec"
+    targ_archs="$targ_archs bfd_i386_arch"
+    ;;
+  armeb-*-nacl*)
+    targ_defvec=bfd_elf32_bigarm_nacl_vec
+    targ_selvecs="bfd_elf32_littlearm_nacl_vec bfd_elf32_i386_nacl_vec"
+    targ64_selvecs="bfd_elf32_x86_64_nacl_vec bfd_elf64_x86_64_nacl_vec"
+    targ_archs="$targ_archs bfd_i386_arch"
+    ;;
   armeb-*-netbsdelf*)
     targ_defvec=bfd_elf32_bigarm_vec
     targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec"
@@ -327,7 +379,7 @@ case "${targ}" in
     targ_underscore=yes
     ;;
 
-  cr16-*-elf*)
+  cr16-*-elf* | cr16*-*-uclinux*)
     targ_defvec=bfd_elf32_cr16_vec
     targ_underscore=yes
     ;;
@@ -384,8 +436,9 @@ case "${targ}" in
     targ_selvecs=bfd_elf32_frv_vec
     ;;
 
-  moxie-*-elf | moxie-*-rtems | moxie-*-uclinux)
-    targ_defvec=bfd_elf32_moxie_vec
+  moxie-*-elf | moxie-*-rtems* | moxie-*-uclinux)
+    targ_defvec=bfd_elf32_bigmoxie_vec
+    targ_selvecs=bfd_elf32_littlemoxie_vec
     ;;
 
   h8300*-*-rtemscoff*)
@@ -507,9 +560,10 @@ case "${targ}" in
   i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
     targ_defvec=mach_o_i386_vec
     targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
+    targ64_selvecs=mach_o_x86_64_vec
     targ_archs="$targ_archs bfd_powerpc_arch bfd_rs6000_arch"
     ;;
- i[3-7]86-sequent-bsd*)
 i[3-7]86-sequent-bsd*)
     targ_defvec=i386dynix_vec
     targ_underscore=yes
     ;;
@@ -568,11 +622,13 @@ case "${targ}" in
   i[3-7]86-*-linux-*)
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs="i386linux_vec i386pei_vec"
-    targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf32_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
+    targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf32_x86_64_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
     ;;
   i[3-7]86-*-nacl*)
     targ_defvec=bfd_elf32_i386_nacl_vec
-    targ_selvecs="bfd_elf32_i386_vec"
+    targ_selvecs="bfd_elf32_bigarm_nacl_vec bfd_elf32_littlearm_nacl_vec"
+    targ64_selvecs="bfd_elf64_x86_64_nacl_vec bfd_elf32_x86_64_nacl_vec"
+    targ_archs="$targ_archs bfd_arm_arch"
     ;;
 #ifdef BFD64
   x86_64-*-darwin*)
@@ -611,12 +667,22 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_i386_vec bfd_elf32_x86_64_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
     want64=true
     ;;
-  x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep)
+  x86_64-*-nacl*)
+    targ_defvec=bfd_elf32_x86_64_nacl_vec
+    targ_selvecs="bfd_elf32_i386_nacl_vec bfd_elf64_x86_64_nacl_vec bfd_elf32_bigarm_nacl_vec bfd_elf32_littlearm_nacl_vec"
+    targ_archs="$targ_archs bfd_arm_arch"
+    want64=true
+    ;;
+  x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
     targ_defvec=x86_64pe_vec
     targ_selvecs="x86_64pe_vec x86_64pei_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec i386pe_vec i386pei_vec bfd_elf32_i386_vec"
     want64=true
     targ_underscore=no
     ;;
+  x86_64-*-rdos*)
+    targ_defvec=bfd_elf64_x86_64_vec
+    want64=true
+    ;;
 #endif
   i[3-7]86-*-lynxos*)
     targ_defvec=bfd_elf32_i386_vec
@@ -872,8 +938,19 @@ case "${targ}" in
     targ_selvecs=bfd_elf32_mep_little_vec
     ;;
 
+  metag-*-*)
+    targ_defvec=bfd_elf32_metag_vec
+    targ_underscore=yes
+    ;;
+
+  microblazeel*-*)
+    targ_defvec=bfd_elf32_microblazeel_vec
+    targ_selvecs=bfd_elf32_microblaze_vec
+    ;;
+
   microblaze*-*)
     targ_defvec=bfd_elf32_microblaze_vec
+    targ_selvecs=bfd_elf32_microblazeel_vec
     ;;
 
   mips*-big-*)
@@ -902,7 +979,16 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
     want64=true
     ;;
+  mips64*-ps2-elf*)
+    targ_defvec=bfd_elf32_nlittlemips_vec
+    targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_nbigmips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+    want64=true
+    ;;
 #endif
+  mips*-ps2-elf*)
+    targ_defvec=bfd_elf32_littlemips_vec
+    targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+    ;;
   mips*-*-irix5*)
     targ_defvec=bfd_elf32_bigmips_vec
     targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
@@ -940,7 +1026,7 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
     want64=true
     ;;
-  mips*-sde-elf*)
+  mips*-sde-elf* | mips*-mti-elf*)
     targ_defvec=bfd_elf32_tradbigmips_vec
     targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
     want64=true
@@ -983,7 +1069,6 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
     want64=true
     ;;
-#endif
   mips*el-*-linux*)
     targ_defvec=bfd_elf32_tradlittlemips_vec
     targ_selvecs="bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec"
@@ -994,7 +1079,6 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec"
     want64=true
     ;;
-#ifdef BFD64
   mips64*el-*-freebsd* | mips64*el-*-kfreebsd*-gnu)
     # FreeBSD vectors
     targ_defvec=bfd_elf32_ntradlittlemips_freebsd_vec
@@ -1061,6 +1145,21 @@ case "${targ}" in
     targ_underscore=yes
     ;;
 
+  nios2eb-*-*)
+    targ_defvec=bfd_elf32_bignios2_vec
+    targ_selvecs=bfd_elf32_littlenios2_vec
+    ;;
+
+  nios2el-*-*)
+    targ_defvec=bfd_elf32_littlenios2_vec
+    targ_selvecs=bfd_elf32_bignios2_vec
+    ;;
+
+  nios2-*-*)
+    targ_defvec=bfd_elf32_littlenios2_vec
+    targ_selvecs=bfd_elf32_bignios2_vec
+    ;;
+
   openrisc-*-elf)
     targ_defvec=bfd_elf32_openrisc_vec
     ;;
@@ -1506,8 +1605,12 @@ case "${targ}" in
 
 #ifdef BFD64
   tilegx-*-*)
-    targ_defvec=bfd_elf64_tilegx_vec
-    targ_selvecs=bfd_elf32_tilegx_vec
+    targ_defvec=bfd_elf64_tilegx_le_vec
+    targ_selvecs="bfd_elf64_tilegx_be_vec bfd_elf32_tilegx_be_vec bfd_elf32_tilegx_le_vec"
+    ;;
+  tilegxbe-*-*)
+    targ_defvec=bfd_elf64_tilegx_be_vec
+    targ_selvecs="bfd_elf64_tilegx_le_vec bfd_elf32_tilegx_be_vec bfd_elf32_tilegx_le_vec"
     ;;
 #endif
 
@@ -1517,6 +1620,7 @@ case "${targ}" in
 
   v850*-*-*)
     targ_defvec=bfd_elf32_v850_vec
+    targ_selvecs="bfd_elf32_v850_rh850_vec"
     ;;
 
   vax-*-netbsdelf*)
@@ -1551,7 +1655,12 @@ case "${targ}" in
   w65-*-*)
     targ_defvec=w65_vec
     ;;
-
+    
+  xgate-*-*)
+    targ_defvec=bfd_elf32_xgate_vec
+    targ_selvecs="bfd_elf32_xgate_vec"
+    ;;
+       
   xstormy16-*-elf)
     targ_defvec=bfd_elf32_xstormy16_vec
     ;;
index bba0d1c..8d62938 100644 (file)
@@ -169,7 +169,7 @@ generic_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
      of the const char * returned by bfd_core_file_failing_command to a
      non-const char *.  In this case, the assignement does not lead to
      breaking the const, as we're only reading the string.  */
-     
+
   core = (char *) bfd_core_file_failing_command (core_bfd);
   if (core == NULL)
     return TRUE;
@@ -185,7 +185,7 @@ generic_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
   last_slash = strrchr (exec, '/');
   if (last_slash != NULL)
     exec = last_slash + 1;
-  
+
   return filename_cmp (exec, core) == 0;
 }
 
index f98c0e5..6174612 100644 (file)
 #include "sysdep.h"
 #include "bfd.h"
 #include "libbfd.h"
+#include "libiberty.h"
+
+extern void * bfd_arch_i386_short_nop_fill (bfd_size_type, bfd_boolean,
+                                           bfd_boolean);
 
 static const bfd_arch_info_type *
 bfd_i386_compatible (const bfd_arch_info_type *a,
@@ -38,6 +42,83 @@ bfd_i386_compatible (const bfd_arch_info_type *a,
   return compat;
 }
 
+/* Fill the buffer with zero or nop instruction if CODE is TRUE.  Use
+   multi byte nop instructions if LONG_NOP is TRUE.  */
+
+static void *
+bfd_arch_i386_fill (bfd_size_type count, bfd_boolean code,
+                   bfd_boolean long_nop)
+{
+  /* nop */
+  static const char nop_1[] = { 0x90 };
+  /* xchg %ax,%ax */
+  static const char nop_2[] = { 0x66, 0x90 };
+  /* nopl (%[re]ax) */
+  static const char nop_3[] = { 0x0f, 0x1f, 0x00 };
+  /* nopl 0(%[re]ax) */
+  static const char nop_4[] = { 0x0f, 0x1f, 0x40, 0x00 };
+  /* nopl 0(%[re]ax,%[re]ax,1) */
+  static const char nop_5[] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 };
+  /* nopw 0(%[re]ax,%[re]ax,1) */
+  static const char nop_6[] = { 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 };
+  /* nopl 0L(%[re]ax) */
+  static const char nop_7[] = { 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00 };
+  /* nopl 0L(%[re]ax,%[re]ax,1) */
+  static const char nop_8[] =
+    { 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00};
+  /* nopw 0L(%[re]ax,%[re]ax,1) */
+  static const char nop_9[] =
+    { 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 };
+  /* nopw %cs:0L(%[re]ax,%[re]ax,1) */
+  static const char nop_10[] =
+    { 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 };
+  static const char *const nops[] =
+    { nop_1, nop_2, nop_3, nop_4, nop_5,
+      nop_6, nop_7, nop_8, nop_9, nop_10 };
+  bfd_size_type nop_size = long_nop ? ARRAY_SIZE (nops) : 2;
+
+  void *fill = bfd_malloc (count);
+  if (fill == NULL)
+    return fill;
+
+  if (code)
+    {
+      bfd_byte *p = fill;
+      while (count >= nop_size)
+       {
+         memcpy (p, nops[nop_size - 1], nop_size);
+         p += nop_size;
+         count -= nop_size;
+       }
+      if (count != 0)
+       memcpy (p, nops[count - 1], count);
+    }
+  else
+    memset (fill, 0, count);
+
+  return fill;
+}
+
+/* Fill the buffer with zero or short nop instruction if CODE is TRUE.  */
+
+void *
+bfd_arch_i386_short_nop_fill (bfd_size_type count,
+                             bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
+                             bfd_boolean code)
+{
+  return bfd_arch_i386_fill (count, code, FALSE);
+}
+
+/* Fill the buffer with zero or long nop instruction if CODE is TRUE.  */
+
+static void *
+bfd_arch_i386_long_nop_fill (bfd_size_type count,
+                            bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
+                            bfd_boolean code)
+{
+  return bfd_arch_i386_fill (count, code, TRUE);
+}
+
 static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
@@ -51,6 +132,7 @@ static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_long_nop_fill,
   0
 };
 
@@ -67,6 +149,7 @@ static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_long_nop_fill,
   &bfd_x64_32_arch_intel_syntax,
 };
 
@@ -83,6 +166,7 @@ static const bfd_arch_info_type bfd_i386_arch_intel_syntax =
   TRUE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_short_nop_fill,
   &bfd_x86_64_arch_intel_syntax
 };
 
@@ -99,6 +183,7 @@ static const bfd_arch_info_type i8086_arch =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_short_nop_fill,
   &bfd_i386_arch_intel_syntax
 };
 
@@ -115,6 +200,7 @@ static const bfd_arch_info_type bfd_x64_32_arch =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_long_nop_fill,
   &i8086_arch
 };
 
@@ -131,6 +217,7 @@ static const bfd_arch_info_type bfd_x86_64_arch =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_long_nop_fill,
   &bfd_x64_32_arch
 };
 
@@ -147,5 +234,6 @@ const bfd_arch_info_type bfd_i386_arch =
   TRUE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_short_nop_fill,
   &bfd_x86_64_arch
 };
index c1057c4..46ac3a0 100644 (file)
@@ -23,6 +23,9 @@
 #include "bfd.h"
 #include "libbfd.h"
 
+extern void * bfd_arch_i386_short_nop_fill (bfd_size_type, bfd_boolean,
+                                           bfd_boolean);
+
 static const bfd_arch_info_type bfd_l1om_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
@@ -36,6 +39,7 @@ static const bfd_arch_info_type bfd_l1om_arch_intel_syntax =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_i386_short_nop_fill,
   0
 };
 
@@ -52,5 +56,6 @@ const bfd_arch_info_type bfd_l1om_arch =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_i386_short_nop_fill,
   &bfd_l1om_arch_intel_syntax
 };
index 577f278..7a1a4ae 100644 (file)
@@ -173,6 +173,9 @@ struct dwarf2_debug
 #define STASH_INFO_HASH_OFF        0
 #define STASH_INFO_HASH_ON         1
 #define STASH_INFO_HASH_DISABLED   2
+
+  /* True if we opened bfd_ptr.  */
+  bfd_boolean close_on_cleanup;
 };
 
 struct arange
@@ -405,8 +408,8 @@ create_info_hash_table (bfd *abfd)
 {
   struct info_hash_table *hash_table;
 
-  hash_table = (struct info_hash_table *)
-      bfd_alloc (abfd, sizeof (struct info_hash_table));
+  hash_table = ((struct info_hash_table *)
+               bfd_alloc (abfd, sizeof (struct info_hash_table)));
   if (!hash_table)
     return hash_table;
 
@@ -503,7 +506,7 @@ read_section (bfd *           abfd,
       if (syms)
        {
          *section_buffer
-             = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, syms);
+           = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, syms);
          if (! *section_buffer)
            return FALSE;
        }
@@ -522,7 +525,8 @@ read_section (bfd *           abfd,
      that the client wants.  Validate it here to avoid trouble later.  */
   if (offset != 0 && offset >= *section_size)
     {
-      (*_bfd_error_handler) (_("Dwarf Error: Offset (%lu) greater than or equal to %s size (%lu)."),
+      (*_bfd_error_handler) (_("Dwarf Error: Offset (%lu)"
+                              " greater than or equal to %s size (%lu)."),
                             (long) offset, section_name, *section_size);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
@@ -979,6 +983,7 @@ struct line_info
   char *filename;
   unsigned int line;
   unsigned int column;
+  unsigned int discriminator;
   unsigned char op_index;
   unsigned char end_sequence;          /* End of (sequential) code sequence.  */
 };
@@ -1014,20 +1019,27 @@ struct line_info_table
 /* Remember some information about each function.  If the function is
    inlined (DW_TAG_inlined_subroutine) it may have two additional
    attributes, DW_AT_call_file and DW_AT_call_line, which specify the
-   source code location where this function was inlined. */
+   source code location where this function was inlined.  */
 
 struct funcinfo
 {
-  struct funcinfo *prev_func;          /* Pointer to previous function in list of all functions */
-  struct funcinfo *caller_func;                /* Pointer to function one scope higher */
-  char *caller_file;                   /* Source location file name where caller_func inlines this func */
-  int caller_line;                     /* Source location line number where caller_func inlines this func */
-  char *file;                          /* Source location file name */
-  int line;                            /* Source location line number */
+  /* Pointer to previous function in list of all functions.  */
+  struct funcinfo *prev_func;
+  /* Pointer to function one scope higher.  */
+  struct funcinfo *caller_func;
+  /* Source location file name where caller_func inlines this func.  */
+  char *caller_file;
+  /* Source location line number where caller_func inlines this func.  */
+  int caller_line;
+  /* Source location file name.  */
+  char *file;
+  /* Source location line number.  */
+  int line;
   int tag;
   char *name;
   struct arange arange;
-  asection *sec;                       /* Where the symbol is defined */
+  /* Where the symbol is defined.  */
+  asection *sec;
 };
 
 struct varinfo
@@ -1072,6 +1084,7 @@ add_line_info (struct line_info_table *table,
               char *filename,
               unsigned int line,
               unsigned int column,
+              unsigned int discriminator,
               int end_sequence)
 {
   bfd_size_type amt = sizeof (struct line_info);
@@ -1087,6 +1100,7 @@ add_line_info (struct line_info_table *table,
   info->op_index = op_index;
   info->line = line;
   info->column = column;
+  info->discriminator = discriminator;
   info->end_sequence = end_sequence;
 
   if (filename && filename[0])
@@ -1248,12 +1262,16 @@ concat_filename (struct line_info_table *table, unsigned int file)
 }
 
 static bfd_boolean
-arange_add (bfd *abfd, struct arange *first_arange,
+arange_add (const struct comp_unit *unit, struct arange *first_arange,
            bfd_vma low_pc, bfd_vma high_pc)
 {
   struct arange *arange;
 
-  /* If the first arange is empty, use it. */
+  /* Ignore empty ranges.  */
+  if (low_pc == high_pc)
+    return TRUE;
+
+  /* If the first arange is empty, use it.  */
   if (first_arange->high == 0)
     {
       first_arange->low = low_pc;
@@ -1281,7 +1299,7 @@ arange_add (bfd *abfd, struct arange *first_arange,
 
   /* Need to allocate a new arange and insert it into the arange list.
      Order isn't significant, so just insert after the first arange. */
-  arange = (struct arange *) bfd_zalloc (abfd, sizeof (*arange));
+  arange = (struct arange *) bfd_alloc (unit->abfd, sizeof (*arange));
   if (arange == NULL)
     return FALSE;
   arange->low = low_pc;
@@ -1401,6 +1419,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
   unsigned int i, bytes_read, offset_size;
   char *cur_file, *cur_dir;
   unsigned char op_code, extended_op, adj_opcode;
+  unsigned int exop_len;
   bfd_size_type amt;
 
   if (! read_section (abfd, &stash->debug_sections[debug_line],
@@ -1560,6 +1579,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
       char * filename = table->