aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2014-11-08daily updateAlan Modra1-1/+1
2014-11-07Cast to unsigned long in range checksH.J. Lu2-2/+7
* peXXigen.c (pe_print_idata): Cast to unsigned long in range checks.
2014-11-07X32: Add REX prefix to encode R_X86_64_GOTTPOFFH.J. Lu2-6/+22
Structions with R_X86_64_GOTTPOFF relocation must be encoded with REX prefix even if it isn't required by destination register. Otherwise linker can't safely perform IE -> LE optimization. bfd/ PR ld/17482 * elf64-x86-64.c (elf_x86_64_relocate_section): Update comments for IE->LE transition. gas/ PR ld/17482 * config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix for structions with R_X86_64_GOTTPOFF relocation for x32 if needed. gas/testsuite/ PR ld/17482 * gas/i386/ilp32/x32-tls.d: New file. * gas/i386/ilp32/x32-tls.s: Likewise. ld/testsuite/ PR ld/17482 * ld-x86-64/tlsie4.dd: Updated.
2014-11-07tekhex architecureAlan Modra2-1/+7
is a don't care. * tekhex.c (tekhex_set_arch_mach): Ignore unknown arch errors.
2014-11-07tekhex buffer management and symbol typesAlan Modra2-45/+79
Dramatically reduces memory consumption and processing time for large all-zero data segments. Allows multiple symbol types attached to a given segment to survive objcopy. * tekhex.c (CHUNK_SPAN): Define. (struct data_struct <chunk_init>): Use one byte per span, update all code accessing this field. (find_chunk): Add create param, don't create new entry unless set. (insert_byte): Don't save zeros. (first_phase): Set section SEC_CODE or SEC_DATA flag depending on symbol type. Create an alternate section if both types of symbol are given. Attach type '2' and '6' symbols to absolute section. (move_section_contents): Fix caching of chunk. Don't create chunk when reading, or for writing zeros. (tekhex_set_section_contents): Don't create initial chunks. (tekhex_write_object_contents): Use CHUNK_SPAN.
2014-11-07aoutx.h tidyAlan Modra2-14/+14
Save a multiplication, and any concern that the buffer allocation might be smaller than the amount read (as it could be if the header size isn't a multiple of EXTERNAL_NLIST_SIZE). * aoutx.h (aout_get_external_symbols): Tidy allocation of symbol buffer.
2014-11-07Revert bfd_get_size checksAlan Modra6-40/+11
* archive.c (_bfd_slurp_extended_name_table): Revert bfd_get_size check. * coffcode.h (coff_set_alignment_hook): Likewise. (coff_slurp_line_table): Likewise. * coffgen.c (coff_get_normalized_symtab): Likewise. (_bfd_coff_get_external_symbols): Likewise. * elf.c (bfd_elf_get_str_section): Likewise. * tekhex.c (first_phase): Likewise.
2014-11-07daily updateAlan Modra1-1/+1
2014-11-06Revert changes in previous deltas that introduced new failures intoNick Clifton4-19/+17
the linker testsuite. * aoutx.h (slurp_symbol_table): Revert previous delta. (slurp_reloc_table): Likewise. * compress.c (bfd_get_full_section_contents): Remove file size test. * coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs and do not complain about linker generated files.
2014-11-06bfd/elf-attrs.c: Fix possible infinite loop parsing attributesWill Newton2-0/+9
Handle the case of a zero length section or sub-section in _bfd_elf_parse_attributes and in doing so prevent an infinite loop in the parser. bfd/ChangeLog: 2014-11-06 Will Newton <will.newton@linaro.org> * elf-attrs.c (_bfd_elf_parse_attributes): Handle zero length sections and sub-sections.
2014-11-06daily updateAlan Modra1-1/+1
2014-11-05More fixes for memory problems uncovered by file fuzzers.Nick Clifton3-7/+28
PR binutils/17512 * coffcode.h (handle_COMDAT): Replace abort with BFD_ASSERT. Replace another abort with an error message. (coff_slurp_line_table): Add more range checking. * peXXigen.c (pe_print_debugdata): Add range checking.
2014-11-05Fix segfault when creating a dso with discarded .dynsym section.Matthew Fortune2-2/+9
bfd/ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Fix segfault when creating a dso with discarded dynsym section.
2014-11-05Update .MIPS.abiflags to support MIPS R6Matthew Fortune2-0/+13
bfd/ * elfxx-mips.c (update_mips_abiflags_isa): Add E_MIPS_ARCH_32R6 and E_MIPS_ARCH_64R6 support. ld/testsuite/ * ld-mips-elf/abiflags-strip10-ph.d: New file. * ld-mips-elf/mips-eld.exp: Run the new test. gas/ * config/tc-mips.c (mips_elf_final_processing): Add INSN_ISA32R6 and INSN_ISA64R6 support. gas/testsuite/ * gas/mips/elf_arch_mips32r6.d: New file. * gas/mips/elf_arch_mips64r6.d: New file. * gas/mips/mips.exp: Run the new tests.
2014-11-05More fixes for processing corrupt files.Nick Clifton3-39/+129
PR binutils/17512 * coffcode.h (coff_set_alignment_hook): Warn if the file lies about the number of relocations it contains. (coff_sort_func_alent): Return 0 if the pointers are NULL. (coff_slurp_line_table): Add more range checks. Do not free new tables created when sorting line numbers. * peXXigen.c (pe_print_idata): Add range checks. (pe_print_edata): Likewise. (rsrc_print_resource_entries): Likewise. Avoid printing control characters. Terminate priniting if corruption is detected. (rsrc_print_resource_directory): Terminate printing if an unknown directory type is encountered. (pe_print_debugdata): Fix off-by-one error. (rsrc_count_entries): Add range checking. (rsrc_parse_entry): Likewise.
2014-11-05daily updateAlan Modra1-1/+1
2014-11-04Fix problem with linker created sections being mistakenly flaggedNick Clifton2-1/+6
as corrupt by the new error checking code in bfd_get_full_section_contents. PR binutils/17512 * compress.c (bfd_get_full_section_contents): Improve test for linker created objects.
2014-11-04Fix a seg-fault triggered by reading a mal-formed archive.Nick Clifton2-2/+13
PR binutils/17533 * archive.c (_bfd_slurp_extended_name_table): Handle archives with corrupt extended name tables.
2014-11-04Provide stat function for spu overlay manager iovecAlan Modra2-1/+18
Commit f54498b4 broke spu-elf, specifically the change "Do not try to load a string table bigger than the file", because bfd_get_size returns zero for the spu built-in overlay manager bfd. * elf32-spu.c (ovl_mgr_stat): New function. (spu_elf_open_builtin_lib): Pass to bfd_openr_iovec.
2014-11-04daily updateAlan Modra1-1/+1
2014-11-03When relaxing, update size of symbols.Andrew Burgess2-8/+37
When performing linker relaxation, reduce the size of symbols that span the deleted bytes. This ensures that, for example, function symbols will have the correct size. bfd/ChangeLog: * elf32-avr.c (elf32_avr_relax_delete_bytes): During linker relaxation, reduce the size of symbols that span the deleted bytes. ld/ChangeLog: * testsuite/ld-avr/relax-02.d: Update to check size of symbols has changed. * testsuite/ld-avr/relax-03.d: Likewise.
2014-11-03When relaxing, update symbols at the very end of the section.Andrew Burgess2-2/+7
Symbols at the very end of a section were not being updated correctly when linker relaxation takes place due to the use of '<' instead of '<='. Added a couple of tests to cover this behaviour. bfd/ChangeLog: * elf32-avr.c (elf32_avr_relax_delete_bytes): Modify symbols located at the very end of the section. ld/ChangeLog: * ld/testsuite/ld-avr/relax-02.d: New file. * ld/testsuite/ld-avr/relax-02.s: New file. * ld/testsuite/ld-avr/relax-03.d: New file. * ld/testsuite/ld-avr/relax-03.s: New file.
2014-11-03More fixes for buffer overruns instigated by corrupt binaries.Nick Clifton10-30/+124
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-03Import updated translations supplied by the Translation Project.Nick Clifton2-1576/+2055
bfd, binutils, gprof, opcodes: * po/fi.po: Updated Finnish translation. binutils: * po/sv.po: Updated Swedish translation. gprof: * po/hu.po: New Hungarian translation.
2014-11-03daily updateAlan Modra1-1/+1
2014-11-02daily updateAlan Modra1-1/+1
2014-11-01daily updateAlan Modra1-1/+1
2014-10-31MIPS: Add Octeon 3 supportNaveen H.S5-0/+32
binutils: 2014-10-31 Andrew Pinski <apinski@cavium.com> Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * readelf.c (print_mips_isa_ext): Print the value of Octeon3. gas: 2014-10-31 Andrew Pinski <apinski@cavium.com> Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * config/tc-mips.c (CPU_IS_OCTEON): Handle CPU_OCTEON3. (mips_cpu_info_table): Octeon3 enables virt ase. * doc/c-mips.texi: Document octeon3 as an acceptable value for -march=. gas/testsuite: 2014-10-31 Andrew Pinski <apinski@cavium.com> Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * gas/mips/mips.exp: Add support for Octeon3 architecture. Also add in support for running Octeon3 tests. * gas/mips/octeon3.d: New test. * gas/mips/octeon3.s: New test source. opcodes: 2014-10-31 Andrew Pinski <apinski@cavium.com> Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * mips-dis.c (mips_arch_choices): Add octeon3. * mips-opc.c (IOCT): Include INSN_OCTEON3. (IOCT2): Likewise. (IOCT3): New define. (IVIRT): New define. (mips_builtin_opcodes): Add dmfgc0, dmtgc0, hypcall, mfgc0, mtgc0, tlbinv, tlbinvf, tlbgr, tlbgwi, tlbginv, tlbginvf, tlbgwr, tlbgp, tlti IVIRT instructions. Extend mtm0, mtm1, mtm2, mtp0, mtp1, mtp2 instructions to take another operand for IOCT3. bfd: 2014-10-31 Andrew Pinski <apinski@cavium.com> Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * archures.c: Add octeon3 for mips target. * bfd-in2.h: Regenerate. * bfd/cpu-mips.c: Define I_mipsocteon3. nfo_struct): Add octeon3 support. * bfd/elfxx-mips.c: (_bfd_elf_mips_mach): Add support for octeon3. (mips_set_isa_flags): Add support for octeon3. (bfd_mips_isa_ext): Add bfd_mach_mips_octeon3. (mips_mach_extensions): Make bfd_mach_mips_octeon3 an extension of bfd_mach_mips_octeon2. (print_mips_isa_ext): Print the value of Octeon3.
2014-10-31Fix an (almost) infinite loop in the tekhex parser.Nick Clifton2-0/+4
PR binutils/17512 * tekhex.c (first_phase): Check that the section range is sane.
2014-10-31Avoid allocating over-large buffers when parsing corrupt binaries.Nick Clifton3-0/+18
PR binutils/17512 * coffgen.c (_bfd_coff_get_external_symbols): Do not try to load a symbol table bigger than the file. * elf.c (bfd_elf_get_str_section): Do not try to load a string table bigger than the file. * readelf.c (process_program_headers): Avoid memory exhaustion due to corrupt values in a dynamis segment header. (get_32bit_elf_symbols): Do not attempt to read an over-large section. (get_64bit_elf_symbols): Likewise.
2014-10-31daily updateAlan Modra1-1/+1
2014-10-30Fixes a seg-fault in the ihex parser when it encounters a malformed ihex file.Nick Clifton2-1/+2
PR binutils/17512 * ihex.c (ihex_scan): Fix typo in invocation of ihex_bad_byte.
2014-10-30Closes another memory corruption, this time due to heap overrun.Nick Clifton2-2/+11
PR binutils/17512 * coffgen.c (coff_get_normalized_symtab): Prevent buffer overrun.
2014-10-30daily updateAlan Modra1-1/+1
2014-10-29Fixes another memory corruption bug introduced by patches for PR 17512.Nick Clifton2-2/+7
* elf.c (bfd_section_from_shdr): Fix heap use after free memory leak.
2014-10-29Thix fixes an obvious coding error that led to a GDB crash on AIX or HPUX.Dennis Brueni2-1/+5
* elf.c (elfcore_write_lwpstatus): fix typo in call to memcpy
2014-10-29daily updateAlan Modra1-1/+1
2014-10-28More fixes for corrupt binaries crashing the binutils.Nick Clifton3-3/+30
PR binutils/17512 * elf.c (bfd_section_from_shdr): Allocate and free the recursion detection table on a per-bfd basis. * peXXigen.c (pe_print_edata): Handle binaries with a truncated export table.
2014-10-28This patch fixes a flaw in the SREC parser which could cause a stack overflowNick Clifton4-4/+11
and potential secuiryt breach. PR binutils/17510 * srec.c (srec_bad_byte): Increase size of buf to allow for negative values. (srec_scan): Use an unsigned char buffer to hold header bytes.
2014-10-28daily updateAlan Modra1-1/+1
2014-10-27This fixes more seg-faults in tools like "strings" and "objdump" whenNick Clifton3-67/+150
presented with corrupt binaries. PR binutils/17512 * elf.c (bfd_section_from_shdr): Detect and warn about ELF binaries with a group of sections linked by the string table indicies. * peXXigen.c (pe_print_edata): Detect out of range rvas and entry counts for the Export Address table, Name Pointer table and Ordinal table.
2014-10-27Fix a seg-fault in strings and other binutuils when parsing a corrupt PENick Clifton2-0/+16
executable with an invalid value in the NumberOfRvaAndSizes field of the AOUT header. PR binutils/17512 * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Handle corrupt binaries with an invalid value for NumberOfRvaAndSizes.
2014-10-27This patch closes a potential security hole in applications that useNick Clifton2-4/+36
the bfd library to parse binaries containing maliciously corrupt section group headers. PR binutils/17510 * elf.c (setup_group): Improve handling of corrupt group sections.
2014-10-27daily updateAlan Modra1-1/+1
2014-10-26daily updateAlan Modra1-1/+1
2014-10-25daily updateAlan Modra1-1/+1
2014-10-24[AArch64] Cortex-A53 erratum 835769 linker workaroundJiong Wang4-7/+671
2014-10-22 Tejas Belagod <tejas.belagod@arm.com> bfd/ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. (elf_aarch64_stub_type): Add new type aarch64_stub_erratum_835769_veneer. (elf_aarch64_stub_hash_entry): New fields for erratum 835769. (aarch64_erratum_835769_fix): New data struct to record erratum 835769. (elf_aarch64_link_hash_table: Global flags for 835769. (aarch64_build_one_stub): Add case for 835769. (aarch64_size_one_stub): Likewise. (aarch64_mem_op_p, aarch64_mlxl_p, aarch64_erratum_sequence,erratum_835769_scan): New. Decode and scan functions for erratum 835769. (elf_aarch64_create_or_find_stub_sec): New. (elfNN_aarch64_size_stubs): Look for erratum 835769 and record them. (bfd_elfNN_aarch64_set_options: Set global flag for 835769. (erratum_835769_branch_to_stub_data, make_branch_to_erratum_835769_stub):New. Connect up all the erratum stubs to occurances by branches. (elfNN_aarch64_write_section): New hook. (aarch64_map_one_stub): Output erratum stub symbol. (elfNN_aarch64_size_dynamic_sections): Init mapping symbol information for erratum 835769. (elf_backend_write_section): Define. ld/ * emultempl/aarch64elf.em: Add command-line option for erratum 835769. ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum 835769 tests. * ld-aarch64/erratum835769.d: New. * ld-aarch64/erratum835769.s: New.
2014-10-24daily updateAlan Modra1-1/+1
2014-10-23ARM: plt_size functions need to read instructions in right byte orderVictor Kamensky2-4/+32
elf32_arm_plt0_size and elf32_arm_plt_size read instructions to determine what is size of PLT entry. However it does not read instruction correctly in case of ARM big endian V7 case. In this case instructions are still kept in little endian order (BE8). * elf32-arm.c (read_code32): New function to read 32 bit arm instruction. (read_code16): New function to read 16 bit thumb instrution. (elf32_arm_plt0_size, elf32_arm_plt_size): Use read_code32 and read_code16 to read instructions.
2014-10-23daily updateAlan Modra1-1/+1