aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2019-01-09cxxfilt test failuresAlan Modra2-29/+10
Fixes these: bfin-elf +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E bfin-elf +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE h8300-elf +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E h8300-elf +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE i686-pe +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E i686-pe +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE i686-vxworks +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E i686-vxworks +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE m32c-elf +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E m32c-elf +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE * testsuite/binutils-all/cxxfilt.exp: Pass --no-strip-underscores unconditionally to tests needing the option rather than via a list of targets.
2019-01-08Remove support for old gnu v2 name mangling.Nick Clifton4-71/+53
PR 24044 * cxxfilt.c (hp_symbol_characters): Delete. (main): Remove depcreated demangling styles. * stabs.c (parse_stab_argtypes): Remove support for old gnu v2 demangling opnames. * testsuite/binutils-all/cxxfilt.exp: Use the --no-strip-underscore option for targets that do prefix their symbols with underscores. Update tests to elimiate those that use gnu v2 encoding.
2019-01-08Add testcase for PR/24065.Tamar Christina3-0/+15
This adds a new testcase for objcopy -O ihex to test that it correctly works. binutils/ChangeLog: PR 24065 * testsuite/binutils-all/copy-6.d: New test. * testsuite/binutils-all/objcopy.exp: Use it.
2019-01-08run_dump_test source in build directoryAlan Modra2-2/+8
Some existing tests build .s and .d files for run_dump_test, using an absolute #source: line in the .d file. This patch changes that scheme a little to instead use "#source: ./..." in .d files rather than "#source: $objdir/...", which is more useful in cases where the .d file is not generated. This allows RX gas test files to be built in the build directory, rather than in a source directory (which might be read-only). binutils/ * testsuite/lib/binutils-common.exp (run_dump_test): Don't prepend $srcdir/$subdir to source file name if it starts with "./". gas/ * testsuite/gas/rx/rx.exp: Create generated test source in current directory. * testsuite/gas/rx/Xtod.d, * testsuite/gas/rx/abs.d, * testsuite/gas/rx/adc.d, * testsuite/gas/rx/add.d, * testsuite/gas/rx/and.d, * testsuite/gas/rx/bclr.d, * testsuite/gas/rx/bcnd.d, * testsuite/gas/rx/bfmov.d, * testsuite/gas/rx/bmcnd.d, * testsuite/gas/rx/bnot.d, * testsuite/gas/rx/bra.d, * testsuite/gas/rx/brk.d, * testsuite/gas/rx/bset.d, * testsuite/gas/rx/bsr.d, * testsuite/gas/rx/btst.d, * testsuite/gas/rx/clrpsw.d, * testsuite/gas/rx/cmp.d, * testsuite/gas/rx/dabs.d, * testsuite/gas/rx/dadd.d, * testsuite/gas/rx/dbt.d, * testsuite/gas/rx/dcmp.d, * testsuite/gas/rx/ddiv.d, * testsuite/gas/rx/div.d, * testsuite/gas/rx/divu.d, * testsuite/gas/rx/dmov.d, * testsuite/gas/rx/dmul.d, * testsuite/gas/rx/dneg.d, * testsuite/gas/rx/dpopm.d, * testsuite/gas/rx/dpushm.d, * testsuite/gas/rx/dround.d, * testsuite/gas/rx/dsqrt.d, * testsuite/gas/rx/dsub.d, * testsuite/gas/rx/dtoX.d, * testsuite/gas/rx/emaca.d, * testsuite/gas/rx/emsba.d, * testsuite/gas/rx/emul.d, * testsuite/gas/rx/emula.d, * testsuite/gas/rx/emulu.d, * testsuite/gas/rx/fadd.d, * testsuite/gas/rx/fcmp.d, * testsuite/gas/rx/fdiv.d, * testsuite/gas/rx/fmul.d, * testsuite/gas/rx/fsqrt.d, * testsuite/gas/rx/fsub.d, * testsuite/gas/rx/ftoi.d, * testsuite/gas/rx/ftou.d, * testsuite/gas/rx/gprel.d, * testsuite/gas/rx/int.d, * testsuite/gas/rx/itof.d, * testsuite/gas/rx/jmp.d, * testsuite/gas/rx/jsr.d, * testsuite/gas/rx/machi.d, * testsuite/gas/rx/maclh.d, * testsuite/gas/rx/maclo.d, * testsuite/gas/rx/max.d, * testsuite/gas/rx/min.d, * testsuite/gas/rx/mov.d, * testsuite/gas/rx/movco.d, * testsuite/gas/rx/movli.d, * testsuite/gas/rx/movu.d, * testsuite/gas/rx/msbhi.d, * testsuite/gas/rx/msblh.d, * testsuite/gas/rx/msblo.d, * testsuite/gas/rx/mul.d, * testsuite/gas/rx/mulhi.d, * testsuite/gas/rx/mullh.d, * testsuite/gas/rx/mullo.d, * testsuite/gas/rx/mvfacgu.d, * testsuite/gas/rx/mvfachi.d, * testsuite/gas/rx/mvfaclo.d, * testsuite/gas/rx/mvfacmi.d, * testsuite/gas/rx/mvfc.d, * testsuite/gas/rx/mvfcp.d, * testsuite/gas/rx/mvfdc.d, * testsuite/gas/rx/mvfdr.d, * testsuite/gas/rx/mvtacgu.d, * testsuite/gas/rx/mvtachi.d, * testsuite/gas/rx/mvtaclo.d, * testsuite/gas/rx/mvtc.d, * testsuite/gas/rx/mvtcp.d, * testsuite/gas/rx/mvtdc.d, * testsuite/gas/rx/neg.d, * testsuite/gas/rx/nop.d, * testsuite/gas/rx/not.d, * testsuite/gas/rx/opecp.d, * testsuite/gas/rx/or.d, * testsuite/gas/rx/pop.d, * testsuite/gas/rx/popc.d, * testsuite/gas/rx/popm.d, * testsuite/gas/rx/push.d, * testsuite/gas/rx/pushc.d, * testsuite/gas/rx/pushm.d, * testsuite/gas/rx/r-bcc.d, * testsuite/gas/rx/r-bra.d, * testsuite/gas/rx/racl.d, * testsuite/gas/rx/racw.d, * testsuite/gas/rx/rdacl.d, * testsuite/gas/rx/rdacw.d, * testsuite/gas/rx/revl.d, * testsuite/gas/rx/revw.d, * testsuite/gas/rx/rmpa.d, * testsuite/gas/rx/rolc.d, * testsuite/gas/rx/rorc.d, * testsuite/gas/rx/rotl.d, * testsuite/gas/rx/rotr.d, * testsuite/gas/rx/round.d, * testsuite/gas/rx/rstr.d, * testsuite/gas/rx/rte.d, * testsuite/gas/rx/rtfi.d, * testsuite/gas/rx/rts.d, * testsuite/gas/rx/rtsd.d, * testsuite/gas/rx/sat.d, * testsuite/gas/rx/satr.d, * testsuite/gas/rx/save.d, * testsuite/gas/rx/sbb.d, * testsuite/gas/rx/sccnd.d, * testsuite/gas/rx/scmpu.d, * testsuite/gas/rx/setpsw.d, * testsuite/gas/rx/shar.d, * testsuite/gas/rx/shll.d, * testsuite/gas/rx/shlr.d, * testsuite/gas/rx/smovb.d, * testsuite/gas/rx/smovf.d, * testsuite/gas/rx/smovu.d, * testsuite/gas/rx/sstr.d, * testsuite/gas/rx/stnz.d, * testsuite/gas/rx/stz.d, * testsuite/gas/rx/sub.d, * testsuite/gas/rx/suntil.d, * testsuite/gas/rx/swhile.d, * testsuite/gas/rx/tst.d, * testsuite/gas/rx/utof.d, * testsuite/gas/rx/wait.d, * testsuite/gas/rx/xchg.d, * testsuite/gas/rx/xor.d: Add #source line. ld/ * testsuite/ld-elf/sec64k.exp: Use . rather than $objdir in generated source file names. * testsuite/ld-m68k/m68k-got.exp: Likewise.
2019-01-07Revert "Sync libiberty sources with master version in gcc repository. ↵Simon Marchi3-44/+24
Updated stabs demangling and cxxfilt tests to match." The previous commit breaks the GDB build, which is still using functions cplus_demangle_opname & co. Since removing these usages is not an obvious fix, let's revert this patch until we get rid of them.
2019-01-07Sync libiberty sources with master version in gcc repository. Updated stabs ↵Nick Clifton3-24/+44
demangling and cxxfilt tests to match. PR 24044 * stabs.c (parse_stab_argtypes): Remove call to cplus_mangle_opcode. * testsuite/binutils-all/cxxfilt.exp: Replace tests of v2 encoding with v3 encoding. Add escape for known failures.
2019-01-05RX: binutils - Add RXv3 support.Yoshinori Sato2-0/+5
* readelf.c (get_machine_flags): Add RXv3 output.
2019-01-04Fix a possible integer overflow problem when examining corrupt binaries ↵Nick Clifton2-3/+17
using a 32-bit binutil. PR 24005 * objdump.c (load_specific_debug_section): Check for integer overflow before attempting to allocate contents.
2019-01-04Fix ridiculously small memory leak.Nick Clifton3-1/+18
PR 24001 * objcopy.c (copy_object): Free dhandle after writing out the debug information. * objdump.c (dump_bfd): Free dhandle after printing out the debug information.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra140-140/+144
2019-01-01ChangeLog rotationAlan Modra2-1546/+1560
2018-12-14elf: Add PT_GNU_PROPERTY segment typeH.J. Lu7-21/+26
Linkers group input note sections with the same name into one output note section with the same name. One output note section is placed in one PT_NOTE segment. New linkers merge all input .note.gnu.property sections into one output .note.gnu.property section with a single NT_GNU_PROPERTY_TYPE_0 note in a single PT_NOTE segment. Since older linkers treat input .note.gnu.property section as a generic note section and just concatenate all input .note.gnu.property sections into one output .note.gnu.property section without merging them, we may see one or more NT_GNU_PROPERTY_TYPE_0 notes in PT_NOTE segment, which are invalid. GNU_PROPERTY_X86_UINT32_VALID was defined to address this issue such that linker sets the bit for non-relocatable outputs. But it isn't sufficient: 1. It doesn't cover generic properties. 2. When -mx86-used-note=yes is passed to x86 assembler, the GNU_PROPERTY_X86_UINT32_VALID bit is set in GNU_PROPERTY_X86_ISA_1_USED property in object file and older linkers generate invalid NT_GNU_PROPERTY_TYPE_0 notes with the GNU_PROPERTY_X86_UINT32_VALID bit set. I am proposing the following changes: 1. Add PT_GNU_PROPERTY segment type: # define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) which covers .note.gnu.property section. 2. Remove GNU_PROPERTY_X86_UINT32_VALID. bfd/ PR ld/23900 * elf.c (get_program_header_size): Add a PT_GNU_PROPERTY segment for NOTE_GNU_PROPERTY_SECTION_NAME. (_bfd_elf_map_sections_to_segments): Create a PT_GNU_PROPERTY segment for NOTE_GNU_PROPERTY_SECTION_NAME. * elfxx-x86.c (_bfd_elf_link_setup_gnu_properties): Don't set GNU_PROPERTY_X86_UINT32_VALID. binutils/ PR ld/23900 * readelf.c (get_segment_type): Support PT_GNU_PROPERTY. (decode_x86_isa): Don't check GNU_PROPERTY_X86_UINT32_VALID. (decode_x86_feature_1): Likewise. (decode_x86_feature_2): Likewise. (print_gnu_property_note): Remove GNU_PROPERTY_X86_UINT32_VALID check. * testsuite/binutils-all/i386/empty.d: Updated. * testsuite/binutils-all/x86-64/empty-x32.d: Likewise. * testsuite/binutils-all/x86-64/empty.d: Likewise. * testsuite/binutils-all/i386/pr21231b.s: Change GNU_PROPERTY_X86_ISA_1_USED bits to 0x7fffffff. * testsuite/binutils-all/x86-64/pr21231b.s: Likewise. gas/ PR ld/23900 * config/tc-i386.c (x86_cleanup): Don't set GNU_PROPERTY_X86_UINT32_VALID. * testsuite/gas/i386/property-1.s: Change GNU_PROPERTY_X86_ISA_1_USED bits to 0. include/ PR ld/23900 * elf/common.h (PT_GNU_PROPERTY): New. (GNU_PROPERTY_X86_UINT32_VALID): Removed. ld/ PR ld/23900 * testsuite/ld-elf/elf.exp: Run PR ld/23900 test. * testsuite/ld-elf/pr23900-1-32.rd: New file. * testsuite/ld-elf/pr23900-1-64.rd: Likewise. * testsuite/ld-elf/pr23900-1.d: Likewise. * testsuite/ld-elf/pr23900-1.s: Likewise. * testsuite/ld-elf/pr23900-2.s: Likewise. * testsuite/ld-elf/pr23900-2a.d: Likewise. * testsuite/ld-elf/pr23900-2b.d: Likewise. * testsuite/ld-i386/ibt-plt-1.d: Adjusted. * testsuite/ld-i386/ibt-plt-2c.d: Likewise. * testsuite/ld-i386/ibt-plt-2d.d: Likewise. * testsuite/ld-i386/ibt-plt-3d.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise. * testsuite/ld-i386/pr23372c.d: Expect <None> for GNU_PROPERTY_X86_ISA_1_USED. * testsuite/ld-x86-64/pr23372c-x32.d: Likewise. * testsuite/ld-x86-64/pr23372c.d: Likewise. * testsuite/ld-x86-64/pr23372d-x32.d: Likewise. * testsuite/ld-x86-64/pr23372d.d: Likewise. * testsuite/ld-x86-64/property-x86-5a.s: Change GNU_PROPERTY_X86_ISA_1_USED bits to 0. * testsuite/ld-x86-64/property-x86-5b.s: Likewise.
2018-12-13Move aarch64 CIE code to aarch64 backendSam Tebbs2-0/+6
This commit moves all aarch64-specific code to deal with CIE structure introduced in 3a67e1a6b4430374f3073e51bb19347d4c421cfe from target-independent files to the aarch64 backend. 2018-12-13 Sam Tebbs <sam.tebbs@arm.com> binutils/ * dwarf.c (read_cie): Add check for 'B'. gas/ * config/tc-aarch64.h (enum pointer_auth_key, tc_fde_entry_extras, tc_cie_entry_extras, tc_fde_entry_init_extra, tc_output_cie_extra, tc_cie_fde_equivalent_extra, tc_cie_entry_init_extra): Define. * dw2gencfi.c (struct cie_entry): Add tc_cie_entry_extras invocation. (alloc_fde_entry, select_cie_for_fde): Add tc_fde_entry_init_extra invocation. (output_cie): Add tc_output_cie_extra invocation. (select_cie_for_fde): Add tc_cie_fde_equivalent_extra invocation. * dw2gencfi.h (enum pointer_auth_key): Move to config/tc-aarch64.h. (struct fde_entry): Add tc_fde_entry_extras invocation
2018-12-11Fix a failure in the libiberty testsuite by increasing the recursion limit ↵Nick Clifton3-5/+10
to 2048. PR 88409 include * demangle.h (DEMANGLE_RECURSION_LIMIT): Increase to 2048. binutils* NEWS: Note that recursion limit has increased to 2048. * doc/binutils.texi: Likewise.
2018-12-08Fix strings.c endian issue and strings testAlan Modra3-105/+87
git commit 71f5e3f7b624 obviously wasn't tested on a big-endian host, and the test fail message resulted in tcl errors. * strings.c (unget_part_char): New function. (print_strings): Use unget_part_char. Formatting. * testsuite/binutils-all/strings.exp (test_multibyte): Don't use square brackets in fail message. Expect "String1\nString2".
2018-12-08PR23952, memory leak in _bfd_generic_read_minisymbolsAlan Modra2-6/+8
bfd/ PR 23952 * syms.c (_bfd_generic_read_minisymbols): Free syms before returning with zero symcount. binutils/ * nm.c (display_rel_file): Use xrealloc to increase minisyms for synthetic symbols.
2018-12-07Synchronize libiberty with gcc and add --no-recruse-limit option to tools ↵Nick Clifton11-17/+265
that support name demangling. This patch addresses the multitude of bug reports about resource exhaustion in libiberty's name demangling code. It adds a limit to the amount of recursion that is allowed, before an error is triggered. It also adds a new demangling option to disable this limit. (The limit is enabled by default). PR 87681 PR 87675 PR 87636 PR 87335 libiberty * cp-demangle.h (struct d_info): Add recursion_limit field. * cp-demangle.c (d_function_type): If the recursion limit is enabled and reached, return with a failure result. (d_demangle_callback): If the recursion limit is enabled, check for a mangled string that is so long that there is not enough stack space for the local arrays. * cplus-dem.c (struct work): Add recursion_level field. (demangle_nested_args): If the recursion limit is enabled and reached, return with a failure result. include * demangle.h (DMGL_RECURSE_LIMIT): Define. (DEMANGLE_RECURSION_LIMIT): Prototype. binutuils * addr2line.c (demangle_flags): New static variable. (long_options): Add --recurse-limit and --no-recurse-limit. (translate_address): Pass demangle_flags to bfd_demangle. (main): Handle --recurse-limit and --no-recurse-limit options. * cxxfilt.c (flags): Add DMGL_RECURSE_LIMIT. (long_options): Add --recurse-limit and --no-recurse-limit. (main): Handle new options. * dlltool.c (gen_def_file): Include DMGL_RECURSE_LIMIT in flags passed to cplus_demangle. * nm.c (demangle_flags): New static variable. (long_options): Add --recurse-limit and --no-recurse-limit. (main): Handle new options. * objdump.c (demangle_flags): New static variable. (usage): Add --recurse-limit and --no-recurse-limit. (long_options): Likewise. (objdump_print_symname): Pass demangle_flags to bfd_demangle. (disassemble_section): Likewise. (dump_dymbols): Likewise. (main): Handle new options. * prdbg.c (demangle_flags): New static variable. (tg_variable): Pass demangle_flags to demangler. (tg_start_function): Likewise. * stabs.c (demangle_flags): New static variable. (stab_demangle_template): Pass demangle_flags to demangler. (stab_demangle_v3_argtypes): Likewise. (stab_demangle_v3_arg): Likewise. * doc/binutuls.texi: Document new command line options. * NEWS: Mention the new feature. * testsuite/config/default.exp (CXXFILT): Define if not already defined. (CXXFILTFLAGS): Likewise. * testsuite/binutils-all/cxxfilt.exp: New file. Runs a few simple tests of the cxxfilt program.
2018-12-03Update the assembler to use a version of 3 when generating the header of the ↵Nick Clifton3-2/+8
.debug_line section. PR 23941 gas * dwarf2dbg.c (DWARF2_LINE_VERSION): Change to 3. * testsuite/gas/elf/dwarf2-3.d: Update expected output. * testsuite/gas/elf/dwarf2-5.d: Likewise. * testsuite/gas/i386/debug1.d: Likewise. * testsuite/gas/i386/dw2-compress-1.d: Likewise. * testsuite/gas/i386/dw2-compress-3a.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-1.d: Likewise. * testsuite/gas/i386/dw2-compressed-3a.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/ia64/pr13167.d: Likewise. * testsuite/gas/mips/loc-swap-2.d: Likewise. * testsuite/gas/mips/loc-swap.d: Likewise. * testsuite/gas/mips/micromips@loc-swap-2.d: Likewise. * testsuite/gas/mips/micromips@loc-swap.d: Likewise. * testsuite/gas/mips/mips16@loc-swap-2.d: Likewise. * testsuite/gas/mips/mips16@loc-swap.d: Likewise. * testsuite/gas/mips/mips16e@loc-swap.d: Likewise. binutils* testsuite/binutils-all/i386/compressed-1a.d: Update expected output. * testsuite/binutils-all/x86-64/compressed-1a.d: Likewise.
2018-12-01PR23946, illegal memory access in readelf.c:slurp_ia64_unwind_tableAlan Modra2-2/+27
PR 23946 * readelf.c (slurp_ia64_unwind_table): Bounds check symbol index on reloc. (slurp_hppa_unwind_table): Likewise.
2018-12-01PR23945, NULL pointer dereference in readelf.c:slurp_hppa_unwind_tableAlan Modra2-5/+25
PR 23945 * readelf.c (slurp_ia64_unwind_table): Don't call elf_ia64_reloc_type needlessly. (slurp_hppa_unwind_table): Use same range checks and error messages as slurp_ia64_unwind_table.
2018-11-29objdump: Fix check for corrupt reloc information, to allow for the fact that ↵Nick Clifton2-2/+15
PDP11 relocs are bigger when in internal format. PR 23931 * objdump.c (dump_relocs_in_section): When checking for an unreasonable amount of relocs in a bfd, allow for the fact that the internal representation of a reloc may be bigger than the external representation.
2018-11-27Handle ELF compressed header alignment correctly by setting up the section ↵Mark Wielaard4-20/+11
alignment correctly for the Elf32_Chdr or Elf64_Chdr type and respect the ch_addralign field when decompressing the section data. PR binutils/23919 binutils* readelf.c (dump_sections_as_strings): Remove bogus addralign check. (dump_sections_as_bytes): Likewise. (load_specific_debug_sections): Likewise. * testsuite/binutils-all/dw2-3.rS: Adjust alignment. * testsuite/binutils-all/dw2-3.rt: Likewise. bfd * bfd.c (bfd_update_compression_header): Explicitly set alignment. (bfd_check_compression_header): Add uncompressed_alignment_power argument. Check ch_addralign is a power of 2. * bfd-in2.h: Regenerated. * compress.c (bfd_compress_section_contents): Get and set orig_uncompressed_alignment_pow if section is decompressed. (bfd_is_section_compressed_with_header): Add and get uncompressed_align_pow_p argument. (bfd_is_section_compressed): Add uncompressed_align_power argument to bfd_is_section_compressed_with_header call. (bfd_init_section_decompress_status): Get and set uncompressed_alignment_power. * elf.c (_bfd_elf_make_section_from_shdr): Add uncompressed_align_power argument to bfd_is_section_compressed_with_header call.
2018-11-20readelf: Prune gaps warning in build notesH.J. Lu2-0/+8
Since some object files may not have build notes, it is normal to have gaps in build notes. PR binutils/23898 * testsuite/lib/binutils-common.exp (prune_warnings_extra): Prune gaps in build notes.
2018-11-13opcodes/nfp: Fix disassembly of crc[] with swapped operands.Francois H. Theron3-4/+33
The decoding of the CRC operation in alu instructions was using bits from the instruction word directly, instead of srcA which would be different if the swap bit was set. Signed-off-by: Francois H. Theron <francois.theron@netronome.com>
2018-11-09Fix a typo in iconv.m4.Hafiz Abid Qadeer2-1/+5
config/ 2018-11-09 Hafiz Abid Qadeer <abidh@codesourcery.com> * iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS. Append $INCICONV to it. gdb/ 2018-11-09 Hafiz Abid Qadeer <abidh@codesourcery.com> * configure: Regenerate. binutils/ 2018-11-09 Hafiz Abid Qadeer <abidh@codesourcery.com> * configure: Regenerate. intl/ 2018-11-09 Hafiz Abid Qadeer <abidh@codesourcery.com> * configure: Regenerate.
2018-11-09oops - add missing piece of previous deltaNick Clifton1-1/+37
2018-11-09Enhance the strings program so that it can display multibyte strings.Nick Clifton5-2/+97
* strings.c (print_strings): Check for multibyte encodings. * binutils-all/strings-1.bin: New file. Test binary for string decoding. * testsuite/binutils-all/strings.exp: New file. Test the strings program. * testsuite/config/default.exp (STRINGS): Define if not provided by the environment. (STRINGSFLAGS): Likewise.
2018-11-07Enhance objdump's --disassemble switch so that it can now take an optional ↵Masatake Yamato12-21/+173
parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. * objdump.c (long_options): Have the --disassemble option take an optional argument. (usage): Add description for the `symbol' argument to the --disassemble option. (disasm_sym): New file private variable. (struct objdump_disasm_info): New field `symbol'. (disassemble_section): Introduce `do_print' local variable to control whether objdump displays the result of disassembling for a symbol or not. (main): Set `symbol' file private variable if the option argument for the --disassemble option is given. * doc/binutils.texi (objdump): Add description for the option argument. * NEWS: Mention the new feature. * testsuite/binutils-all/objdump.exp: Add tests of the -d and --disassemble=<symbol> options. * testsuite/binutils-all/bintest.s: Add more symbols and code. * testsuite/binutils-all/readelf.s: Update expected output. * testsuite/binutils-all/readelf.ss-64: Likewise. * testsuite/binutils-all/readelf.ss-mips: Likewise. * testsuite/binutils-all/readelf.ss-tmips: Likewise.
2018-11-07Add updated French and Portuguese translations.Nick Clifton2-11/+15
gas * po/fr.po: Updated French translation. bfd * po/fr.po: Updated French translation. * po/pt.po: Updated Portuguese translation. binutils* po/pt.po: Updated Portuguese translation.
2018-11-07Add support for new load commands added by Apple to the MACH-O file format.Roman Bolshakov2-8/+125
bfd * mach-o.h: Add new enums for BFD_MACH_O_PLATFORM_MACOS, BFD_MACH_O_PLATFORM_IOS, BFD_MACH_O_PLATFORM_TVOS, BFD_MACH_O_PLATFORM_WATCHOS, BFD_MACH_O_PLATFORM_BRIDGEOS, BFD_MACH_O_TOOL_CLANG, BFD_MACH_O_TOOL_SWIFT, BFD_MACH_O_TOOL_LD. (struct bfd_mach_o_note_command): New. (struct bfd_mach_o_build_version_tool): New. (struct bfd_mach_o_build_version_command): New. (bfd_mach_o_read_version_min): Don't split version into a few fields. Rename reserved to sdk. * mach-o.c (bfd_mach_o_read_version_min): Don't split version into a few fields. Rename reserved to sdk. (bfd_mach_o_read_command): Handle LC_VERSION_MIN_TVOS, LC_NOTE, LC_BUILD_VERSION. (bfd_mach_o_read_note): New. (bfd_mach_o_read_build_version): New. PR 23728 binutils* od-macho.c (printf_version): New. (dump_load_command): Use it to print version. Print sdk version. Print version info for watchOS and tvOS. Print LC_NOTE, LC_BUILD_VERSION. (dump_buld_version): New. (bfd_mach_o_platform_name): New (bfd_mach_o_tool_name): New * mach-o/external.h (mach_o_nversion_min_command_external): Rename reserved to sdk. (mach_o_note_command_external): New. (mach_o_build_version_command_external): New. * mach-o/loader.h (BFD_MACH_O_LC_VERSION_MIN_TVOS): Define. (BFD_MACH_O_LC_NOTE): Define.
2018-11-07rx: Add target rx-*-linux.Yoshinori Sato2-1/+5
2018-11-06elfedit: Add --enable-x86-feature/--disable-x86-featureH.J. Lu3-10/+298
Add --enable-x86-feature and --disable-x86-feature options to elfedit to set and clear the IBT and SHSTK bits in program property in ELF executables and shared objects. binutils/ * doc/binutils.texi: Document --enable-x86-feature and --disable-x86-feature options for elfedit. * elfedit.c: Include "config.h" and <sys/mman.h>. (enable_x86_features): New. (disable_x86_features): Likewise. (update_gnu_property): Likewise. (elf_x86_feature): Likewise. (process_file): Call update_gnu_property on ET_EXEC or ET_DYN file. (command_line_switch): Add OPTION_ENABLE_X86_FEATURE and OPTION_DISABLE_X86_FEATURE. (options): Add--enable-x86-feature and --disable-x86-feature. (usage): Likewise. (main): Handle OPTION_ENABLE_X86_FEATURE and OPTION_DISABLE_X86_FEATURE. ld/ * testsuite/config/default.exp (ELFEDIT): New. * testsuite/ld-elf/linux-x86.exp (elfedit_test): New proc. Run elfedit tests. * testsuite/ld-elf/x86-feature-1a.rd: New file. * testsuite/ld-elf/x86-feature-1b.rd: Likewise. * testsuite/ld-elf/x86-feature-1c.rd: Likewise. * testsuite/ld-elf/x86-feature-1d.rd: Likewise. * testsuite/ld-elf/x86-feature-1e.rd: Likewise.
2018-11-03elfedit: Move ELF header magic bytes check to get_file_headerH.J. Lu2-13/+11
Skip the file if ELF header magic bytes doesn't match. * elfedit.c (update_elf_header): Move EI_MAG? check to ... (get_file_header): Here.
2018-11-02binutils: Add AC_FUNC_MMAP to configure.acH.J. Lu4-2/+220
Add AC_FUNC_MMAP to configure.ac so that HAVE_MMAP will be checked in objdump.c and mmap is used if available. * configure.ac (AC_FUNC_MMAP): New. * config.in: Regenerated. * configure: Likewise.
2018-11-02Squash readelf warning on zero sh_link reloc sectionAlan Modra2-20/+26
On readelf examining a static executable built with current glibc, we get a silly warning. Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .note.ABI-tag NOTE 0000000000400190 000190 000020 00 A 0 0 4 [ 2] .note.gnu.build-id NOTE 00000000004001b0 0001b0 000024 00 A 0 0 4 readelf: Warning: [ 3]: Link field (0) should index a symtab section. [ 3] .rela.plt RELA 00000000004001d8 0001d8 000228 18 AI 0 20 8 This .rela.plt section contains only IRELATIVE relocations (which have symbol index zero), so it isn't appropriate to warn. A zero sh_link section is deliberately chosen for such a section (see PR10337 and PR23850). So this patch disables the SHT_REL* sh_link warning. I've also removed the .rel.dyn/.rela.dyn section name test to disable the sh_info warning for SHT_REL* sections. While relocation sections in an executable need not specify the section they relocate (the relocation sh_offset field is an address, not a section offset), that isn't true in a relocatable file where sh_offset is relative to a section. If .rela.dyn happens to exist in an ET_REL object it must specify a valid section. * readelf.c (process_section_headers): Don't warn on a zero sh_info or sh_link for any reloc section in an executable or shared library. Do warn for .rel.dyn/.rela.dyn in ET_REL.
2018-11-01Fix ld action in run_dump_testThomas Preud'homme3-0/+35
run_dump_test proposes an ld action but when trying to make use of it in a gas test it gave me some Tcl error. It turns out that it references the check_shared_lib_support procedure and ld_elf_shared_opt variable both only available in ld-lib.exp. I've thus moved the procedure in binutils-common.exp and defined the variable needed in the various default.exp of testsuite that seem to be using run_dump_test. Since check_shared_lib_support itself references the ld variable not defined in binutils-common I've defined it from LD in run_dump_test and fixed LD and LDFLAGS to be defined as expected by run_dump_test in the various default.exp of testsuite using run_dump_test. 2018-11-01 Thomas Preud'homme <thomas.preudhomme@linaro.org> binutils/ * testsuite/config/default.exp: Define LD, LDFLAGS and ld_elf_shared_opt. * testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved from ld-lib.exp. (run_dump_test): Set ld to $LD. gas/ * testsuite/config/default.exp: Define LD, LDFLAGS and ld_elf_shared_opt. ld/ * testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to binutils-common.exp.
2018-10-23S12Z: New 32 bit Reloc.John Darrington1-1/+2
Third party tools produce 32 bit relocs at index 6 with strange properties. This change moves the existing 32 bit reloc (R_S12Z_EXT32) to index 7 and introduces a new one (R_S12Z_CW32) at index 6 to try to support code generated by these tools. * bfd/elf32-s12z.c (elf_s12z_howto_table) [R_S12Z_CW32]: New member. * binutils/readelf.c (is_32bit_abs_reloc): Reloc type 7 is also 32 bit. * include/elf/s12z.h (elf_s12z_reloc_tpe) [RELOC_NUMBER (R_S12Z_CW32)]: New enum.
2018-10-18Update documentation of readelf's --unwind option.Nick Clifton2-1/+11
* doc/binutils.texi (readelf): Document alternatives to the --unwind option if it is not supported for the target architecture.
2018-10-16PR23780, assertion abort in function display_raw_attributeAlan Modra2-1/+6
PR 23780 * readelf.c (display_raw_attribute): Correct assertion.
2018-10-15BFD_INIT_MAGICAlan Modra11-10/+35
This patch performs a run-time test that a shared libbfd.so has been compiled with the same size bfd_vma as that of apps using the library. On a 32-bit host it is easily possible to have one libbfd.so compiled to support 64-bit targets (or configured with --enable-64-bit-bfd) while another only supports 32-bit targets. The two libraries will have differently sized bfd_vma types, and if the wrong one is loaded all sorts of weird behaviour might be seen. bfd/ PR 23534 * init.c (BFD_INIT_MAGIC): Define. (bfd_init): Return BFD_INIT_MAGIC. bfd-in2.h: Regenerate. binutils/ PR 23534 * addr2line.c (main): Exit with fatal error if bfd_init returns an unexpected value. * ar.c (main): Likewise. * dlltool.c (identify_dll_for_implib): Likewise. * nm.c (main): Likewise. * objcopy.c (main): Likewise. * objdump.c (main): Likewise. * size.c (main): Likewise. * strings.c (main): Likewise. * windmc.c (main): Likewise. * windres.c (main): Likewise. gas/ PR 23534 * as.c (main): Exit with fatal error if bfd_init returns an unexpected value. ld/ PR 23534 * ldmain.c (main): Exit with fatal error if bfd_init returns an unexpected value.
2018-10-11Prevent the --keep-global-symbol and --globalize-symbol options from being ↵Nick Clifton5-4/+38
used together. This is the result of an email thread starting here: https://sourceware.org/ml/binutils/2018-09/msg00031.html The main point of the thread is this observation: * Supposing we had an object file with two globals, SomeGlobal and SomeOtherGlobal, if one were to do "--globalize-symbol SomeGlobal --keep-global-symbol SomeOtherGlobal", you might expect that both SomeGlobal and SomeOtherGlobal are global in the output file... but it isn't. Because --keep-global-symbol is set and doesn't include SomeGlobal, SomeGlobal will be demoted to a local symbol. And because the check to see if we should apply the --globalize-symbol flag checks "flags" (the original flag set), and not "sym->flags", it decides not to do anything, so SomeGlobal remains a local symbol. Although this is a weird edge case, should this be changed so that --keep-global-symbol implicitly keeps anything also specified via --globalize-symbol? (The code seems technically correct with respect to the documentation, but IMO the behavior is counter-intuitive). binutils* objcopy.c (copy_main): Issue a fata error if the --keep-global-symbol(s) and the --globalize-symbol(s) options are used together. * doc/binutils.texi: Document that the two options are incompatible. * testsuite/binutils-all/copy-5.d: New test. * testsuite/binutils-all/objcopy.exp: Run the new test.
2018-10-10HPPA64 .PARISC.unwind entriesAlan Modra2-2/+9
.PARISC.unwind has 32-bit addresses in both 32-bit ELF and 64-bit ELF. Well, strictly speaking, the 32-bit "start" and "end" fields are segment relative offsets. (The 64-bit ABI says so, while the 32-bit ABI says they are addresses but it appears they are segment relative offsets in practice. Likely the 32-bit ABI lacks an update.) * readelf.c (hppa_process_unwind): Don't use eh_addr_size to calculate number of entries. (slurp_hppa_unwind_table): Don't use eh_addr_size here either.
2018-10-10S12Z: Set eh_addr_size to 4Alan Modra2-0/+10
* objdump.c (dump_dwarf): Set s12z eh_addr_size to 4.
2018-10-08Handle R_RISCV_32_PCREL in readelfAndreas Schwab2-0/+6
* readelf.c (is_32bit_pcrel_reloc): Handle R_RISCV_32_PCREL.
2018-10-03Updated French translation for the binutils/ subdirectory.Nick Clifton2-2008/+1911
2018-10-03Updated Portuguese translations for the bfd/ and binutils/ subdirectories.Nick Clifton2-2011/+1917
2018-09-22Revert part of commit 32ec8896025Alan Modra2-6/+5
echo "__thread char *p;" | gcc -c -g -xc - -o thread.o With current powerpc64le-linux-gcc has this reloc in .debug_info 0000000000000025 0000000d0000004e R_PPC64_DTPREL64 0000000000000000 p + 8000 That stops me looking at .debug_info. ~/build/gas-virgin/powerpc64le-linux/binutils/readelf -wi thread.o readelf: Warning: unable to apply unsupported reloc type 78 to section .debug_info Older readelf continued on after the warning, dumping .debug_info. * readelf.c (apply_relocations): Don't return FALSE for warnings.
2018-09-20binutils --dwarf=decodedline: Add display of is_stmt flagJohn Darrington3-11/+16
binutils/ * dwarf.c (display_debug_lines_decoded): Add display of is_stmt. * testsuite/binutils-all/dw5.W: Deal with the consequences. * testsuite/binutils-all/objdump.WL: Deal with the consequences.
2018-09-20Andes Technology has good news for you, we plan to update the nds32 port of ↵Nick Clifton7-6/+20
binutils on upstream! We have not only removed all unsupported and obsolete code, but also supported lost of new features, including better link-time relaxations and TLS implementations. Besides, the files generated by the newly assembler and linker usually get higher performance and more optimized code size. ld * emultempl/nds32elf.em (hyper_relax): New variable. (nds32_elf_create_output_section_statements): the parameters of bfd_elf32_nds32_set_target_option (PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Add new option --mhyper-relax. * emultempl/nds32elf.em (nds32_elf_after_open): Updated. * emultempl/nds32elf.em (tls_desc_trampoline): New variable. * (nds32_elf_create_output_section_statements): Updated. * (nds32_elf_after_parse): Disable relaxations when PIC is enable. * (PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Add new option --m[no-]tlsdesc-trampoline. include * elf/nds32.h: Remove the unused target features. * dis-asm.h (disassemble_init_nds32): Declared. * elf/nds32.h (E_NDS32_NULL): Removed. (E_NDS32_HAS_DSP_INST, E_NDS32_HAS_ZOL): New. * opcode/nds32.h: Ident. (N32_SUB6, INSN_LW): New macros. (enum n32_opcodes): Updated. * elf/nds32.h: Doc fixes. * elf/nds32.h: Add R_NDS32_LSI. * elf/nds32.h: Add new relocations for TLS. gas * config/tc-nds32.c: Remove the unused target features. (nds32_relax_relocs, md_pseudo_table, nds32_elf_record_fixup_exp, nds32_set_elf_flags_by_insn, nds32_insert_relax_entry, nds32_apply_fix): Likewise. (nds32_no_ex9_begin): Removed. * config/tc-nds32.c (add_mapping_symbol_for_align, make_mapping_symbol, add_mapping_symbol): New functions. * config/tc-nds32.h (enum mstate): New. (nds32_segment_info_type): Likewise. * configure.ac (--enable-dsp-ext, --enable-zol-ext): New options. * config.in: Regenerated. * configure: Regenerated. * config/tc-nds32.c (nds32_dx_regs): Set the value according to the configuration. (nds32_perf_ext, nds32_perf_ext2, nds32_string_ext, nds32_audio_ext): Likewise. (nds32_dsp_ext): New variable. Set the value according to the configuration. (nds32_zol_ext): Likewise. (asm_desc, nds32_pseudo_opcode_table): Make them static. (nds32_set_elf_flags_by_insn): Updated. (nds32_check_insn_available): Updated. (nds32_str_tolower): New function. * config/tc-nds32.c (relax_table): Updated. (md_begin): Updated. (md_assemble): Use XNEW macro to allocate space for `insn.info', and then remember to free it. (md_section_align): Cast (-1) to ValueT. (nds32_get_align): Cast (~0U) to addressT. (nds32_relax_branch_instructions): Updated. (md_convert_frag): Add new local variable `final_r_type'. (invalid_prev_frag): Add new bfd_boolean parameter `relax'. All callers changed. * config/tc-nds32.c (struct nds32_relocs_pattern): Add `insn' field. (struct nds32_hint_map): Add `option_list' field. (struct suffix_name, suffix_table): Remove the unused `pic' field. (do_pseudo_b, do_pseudo_bal): Remove the suffix checking. (do_pseudo_la_internal, do_pseudo_pushpopm): Indent. (relax_hint_bias, relax_hint_id_current): New static variables. (reset_bias, relax_hint_begin): New variables. (nds_itoa): New function. (CLEAN_REG, GET_OPCODE): New macros. (struct relax_hint_id): New. (nds32_relax_hint): For .relax_hint directive, we can use `begin' and `end' to mark the relax pattern without giving exactly id number. (nds32_elf_append_relax_relocs): Handle the case that the .relax_hint directives are attached to pseudo instruction. (nds32_elf_save_pseudo_pattern): Change the second parameter from instruction's opcode to byte code. (nds32_elf_build_relax_relation): Add new bfd_boolean parameter `pseudo_hint'. (nds32_lookup_pseudo_opcode): Fix the overflow issue. (enum nds32_insn_type): Add N32_RELAX_ALU1 and N32_RELAX_16BIT. (nds32_elf_record_fixup_exp, relax_ls_table, hint_map, nds32_find_reloc_table, nds32_match_hint_insn, nds32_parse_name): Updated. * config/tc-nds32.h (MAX_RELAX_NUM): Extend it to 6. (enum nds32_relax_hint_type): Merge NDS32_RELAX_HINT_LA and NDS32_RELAX_HINT_LS into NDS32_RELAX_HINT_LALS. Add NDS32_RELAX_HINT_LA_PLT, NDS32_RELAX_HINT_LA_GOT and NDS32_RELAX_HINT_LA_GOTOFF. * config/tc-nds32.h (relax_ls_table): Add floating load/store to gp relax pattern. (hint_map, nds32_find_reloc_table): Likewise. * configure.ac: Define NDS32_LINUX_TOOLCHAIN. * configure: Regenerated. * config.in: Regenerated. * config/tc-nds32.h (enum nds32_ramp): Updated. (enum nds32_relax_hint_type): Likewise. * config/tc-nds32.c: Include "errno.h" and "limits.h". (relax_ls_table): Add TLS relax patterns. (nds32_elf_append_relax_relocs): Attach BFD_RELOC_NDS32_GROUP on each instructions of TLS patterns. (nds32_elf_record_fixup_exp): Updated. (nds32_apply_fix): Likewise. (suffix_table): Add TLSDESC suffix. binutils* testsuite/binutils-all/objcopy.exp: Set the unsupported reloc number from 215 to 255 for NDS32. bfd * elf32-nds32.c (nds32_elf_relax_loadstore): Remove the unused target features. (bfd_elf32_nds32_set_target_option): Remove the unused parameters. (nds32_elf_relax_piclo12, nds32_elf_relax_letlslo12, nds32_elf_relax_letlsadd, nds32_elf_relax_letlsls, nds32_elf_relax_pltgot_suff, nds32_elf_relax_got_suff nds32_elf_relax_gotoff_suff, calculate_plt_memory_address, calculate_plt_offset, calculate_got_memory_address, nds32_elf_check_dup_relocs): Removed. All callers changed. * elf32-nds32.h: Remove the unused macros and defines. (elf_nds32_link_hash_table): Remove the unused variable. (bfd_elf32_nds32_set_target_option): Update prototype. (nds32_elf_ex9_init): Removed. * elf32-nds32.c (nds32_convert_32_to_16): Updated. * elf32-nds32.c (HOWTO2, HOWTO3): Define new HOWTO macros to initialize array nds32_elf_howto_table in any order without lots of EMPTY_HOWTO. (nds32_reloc_map): Updated. * reloc.c: Add BFD_RELOC_NDS32_LSI. * bfd-in2.h: Regenerated. * bfd/libbfd.h: Regenerated. * elf32-nds32.c (nds32_elf_relax_howto_table): Add R_NDS32_LSI. (nds32_reloc_map): Likewise. (nds32_elf_relax_flsi): New function. (nds32_elf_relax_section): Support floating load/store relaxation. * elf32-nds32.c (NDS32_GUARD_SEC_P, elf32_nds32_local_gp_offset): New macro. (struct elf_nds32_link_hash_entry): New `offset_to_gp' field. (struct elf_nds32_obj_tdata): New `offset_to_gp' and `hdr_size' fields. (elf32_nds32_allocate_local_sym_info, nds32_elf_relax_guard, nds32_elf_is_target_special_symbol, nds32_elf_maybe_function_sym): New functions. (nds32_info_to_howto_rel): Add BFD_ASSERT. (bfd_elf32_bfd_reloc_type_table_lookup, nds32_elf_link_hash_newfunc, nds32_elf_link_hash_table_create, nds32_elf_relocate_section, nds32_elf_relax_loadstore, nds32_elf_relax_lo12, nds32_relax_adjust_label, bfd_elf32_nds32_set_target_option, nds32_fag_mark_relax): Updated. (nds32_elf_final_sda_base): Improve it to find the better gp value. (insert_nds32_elf_blank): Must consider `len' when inserting blanks. * elf32-nds32.h (bfd_elf32_nds32_set_target_option): Update prototype. (struct elf_nds32_link_hash_table): Add new variable `hyper_relax'. * elf32-nds32.c (elf32_nds32_allocate_dynrelocs): New function. (create_got_section): Likewise. (allocate_dynrelocs, nds32_elf_size_dynamic_sections, nds32_elf_relocate_section, nds32_elf_finish_dynamic_symbol): Updated. (nds32_elf_check_relocs): Fix the issue that the shared library may has TEXTREL entry in the dynamic section. (nds32_elf_create_dynamic_sections): Enable to call readonly_dynrelocs since the TEXTREL issue is fixed in the nds32_elf_check_relocs. (nds32_elf_finish_dynamic_sections): Update and add DT_RELASZ dynamic entry. (calculate_offset): Remove the unused parameter `pic_ext_target' and related codes. All callers changed. (elf_backend_dtrel_excludes_plt): Disable it temporarily since it will cause some errors for our test cases. * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Allow to link the generic object. * reloc.c: Add TLS relocations. * libbfd.h: Regenerated. * bfd-in2.h: Regenerated. * elf32-nds32.h (struct section_id_list_t): New. (elf32_nds32_lookup_section_id, elf32_nds32_check_relax_group, elf32_nds32_unify_relax_group, nds32_elf_unify_tls_model): New prototypes. (elf32_nds32_compute_jump_table_size, elf32_nds32_local_tlsdesc_gotent): New macro. (nds32_insertion_sort, bfd_elf32_nds32_set_target_option, elf_nds32_link_hash_table): Updated. * elf32-nds32.c (enum elf_nds32_tls_type): New. (struct elf32_nds32_relax_group_t, struct relax_group_list_t): New. (elf32_nds32_add_dynreloc, patch_tls_desc_to_ie, get_tls_type, fls, ones32, list_insert, list_insert_sibling, dump_chain, elf32_nds32_check_relax_group, elf32_nds32_lookup_section_id, elf32_nds32_unify_relax_group, nds32_elf_unify_tls_model): New functions. (elf_nds32_obj_tdata): Add new fields. (elf32_nds32_relax_group_ptr, nds32_elf_local_tlsdesc_gotent): New macros. (nds32_elf_howto_table): Add TLS relocations. (nds32_reloc_map): Likewise. (nds32_elf_copy_indirect_symbol, nds32_elf_size_dynamic_sections, nds32_elf_finish_dynamic_symbol, elf32_nds32_allocate_local_sym_info, nds32_elf_relocate_section, bfd_elf32_nds32_set_target_option, nds32_elf_check_relocs, allocate_dynrelocs): Updated. (nds32_elf_relax_section): Call nds32_elf_unify_tls_model. (dtpoff_base): Rename it to `gottpof' and then update it. opcodes * nds32-asm.c (operand_fields): Remove the unused fields. (nds32_opcodes): Remove the unused instructions. * nds32-dis.c (nds32_ex9_info): Removed. (nds32_parse_opcode): Updated. (print_insn_nds32): Likewise. * nds32-asm.c (config.h, stdlib.h, string.h): New includes. (LEX_SET_FIELD, LEX_GET_FIELD): Update defines. (nds32_asm_init, build_operand_hash_table, build_keyword_hash_table, build_opcode_hash_table): New functions. (nds32_keyword_table, nds32_keyword_count_table, nds32_field_table, nds32_opcode_table): New. (hw_ktabs): Declare it to a pointer rather than an array. (build_hash_table): Removed. * nds32-asm.h (enum): Add SYN_INPUT, SYN_OUTPUT, SYN_LOPT, SYN_ROPT and upadte HW_GPR and HW_INT. * nds32-dis.c (keywords): Remove const. (match_field): New function. (nds32_parse_opcode): Updated. * disassemble.c (disassemble_init_for_target): Add disassemble_init_nds32. * nds32-dis.c (eum map_type): New. (nds32_private_data): Likewise. (get_mapping_symbol_type, is_mapping_symbol, nds32_symbol_is_valid, nds32_add_opcode_hash_table, disassemble_init_nds32): New functions. (print_insn_nds32): Updated. * nds32-asm.c (parse_aext_reg): Add new parameter. (parse_re, parse_re2, parse_aext_reg): Only reduced registers are allowed to use. All callers changed. * nds32-asm.c (keyword_usr, keyword_sr): Updated. (operand_fields): Add new fields. (nds32_opcodes): Add new instructions. (keyword_aridxi_mx): New keyword. * nds32-asm.h (enum): Add NASM_ATTR_DSP_ISAEXT, HW_AEXT_ARIDXI_MX and NASM_ATTR_ZOL. (ALU2_1, ALU2_2, ALU2_3): New macros. * nds32-dis.c (nds32_filter_unknown_insn): Updated.
2018-09-17Free symbol buffers if they are no longer in useH.J. Lu2-8/+60
add_specific_symbols allocates a buffer to hold symbols. It should be freed only if it is no longer in use. PR binutils/23633 * objcopy.c (strip_specific_buffer): New. (strip_unneeded_buffer): Likewise. (keep_specific_buffer): Likewise. (localize_specific_buffer): Likewise. (globalize_specific_buffer): Likewise. (keepglobal_specific_buffer): Likewise. (weaken_specific_buffer): Likewise. (add_specific_symbols): Add an argument to return pointer to allocated buffer. (copy_main): Update add_specific_symbols to update pointers to allocated buffer. Free pointers to allocated buffer before return.