Commit Graph

238 Commits

Author SHA1 Message Date
Peter Bergner 65b48a8140 GDB: Add support for the new set/show disassembler-options commands.
This commit adds support to GDB so that it can modify the disassembler-options
value that is passed to the disassembler, similar to objdump's -M option.
Currently, the only supported targets are ARM, PowerPC and S/390, but
adding support for a new target(s) is not difficult.

include/
	* dis-asm.h (disasm_options_t): New typedef.
	(parse_arm_disassembler_option): Remove prototype.
	(set_arm_regname_option): Likewise.
	(get_arm_regnames): Likewise.
	(get_arm_regname_num_options): Likewise.
	(disassemble_init_s390): New prototype.
	(disassembler_options_powerpc): Likewise.
	(disassembler_options_arm): Likewise.
	(disassembler_options_s390): Likewise.
	(remove_whitespace_and_extra_commas): Likewise.
	(disassembler_options_cmp): Likewise.
	(next_disassembler_option): New inline function.
	(FOR_EACH_DISASSEMBLER_OPTION): New macro.

opcodes/
	* disassemble.c Include "safe-ctype.h".
	(disassemble_init_for_target): Handle s390 init.
	(remove_whitespace_and_extra_commas): New function.
	(disassembler_options_cmp): Likewise.
	* arm-dis.c: Include "libiberty.h".
	(NUM_ELEM): Delete.
	(regnames): Use long disassembler style names.
	Add force-thumb and no-force-thumb options.
	(NUM_ARM_REGNAMES): Rename from this...
	(NUM_ARM_OPTIONS): ...to this.  Use ARRAY_SIZE.
	(get_arm_regname_num_options): Delete.
	(set_arm_regname_option): Likewise.
	(get_arm_regnames): Likewise.
	(parse_disassembler_options): Likewise.
	(parse_arm_disassembler_option): Rename from this...
	(parse_arm_disassembler_options): ...to this.  Make static.
	Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options.
	(print_insn): Use parse_arm_disassembler_options.
	(disassembler_options_arm): New function.
	(print_arm_disassembler_options): Handle updated regnames.
	* ppc-dis.c: Include "libiberty.h".
	(ppc_opts): Add "32" and "64" entries.
	(ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp.
	(powerpc_init_dialect): Add break to switch statement.
	Use new FOR_EACH_DISASSEMBLER_OPTION macro.
	(disassembler_options_powerpc): New function.
	(print_ppc_disassembler_options): Use ARRAY_SIZE.
	Remove printing of "32" and "64".
	* s390-dis.c: Include "libiberty.h".
	(init_flag): Remove unneeded variable.
	(struct s390_options_t): New structure type.
	(options): New structure.
	(init_disasm): Rename from this...
	(disassemble_init_s390): ...to this.  Add initializations for
	current_arch_mask and option_use_insn_len_bits_p.  Remove init_flag.
	(print_insn_s390): Delete call to init_disasm.
	(disassembler_options_s390): New function.
	(print_s390_disassembler_options): Print using information from
	struct 'options'.
	* po/opcodes.pot: Regenerate.

binutils/
	* objdump.c (main): Use remove_whitespace_and_extra_commas.

gdb/
	* NEWS: Mention new set/show disassembler-options commands.
	* doc/gdb.texinfo: Document new set/show disassembler-options commands.
	* disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h".
	(prospective_options): New static variable.
	(gdb_disassembler::gdb_disassembler): Initialize
	m_di.disassembler_options.
	(gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options.
	(get_disassembler_options): New function.
	(set_disassembler_options): Likewise.
	(set_disassembler_options_sfunc): Likewise.
	(show_disassembler_options_sfunc): Likewise.
	(disassembler_options_completer): Likewise.
	(_initialize_disasm): Likewise.
	* disasm.h (get_disassembler_options): New prototype.
	(set_disassembler_options): Likewise.
	* gdbarch.sh (gdbarch_disassembler_options): New variable.
	(gdbarch_verify_disassembler_options): Likewise.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Likewise.
	* arm-tdep.c (num_disassembly_options): Delete.
	(set_disassembly_style): Likewise.
	(arm_disassembler_options): New static variable.
	(set_disassembly_style_sfunc): Convert short style name into long
	option name.  Call set_disassembler_options.
	(show_disassembly_style_sfunc): New function.
	(arm_gdbarch_init): Call set_gdbarch_disassembler_options and
	set_gdbarch_verify_disassembler_options.
	(_initialize_arm_tdep): Delete regnames variable and update callers.
	(arm_disassembler_options): Initialize.
	(disasm_options): New variable.
	(num_disassembly_options): Rename from this...
	(num_disassembly_styles): ...to this.  Compute by scanning through
	disasm_options.
	(valid_disassembly_styles): Initialize using disasm_options.
	Remove calls to parse_arm_disassembler_option, get_arm_regnames and
	set_arm_regname_option.
	Pass show_disassembly_style_sfunc to the "disassembler" setshow command.
	* rs6000-tdep.c (powerpc_disassembler_options): New static variable.
	(rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and
	set_gdbarch_verify_disassembler_options.
	* s390-tdep.c (s390_disassembler_options): New static variable.
	(s390_gdbarch_init):all set_gdbarch_disassembler_options and
	set_gdbarch_verify_disassembler_options.

gdb/testsuite/
	* gdb.arch/powerpc-power.exp: Delete test.
	* gdb.arch/powerpc-power.s: Likewise.
	* gdb.disasm/disassembler-options.exp: New test.
	* gdb.arch/powerpc-altivec.exp: Likewise.
	* gdb.arch/powerpc-altivec.s: Likewise.
	* gdb.arch/powerpc-altivec2.exp: Likewise.
	* gdb.arch/powerpc-altivec2.s: Likewise.
	* gdb.arch/powerpc-altivec3.exp: Likewise.
	* gdb.arch/powerpc-altivec3.s: Likewise.
	* gdb.arch/powerpc-power7.exp: Likewise.
	* gdb.arch/powerpc-power7.s: Likewise.
	* gdb.arch/powerpc-power8.exp: Likewise.
	* gdb.arch/powerpc-power8.s: Likewise.
	* gdb.arch/powerpc-power9.exp: Likewise.
	* gdb.arch/powerpc-power9.s: Likewise.
	* gdb.arch/powerpc-vsx.exp: Likewise.
	* gdb.arch/powerpc-vsx.s: Likewise.
	* gdb.arch/powerpc-vsx2.exp: Likewise.
	* gdb.arch/powerpc-vsx2.s: Likewise.
	* gdb.arch/powerpc-vsx3.exp: Likewise.
	* gdb.arch/powerpc-vsx3.s: Likewise.
	* gdb.arch/arm-disassembler-options.exp: Likewise.
	* gdb.arch/powerpc-disassembler-options.exp: Likewise.
	* gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 12:32:07 -06:00
Andrew Burgess 1737c64030 objdump: Better objdump section headers in wide mode
When displaying the section headers table using objdump (-h), the column
containing the section header name is currently fixed at 13 characters.
A section name that is longer than 13 characters will overflow the
column causing the table to become miss-aligned.

In this commit I change the behaviour so that _in wide mode_ (-w -h) the
section name column is dynamically resized to fit the longest section
name we plan to display.  In wide mode the column still retains a
minimum width of 13 characters.

In non-wide more the behaviour is completely unchanged.

While I was changing the dump_headers function I have unified the two
printf lines that handled the different address widths into a single
printf, the address width is now passed into printf using the '*' field
width format character.

binutils/ChangeLog:

	* objdump.c (dump_section_header): Extract max section name length
	from data parameter, use this when formatting output.
	(find_longest_section_name): New function.
	(dump_headers): Calculate longest section name when in wide mode,
	reformat to unify printing of header line.

ld/ChangeLog:

	* testsuite/ld-elf/eh-frame-hdr.d: Update expected results.
2017-01-20 09:05:41 +00:00
Nick Clifton cd6581da62 Speed up objdump when displaying disassembly mixed with line number and source code information.
bfd	* dwarf2.c (lookup_address_in_function_table): Return early if
	there are no functions in the given comp unit, or if the high
	address of the last function in the comp unit is less than the
	desired address.

binutils * objdump.c (display_file): Add new parameter 'last_file'.  If
	last_file is true, do not call bfd_close at the end of the
	function.
	(main): Set the value of the last_file parameter when calling
	display_file.
2017-01-09 16:49:48 +00:00
Alan Modra 2571583aed Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
Nick Clifton a24bb4f0cc Enhance objdump so that it will use .got, .plt and .plt.got section symbols when disassembling, and it will use dynamic relocs to interpret entries in the PLT and GOT.
binutils * objdump.c (is_significant_symbol_name): New function.
	(remove_useless_symbols): Do not remove significanr symbols.
	(find_symbol_for_address): If an exact match for the specified
	address has not been found, try scanning the dynamic relocs to see
	if one of these matches the address.  If so, use the symbol
	associated with the reloc.
	(objdump_print_addr_with_symbol): Do not print offsets to symbols
	with no value.
	(disassemble_section): Only use dynamic relocs if the user
	requested this.
	(disassemble_data): Always load dynamic relocs if they are
	available.

ld	* ld-aarch64/emit-relocs-515-be.d: Adjust output to match change
	in objdump.
	* ld-aarch64/emit-relocs-515.d: Likewise.
	* ld-aarch64/emit-relocs-516-be.d: Likewise.
	* ld-aarch64/emit-relocs-516.d: Likewise.
	* ld-aarch64/farcall-b-plt.d: Likewise.
	* ld-aarch64/farcall-bl-plt.d: Likewise.
	* ld-aarch64/gc-plt-relocs.d: Likewise.
	* ld-aarch64/tls-desc-ie.d: Likewise.
	* ld-aarch64/tls-tiny-desc.d: Likewise.
	* ld-aarch64/tls-tiny-gd.d: Likewise.
	* ld-aarch64/tls-tiny-ie.d: Likewise.
	* ld-arm/arm-app-abs32.d: Likewise.
	* ld-arm/arm-app.d: Likewise.
	* ld-arm/arm-lib-plt32.d: Likewise.
	* ld-arm/arm-lib.d: Likewise.
	* ld-arm/armthumb-lib.d: Likewise.
	* ld-arm/cortex-a8-fix-b-plt.d: Likewise.
	* ld-arm/cortex-a8-fix-bcc-plt.d: Likewise.
	* ld-arm/cortex-a8-fix-bl-plt.d: Likewise.
	* ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise.
	* ld-arm/cortex-a8-fix-blx-plt.d: Likewise.
	* ld-arm/farcall-mixed-app-v5.d: Likewise.
	* ld-arm/farcall-mixed-app.d: Likewise.
	* ld-arm/farcall-mixed-app2.d: Likewise.
	* ld-arm/farcall-mixed-lib-v4t.d: Likewise.
	* ld-arm/farcall-mixed-lib.d: Likewise.
	* ld-arm/ifunc-10.dd: Likewise.
	* ld-arm/ifunc-14.dd: Likewise.
	* ld-arm/ifunc-15.dd: Likewise.
	* ld-arm/ifunc-3.dd: Likewise.
	* ld-arm/ifunc-4.dd: Likewise.
	* ld-arm/ifunc-9.dd: Likewise.
	* ld-arm/long-plt-format.d: Likewise.
	* ld-arm/mixed-app-v5.d: Likewise.
	* ld-arm/mixed-app.d: Likewise.
	* ld-arm/mixed-lib.d: Likewise.
	* ld-arm/tls-lib-loc.d: Likewise.
	* ld-cris/dso-pltdis1.d: Likewise.
	* ld-cris/dso-pltdis2.d: Likewise.
	* ld-cris/dso12-pltdis.d: Likewise.
	* ld-elf/symbolic-func.r: Likewise.
	* ld-frv/fdpic-pie-1.d: Likewise.
	* ld-frv/fdpic-pie-2.d: Likewise.
	* ld-frv/fdpic-pie-6.d: Likewise.
	* ld-frv/fdpic-pie-7.d: Likewise.
	* ld-frv/fdpic-pie-8.d: Likewise.
	* ld-frv/fdpic-shared-1.d: Likewise.
	* ld-frv/fdpic-shared-2.d: Likewise.
	* ld-frv/fdpic-shared-3.d: Likewise.
	* ld-frv/fdpic-shared-4.d: Likewise.
	* ld-frv/fdpic-shared-5.d: Likewise.
	* ld-frv/fdpic-shared-6.d: Likewise.
	* ld-frv/fdpic-shared-7.d: Likewise.
	* ld-frv/fdpic-shared-8.d: Likewise.
	* ld-frv/fdpic-shared-local-2.d: Likewise.
	* ld-frv/fdpic-shared-local-8.d: Likewise.
	* ld-frv/fdpic-static-1.d: Likewise.
	* ld-frv/fdpic-static-2.d: Likewise.
	* ld-frv/fdpic-static-6.d: Likewise.
	* ld-frv/fdpic-static-7.d: Likewise.
	* ld-frv/fdpic-static-8.d: Likewise.
	* ld-frv/tls-dynamic-2.d: Likewise.
	* ld-frv/tls-initial-shared-2.d: Likewise.
	* ld-frv/tls-relax-shared-2.d: Likewise.
	* ld-frv/tls-shared-2.d: Likewise.
	* ld-i386/plt-nacl.pd: Likewise.
	* ld-i386/plt-pic-nacl.pd: Likewise.
	* ld-i386/plt-pic.pd: Likewise.
	* ld-i386/plt.pd: Likewise.
	* ld-i386/pr19636-1d-nacl.d: Likewise.
	* ld-i386/pr19636-1d.d: Likewise.
	* ld-i386/pr19636-2c-nacl.d: Likewise.
	* ld-i386/pr19636-2c.d: Likewise.
	* ld-ifunc/ifunc-21-x86-64.d: Likewise.
	* ld-ifunc/ifunc-22-x86-64.d: Likewise.
	* ld-ifunc/pr17154-i386.d: Likewise.
	* ld-ifunc/pr17154-x86-64.d: Likewise.
	* ld-m68k/plt1-68020.d: Likewise.
	* ld-m68k/plt1-cpu32.d: Likewise.
	* ld-m68k/plt1-isab.d: Likewise.
	* ld-m68k/plt1-isac.d: Likewise.
	* ld-metag/shared.d: Likewise.
	* ld-metag/stub_pic_app.d: Likewise.
	* ld-metag/stub_pic_shared.d: Likewise.
	* ld-metag/stub_shared.d: Likewise.
	* ld-s390/tlsbin_64.dd: Likewise.
	* ld-s390/tlspic_64.dd: Likewise.
	* ld-tic6x/shlib-1.dd: Likewise.
	* ld-tic6x/shlib-1b.dd: Likewise.
	* ld-tic6x/shlib-1rb.dd: Likewise.
	* ld-tic6x/shlib-app-1.dd: Likewise.
	* ld-tic6x/shlib-app-1b.dd: Likewise.
	* ld-tic6x/shlib-app-1r.dd: Likewise.
	* ld-tic6x/shlib-app-1rb.dd: Likewise.
	* ld-tic6x/shlib-noindex.dd: Likewise.
	* ld-vax-elf/export-class-data.dd: Likewise.
	* ld-vax-elf/plt-local-lib.dd: Likewise.
	* ld-vax-elf/plt-local.dd: Likewise.
	* ld-x86-64/bnd-ifunc-2.d: Likewise.
	* ld-x86-64/bnd-plt-1.d: Likewise.
	* ld-x86-64/gotpcrel1.dd: Likewise.
	* ld-x86-64/libno-plt-1b.dd: Likewise.
	* ld-x86-64/load1c-nacl.d: Likewise.
	* ld-x86-64/load1c.d: Likewise.
	* ld-x86-64/load1d-nacl.d: Likewise.
	* ld-x86-64/load1d.d: Likewise.
	* ld-x86-64/mov1a.d: Likewise.
	* ld-x86-64/mov1b.d: Likewise.
	* ld-x86-64/mov1c.d: Likewise.
	* ld-x86-64/mov1d.d: Likewise.
	* ld-x86-64/mov2a.d: Likewise.
	* ld-x86-64/mov2b.d: Likewise.
	* ld-x86-64/mov2c.d: Likewise.
	* ld-x86-64/mov2d.d: Likewise.
	* ld-x86-64/mpx3.dd: Likewise.
	* ld-x86-64/mpx4.dd: Likewise.
	* ld-x86-64/no-plt-1a.dd: Likewise.
	* ld-x86-64/no-plt-1b.dd: Likewise.
	* ld-x86-64/no-plt-1c.dd: Likewise.
	* ld-x86-64/no-plt-1e.dd: Likewise.
	* ld-x86-64/no-plt-1f.dd: Likewise.
	* ld-x86-64/no-plt-1g.dd: Likewise.
	* ld-x86-64/plt-main-bnd.dd: Likewise.
	* ld-x86-64/plt-nacl.pd: Likewise.
	* ld-x86-64/plt.pd: Likewise.
	* ld-x86-64/pr18591.d: Likewise.
	* ld-x86-64/pr19609-1c.d: Likewise.
	* ld-x86-64/pr19609-1e.d: Likewise.
	* ld-x86-64/pr19609-1j.d: Likewise.
	* ld-x86-64/pr19609-1l.d: Likewise.
	* ld-x86-64/pr19609-1m.d: Likewise.
	* ld-x86-64/pr19609-5b.d: Likewise.
	* ld-x86-64/pr19609-5c.d: Likewise.
	* ld-x86-64/pr19609-5e.d: Likewise.
	* ld-x86-64/pr19609-6b.d: Likewise.
	* ld-x86-64/pr19609-7b.d: Likewise.
	* ld-x86-64/pr19609-7d.d: Likewise.
	* ld-x86-64/pr19636-2d.d: Likewise.
	* ld-x86-64/pr20093-1.d: Likewise.
	* ld-x86-64/pr20093-2.d: Likewise.
	* ld-x86-64/pr20253-1b.d: Likewise.
	* ld-x86-64/pr20253-1d.d: Likewise.
	* ld-x86-64/pr20253-1f.d: Likewise.
	* ld-x86-64/pr20253-1h.d: Likewise.
	* ld-x86-64/pr20253-1j.d: Likewise.
	* ld-x86-64/pr20253-1l.d: Likewise.
	* ld-x86-64/protected3.d: Likewise.
	* ld-x86-64/tlsbin.dd: Likewise.
	* ld-x86-64/tlsbin2.dd: Likewise.
	* ld-x86-64/tlsbindesc.dd: Likewise.
	* ld-x86-64/tlsdesc-nacl.pd: Likewise.
	* ld-x86-64/tlsdesc.dd: Likewise.
	* ld-x86-64/tlsdesc.pd: Likewise.
	* ld-x86-64/tlsgd10.dd: Likewise.
	* ld-x86-64/tlsgd5.dd: Likewise.
	* ld-x86-64/tlsgd6.dd: Likewise.
	* ld-x86-64/tlsgd8.dd: Likewise.
	* ld-x86-64/tlsgdesc.dd: Likewise.
	* ld-x86-64/tlspic.dd: Likewise.
	* ld-x86-64/tlspic2.dd: Likewise.

2016-10-11  Nick Clifton  <nickc@redhat.com>

	PR ld/20535
	* emultempl/elf32.em (_search_needed): Add support for pseudo
	environment variables supported by ld.so.  Namely $ORIGIN, $LIB
	and $PLATFORM.
	* configure.ac: Add getauxval to list AC_CHECK_FUNCS list.
	* config.in: Regenerate.
	* configure: Regenerate.

2016-10-11  Alan Modra  <amodra@gmail.com>

	* ldlang.c (lang_do_assignments_1): Descend into output section
	statements that do not yet have bfd sections.  Set symbol section
	temporarily for symbols defined in such statements to the undefined
	section.  Don't error on data or reloc statements until final phase.
	* ldexp.c (exp_fold_tree_1 <etree_assign>): Handle bfd_und_section
	in expld.section.
	* testsuite/ld-mmix/bpo-10.d: Adjust.
	* testsuite/ld-mmix/bpo-11.d: Adjust.

2016-10-10  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* emulparams/elf64_s390.sh: Move binary start to 16M.
	* testsuite/ld-s390/tlsbin_64.dd: Adjust testcases accordingly.
	* testsuite/ld-s390/tlsbin_64.rd: Likewise.

2016-10-07  Alan Modra  <amodra@gmail.com>

	* ldexp.c (MAX): Define.
	(exp_unop, exp_binop, exp_trinop): Alloc at least enough for
	etree_type.value.

2016-10-07  Alan Modra  <amodra@gmail.com>

	* testsuite/lib/ld-lib.exp (is_generic_elf): New, extracted from..
	* testsuite/ld-elf/elf.exp: ..here.

2016-10-06  Ludovic Court?s  <ludo@gnu.org>

	* emulparams/elf32bmipn32-defs.sh: Shift quote of
	"x$EMULATION_NAME" to the left to work around
	<http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-007>.

2016-10-06  Alan Modra  <amodra@gmail.com>

	* lexsup.c: Spell fall through comments consistently and add
	missing fall through comments.

2016-10-06  Alan Modra  <amodra@gmail.com>

	* plugin.c (asymbol_from_plugin_symbol): Avoid compiler warning
	by adding return.

2016-10-04  Alan Modra  <amodra@gmail.com>

	* ld.texinfo (Expression Section): Update result of arithmetic
	expressions.
	* ldexp.c (arith_result_section): New function.
	(fold_binary): Use it.

2016-10-04  Alan Modra  <amodra@gmail.com>

	* ldexp.c (exp_value_fold): New function.
	(exp_unop, exp_binop, exp_trinop): Use it.

2016-09-30  Alan Modra  <amodra@gmail.com>

	* scripttempl/v850.sc: Don't reference __ctbp, __ep, __gp when
	not relocating.
	* scripttempl/v850_rh850.sc: Likewise.

2016-09-30  Alan Modra  <amodra@gmail.com>

	PR ld/20528
	* testsuite/ld-elf/pr20528a.d: xfail generic elf targets.  Allow
	multiple .text sections for hppa-linux.
	* testsuite/ld-elf/pr20528b.d: Likewise.

2016-09-30  Alan Modra  <amodra@gmail.com>

	* ldmain.c (default_bfd_error_handler): New function pointer.
	(ld_bfd_error_handler): New function.
	(main): Arrange to call it on bfd errors/warnings.
	(ld_bfd_assert_handler): Enable tail call.

2016-09-30  Alan Modra  <amodra@gmail.com>

	* ldlang.c (ignore_bfd_errors): Update params.

2016-09-29  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/20528
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
	merge 2 sections with different SHF_EXCLUDE.
	* testsuite/ld-elf/pr20528a.d: New file.
	* testsuite/ld-elf/pr20528a.s: Likewise.
	* testsuite/ld-elf/pr20528b.d: Likewise.
	* testsuite/ld-elf/pr20528b.s: Likewise.

2016-09-28  Christophe Lyon  <christophe.lyon@linaro.org>

	PR ld/20608
	* testsuite/ld-arm/arm-elf.exp: Handle new testcase.
	* testsuite/ld-arm/farcall-mixed-app2.d: New file.
	* testsuite/ld-arm/farcall-mixed-app2.r: Likewise.
	* testsuite/ld-arm/farcall-mixed-app2.s: Likewise.
	* testsuite/ld-arm/farcall-mixed-app2.sym: Likewise.

2016-09-26  Vlad Zakharov  <vzakhar@synopsys.com>

	* Makefile.in: Regenerate.
	* configure: Likewise.

2016-09-26  Alan Modra  <amodra@gmail.com>

	* testsuite/ld-powerpc/attr-gnu-4-4.s: Delete.
	* testsuite/ld-powerpc/attr-gnu-4-14.d: Delete.
	* testsuite/ld-powerpc/attr-gnu-4-24.d: Delete.
	* testsuite/ld-powerpc/attr-gnu-4-34.d: Delete.
	* testsuite/ld-powerpc/attr-gnu-4-41.d: Delete.
	* testsuite/ld-powerpc/attr-gnu-4-32.d: Adjust expected warning.
	* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-01.d: Adjust expected output.
	* testsuite/ld-powerpc/attr-gnu-4-02.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-03.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-10.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-11.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-20.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-22.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-33.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-8-11.d: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Don't run deleted tests.

2016-09-23  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>

	PR ld/20595
	* testsuite/ld-arm/unwind-4.d: Add -q option to linker command
	line and -r option to objdump command line.  Match emitted relocs
	to make sure that superflous relocs are not generated.

2016-09-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* emulparams/elf64_s390.sh: Change TEXT_START_ADDR to 256MB.
	* testsuite/ld-s390/tlsbin_64.dd: Adjust testcase accordingly.
	* testsuite/ld-s390/tlsbin_64.rd: Likewise.

2016-09-22  Nick Clifton  <nickc@redhat.com>

	* emultempl/elf32.em (_try_needed): In verbose mode, report failed
	attempts to find a needed library.

2016-09-21  Richard Sandiford  <richard.sandiford@arm.com>

	* testsuite/ld-aarch64/emit-relocs-28.d: Expect spaces after ","
	in addresses.
	* testsuite/ld-aarch64/emit-relocs-301-be.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-301.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-302-be.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-302.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-310-be.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-310.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-313.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-515-be.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-515.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-516-be.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-516.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-531.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-532.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-533.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-534.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-535.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-536.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-537.d: Likewise.
	* testsuite/ld-aarch64/emit-relocs-538.d: Likewise.
	* testsuite/ld-aarch64/erratum835769.d: Likewise.
	* testsuite/ld-aarch64/erratum843419.d: Likewise.
	* testsuite/ld-aarch64/farcall-b-plt.d: Likewise.
	* testsuite/ld-aarch64/farcall-bl-plt.d: Likewise.
	* testsuite/ld-aarch64/gc-plt-relocs.d: Likewise.
	* testsuite/ld-aarch64/ifunc-21.d: Likewise.
	* testsuite/ld-aarch64/ifunc-7c.d: Likewise.
	* testsuite/ld-aarch64/tls-desc-ie.d: Likewise.
	* testsuite/ld-aarch64/tls-large-desc-be.d: Likewise.
	* testsuite/ld-aarch64/tls-large-desc.d: Likewise.
	* testsuite/ld-aarch64/tls-large-ie-be.d: Likewise.
	* testsuite/ld-aarch64/tls-large-ie.d: Likewise.
	* testsuite/ld-aarch64/tls-relax-all.d: Likewise.
	* testsuite/ld-aarch64/tls-relax-gd-ie.d: Likewise.
	* testsuite/ld-aarch64/tls-relax-gdesc-ie-2.d: Likewise.
	* testsuite/ld-aarch64/tls-relax-gdesc-ie.d: Likewise.
	* testsuite/ld-aarch64/tls-relax-large-desc-ie-be.d: Likewise.
	* testsuite/ld-aarch64/tls-relax-large-desc-ie.d: Likewise.
	* testsuite/ld-aarch64/tls-tiny-desc.d: Likewise.
	* testsuite/ld-aarch64/tls-tiny-gd.d: Likewise.

gas	* gas/arm/tls.d: Adjust output to match change in objdump.
2016-10-11 13:50:10 +01:00
Alan Modra 32a0481fb1 PR20337, Objdump makes poor choice of symbols
binutils/
	PR binutils/20337
	* objdump.c (compare_symbols): For ELF, sort same value/type
	symbols according to size.
ld/
	* testsuite/ld-powerpc/elfv2exe.d: Update.
2016-07-09 16:53:33 +09:30
Andre Vieria f0728ee368 [ARM] Change noread to purecode.
bfd/ChangeLog
2016-07-05  Andre Vieria  <andre.simoesdiasvieira@arm.com>

        * bfd-in2.h (SEC_ELF_NOREAD): Rename to ...
          (SEC_ELF_PURECODE): ... this.
        * elf32-arm.c (elf32_arm_post_process_headers): Rename SEC_ELF_NOREAD
          to SEC_ELF_NOREAD.
          (elf32_arm_fake_sections): Likewise.
          (elf_32_arm_section_flags): Likewise.
          (elf_32_arm_lookup_section_flags): Likewise.
        * section.c (SEC_ELF_NOREAD): Rename to ...
          (SEC_ELF_PURECODE): ... this.

binutils/ChangeLog
2016-07-05  Andre Vieria  <andre.simoesdiasvieira@arm.com>

        * objdump.c (dump_section_header): Rename SEC_ELF_NOREAD
          to SEC_ELF_NOREAD.
        * readelf.c (get_elf_section_flags): Rename ARM_NOREAD to
          ARM_PURECODE and SHF_ARM_NOREAD to SHF_ARM_PURECODE.
          (process_section_headers): Rename noread to purecode.

        * section.c (SEC_ELF_NOREAD): Rename to ...
          (SEC_ELF_PURECODE): ... this.

include/ChangeLog
2016-07-05  Andre Vieria  <andre.simoesdiasvieira@arm.com>

        * elf/arm.h (SHF_ARM_NOREAD): Rename to ...
          (SHF_ARM_PURECODE): ... this.

ld/ChangeLog
2016-07-05  Andre Vieria  <andre.simoesdiasvieira@arm.com>

        * testsuite/ld-arm/arm_noread.ld: Renamed to ...
          testsuite/ld-arm/arm_purecode.ld: ... this, and replaced
          all noread's by purecode.
2016-07-05 11:28:46 +01:00
Alan Modra f2b2af2c9f Invalid read in _bfd_elf_get_symbol_version_string
PR 20304
	* objdump.c (objdump_print_symname): Don't attempt to retrieve
	version info from synthetic symbols.
2016-06-28 19:09:10 +09:30
Alan Modra 43339b1d1c Limit objdump -S context lines
Showing context lines is confusing in many cases, an obvious example
being loops.

	* objdump.c (struct print_file_list): Add "max_printed".
	(try_print_file_open): Init new field.
	(show_line): Don't show 5 context lines when redisplaying source.
2016-06-24 23:05:48 +09:30
Andreas Arnez d6bb17b079 Add init_dwarf_regnames_s390
Define and use DWARF register names for s390.

binutils/ChangeLog:

	* dwarf.h (init_dwarf_regnames_s390): Declare.
	* dwarf.c (dwarf_regnames_s390): New.
	(init_dwarf_regnames_s390): New.
	(init_dwarf_regnames): Call it.
	* objdump.c (dump_dwarf): Likewise.
2016-04-13 10:56:30 +02:00
Nick Clifton e1fa016350 Remove use of alloca.
bfd	* warning.m4 (GCC_WARN_CFLAGS): Add -Wstack-usage=262144
	* configure: Regenerate.
	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Replace use of
	alloca with call to xmalloc.
	* elf32-nds32.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elfxx-mips.c: Likewise.
	* pef.c: Likewise.
	* pei-x86_64.c: Likewise.
	* som.c: Likewise.
	* xsym.c: Likewise.

binutils * dlltool.c: Replace use of alloca with call to xmalloc.
	* dllwrap.c: Likewise.
	* nlmconv.c: Likewise.
	* objdump.c: Likewise.
	* resrc.c: Likewise.
	* winduni.c: Likewise.
	* configure: Regenerate.

gas	* atof-generic.c: Replace use of alloca with call to xmalloc.
	* cgen.c: Likewise.
	* dwarf2dbg.c: Likewise.
	* macro.c: Likewise.
	* remap.c: Likewise.
	* stabs.c: Likewise.
	* symbols.c: Likewise.
	* config/obj-elf.c: Likewise.
	* config/tc-aarch64.c: Likewise.
	* config/tc-arc.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-avr.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-mips.c: Likewise.
	* config/tc-msp430.c: Likewise.
	* config/tc-nds32.c: Likewise.
	* config/tc-ppc.c: Likewise.
	* config/tc-sh.c: Likewise.
	* config/tc-tic30.c: Likewise.
	* config/tc-tic54x.c: Likewise.
	* config/tc-xstormy16.c: Likewise.
	* config/te-vms.c: Likewise.
	* configure: Regenerate.

ld	* emultempl/msp430.em: Replace use of alloca with call to xmalloc.
	* plugin.c: Likewise.
	* pe-dll.c: Likewise.
2016-03-21 16:31:46 +00:00
Mickael Guene 91f68a68f9 Add support for an ARM specific 'y' section attribute flag to mark the section as NOREAD.
bfd/ChangeLog:
      * elf32-arm.c ((elf32_arm_special_sections): Remove catch of noread
      section using '.text.noread' pattern.

gas/ChangeLog:
      * config/obj-elf.c (obj_elf_change_section) : Allow arm section with
      SHF_ARM_NOREAD section flag.
      * config/tc-arm.h (md_elf_section_letter) : Implement this hook to
      handle letter 'y'.
     (arm_elf_section_letter) : Declare it.
      * config/tc-arm.c (arm_elf_section_letter): Handle letter 'y' to set
      SHF_ARM_NOREAD section flag.
      * doc/c-arm.texi (ARM section attribute 'y'): Document it.

gas/testsuite/ChangeLog:
      * gas/arm/section-execute-only.s: New test case.
      * gas/arm/section-execute-only.d: Expected output.

ld/testsuite/ChangeLog:
      * ld-arm/thumb1-noread-not-present-mixing-two-section.s: Add 'y'
      attribute usage.
      * ld-arm/thumb1-noread-present-one-section.s: Likewise.
      * ld-arm/thumb1-noread-present-two-section.s: Likewise.
      * ld-arm/thumb1-input-section-flag-match.s: Likewise.

binutils/ChangeLog:
      * readelf.c (get_elf_section_flags): Display y letter for section
      with SHF_ARM_NOREAD section flag in readelf section output.
      (process_section_headers): Add y letter in readelf section output
      key mapping for ARM architecture.
2016-01-20 12:53:50 +00:00
Alan Modra 6f2750feaf Copyright update for binutils 2016-01-01 23:00:01 +10:30
H.J. Lu 3aade68889 Remove trailing spaces in binutils 2015-08-12 04:42:37 -07:00
Nick Clifton bdc4de1b24 Stop "objdump -d" from disassembling past a symbolic address.
include	* dis-asm.h (struct disassemble_info): Add stop_vma field.

binuti  * objdump.c (disassemble_bytes): Set the stop_vma field in the
	disassemble_info structure when disassembling code sections with
	-d.
	* doc/binutils.texi (objdump): Document the discrepancy between -d
	and -D.

opcodes	* dis-buf.c (buffer_read_memory): Fail is stop_vma is set and the
	requested region lies beyond it.
	* bfin-dis.c (print_insn_bfin): Ignore sysop instructions when
	looking for 32-bit insns.
	* mcore-dis.c (print_insn_mcore): Disable stop_vma when reading
	data.
	* sh-dis.c (print_insn_sh): Likewise.
	* tic6x-dis.c (print_insn_tic6x): Disable stop_vma when reading
	blocks of instructions.
	* vax-dis.c (print_insn_vax): Check that the requested address
	does not clash with the stop_vma.

tests	* gas/arm/backslash-at.s: Add extra .byte directives so that the
	foo symbol does not appear to point half way through an
	instruction.
	* gas/arm/backslash-at.d: Update expected disassembly.
	* gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise.
	* gas/i386/ilp32/x86-64-opcode-inval.d: Likewise.
	* gas/i386/x86-64-opcode-inval-intel.d: Likewise.
	* gas/i386/x86-64-opcode-inval.d: Likewise.
2015-06-22 16:53:27 +01:00
Nick Clifton d1c4b12b9d Fix PR18374 by making readelf and objdump ignore end-of-list markers in the .debug_loc section if there are relocations against them.
PR binutils/18374
bin	* dwarf.h (struct dwarf_section): Add reloc_info and num_relocs
	fields.
	(struct dwarf_section_display): Change bitfield to boolean.
	(reloc_at): Add prototype.
	* dwarf.c (display_loc_list): Ignore list terminators if there are
	relocs against them.
	(display_debug_loc): Issue a warning if there are relocs against
	the .debug_loc section.
	(display_displays): Initialise reloc_info and num_relocs fields.
	* objdump.c (load_specific_debug_section): Initialise reloc_info
	and num_relocs fields.
	(reloc_at): New function.
	* readelf.c (is_32bit_abs_reloc): Add IA64's R_IA64_DIS32LSB
	reloc.
	(reloc_at): New function.
	(apply_relocations): Add relocs_return and num_relocs_return
	parameters.  Fill them in with the loaded relocs if non-NULL.
	(dump_section_as_bytes): Update call to apply_relocations.
	(load_specific_debug_section): Initialise reloc_info and
	num_relocs fields.

tests	* binutils-all/pr18374.s: New test file.
	* binutils-all/readelf.exp: Assemble and run the new test.
	* binutils-all/readelf.pr18374: Expected output from readelf.
2015-05-15 11:24:33 +01:00
H.J. Lu 3d875af575 Add init_dwarf_regnames_iamcu
* dwarf.c (dwarf_regnames_iamcu): New.
	(init_dwarf_regnames_iamcu): Likewise.
	(init_dwarf_regnames): Call init_dwarf_regnames_iamcu for EM_IAMCU.
	* dwarf.h (init_dwarf_regnames_iamcu): New.
	* objdump.c (dump_dwarf): Call init_dwarf_regnames_iamcu for
	bfd_arch_iamcu.
2015-05-11 10:41:44 -07:00
Nick Clifton 0821d5b14e Improves the warning message produyced by objdump when it cannot load a section.
* objdump.c (dump_section): Extend the warning message displayed
	when a section cannot be loaded.
2015-02-24 11:10:07 +00:00
Nick Clifton 64d2901806 More fixes for illegal memory accesses triggered by running objdump on fuzzed binaries.
PR binutils/17512
	* objdump.c (display_any_bfd): Fail if archives nest too deeply.

	* ecoff.c: Use bfd_alloc2 to allocate space for structure arrays.
	(_bfd_ecoff_slurp_symbol_table): Check for a negative symbol
	index or an out of range fdr index.
	* elf-m10300.c (mn10300_info_to_howto): Fix typo in error message.
	* elf32-arc.c (arc_info_to_howto_rel): Likewise.
	* elf32-avr.c (avr_info_to_howto_rela): Likewise.
	* elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
	* elf32-cr16c.c (elf_cr16c_info_to_howto_rel): Likewise.
	* elf32-cris.c (cris_info_to_howto_rela): Likewise.
	* elf32-crx.c (elf_crx_info_to_howto): Likewise.
	* elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
	* elf32-d30v.c (d30v_info_to_howto_rel): Likewise.
	* elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
	* elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
	* elf32-frv.c (frv_info_to_howto_rela): Likewise.
	* elf32-i370.c (i370_elf_info_to_howto): Likewise.
	* elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
	* elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
	* elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
	* elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
	* elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
	* elf32-m32r.c (m32r_info_to_howto_rel): Likewise.
	* elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
	* elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
	* elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
	* elf32-mep.c (mep_info_to_howto_rela): Likewise.
	* elf32-metag.c (metag_info_to_howto_rela): Likewise.
	* elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
	* elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
	* elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
	* elf32-mt.c (mt_info_to_howto_rela): Likewise.
	* elf32-nds32.c (nds32_info_to_howto_rel): Likewise.
	* elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
	* elf32-pj.c (pj_elf_info_to_howto): Likewise.
	* elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
	* elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
	* elf32-rx.c (rx_info_to_howto_rela): Likewise.
	* elf32-sh.c (sh_elf_info_to_howto): Likewise.
	* elf32-spu.c (spu_elf_info_to_howto): Likewise.
	* elf32-v850.c (v850_elf_perform_relocation): Likewise.
	* elf32-vax.c (rtype_to_howto): Likewise.
	* elf32-visium.c (visium_info_to_howto_rela): Likewise.
	* elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
	* elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
	* elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
	* elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
	* mach-o.c: Use bfd_alloc2 to allocate space for structure arrays.
	(bfd_mach_o_canonicalize_one_reloc): Fix check on out
	of range symbol indicies.
	(bfd_mach_o_canonicalize_relocs): Check for out of range alloc.
	(bfd_mach_o_canonicalize_dynamic_reloc): Likewise.
	(bfd_mach_o_build_dysymtab): Likewise.
	(bfd_mach_o_write_symtab_content): Set the string table size to
	zero upon error.
	(bfd_mach_o_read_symtab_symbols): Reset the nsyms value if the
	read fails.
	* peXXigen.c (pe_print_edata):  Check for numeric overflow in edt
	fields.
	* tekhex.c (first_phase): Check for src pointer reaching end of
	buffer.
2015-02-03 14:34:54 +00:00
Nick Clifton 86eafac0aa Fix memory access violations triggered by running strip on fuzzed binaries.
PR binutils/17512
	* coffcode.h (coff_set_arch_mach_hook): Check return value from
	bfd_malloc.
	(coff_slurp_line_table): Return FALSE if the line number
	information was corrupt.
	(coff_slurp_symbol_table): Return FALSE if the symbol information
	was corrupt.
	* mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always
	initialise the fields of the dyld_info structure.
	(bfd_mach_o_build_exec_seg_command): Replace assertion with an
	error message and a return value.
	(bfd_mach_o_layout_commands): Change the function to boolean.
	Return FALSE if the function fails.
	(bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands
	fails.
	(bfd_mach_o_read_command): Fail if an unrecognised command is
	encountered.
	* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the
	read fails.
	(slurp_symtab): Check the return from bfd_malloc.
	(_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy
	encountered an error.
	(_bfd_XXi_final_link_postscript): Fail if a section could not be
	copied.
	* peicode.h (pe_bfd_object_p): Fail if the header could not be
	swapped in.
	* tekhex.c (first_phase): Fail if the section is too big.
	* versados.c (struct esdid): Add content_size field.
	(process_otr): Use and check the new field.
	(versados_get_section_contents): Check that the section exists and
	that the requested data is available.

	PR binutils/17512
	* addr2line.c (main): Call bfd_set_error_program_name.
	* ar.c (main): Likewise.
	* coffdump.c (main): Likewise.
	* cxxfilt.c (main): Likewise.
	* dlltool.c (main): Likewise.
	* nlmconv.c (main): Likewise.
	* nm.c (main): Likewise.
	* objdump.c (main): Likewise.
	* size.c (main): Likewise.
	* srconv.c (main): Likewise.
	* strings.c (main): Likewise.
	* sysdump.c (main): Likewise.
	* windmc.c (main): Likewise.
	* windres.c (main): Likewise.
	* objcopy.c (main): Likewise.
	(copy_relocations_in_section): Check for relocs without associated
	symbol pointers.
2015-01-21 17:37:23 +00:00
Nick Clifton c88f5b8e49 Fix memory access violations exposed by running the srconv tool on fuzzed binaries.
PR binutils/17512
	* objdump.c (display_any_bfd): Add a depth limit to nested archive
	display in order to avoid infinite loops.
	* srconv.c: Replace calls to abort with calls to fatal with an
	error message.
2015-01-07 16:41:25 +00:00
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Alan Modra f4943d8253 Don't always build coffgen.o
Removes a bunch of unused functions from libbfd when building ELF or
AOUT.  Split off the bits we need externally when not building a COFF
target into coff-bfd.c and coff-bfd.h.

bfd/
	* Makefile.am (BFD32_LIBS, BFD32_LIBS_CFILES): Remove dwarf2
	and coffgen.  Add coff-bfd.  Sort.
	(BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add coffgen and dwarf2.
	* bfd-in.h (bfd_coff_get_syment, bfd_coff_get_auxent): Delete.
	(struct coff_comdat_info, bfd_coff_get_comdat_section): Delete.
	* coffgen.c (coff_symbol_from): Move to coff-bfd.h as macro,
	without unused param.  Update uses.
	(bfd_coff_get_comdat_section): Move to coff-bfd.h as macro.
	(bfd_coff_get_syment, bfd_coff_get_auxent): Move to coff-bfd.c.
	* libcoff-in.h: #include "coff-bfd.h".
	(struct coff_section_tdata, coff_section_data): Move to coff-bfd.h.
	(coff_symbol_from): Delete.
	* coff-bfd.c: New file.
	* coff-bfd.h: New file.
	* coff-i386.c: Update coff_symbol_from occurrences.
	* coff-i960.c: Likewise.
	* coff-m68k.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-x86_64.c: Likewise.
	* coffcode.h: Likewise.
	* pe-mips.c: Likewise.
	* configure.ac (elf): Add dwarf2.lo.
	(coffgen, coff, ecoff, xcoff): Define.  Use when mapping bfd
	target vectors to .o files.  Add dwarf2 for mach-o targets.
	Fix the sh target FIXME.
	* po/SRC-POTFILES.in: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* bfd-in2.h: Regenerate.
	* libcoff.h: Regenerate.
binutils/
	* objdump.c: #include "coff-bfd.h".
ld/
	* ldmisc.c: #include "coff-bfd.h"
2014-12-10 23:13:49 +10:30
Nick Clifton f64e188b58 More fixes for memory access violations triggered by fuzzed binaries.
PR binutils/17512
	* objdump.c (display_any_bfd): Avoid infinite loop closing and
	opening the same archive again and again.

	* archive64.c (bfd_elf64_archive_slurp_armap): Add range checks.
	* libbfd.c (safe_read_leb128): New function.
	* libbfd-in.h (safe_read_leb128): Add prototype.
	* libbfd.h: Regenerate.
	* elf-attrs.c (_bfd_elf_parse_attributes): Use safe_read_leb128.
	Check for an over-long subsection length.
	* elf.c (elf_parse_notes): Check that the namedata is long enough
	for the string comparison that is about to be performed.
	(elf_read_notes): Zero-terminate the note buffer.
2014-12-09 12:42:18 +00:00
Nick Clifton db6b071a97 Fix memory access problems exposed by fuzzed binaries.
PR binutils/17512
	* objdump.c (free_debug_section): Reset the compress_status as
	well.

	* compress.c (bfd_get_full_section_contents): Fail if there are no
	section contents available when the compress_status is
	COMPRESS_SECTION_DONE.
	* libbfd.c (bfd_malloc): Refuse to allocate a negative size.
	(bfd_malloc2): Use bfd_malloc.
	(bfd_realloc): Refuse to reallocate a negative size.
	(bfd_realloc2): Use bfd_realloc.
	(bfd_realloc_or_free): Use bfd_realloc.
	(bfd_zmalloc): Use bfd_malloc.
	(bfd_zmalloc): Use bfd_malloc2.
	* opncls.c (bfd_alloc): Refuse to allocate a negative size.
2014-12-03 19:50:48 +00:00
Nick Clifton 06614111d1 More fixes for memory access violations exposed by fuzzed binaries.
PR binutils/17512
	* dwarf.h (struct dwarf_section): Add user_data field.
	* dwarf.c (frame_need_space): Check for an over large register
	number.
	(display_debug_frames): Check the return value from
	frame_need_space.  Check for a CFA expression that is so long the
	start address wraps around.
	(debug_displays): Initialise the user_data field.
	* objdump.c (load_specific_debug_section): Save the BFD section
	pointer in the user_data field of the dwarf_section structure.
	(free_debug_section): Update BFD section data when freeing section
	contents.
	* readelf.c (load_specific_debug_section): Initialise the
	user_data field.

	* archive.c (do_slurp_coff_armap): Add range checks to prevent
	running off the end of the string table.
	* compress.c (bfd_get_full_section_contents): Return a NULL
	pointer for zero sized sections.  Do not attempt to copy a buffer
	onto itself.
	* elf-attrs.c (_bfd_elf_parse_attributes): Check for an empty
	header.  Add range checks to avoid running off the end of the
	section.
	* elf.c (bfd_elf_get_str_section): Seek before allocating so that
	if the seek fails, no memory is allocated.
	(bfd_elf_string_from_elf_section): Do not allocate a string from a
	non string section.  It only leads to trouble later on.
	(_bfd_elf_print_private_bfd_data): Check for there being too
	little external dynamic data.
	(bfd_section_from_shdr): Replace assertion with a failure mode.
	(bfd_section_from_shdr): When walking a loaded group section use
	the internal structure size, not the external size.  Check for the
	group section being empty.
	* elf32-i386.c (elf_i386_rtype_to_howto): Replace assertion with a
	failure mode.
	* elfcode.h (elf_slurp_reloc_table): Likewise.
	* reloc.c (bfd_perform_relocation): Avoid seg-fault if the howto
	parameter is NULL.
2014-12-01 16:43:46 +00:00
H.J. Lu 60bb06bc89 Use get_symbol_version_string in BFD_JUMP_TABLE_SYMBOLS
This patch adds get_symbol_version_string to BFD_JUMP_TABLE_SYMBOLS so
that we can use bfd_get_symbol_version_string in objdump for non-ELF
targets.

bfd/

	* targets.c (BFD_JUMP_TABLE_SYMBOLS): Use
	NAME##_get_symbol_version_string.
	(bfd_get_symbol_version_string): New.
	* aout-adobe.c (aout_32_get_symbol_version_string): Define using
	_bfd_nosymbols define.
	* aout-target.h (MY_get_symbol_version_string): Likewise.
	* aout-tic30.c (MY_get_symbol_version_string): Likewise.
	* binary.c (binary_get_symbol_version_string): Likewise.
	* bout.c (aout_32_get_symbol_version_string): Likewise.
	* coff-rs6000.c (_bfd_xcoff_get_symbol_version_string): Likewise.
	* i386msdos.c (msdos_get_symbol_version_string): Likewise.
	* i386os9k.c (aout_32_get_symbol_version_string): Likewise.
	* ieee.c (ieee_get_symbol_version_string): Likewise.
	* ihex.c (ihex_get_symbol_version_string): Likewise.
	* libecoff.h (_bfd_ecoff_get_symbol_version_string): Likewise.
	* mach-o-target.c (bfd_mach_o_get_symbol_version_string): Likewise.
	* mmo.c (mmo_get_symbol_version_string): Likewise.
	* nlm-target.h (nlm_get_symbol_version_string): Likewise.
	* oasys.c (oasys_get_symbol_version_string): Likewise.
	* pef.c (bfd_pef_get_symbol_version_string): Likewise.
	* plugin.c (bfd_plugin_get_symbol_version_string): Likewise.
	* ppcboot.c (ppcboot_get_symbol_version_string): Likewise.
	* som.c (som_get_symbol_version_string): Likewise.
	* srec.c (srec_get_symbol_version_string): Likewise.
	* tekhex.c (tekhex_get_symbol_version_string): Likewise.
	* versados.c (versados_get_symbol_version_string): Likewise.
	* vms-alpha.c (alpha_vms_get_symbol_version_string): Likewise.
	* xsym.c (bfd_sym_get_symbol_version_string): Likewise.

	* coff64-rs6000.c (rs6000_xcoff64_vec): Use
	coff_get_symbol_version_string.
	(rs6000_xcoff64_aix_vec): Likewise.

	* elf-bfd.h (bfd_elf_get_symbol_version_string): Renamed to ...
	(_bfd_elf_get_symbol_version_string): This.
	* elf.c: Likewise.
	(bfd_elf_print_symbol): Updated.
	* elfxx-target.h (bfd_elfNN_get_symbol_version_string): Define.

	* libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Define.
	* libcoff-in.h (coff_get_symbol_version_string): Likewise.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.
	* libcoff.h: Likewise.

binutils/

	* objdump.c (objdump_print_symname): Replace
	bfd_elf_get_symbol_version_string with
	bfd_get_symbol_version_string.
2014-11-25 09:28:32 -08:00
H.J. Lu bb4d2ac2cc Display symbol version when dumping dynrelocs
Both readelf/objdump know how to get symbol version string for dynamic
symbols.  This patch extracts this functionality into a separate
function and uses it to add symbol version string to versioned symbol
names when dumping dynamic relocations.

bfd/

	PR binutils/16496
	* elf-bfd.h (bfd_elf_get_symbol_version_string): New.
	* elf.c (bfd_elf_get_symbol_version_string): New.  Extracted
	from bfd_elf_print_symbol.
	(bfd_elf_print_symbol): Use it.

binutils/

	PR binutils/16496
	* objdump.c (objdump_print_symname): Call
	bfd_elf_get_symbol_version_string to get ELF symbol version
	string.  Append version string if needed.

	* readelf.c (versioned_symbol_info): New enum.
	(get_symbol_version_string): New.  Extracted from
	process_symbol_table.
	(dump_relocations): Add a new argument to indicate if dynamic
	symbol table is used.  Use get_symbol_version_string to get
	symbol version string for dynamic symbol.  Append version string
	if needed.
	(process_relocs): Updated dump_relocations call.
	(process_symbol_table): Use get_symbol_version_string.

ld/testsuite/

	PR binutils/16496
	* ld-cris/weakref3.d: Add symbol version string to versioned
	symbol names in dynamic relocation.
	* ld-cris/weakref4.d: Likewise.
	* ld-elfvers/vers24.rd: Likewise.

	* ld-elf/pr16496a.c: New file.
	* ld-elf/pr16496a.map: Likewise.
	* ld-elf/pr16496b.c: Likewise.
	* ld-elf/pr16496b.od: Likewise.

	* ld-elf/shared.exp (build_tests): Add libpr16496a.so and
	libpr16496b.so tests.
2014-11-25 06:47:44 -08:00
Nick Clifton f41e4712a7 Fix more memory faults uncovered by fuzzing various executables.
PR binutils/17512
	* dwarf.c (read_and_display_attr_value): Check that we do not read
	past end.
	(display_debug_pubnames_worker): Add range checks.
	(process_debug_info): Check for invalid pointer sizes.
	(display_loc_list): Likewise.
	(display_loc_list_dwo): Likewise.
	(display_debug_ranges): Likewise.
	(display_debug_aranges): Check for invalid address size.
	(read_cie): Add range checks.  Replace call strchr with while loop.
	* objdump.c (dump_dwarf): Replace abort with a warning message.
	(print_section_stabs): Improve range checks.
	* rdcoff.c (coff_get_slot): Use long for indx parameter type.
	Add check for an excesively large index.
	* rddbg.c (read_section_stabs_debugging_info): Zero terminate the
	string table.  Avoid walking off the end of the stabs data.
	* stabs.c (parse_stab_string): Add check for a NULL name.

	PR binutils/17512
	* coffcode.h (coff_slurp_line_table): Set the line number of
	corrupt entries to -1.
	(coff_slurp_symbol_table): Alway initialise the value of the
	symbol.
	* coffgen.c (coff_print_symbol): Check that the combined pointer
	is valid.
	(coff_print_symbol): Do not print negative line numbers.
	* peXXigen.c (pe_print_idata): Add range checking displaying
	member names.
2014-11-12 22:39:58 +00:00
Nick Clifton 5a3f568b70 More fixes for buffer overruns instigated by corrupt binaries.
PR binutils/17512
	* objdump.c (slurp_symtab): Fail gracefully if the table could not
	be read.
	(dump_relocs_in_section): Likewise.

	* aoutx.h (slurp_symbol_table): Check that computed table size is
	not bigger than the file from which is it being read.
	(slurp_reloc_table): Likewise.
	* coffcode.h (coff_slurp_line_table): Remove unneeded local
	'warned'.  Do not try to print the details of a symbol with an
	invalid index.
	* coffgen.c (make_a_sectiobn_from_file): Check computed string
	index against length of string table.
	(bfd_coff_internal_syment_name): Check read in string offset
	against length of string table.
	(build_debug_section): Return a pointer to the section used.
	(_bfd_coff_read_string_table): Store the length of the string
	table in the coff_tdata structure.
	(bfd_coff_free_symbols): Set the length of the string table to
	zero when it is freed.
	(coff_get_normalized_symtab): Check offsets against string table
	or data table lengths as appropriate.
	* cofflink.c (_bfd_coff_link_input_bfd): Check offset against
	length of string table.
	* compress.c (bfd_get_full_section_contents): Check computed size
	against the size of the file.
	* libcoff-in.h (obj_coff_strings_len): Define.
	(struct coff_tdata): Add strings_len field.
	* libcoff.h: Regenerate.
	* peXXigen.c (pe_print_debugdata): Do not attempt to print the
	data if the debug section is too small.
	* xcofflink.c (xcoff_link_input_bfd):  Check offset against
	length of string table.
2014-11-03 17:44:00 +00:00
Richard Henderson 4ee220358d aarch64: Decode dwarf2 register numbers
* dwarf.h (init_dwarf_regnames_aarch64): Declare.
	* dwarf.c (dwarf_regnames_aarch64): New.
	(init_dwarf_regnames_aarch64): New.
	(init_dwarf_regnames): Call it.
	* objdump.c (dump_dwarf): Likewise.
2014-08-22 14:40:10 -07:00
Alan Modra b6a1c03a95 Reorganise struct bfd
for better packing.  Removes a field and a flag that are never set.

bfd/
	* bfd.c (struct bfd): Reorganise for better packing.  Delete
	"ifd" field.  Make "format", "direction" and "flags" bitfields.
	(HAS_LOAD_PAGE): Delete, renumber following flags.
	* bfd-in2.h: Regenerate.
	* coff-tic4x.c: Remove HAS_LOAD_PAGE from extra flags in target vecs.
binutils/
	* objdump.c (dump_bfd_header): Don't print HAS_LOAD_PAGE.
2014-07-01 20:43:14 +09:30
Tristan Gingold 595330b7ce objdump: set address of debug sections.
This patche fixes the values of FDE pc in output of objdump -Wf. They now
match readelf ones.

binutils/
	* objdump.c (load_specific_debug_section): Set address of section.
2014-03-27 09:35:10 +01:00
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Roland McGrath 64b384e1e8 Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets
bfd/
	* archures.c (bfd_mach_i386_nacl): Fix definition so it doesn't
	collide with bfd_mach_l1om.
	* bfd-in2.h: Regenerate.

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

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

ld/testsuite/
	* ld-x86-64/x86-64.exp (mixed1, mixed2): Loosen error string match
	so it accepts "i386:nacl" in place of "i386".
	* ld-x86-64/ilp32-2.d: Likewise.
	* ld-x86-64/ilp32-3.d: Likewise.
	* ld-x86-64/lp64-2.d: Likewise.
	* ld-x86-64/lp64-3.d: Likewise.
2013-11-07 10:00:32 -08:00
Nick Clifton aebcf7b7ec PR binutils/16024
* objdump.c (usage): Mark as a no-return function.
	(main): Add comment explaining why a break statement is not
	needed.
2013-10-09 16:17:23 +00:00
Andreas Schwab 643902a49a PR binutils/15818
* objdump.c (disassemble_section): Return early if nothing from
this section needs to be disassembled.
2013-08-12 07:55:55 +00:00
Alan Modra c32d6f7bd4 * objdump.c (dump_target_specific): Fix NULL pointer test. 2013-01-17 02:24:47 +00:00
Cary Coutant 657d0d47ba binutils/
* dwarf.c (do_debug_addr, do_debug_cu_index): New global flags.
	(load_debug_info): Fix typo.
	(cu_tu_indexes_read, shndx_pool, shndx_pool_size, shndx_pool_used):
	New global variables.
	(prealloc_cu_tu_list, add_shndx_to_cu_tu_entry, end_cu_tu_entry)
	(process_cu_tu_index, load_cu_tu_indexes, find_cu_tu_set)
	(display_cu_index): New functions.
	(dwarf_select_sections_by_names): Add "debug_addr", "cu_index".
	Sort entries alphabetically.
	(dwarf_select_sections_all): Set do_debug_addr, do_debug_cu_index.
	(debug_displays): Add .debug_cu_index, .debug_tu_index.
	Clean up formatting.
	* dwarf.h (dwarf_section_display_enum): Add dwp_cu_index,
	dwp_tu_index.
	(do_debug_addr, do_debug_cu_index): New global flags.
	(find_cu_tu_set): New function declaration.
	* objdump.c (usage): Add --dwarf=addr, --dwarf=cu_index.
	* readelf.c (find_section_in_set): New function.
	(usage): Add --debug-dump=addr, --debug_dump=cu_index.
	(process_section_headers): Check do_debug_addr and do_debug_cu_index.
	(section_subset): New global variable.
	(load_debug_section): Restrict search to section subset.
	(display_debug_section): Add section index as paramter.  Select subset
	of sections when dumping a .dwp file.  Update caller.
2012-10-24 01:59:39 +00:00
H.J. Lu f24e5a8a46 Handle x32 in dump_dwarf
* objdump.c (dump_dwarf): Handle bfd_mach_x64_32 and
	bfd_mach_x64_32_intel_syntax.
2012-10-21 10:56:00 +00:00
Alan Modra 8a72cc6e7e bfd/
* compress.c (bfd_cache_section_contents): New function.
	* bfd-in2.h: Regenerate.
binutils/
	* objdump.c (load_specific_debug_section): Use
	bfd_cache_section_contents.
2012-10-21 09:06:07 +00:00
Kai Tietz a29a8af823 ChangeLog bfd
2012-10-18  Kai Tietz  <ktietz@redhat.com>

	PR binutils/14067
	* coff-i386.c (bfd_target): Add section flag SEC_EXCLUDE.
	Allow BFD_COMPRESS and BFD_DECOMPRESS flags.
	* coff-x86_64.c: Likewise.
	* coffcode.h (DOT_ZDEBUG): New define.
	(sec_to_styp_flags): Check for .zdebug.
	(styp_to_sec_flags): Likewise.
	* coffgen.c (make_a_section): Handle .debug_* section
	compression/decompression flags.
	* cofflink.c (mark_relocs): Ignore relocations
	for a section, which isn't marked as used.
	(_bfd_coff_link_input_bfd): Add support of compressed
	debug sections.
	* compress.c (decompress_contents): Loop as long
	as there is input available and there is room for
	output.
	* bfd/pe-arm.c: Add .zdebug_ partial match entry.
	* pe-i386.c: Likewise.
	* pe-x86_64.c: Likewise.
	* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't clear all
	data-directories as this might destroy content.

        * coff-i386.c (_bfd_generic_find_nearest_line_discriminator):
        define as coff_find_nearest_line_discriminator.
        * libcoff-in.h (coff_find_nearest_line_discriminator): New
        * libcoff.h: Regenerated.
        * coff-x86_64.c: Likewise.
        * coffgen.c (coff_find_nearest_line_discriminator): New function.
        prototype.

ChangeLog binutils

2012-10-18  Kai Tietz  <ktietz@redhat.com>

	* objdump.c (dump_bfd): Call dump headers after
	call of slurp_symtab.

ChangeLog ld

2012-10-18  Kai Tietz  <ktietz@redhat.com>

	PR binutils/14067
	* NEWS: Menition new feature.
	* scripttempl/pep.sc: Add zdebug sections.
	* scripttempl/pe.sc: L
2012-10-18 17:42:29 +00:00
Alan Modra a86852103b typo fixes 2012-08-17 02:43:21 +00:00
Cary Coutant 9b8d1a3603 2012-07-24 Teresa Johnson <tejohnson@google.com>
bfd/
	* bfd.c (bfd_find_nearest_line_discriminator): New macro.
	* coff-rs6000.c: Init _bfd_find_nearest_line_discriminator.
	* coff64-rs6000.c: Likewise.
	* dwarf2.c (struct line_info): Add discriminator field.
	(add_line_info): Fill in new discriminator field.
	(decode_line_info): Record discriminator information instead
        of ignoring it.
	(lookup_address_in_line_info_table): Return discriminator field if
        requested.
	(comp_unit_find_nearest_line): Add discriminator argument.
	(find_line): Likewise.
	(_bfd_dwarf2_find_nearest_line): Likewise.
	(_bfd_dwarf2_find_line): Likewise.
	* elf-bfd.h (_bfd_elf_find_nearest_line_discriminator): New.
        (_bfd_elf_find_line_discriminator): Likewise.
        (_bfd_generic_find_nearest_line_discriminator): Likewise. Defined.
	* elf.c (_bfd_elf_find_nearest_line): Change to a wrapper
        that invokes _bfd_elf_find_nearest_line_discriminator with correct
        arguments.
	(_bfd_elf_find_nearest_line_discriminator): New.
	(_bfd_elf_find_line): Change to a wrapper
        that invokes _bfd_elf_find_line_discriminator with correct
        arguments.
	(_bfd_elf_find_line_discriminator): New.
	* coffgen.c (coff_find_nearest_line_with_names): Handle
        new discriminator argument.
	* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
	* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
	* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
	* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Add discriminator
        argument.
        (_bfd_dwarf2_find_line): Likewise.
        (_bfd_generic_find_nearest_line_discriminator): New.
	* libbfd.c (_bfd_generic_find_nearest_line_discriminator): New.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.
	* targets.c (BFD_JUMP_TABLE_SYMBOLS): Initialize
        _bfd_find_nearest_line_discriminator with
        _bfd_generic_find_nearest_line_discriminator.
        (bfd_target): Add _bfd_find_nearest_line_discriminator.

binutils/
	* addr2line.c (find_address_in_section): Invoke
        bfd_find_nearest_line_discriminator to get the discriminator.
	(find_offset_in_section): Likewise.
	(translate_addresses): Print discriminator if it is non-zero.
	* objdump.c (show_line): Invoke
        bfd_find_nearest_line_discriminator to get the discriminator,
        and keep track of prev_discriminator. Print discriminator
        if it is non-zero.
	(disassemble_data): Initialize prev_discriminator.
	(dump_reloc_set): Invoke bfd_find_nearest_line_discriminator
        to get the discriminator, and keep track of last_discriminator.
        Print discriminator if it is non-zero.
2012-07-24 21:06:58 +00:00
H.J. Lu 343dbc36ff Print addend as signed in objdump
binutils/

	* objdump.c (disassemble_bytes): Print addend as signed.
	(dump_reloc_set): Likewise.

gas/testsuite/

	* gas/all/fwdexp.d: Expect addend as signed.
	* gas/alpha/elf-reloc-1.d: Likewise.
	* gas/i386/mixed-mode-reloc64.d: Likewise.
	* gas/i386/reloc64.d: Likewise.
	* gas/i386/ilp32/mixed-mode-reloc64.d: Expect addend as signed.
	* gas/i386/ilp32/reloc64.d: Likewise.
	* gas/ia64/pcrel.d: Likewise.
	* gas/mips/branch-misc-2-64.d: Likewise.
	* gas/mips/branch-misc-2pic-64.d: Likewise.
	* gas/mips/branch-misc-4-64.d: Likewise.
	* gas/mips/ldstla-n64-sym32.d: Likewise.
	* gas/mips/micromips@branch-misc-2-64.d: Likewise.
	* gas/mips/micromips@branch-misc-2pic-64.d: Likewise.
	* gas/mips/micromips@branch-misc-4-64.d: Likewise.
	* gas/mips/mips16-hilo-n32.d: Likewise.
	* gas/ppc/astest.d: Likewise.
	* gas/ppc/astest2.d: Likewise.
	* gas/ppc/astest2_64.d: Likewise.
	* gas/ppc/astest64.d: Likewise.
	* gas/ppc/test1elf32.d: Likewise.
	* gas/ppc/test1elf64.d: Likewise.
	* gas/sparc/reloc64.d: Likewise.
2012-05-14 02:40:00 +00:00
Cary Coutant 4723351a02 * doc/binutils.texi: Add --dwarf-check option.
* dwarf.c (dwarf_check): New global flag.
	(fetch_indexed_string): New function.
	(fetch_indexed_value): New function.
	(get_FORM_name): Add DW_FORM_GNU_str_index and DW_FORM_GNU_addr_index.
	(decode_location_expression): Add DW_OP_GNU_addr_index.
	(read_and_display_attr_value): Add DW_FORM_GNU_str_index,
	DW_FORM_GNU_addr_index, DW_AT_GNU_addr_base, and DW_AT_GNU_ranges_base.
	(get_AT_name): Add new attributes for Fission.
	(process_debug_info): Load new debug sections for Fission.
	(load_debug_info): Check for .debug_info.dwo section.
	(display_loc_list, display_loc_list_dwo): New functions.
	(display_debug_loc): Move logic to above two functions.
	(display_debug_info): Choose abbrev section based on info section.
	(display_debug_types): Likewise.
	(display_trace_info): Likewise.
	(comp_addr_base): New function.
	(display_debug_addr): New function.
	(display_debug_str_offsets): New function.
	(display_debug_ranges): Allow missing range lists.  Suppress
	diagnostics if dwarf_check not set.
	(debug_displays): Add column to select abbrev section.
	* dwarf.h (enum dwarf_section_display_enum): Add new debug sections
	for Fission.
	(struct dwarf_section): Add abbrev_sec field.
	(struct dwarf_section_display): New type.
	(debug_info): Add addr_base, ranges_base fields.
	(dwarf_check): New global variable.
	* objdump.c (usage): Add --dwarf-check option.
	(enum option_values): Add OPTION_DWARF_CHECK.
	(long_options): Add --dwarf-check.
	(main): Likewise.
	* readelf.c (OPTION_DWARF_CHECK): New macro.
	(options): Add --dwarf-check.
	(parse_args): Likewise.
	(process_section_headers): Use const_strneq instead of
	streq.
2012-05-11 18:18:34 +00:00
Nick Clifton 1233b4a775 * objdump.c (dump_bfd): If defaulting to dwarf call
dwarf_select_sections_all to enable displays.
2012-04-11 14:05:30 +00:00
Alan Modra 6c7130122d * objdump.c (slurp_file): Close file if fstat fails. 2012-02-20 03:25:21 +00:00
Alan Modra dbb7c4414b * sysdep.h: Include sys/stat.h here.
* ar.c: Don't include headers already included by sysdep.h.
	* bucomm.c: Likewise.
	* budbg.h: Likewise.
	* dlltool.h: Likewise.
	* elfedit.c: Likewise.
	* nlmconv.c: Likewise.
	* objcopy.c: Likewise.
	* objdump.c: Likewise.
	* objdump.h: Likewise.
	* readelf.c: Likewise.
	* rename.c: Likewise.
	* resrc.c: Likewise.
	* strings.c: Likewise.
	* windres.c: Likewise.
	* od-macho.c: Ensure #include sysdep.h is first.
	* od-xcoff.c: Likewise.
	* dllwrap.c: Remove alloca pragma handled by sysdep.h, and
	remove duplicate headers.
	* dlltool.c: Likewise and ensure #include sysdep.h is first.
2012-02-09 04:51:44 +00:00
Tristan Gingold 1598539f98 2012-01-10 Tristan Gingold <gingold@adacore.com>
* objdump.c (display_object_bfd): Renamed from ...
	(display_bfd): ... this.
	(display_any_bfd): New function.
	(display_file): Split.  Handle nested archives.
2012-01-10 11:52:27 +00:00