aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2016-07-20Update documentation to reflect that the symbol localization options of ↵Nick Clifton2-2/+8
objcopy do not affect unique symbols. * doc/binutils.texi (objcopy): Note that the localize symbol options do not affect unique symbols.
2016-07-16Don't include libbfd.h outside of bfd, part 6Alan Modra3-0/+7
Some messing with plugin code in order to not need arelt_size in ld code. File descriptor handling in ld/plugin.c is tidied too, simply duping the open fd rather than opening the file again. bfd/ * elflink.c: Include plugin-api.h. * plugin.c (bfd_plugin_open_input): New function, extracted from.. (try_claim): ..here. * plugin.h: Don't include bfd.h. (bfd_plugin_open_input): Declare. binutils/ * ar.c: Include plugin-api.h. * nm.c: Likewise. ld/ * plugin.c: Don't include libbfd.h. Include plugin-api.h before bfd/plugin.h. (plugin_object_p): Use bfd_plugin_open_input.
2016-07-16Don't include libbfd.h outside of bfd, part 5Alan Modra2-150/+174
A rewrite of the code in bucomm.c supporting objdump -i, to use bfd_iterate_over_targets rather than accessing bfd_target_vector directly. Calculates widest arch string rather than using an out of date constant. Stashes info from the first display of valid target/arch combinations for use in second tabular display. binutils/ * bucomm.c: Don't include libbfd.h. (endian_string, display_target_list): Delete forward declaration. (display_info_table, display_target_tables): Likewise. (LONGEST_ARCH): Delete. (struct display_target): New. (do_display_target): New function. (display_target_list, display_info): Rewrite functions. (display_info_table): Delete. (do_info_size, do_info_header, do_info_row): New functions.
2016-07-16Don't include libbfd.h outside of bfd, part 3Alan Modra4-47/+60
Fix od-macho.c to use a leb128 function from binutils/dwarf.c rather than one from bfd/libbfd.c. binutils/ * elfcomm.h (HOST_WIDEST_INT): Move to.. * sysdep.h: ..here. * od-macho.c: Don't include libbfd.h. Do include dwarf.h (dump_dyld_info_rebase): Use read_leb128 rather than read_unsigned_leb128. (dump_dyld_info_bind, dump_dyld_info_export_1): Likewise. (dump_segment_split_info): Likewise. (dump_dyld_info): Rename vars to avoid shadowing dwarf.h enums. (dump_load_command): Likewise.
2016-07-16Don't include libbfd.h outside of bfd, part 1Alan Modra4-10/+8
Make BFD_ALIGN available to objcopy. Fix assertions. Don't use bfd_log2 in ppc32elf.em or bfd_malloc in xtensaelf.em and bucomm.c. bfd/ * libbfd-in.h (BFD_ALIGN): Move to.. * bfd-in.h: ..here. * elf32-ppc.h (struct ppc_elf_params): Add pagesize. * elf32-ppc.c (default_params): Adjust init. (ppc_elf_link_params): Set pagesize_p2. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. binutils/ * ar.c: Don't include libbfd.h. * objcopy.c: Likewise. * bucomm.c (bfd_get_archive_filename): Use xmalloc rather than bfd_malloc. gas/ * config/bfin-parse.y: Don't include libbfd.h. * config/tc-bfin.c: Likewise. * config/tc-rl78.c: Likewise. * config/tc-rx.c: Likewise. * config/tc-metag.c: Likewise. (create_dspreg_htabs, create_scond_htab): Use gas_assert not BFD_ASSERT. * Makefile.am: Update dependencies. * Makefile.in: Regenerate. ld/ * ldlang.c: Don't include libbfd.h. * emultempl/nds32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/ppc32elf.em: Likewise. (pagesize): Delete. (params): Update init. (ppc_after_open_output): Use params.pagesize. Don't call bfd_log2. (PARSE_AND_LIST_ARGS_CASES): Use params.pagesize. * emultempl/sh64elf.em: Don't include libbfd.h. (after_allocation): Use ASSERT, not BFD_ASSERT. * emultempl/xtensaelf.em: Don't include libbfd.h. (replace_insn_sec_with_prop_sec): Use xmalloc, not bfd_malloc. * Makefile.am: Update dependencies. * Makefile.in: Regenerate.
2016-07-15Use address sized relocs in remove-relocs-01.sAlan Modra2-12/+16
Fixes failures on alpha, ia64, mcore, metag, moxie, and pj due to lack of 16-bit relocs. * testsuite/binutils-all/remove-relocs-01.s: Use .dc.a, not .word.
2016-07-14objcopy/strip: Add option --remove-relocations=SECTIONPATTERNAndrew Burgess12-5/+242
The objcopy and strip tools make use of the bfd library to manipulate the state of the input file (to produce an output file). Within the input file (for ELF at least), relocations are held within a section, and so, if the user wanted to remove the relocations, but keep the section to which the relocations would have been applied, it is tempting to think that specifying the name of a relocation section to objcopy's --remove-section option might do what you want, for example: objcopy --remove-section=.rela.text input.elf output.elf However, this does not work. The reason is that when the input file is loaded, relocations are not managed as sections, but are, instead, loaded as data associated with the section to which the relocations would be applied. In our example above the relocations in '.rela.text' are held as data on the section '.text' once 'input.elf' is loaded. One task that objcopy and strip do is copy the relocations from the input file to the output file if the section is also being copied from the input file to the output file. This commit adds a new command line option for objcopy and strip, --remove-relocations, which can be used to remove the relocations, while keeping the section that the relocations would have been applied to, for example: objcopy --remove-relocations=.text input.elf output.elf in this case the section '.text' will appear in both 'input.elf' and 'output.elf', but any relocations in 'input.elf' that apply to '.text' will not be present in 'output.elf'. I have also added a special case to the handling of --remove-section that spots if a user tries to remove a relocation section (currently this is done by spotting the '.rela.' or '.rel.' prefix) and forwards the request to --remove-relocations. As with --remove-section and --only-section the --remove-relocations option supports the '!' prefix on the section-patterns it takes to allow for sections to be specifically not matched. There are tests for all the new functionality. binutils/ChangeLog: * doc/binutils.texi (objcopy): Document 'remove-relocations'. (strip): Likewise. * objcopy.c (SECTION_CONTEXT_REMOVE_RELOCS): Define. (enum command_line_switch): Add 'OPTION_REMOVE_RELOCS'. (struct option strip_options): Add 'remove-relocations'. (struct option copy_options): Likewise. (copy_usage): Likewise. (strip_usage): Likewise. (handle_remove_relocations_option): New function. (discard_relocations): New function. (handle_remove_section_option): New function. (copy_relocations_in_section): Use discard_relocations. (strip_main): Use handle_remove_section_option for 'remove-section', and handle 'remove-relocations' option. (copy_main): Likewise. * testsuite/binutils-all/objcopy.exp: Run new tests. * testsuite/binutils-all/remove-relocs-01.d: New file. * testsuite/binutils-all/remove-relocs-01.s: New file. * testsuite/binutils-all/remove-relocs-02.d: New file. * testsuite/binutils-all/remove-relocs-03.d: New file. * testsuite/binutils-all/remove-relocs-04.d: New file. * testsuite/binutils-all/remove-relocs-05.d: New file. * testsuite/binutils-all/remove-relocs-06.d: New file.
2016-07-14objcopy/strip: Allow section patterns starting with '!'.Andrew Burgess8-11/+124
For symbol matching, prefixing a pattern with '!' will indicate a non-matching pattern, however, this is not the case for section patterns. As a result it is not possible to say "apply this action to all sections except ...". With this commit the objcopy and strip tools now support '!' prefix for section patterns, so we can say: objcopy --remove-section="*" --remove-section="!.text*" Which will remove all sections, except those matching the pattern '.text*'. binutils/ChangeLog: * objcopy.c (find_section_list): Handle section patterns starting with '!' being a non-matching pattern. * doc/binutils.texi (objcopy): Give example of using '!' with --remove-section and --only-section. (strip): Give example of using '!' with --remove-section. * testsuite/binutils-all/data-sections.s: New file. * testsuite/binutils-all/only-section-01.d: New file. * testsuite/binutils-all/remove-section-01.d: New file. * testsuite/binutils-all/objcopy.exp: Run new tests. * NEWS: Mention new feature.
2016-07-09PR20337, Objdump makes poor choice of symbolsAlan Modra2-0/+21
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-05[ARM] Change noread to purecode.Andre Vieria3-10/+16
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-01Fix potential buffer overflows with sprintf and very large integer values.Nick Clifton2-18/+40
binutuils* prdbg.c (pr_enum_type): Use a buffer big enough to hold an extremely large decimal value. (pr_range_type): Likewise. (pr_array_type): Likewise. (pr_struct_field): Likewise. (pr_class_baseclass): Likewise. (pr_class_method_variant): Likewise. (pr_tag_type): Likewise. (pr_int_constant): Likewise. (pr_typed_constant): Likewise. (pr_variable): Likewise. (pr_function_parameter): Likewise. (pr_start_block): Likewise. (pr_lineno): Likewise. (pr_end_block): Likewise. (tg_enum_type): Likewise. (tg_int_constant): Likewise. (tg_typed_constant): Likewise. (tg_start_block): Likewise. gas * macro.c (macro_expand_body): Use a buffer big enough to hold an extremely large integer.
2016-07-01Expect the objcopy without global symbols test to fail for ARM and AArch64 ↵Nick Clifton2-0/+11
targets. * testsuite/binutils-all/objcopy.exp (objcopy_test_without_global_symbol): Expect this test to fail on the AArch64 and ARM targets, since they preserve their mapping symbols.
2016-07-01Add marker for 2.27 branch.Tristan Gingold3-3/+9
binutils/ 2016-07-01 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.27. gas/ 2016-07-01 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.27. ld/ 2016-07-01 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.27.
2016-07-01Fix mis-placement in binutils.texiTristan Gingold2-2/+6
binutils/ * doc/binutils.texi (objdump): Fix mis-placement.
2016-06-28Relax previous restriction on running binutils ar tests for Alpha targets, ↵Nick Clifton2-2/+7
allowing the tests to be run for ELF variants. * testsuite/binutils-all/ar.exp: Relax previous restriction on Alpha targets. Allow ELF based Alpha targets.
2016-06-28Use `supports_gnu_unique' with the `unique_symbol' and `type' testsMaciej W. Rozycki2-3/+6
Complement commit a43942db49b0 ("LD/ELF: Unify STB_GNU_UNIQUE handling") and use `supports_gnu_unique' with the `unique_symbol' and `type' tests, fixing failures like: .../binutils/testsuite/binutils-all/unique.s: Assembler messages: .../binutils/testsuite/binutils-all/unique.s:2: Error: symbol type "gnu_unique_object" is supported only by GNU targets ERROR: .../binutils/testsuite/binutils-all/unique.s: assembly failed UNRESOLVED: ar unique symbol in archive .../binutils/ar -s -r -c tmpdir/artest.a tmpdir/unique.o Executing on host: .../binutils/ar -s -r -c tmpdir/artest.a tmpdir/unique.o (timeout = 300) .../binutils/ar: tmpdir/unique.o: No such file or directory FAIL: ar unique symbol in archive and: .../gas/testsuite/gas/elf/type.s: Assembler messages: .../gas/testsuite/gas/elf/type.s:30: Error: symbol type "gnu_unique_object" is supported only by GNU targets ../as-new: BFD (GNU Binutils) 2.26.51.20160628 internal error, aborting at .../gas/write.c:608 in size_seg ../as-new: Please report this bug. .../gas/testsuite/../../binutils/readelf -s dump.o | grep "1 *\[FIONTCU\]" > dump.out Executing on host: sh -c {.../gas/testsuite/../../binutils/readelf -s dump.o >readelf.out 2>gas.stderr} /dev/null (timeout = 300) readelf: Error: dump.o: Failed to read file's magic number FAIL: elf type list on MIPS/FreeBSD targets: mips-freebsd -FAIL: ar unique symbol in archive mips-freebsd -FAIL: elf type list mips64-freebsd -FAIL: ar unique symbol in archive mips64-freebsd -FAIL: elf type list mips64el-freebsd -FAIL: ar unique symbol in archive mips64el-freebsd -FAIL: elf type list mipsel-freebsd -FAIL: ar unique symbol in archive mipsel-freebsd -FAIL: elf type list binutils/ * testsuite/binutils-all/ar.exp: Use `supports_gnu_unique' with the `unique_symbol' test. gas/ * testsuite/gas/elf/elf.exp: Use `supports_gnu_unique' with the `type' test.
2016-06-28Invalid read in _bfd_elf_get_symbol_version_stringAlan Modra2-1/+8
PR 20304 * objdump.c (objdump_print_symname): Don't attempt to retrieve version info from synthetic symbols.
2016-06-24MIPS objcopy --rename-section fixAlan Modra6-38/+74
Some MIPS targets use a named section symbol rather than a symbol with no name as is used with most ELF targets. When renaming sections, the named section symbol needs to be renamed too. Rather than fix this bug, I'd originally intended to just correct the xfail added recently for update-1.o vs update4.o in update-section.exp, using the same set of targets for the localize-hidden-1 mips xfail. I'd extracted that target test into a new function, is_bad_symtab. It turns out to be useful in readelf.exp too. bfd/ * config.bfd: Delete mips vxworks patterns matched earlier. Combine mips*-*-none with mips*-*-elf*. binutils/ * objcopy.c (find_section_rename): Forward declare. Remove ibfd and sec_ptr param. Add old_name param. Allow for NULL returned_flags. Move read of section name and flags to.. (setup_section): ..here. Update find_section_rename call. (filter_symbols): Rename section symbols for renamed sections. (copy_object): Call filter_symbols when renamed sections. * testsuite/lib/binutils-common.exp (is_bad_symtab): New. * testsuite/binutils-all/update-section.exp: Revert 96037eb0 mips xfail. * testsuite/binutils-all/objcopy.exp (copy_executable): Use is_bad_symtab. (localize-hidden-1): xfail if is_bad_symtab. * testsuite/binutils-all/readelf.exp: Use is_bad_symtab to select between mips/tmips.
2016-06-24Limit objdump -S context linesAlan Modra2-2/+17
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-22Fix various binutils testsuite failures.Nick Clifton15-82/+179
* testsuite/binutils-all/ar.exp: Skip tests for Alpha target. Skip bfdtest1 tests for tic30 target. * testsuite/binutils-all/arm/objdump.exp: Skip for aout arm target. * testsuite/binutils-all/compress.exp: Expect some tests to fail on the nds32. * testsuite/binutils-all/copy-3.d: Skip for go32 targets. * testsuite/binutils-all/copy-4.d: Skip for AIX and linuxecoff targets. * testsuite/binutils-all/nm.exp: Treat beos based targets as ELF targets. * testsuite/binutils-all/objcopy.exp: Only run reverse bytes tests if the bintest.o file was created. Use the get_standard_section_names proc to get the name of the data section. * testsuite/binutils-all/objdump.exp: Update regexps to allow for RX section names. * testsuite/binutils-all/readelf.exp: Use get_standard_section_names proc to get the name of the data section. * testsuite/binutils-all/readelf.r: Allow for non standard text section names. * testsuite/binutils-all/readelf.s: Update regexps for tilepro. * testsuite/binutils-all/size.exp: Allow for non standard section names. * testsuite/binutils-all/update-section.exp: Expect comapre 1vs4 to fail on mips targets. * testsuite/lib/utils-lib.exp (default_binutils_run): Use get_standard_section_names proc. (run_dump_test): Likewise. (proc get_standard_section_names): New proc.
2016-06-22Increase size of string buffer used to hold printed versions of timestamps.Nick Clifton2-3/+9
binutils* readelf.c (dynamic_section_mips_val): Increase size of timebuf. (process_mips_specific): Likewise. (process_gnu_liblist): Likewise.
2016-06-21Arc assembler: Convert nps400 from a machine type to an extension.Graham Markall2-3/+5
gas * config/tc-arc.c (check_cpu_feature, md_parse_option): Add nps400 option and feature. Add check for nps400 feature. Refactor existing checks to check subclass before feature enablement. (md_show_usage): Document flags for NPS-400 and add some other undocumented flags. (cpu_type): Remove nps400 CPU type entry (check_zol): Remove bfd_mach_arc_nps400 case. (md_show_usage): Add help on -mcpu=nps400. (cpu_types): Add entry for nps400 as arc700 plus nps400 extension set. * doc/c-arc.texi: Document the -mnps400, -mspfp, -mdpfp, and -fpuda flags. Document -mcpu=nps400. * testsuite/gas/arc/nps-400-0.d: Use -mcpu=arc700 -mnps400. Change expected flags to match ARC700 instead of NPS400. * testsuite/gas/arc/nps-400-1.d: Use -mcpu=arc700 -mnps400. * testsuite/gas/arc/nps-400-2.d: Likewise. * testsuite/gas/arc/nps-400-3.d: Likewise. * testsuite/gas/arc/nps-400-4.d: Likewise. * testsuite/gas/arc/nps-400-5.d: Likewise. * testsuite/gas/arc/nps-400-6.d: Likewise. * testsuite/gas/arc/nps-400-7.d: Likewise. * testsuite/gas/arc/textinsn2op01.s: Change opcode of myinsn to avoid clash with cbba instruction. * testsuite/gas/arc/textinsn2op01.d: Likewise. * testsuite/gas/arc/textinsn3op.d: Likewise. * testsuite/gas/arc/textinsn3op.s: Likewise. * testsuite/gas/arc/nps-400-0.d: Test using NPS-400 using -mcpu=nps400 as an alternative to -mcpu=arc700 -mnps400 flags. binutils* readelf.c (decode_ARC_machine_flags): Remove E_ARC_MACH_NPS400 case. ld * testsuite/ld-arc/nps-1a.d: Use -mcpu=arc700 -mnps400. * testsuite/ld-arc/nps-1b.d: Likewise. include * opcode/arc.h: Add nps400 extension and instruction subclass. Remove ARC_OPCODE_NPS400 * elf/arc.h: Remove E_ARC_MACH_NPS400 opcodes * arc-dis.c (arc_insn_length): Add comment on instruction length. Use same method for determining instruction length on ARC700 and NPS-400. (arc_insn_length, print_insn_arc): Remove bfd_mach_arc_nps400. * arc-nps400-tbl.h: Make all nps400 instructions ARC700 instructions with the NPS400 subclass. * arc-opc.c: Likewise. bfd * archures.c: Remove bfd_mach_arc_nps400. * bfd-in2.h: Likewise. * cpu-arc.c (arch_info_struct): Likewise. * elf32-arc.c (arc_elf_object_p, arc_elf_final_write_processing): Likewise.
2016-06-15Fix simple gas testsuite failures.Nick Clifton2-0/+7
binutils* readelf.c (is_24bit_abs_reloc): Add support for R_FT32_20 reloc. gas * config/tc-ft32.c (md_assemble): Call dwarf2_emit_insn with the instruction size. * config/tc-mcore.c (md_assemble): Likewise. * config/tc-mn10200.c (md_assemble): Likewise. * config/tc-moxie.c (md_assemble): Likewise. * config/tc-pj.c (md_apply_fix): Handle BFD_RELOC_PJ_CODE_REL32. * testsuite/gas/all/gas.exp (diff1 test): Alpha sort list of exception targets. Add alpha, hppa, microblaze and rl78 to list of exceptions. (forward): Add microblaze to list of exceptions. (fwdexp): Add alpha to list of exceptions. (redef2): Add arm-epoc-pe and rl78 to list of exceptions. (redef3): Add rl78 and x86_64 cygwin to list of exceptions. (do_930509a): Alpha sort list of exception targets. Add h8300 and mn10200 to list of exceptions. (align2): Expect to fail for nds32. (cond): Add alpha and rl78 to list of exceptions. * testsuite/gas/all/none.d: Skip for ft32 and hppa. * testsuite/gas/all/string.d: Skip for tic4x. * testsuite/gas/alpha/alpha.exp: Note that the alpha-linuxecoff target does not support ELF. * testsuite/gas/arm/blx-bl-convert.dL Skip for the nto target. * testsuite/gas/cfi/cfi-alpha-2.d: All extended format names. * testsuite/gas/cfi/cfi.exp: Alpha sort list of targets. Skip SH tests for sh-pe and sh-rtemscoff targets. * testsuite/gas/elf/elf.exp (redef): Add rl78, xgate and vax to list of exceptions. (type): Run the noifunc version for alpha-freebsd and visium. * testsuite/gas/elf/warn-2.s: Do not expect to fail on the mcore, mn10200 or moxie targets. * testsuite/gas/ft32/insn.d: Update expected disassembly. * testsuite/gas/i386/i386.exp (x86-64-pcrel): Skip for cygwin targets. * testsuite/gas/lns/lns.exp (lns-common-1): No longer skip for mcore and rx targets. * testsuite/gas/macros/macros.exp (dot): Add exceptions for ns32k, rl78 and vax. (purge): Expect to fail on the ns32k and vax. * testsuite/gas/nds32/alu-2.d: Update expected disassembly. * testsuite/gas/nds32/ls.d: Likewise. * testsuite/gas/nds32/sys-reg.d: Likewise. * testsuite/gas/nds32/usr-spe-reg.d: Likewise. * testsuite/gas/pe/aligncomm-d.d: Skip for the sh. * testsuite/gas/pe/section-align-3.d: Likewise. * testsuite/gas/pe/section-exclude.d: Likewise. * testsuite/gas/ppc/test2xcoff32.d: Pass once all the required data has been seen. * testsuite/gas/ppc/textalign-xcoff-001.d: Fix up regexp to allow for variations in whitespace. * testsuite/gas/tilepro/t_constants.d: Pass once all the required data has been seen. * testsuite/gas/tilepro/t_constants.s (.safe_word): New macro. Installs a 32-bit value without generating warnings on 64-bit hosts. Use the new macro to replace the .word directives. opcodes * nds32-dis.c (nds32_parse_audio_ext): Change printing of integer constants to match expected behaviour. (nds32_parse_opcode): Likewise. Also for whitespace.
2016-06-14Use correct enum type for do_elf_stt_common.John Baldwin2-1/+5
binutils/ChangeLog: * objcopy.c (do_elf_stt_common): Use correct type.
2016-06-14Delete bfd_my_archive macroAlan Modra3-6/+11
Many more places use abfd->my_archive rather than bfd_my_archive (abfd), so let's make the code consistently use the first idiom. bfd/ * bfd-in.h (bfd_my_archive): Delete. * bfd-in2.h: Regenerate. binutils/ * ar.c: Expand uses of bfd_my_archive. * size.c: Likewise. ld/ * ldlang.c: Expand uses of bfd_my_archive. * ldmain.c: Likewise. * ldmisc.c: Likewise. * plugin.c: Likewise.
2016-06-14Set my_archive for thin archivesAlan Modra2-1/+8
LTO plugin support in plugin_maybe_claim wants to close the IR bfd after replacing it with the recompiled object, but can't do so for archive elements due to various pointers that access the archive bfd. Thin archives have the same problem. They too cannot have their element bfds closed. PR ld/20241 bfd/ * archive.c (open_nested_file): Set my_archive. * bfd.c (_bfd_default_error_handler <%B>): Exclude archive file name for thin archives. * bfdio.c (bfd_tell): Don't adjust origin for thin archives. (bfd_seek): Likewise. * bfdwin.c (bfd_get_file_window): Likewise. * cache.c (cache_bmmap): Likewise. (bfd_cache_lookup_worker): Don't look in my_archive for thin archives. * mach-o.c (bfd_mach_o_follow_dsym): Don't open my_archive for thin archives. * plugin.c (try_claim): Likewise. * xcofflink.c (xcoff_link_add_dynamic_symbols): Use import path of file within thin archive, not the archive. binutils/ * bucomm.c (bfd_get_archive_filename): Return file name within thin archive. ld/ * ldmain.c (add_archive_element): Just print file name of file within thin archives. * ldmisc.c (vfinfo): Likewise. * plugin.c (plugin_object_p): Open file within thin archives. (plugin_maybe_claim): Expand comment.
2016-06-02Also check that the group header's sh_info field is valid.Nick Clifton2-2/+3
PR 20089 * objcopy.c (group_signature): Fail if the input symbol table has not been loaded, or if the sh_info field of the group header is 0.
2016-06-02Fix a seg-fault when stripping a corrupt binary.Nick Clifton2-0/+8
PR 20089 * objcopy.c (group_signature): Fail if the input symbol table has not been loaded.
2016-06-02Fix a bug displaying the interpretation of a CFA block that just contains ↵Nick Clifton2-1/+14
DW_CFA_NOP instructions. * dwarf.c (display_debug_frames): Do not display any interpretation if the block consists solely of DW__CFA_NOPs.
2016-05-31objcopy add-symbol uninitialised structAlan Modra2-110/+119
* objcopy.c: Formatting, whitespace throughout. (copy_main): Init newsym->othersym. (parse_symflags): Make len a size_t. Adjust uses.
2016-05-25Enable 64-bit archives in ar and ranlibH.J. Lu2-0/+8
Since existing ld and gold support the 64-bit (MIPS) ELF archives, we can use the 64-bit (MIPS) ELF archives as 64-bit archives. Since the plugin target is used to create archive in plugin-enabled ar, we need a way to enable 64-bit archives in the plugin target. This patch adds --enable-64-bit-archive to bfd to force 64-bit archives in ar and ranlib. Since both 64-bit MIPS and s390 ELF targets currently use 64-bit archives, 64-bit archives are enabled by default for them. 64-bit archive is generated automatically if the archive is too big. Tested on Linux/x86 and Linux/x86-64 with existing ld and gold. bfd/ PR binutils/14625 * archive.c (bfd_slurp_armap): Replace bfd_elf64_archive_slurp_armap with _bfd_archive_64_bit_slurp_armap. (bsd_write_armap): Call _bfd_archive_64_bit_write_armap if BFD64 is defined and the archive is too big. (coff_write_armap): Likewise. * archive64.c (bfd_elf64_archive_slurp_armap): Renamed to ... (_bfd_archive_64_bit_slurp_armap): This. (bfd_elf64_archive_write_armap): Renamed to ... (_bfd_archive_64_bit_write_armap): This. * configure.ac: Add --enable-64-bit-archive. (want_64_bit_archive): New. Set to true by default for 64-bit MIPS and s390 ELF targets. (USE_64_BIT_ARCHIVE): New AC_DEFINE. * config.in: Regenerated. * configure: Likewise. * elf64-mips.c (bfd_elf64_archive_functions): Removed. (bfd_elf64_archive_slurp_armap): Likewise. (bfd_elf64_archive_write_armap): Likewise. (bfd_elf64_archive_slurp_extended_name_table): Likewise. (bfd_elf64_archive_construct_extended_name_table): Likewise. (bfd_elf64_archive_truncate_arname): Likewise. (bfd_elf64_archive_read_ar_hdr): Likewise. (bfd_elf64_archive_write_ar_hdr): Likewise. (bfd_elf64_archive_openr_next_archived_file): Likewise. (bfd_elf64_archive_get_elt_at_index): Likewise. (bfd_elf64_archive_generic_stat_arch_elt): Likewise. (bfd_elf64_archive_update_armap_timestamp): Likewise. * elf64-s390.c (bfd_elf64_archive_functions): Removed. (bfd_elf64_archive_slurp_armap): Likewise. (bfd_elf64_archive_write_armap): Likewise. (bfd_elf64_archive_slurp_extended_name_table): Likewise. (bfd_elf64_archive_construct_extended_name_table): Likewise. (bfd_elf64_archive_truncate_arname): Likewise. (bfd_elf64_archive_read_ar_hdr): Likewise. (bfd_elf64_archive_write_ar_hdr): Likewise. (bfd_elf64_archive_openr_next_archived_file): Likewise. (bfd_elf64_archive_get_elt_at_index): Likewise. (bfd_elf64_archive_generic_stat_arch_elt): Likewise. (bfd_elf64_archive_update_armap_timestamp): Likewise. * elfxx-target.h (TARGET_BIG_SYM): Use _bfd_archive_64_bit on BFD_JUMP_TABLE_ARCHIVE if USE_64_BIT_ARCHIVE is defined and bfd_elfNN_archive_functions isn't defined. (TARGET_LITTLE_SYM): Likewise. * libbfd-in.h (_bfd_archive_64_bit_slurp_armap): New prototype. (_bfd_archive_64_bit_write_armap): Likewise. (_bfd_archive_64_bit_slurp_extended_name_table): New macro. (_bfd_archive_64_bit_construct_extended_name_table): Likewise. (_bfd_archive_64_bit_truncate_arname): Likewise. (_bfd_archive_64_bit_read_ar_hdr): Likewise. (_bfd_archive_64_bit_write_ar_hdr): Likewise. (_bfd_archive_64_bit_openr_next_archived_file): Likewise. (_bfd_archive_64_bit_get_elt_at_index): Likewise. (_bfd_archive_64_bit_generic_stat_arch_elt): Likewise. (_bfd_archive_64_bit_update_armap_timestamp): Likewise. * libbfd.h: Regenerated. * plugin.c (plugin_vec): Use _bfd_archive_64_bit on BFD_JUMP_TABLE_ARCHIVE if USE_64_BIT_ARCHIVE is defined. binutils/ PR binutils/14625 * NEWS: Mention --enable-64-bit-archive.
2016-05-18Prevent a run time segmentation fault when stripping a corrupt binary.Nick Clifton2-1/+9
PR 20096 * objcopy.c (copy_relocations_in_section): Also check for the symbol pointed to by sym_ptr_ptr being NULL.
2016-05-18MIPS/opcodes: Correct mixed MIPS16 and microMIPS disassemblyMaciej W. Rozycki4-0/+70
Mixing MIPS16 and microMIPS code in a single binary isn't usually supported but GAS happily produces such code if requested. However it is not correctly disassembled even if a symbol table is available and function symbols are correctly anotated with the ISA mode. This is because the ELF-header global microMIPS ASE flag takes precedence over MIPS16 function annotation, causing them to be treated as regular MIPS code. Correct the problem by respecting function symbol anotation regardless of the ELF-header flag. binutils/ * testsuite/binutils-all/mips/mixed-mips16-micromips.d: New test. * testsuite/binutils-all/mips/mixed-mips16-micromips.s: New test source. * testsuite/binutils-all/mips/mips.exp: Run the new test. opcodes/ * mips-dis.c (is_compressed_mode_p): Add `micromips_p' operand, replacing references to `micromips_ase' throughout. (_print_insn_mips): Don't use file-level microMIPS annotation to determine the disassembly mode with the symbol table.
2016-05-18Updated Swedish translations for bfd and binutilsNick Clifton2-52/+56
2016-05-18MIPS/readelf: Use the `d_val' dynamic entry member with the relevant tagsMaciej W. Rozycki2-1/+11
binutils/ * readelf.c (dynamic_section_mips_val) <DT_MIPS_RLD_VERSION> <DT_MIPS_LOCAL_GOTNO, DT_MIPS_CONFLICTNO, DT_MIPS_LIBLISTNO> <DT_MIPS_SYMTABNO, DT_MIPS_UNREFEXTNO, DT_MIPS_HIPAGENO> <DT_MIPS_DELTA_CLASS_NO, DT_MIPS_DELTA_INSTANCE_NO> <DT_MIPS_DELTA_RELOC_NO, DT_MIPS_DELTA_SYM_NO> <DT_MIPS_DELTA_CLASSSYM_NO, DT_MIPS_COMPACT_SIZE>: Use the `d_val' rather than `d_ptr' member of the dynamic entry.
2016-05-17LD/ELF: Unify STB_GNU_UNIQUE handlingMaciej W. Rozycki3-5/+49
Take STB_GNU_UNIQUE handling scattered across targets and gather it in the generic ELF linker. Update test suite infrastructure accordingly. bfd/ * elf-s390-common.c (elf_s390_add_symbol_hook): Remove STB_GNU_UNIQUE handling. * elf32-arc.c (elf_arc_add_symbol_hook): Likewise. * elf32-arm.c (elf32_arm_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise. * elf32-i386.c (elf_i386_add_symbol_hook): Remove function. (elf_backend_add_symbol_hook): Remove macro. * elflink.c (elf_link_add_object_symbols): Set `has_gnu_symbols' for STB_GNU_UNIQUE symbols. binutils/ * testsuite/lib/binutils-common.exp (supports_gnu_unique): New procedure. * testsuite/binutils-all/objcopy.exp: Use `supports_gnu_unique' with the `strip-10' test. ld/ * testsuite/ld-unique/unique.exp: Use `is_elf_format' and `supports_gnu_unique' to qualify testing.
2016-05-16V850/BFD: Call `_bfd_elf_copy_private_bfd_data' againMaciej W. Rozycki2-2/+5
Correct a regression introduced with commit 685080f21003 ("Adds support for generating notes in V850 binaries.") which replaced rather than extending the call to `_bfd_elf_copy_private_bfd_data' with `v850_elf_copy_private_bfd_data'. Consequently ELFOSABI_GNU marking is not propagated to output by `objcopy' from objects containing STB_GNU_UNIQUE symbols. bfd/ * elf32-v850.c (v850_elf_copy_notes): New function, factored out from... (v850_elf_copy_private_bfd_data): ... here. Call the new function and `_bfd_elf_copy_private_bfd_data'. binutils/ * testsuite/binutils-all/objcopy.exp: Don't skip the `strip-10' test for the V850.
2016-05-11Add MIPS32 DSPr3 support.Matthew Fortune2-0/+6
bfd/ * elfxx-mips.c (print_mips_ases): Add DSPR3. binutils/ * readelf.c (print_mips_ases): Add DSPR3. gas/ * config/tc-mips.c (options): Add OPTION_DSPR3 and OPTION_NO_DSPR3. (md_longopts): Likewise. (md_show_usage): Add help for -mdspr3 and -mno-dspr3. (mips_ases): Define availability for DSPr3. (mips_ase_groups): Add ASE_DSPR3 to the DSP group. (mips_convert_ase_flags): Map ASE_DSPR3 to AFL_ASE_DSPR3. * doc/as.texinfo: Document -mdspr3, -mno-dspr3. Fix -mdspr2 formatting. * doc/c-mips.texi: Document -mdspr3, -mno-dspr3, .set dspr3 and .set nodspr3. Fix -mdspr2 formatting. * testsuite/gas/mips/mips32-dspr3.d: New file. * testsuite/gas/mips/mips32-dspr3.s: Likewise. * testsuite/gas/mips/mips.exp: Run mips32-dspr3 test. include/ * elf/mips.h (AFL_ASE_DSPR3): New macro. (AFL_ASE_MASK): Update to include AFL_ASE_DSPR3. * opcode/mips.h (ASE_DSPR3): New macro. opcodes/ * mips-dis.c (mips_arch_choices): Add ASE_DSPR3 to mips32r6 and mips64r6. * mips-opc.c (D34): New macro. (mips_builtin_opcodes): Define bposge32c for DSPr3.
2016-05-10Add support for ARMv8-M Mainline with DSP extensionThomas Preud'homme2-0/+8
2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ (elf32_arm_merge_eabi_attributes): Add merging logic for Tag_DSP_extension. binutils/ * readelf.c (display_arm_attribute): Add output for Tag_DSP_extension. (arm_attr_public_tags): Define DSP_extension attribute. gas/ * NEWS: Document ARMv8-M and ARMv8-M Security and DSP Extensions. * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP instructions. (arm_extensions): Add dsp extension for ARMv8-M Mainline. (aeabi_set_public_attributes): Memorize the feature bits of the architecture selected for Tag_CPU_arch. Use it to set Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension. (arm_convert_symbolic_attribute): Define Tag_DSP_extension. * testsuite/gas/arm/arch7em-bad.d: Rename to ... * testsuite/gas/arm/arch7em-bad-1.d: This. * testsuite/gas/arm/arch7em-bad-2.d: New file. * testsuite/gas/arm/arch7em-bad-3.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise. * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise. include/ * elf/arm.h (Tag_DSP_extension): Define. ld/ * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New test. * testsuite/ld-arm/attr-merge-10b-dsp.s: New file. * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
2016-05-10binutils/doc: Update documentation for nm --size-sortAndrew Burgess2-5/+10
The documentation for 'nm --size-sort' is out of step with the code, the special handling for ELF is not mentioned in the documentation, and could cause confusion to a user. binutils/ChangeLog: * doc/binutils.texi (nm): Update description of --size-sort.
2016-05-09Fix seg fault objdumping a corrupt binary with an invalid sh_link field.Nick Clifton2-0/+15
PR binutils/20063 * elf.c (bfd_elf_get_elf_syms): Check for out of range sh_link field before accessing sections array. * readelf.c (get_32bit_section_headers): Warn if an out of range sh_link or sh_info field is encountered. (get_64bit_section_headers): Likewise.
2016-05-09Regenerate configureAlan Modra1-7/+10
2016-05-04Fix some AVR test failures.Senthil Kumar Selvaraj2-23/+25
binutils* testsuite/lib/binutils-common.exp (is_elf_format): Add avr-*-*. ld * testsuite/ld-elf/pr18735.d: Allow other symbols. * testsuite/ld-elf/sec64k.exp: Skip 64ksec for avr. * testsuite/ld-gc/pr14265.d: Allow other symbols. * testsuite/ld-plugin/plugin.exp: Add PR ld/17973 to plugin_tests only if check_shared_lib_support is true. * testsuite/ld-selective/selective.exp: Add --section-start flag for avr.
2016-05-03Updated Swedish translation for the binutils.Nick Clifton2-4/+8
2016-04-29Enhance readelf's recognition of AVR relocation types.Pitchumani Sivanupandi2-37/+57
* readelf.c (is_32bit_pcrel_reloc): Return true if reloc is 32-bit PC relocation for AVR target. (is_none_reloc): Return true if reloc is any of AVR diff relocations.
2016-04-29Enhance support for copying and stripping Solaris and ARM binaries.Nick Clifton2-1/+27
PR 19938 bfd * elf-bfd.h (struct elf_backend_data): Rename elf_backend_set_special_section_info_and_link to elf_backend_copy_special_section_fields. * elfxx-target.h: Likewise. * elf.c (section_match): Ignore the SHF_INFO_LINK flag when comparing section flags. (copy_special_section_fields): New function. (_bfd_elf_copy_private_bfd_data): Copy the EI_ABIVERSION field. Perform two scans over special sections. The first one looks for a direct mapping between the output section and an input section. The second scan looks for a possible match based upon section characteristics. * elf32-arm.c (elf32_arm_copy_special_section_fields): New function. Handle setting the sh_link field of SHT_ARM_EXIDX sections. * elf32-i386.c (elf32_i386_set_special_info_link): Rename to elf32_i386_copy_solaris_special_section_fields. * elf32-sparc.c (elf32_sparc_set_special_section_info_link): Rename to elf32_sparc_copy_solaris_special_section_fields. * elf64-x86-64.c (elf64_x86_64_set_special_info_link): Rename to elf64_x86_64_copy_solaris_special_section_fields. binutils* readelf.c (get_solaris_segment_type): New function. (get_segment_type): Call it.
2016-04-28Updated Chinese (simplified) translations for bfd, binutils and gold.Nick Clifton2-69/+82
2016-04-28Add support to AArch64 disassembler for verifying instructions. Add ↵Nick Clifton3-0/+25
verifier for LDPSW. PR target/19722 opcodes * aarch64-dis.c (aarch64_opcode_decode): Run verifier if present. * aarch64-opc.c (verify_ldpsw): New function. * aarch64-opc.h (verify_ldpsw): New prototype. * aarch64-tbl.h: Add initialiser for verifier field. (LDPSW): Set verifier to verify_ldpsw. binutils* testsuite/binutils-all/aarch64/illegal.s: New test. * testsuite/binutils-all/aarch64/illegal.d: New test driver. include * opcode/aarch64.h (struct aarch64_opcode): Add verifier field.
2016-04-20update many old style function definitionsTrevor Saunders2-2/+5
This includes regenerating a bunch of files in opcodes/ with trunk cgen. gprof/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * basic_blocks.c: Update old style function definitions. * cg_arcs.c: Likewise. * cg_print.c: Likewise. * gen-c-prog.awk: Likewise. * gmon_io.c: Likewise. * hertz.c: Likewise. * hist.c: Likewise. * sym_ids.c: Likewise. bfd/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * cache.c: Update old style function definitions. * elf32-m68k.c: Likewise. * elf64-mmix.c: Likewise. * stab-syms.c: Likewise. opcodes/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * alpha-dis.c: Regenerate. * crx-dis.c: Likewise. * disassemble.c: Likewise. * epiphany-opc.c: Likewise. * fr30-opc.c: Likewise. * frv-opc.c: Likewise. * ip2k-opc.c: Likewise. * iq2000-opc.c: Likewise. * lm32-opc.c: Likewise. * lm32-opinst.c: Likewise. * m32c-opc.c: Likewise. * m32r-opc.c: Likewise. * m32r-opinst.c: Likewise. * mep-opc.c: Likewise. * mt-opc.c: Likewise. * or1k-opc.c: Likewise. * or1k-opinst.c: Likewise. * tic80-opc.c: Likewise. * xc16x-opc.c: Likewise. * xstormy16-opc.c: Likewise. ld/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * emultempl/scoreelf.em: Likewise. binutils/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * resres.c: Likewise. gas/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * cgen.c: Likewise. * config/tc-bfin.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-metag.c: Likewise. * config/tc-nios2.c: Likewise. * config/tc-rl78.c: Likewise.
2016-04-15Regenerate Makefile.in/aclocal.m4 automake 1.11.6H.J. Lu4-124/+235
bfd/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * doc/Makefile.in: Likewise. binutils/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * doc/Makefile.in: Likewise. gas/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * doc/Makefile.in: Likewise. gold/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. * testsuite/Makefile.in: Likewise. gprof/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. ld/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise. opcodes/ * Makefile.in: Regenerated with automake 1.11.6. * aclocal.m4: Likewise.