aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
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
2014-10-22Show information about unknown ASEs and extensions in .MIPS.abiflagsMatthew Fortune2-1/+8
bfd/ * elfxx-mips.c (print_mips_ases): Print unknown ASEs. (print_mips_isa_ext): Print the value of an unknown extension. binutils/ * readelf.c (print_mips_ases): Print unknown ASEs. (print_mips_isa_ext): Print the value of an unknown extension. include/ * elf/mips.h (AFL_ASE_MASK): Define.
2014-10-22daily updateAlan Modra1-1/+1
2014-10-21Relax ppc64_elf_tls_optimize assertionAlan Modra2-1/+9
The code in ppc64_elf_tls_optimize looking at the .toc is only interested in .toc entries that are addresses. .toc can contain more than just an array of addresses, so if we have items that aren't 8-byte aligned, ignore them. * elf64-ppc.c (ppc64_elf_tls_optimize): Ignore relocs against toc entries that aren't a multiple of 8 rather than failing assertion.
2014-10-21Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7Alan Modra2-0/+11
powerpc64 ld builds plt call stubs with a read barrier to provide thread safety on lazy plt updates, necessary on multi-threaded apps with power7 or later weakly ordered memory. gcc-4.9 libgomp introduced more functions that could call pthread_create, which means we have more functions that if referenced in an executable should cause a default of --plt-thread-safe. * elf64-ppc.c (ppc64_elf_size_stubs): Add gcc-4.9 libgomp functions to thread_starter.
2014-10-21daily updateAlan Modra1-1/+1
2014-10-20daily updateAlan Modra1-1/+1
2014-10-19daily updateAlan Modra1-1/+1
2014-10-18PowerPC64 ELFv1 function symbol definition vs LTO and discarded sectionsAlan Modra2-43/+70
When functions are emitted in comdat groups, global symbols defined in duplicates of the group are treated as if they were undefined. That prevents the symbols in the discarded sections from affecting the linker's global symbol hash table or causing duplicate symbol errors. Annoyingly, when gcc emits a function to a comdat group, it does not put *all* of a function's code and data in the comdat group. Typically, constant tables, exception handling info, and debug info are emitted to normal sections outside of the group, which is a perennial source of linker problems due to the special handling needed to deal with the extra-group pieces that ought to be discarded. In the case of powerpc64-gcc, the OPD entry for a function is not put in the group. Since the function symbol is defined on the OPD entry this means we need to handle symbols in .opd specially. To see how this affects LTO in particular, consider the linker testcase PR ld/12942 (1). This testcase links an LTO object file pr12942a.o with a normal (non-LTO) object pr12942b.o. Both objects contain a definition for _Z4testv in a comdat group. On loading pr12942a.o, the linker sees a comdat group (actually linkonce section) for _Z4testv and a weak _Z4testv defined in the IR. On loading pr12942b.o, the linker sees the same comdat group, and thus discards it. However, _Z4testv is a weak symbol defined in .opd, not part of the group, so this weak symbol overrides the weak IR symbol. On (re)loading the LTO version of pr12942a.o, the linker sees another weak _Z4testv, but this one does not override the value we have from pr12942b.o. The result is a linker complaint about "`_Z4testv' ... defined in discarded section `.group' of tmpdir/pr12942b.o". * elf64-ppc.c (ppc64_elf_add_symbol_hook): If function code section for function symbols defined in .opd is discarded, let the symbol appear to be undefined. (opd_entry_value): Ensure the result section is that for the function code section in the same object as the OPD entry.
2014-10-18daily updateAlan Modra1-1/+1
2014-10-17daily updateAlan Modra1-1/+1
2014-10-16Fix 17492, ld segfault with --oformat=binaryAlan Modra11-39/+62
PR 17492 * elf32-arm.c (elf32_arm_add_symbol_hook): Only set has_gnu_symbols on ELF output bfd. * elf32-i386.c (elf_i386_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. * elf-s390-common.c (elf_s390_add_symbol_hook): Likewise. Handle STB_GNU_UNIQUE too.
2014-10-16PR17488, powerpc64-linux-ld segfaultAlan Modra2-65/+67
For binary ouput, we don't have an ELF bfd output so can't access elf_elfheader. The elf64-ppc.c changes are really just a tidy, triggered by looking at all places where the abiversion bits are accessed. bfd/ * elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing even when output is not ppc64 ELF. Remove redundant tests on type of input bfd. ld/ PR 17488 * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt to access ELF header e_flags when not ppc64 ELF output.
2014-10-16daily updateAlan Modra1-1/+1
2014-10-15Merge bfd_find_nearest_line variantsAlan Modra32-358/+261
When bfd_find_nearest_line_discriminator was added, not enough care was taken to ensure all targets had a proper definition of the function. This patch cures that by merging bfd_find_nearest_line_discriminator and bfd_find_nearest_line target implementations. PR 17481 * aoutx.h (NAME (aout, find_nearest_line)): Add "discriminator_ptr" param, group "section" and "offset" params. Zero discriminator. * bfd.c (bfd_find_nearest_line): Implement with new _bfd_find_nearest_line. (bfd_find_nearest_line_discriminator): Likewise. * coff-i386.c (_bfd_generic_find_nearest_line_discriminator): Don't define. * coff-rs6000.c (xcoff_find_nearest_line, xcoff_find_nearest_line_discriminator): Delete. (_bfd_xcoff_find_nearest_line): Don't define. (_bfd_xcoff_find_nearest_line): Define as coff_find_nearest_line. * coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator): Don't define. * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Adjust. * coffgen.c (coff_find_nearest_line_with_names): Reorder params, adjust _bfd_dwarf2_find_nearest_line call. (coff_find_nearest_line): Add "discriminator_ptr" param, reorder others. Set discriminator. Adjust call. (coff_find_nearest_line_discriminator): Delete. * dwarf1.c (_bfd_dwarf1_find_nearest_line): Reorder params. * dwarf2.c (find_line): Rename to.. (_bfd_dwarf2_find_nearest_line): ..this, reordering params. Simplify setting of do_line. Delete old function. (_bfd_dwarf2_find_line): Delete. * ecoff.c (_bfd_ecoff_find_nearest_line): Reorder params, add discriminator_ptr and set it. * elf-bfd.h (_bfd_elf_find_nearest_line): Update prototype. (_bfd_elf_find_nearest_line_discriminator): Delete. (_bfd_elf_find_line_discriminator): Delete. (_bfd_generic_find_nearest_line_discriminator): Don't define. * elf.c (elf_find_function): Reorder params. (_bfd_elf_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. (_bfd_elf_find_nearest_line_discriminator): Delete. (_bfd_elf_find_line): Adjust call. * elf32-arm.c (arm_elf_find_function): Reorder params. (elf32_arm_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * elf64-alpha.c (elf64_alpha_find_nearest_line): Similarly. * elfnn-aarch64.c (aarch64_elf_find_function): Reorder params. (elfNN_aarch64_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. * elfxx-mips.h (_bfd_mips_elf_find_nearest_line): Update prototype. * libaout.h (NAME (aout, find_nearest_line)): Update prototype. * libbfd-in.h (_bfd_nosymbols_find_nearest_line): Update. (_bfd_dwarf1_find_nearest_line): Likewise. (_bfd_dwarf2_find_nearest_line): Likewise. (_bfd_dwarf2_find_line): Delete. (_bfd_generic_find_nearest_line_discriminator): Delete. * libbfd.c (_bfd_generic_find_nearest_line_discriminator): Delete. * libcoff-in.h (coff_find_nearest_line): Update prototype. (coff_find_nearest_line_discriminator): Delete. (coff_find_nearest_line_with_names): Update prototype. * libecoff.h (_bfd_ecoff_find_nearest_line): Update prototype. * mach-o.c (bfd_mach_o_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * mach-o.h (bfd_mach_o_find_nearest_line): Update prototype. * pdp11.c (NAME (aout, find_nearest_line)): Reorder params, add discriminator_ptr and set. * som.c (som_find_nearest_line): Similarly. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Delete entry for _bfd_find_nearest_line_discriminator. (struct bfd_target <_bfd_find_nearest_line>): Adjust prototype. (struct bfd_target <_bfd_find_nearest_line_discriminator>): Delete. * vms-alpha.c (_bfd_vms_find_nearest_dst_line): Rename to.. (_bfd_vms_find_nearest_line): ..this. Reorder params, add "discriminator" and set. (_bfd_vms_find_nearest_line_discriminator): Delete. (_bfd_generic_find_nearest_line_discriminator): Don't define. (alpha_vms_find_nearest_line): Update define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-10-15Define bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME.Alan Modra35-64/+97
In https://www.sourceware.org/ml/binutils/2005-06/msg00082.html HJ implemented bfd_find_line for DWARF2, but cheated a little in not using the usual NAME##_find_line, saving quite a lot of boring editing. However that shortcut probably contributed to bfd_find_nearest_line_discriminator being implemented the same way, and missing support for some targets. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line. * aout-adobe.c (aout_32_find_line): Define. (aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup, aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define. * aout-target.h (MY_find_line): Define. * aout-tic30.c (MY_find_line): Define. * binary.c (binary_find_line): Define. * bout.c (aout_32_find_line): Define. * coff-rs6000.c (_bfd_xcoff_find_line): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line. (rs6000_xcoff64_aix_vec): Likewise. * elf-bfd.h (_bfd_generic_find_line): Don't define. * elfxx-target.h (bfd_elfNN_find_line): Define. * i386msdos.c (msdos_find_line): Define. * i386os9k.c (aout_32_find_line): Define. * ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func. (ieee_find_nearest_line, ieee_find_line, ieee_find_inliner_info): Define. * ihex.c (ihex_find_line): Define. * libbfd-in.h (_bfd_nosymbols_find_line): Define. (_bfd_generic_find_line): Don't define. * libbfd.c (_bfd_generic_find_line): Delete. * libcoff-in.h (coff_find_line): Define. * libecoff.h (_bfd_ecoff_find_line): Define. * mach-o.h (bfd_mach_o_find_line): Define. * mmo.c (mmo_find_line): Define. * nlm-target.h (nlm_find_line): Define. * oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete. (oasys_find_nearest_line, oasys_find_line, oasys_find_inliner_info): Define. * pef.c (bfd_pef_find_line): Define. * plugin.c (bfd_plugin_find_line): Define. * ppcboot.c (ppcboot_find_line): Define. * som.c (som_find_line): Define. * srec.c (srec_find_line): Define. * tekhex.c (tekhex_find_line): Define. * versados.c (versados_find_line): Define. * vms-alpha.c (alpha_vms_find_line): Define. * xsym.c (bfd_sym_find_line): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-10-15Bump bfd version.Tristan Gingold3-11/+16
bfd/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * version.m4: Bump version to 2.25.51 * configure: Regenerate. binutils/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gprof/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
2014-10-15daily updateAlan Modra1-1/+1
2014-10-14Convert mov to lea only if r_offset >= 2H.J. Lu3-0/+10
* elf32-i386.c (elf_i386_convert_mov_to_lea): Skip if relocation offset is less than 2. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
2014-10-14Avoid undefined behaviour with signed expressionsAlan Modra2-4/+9
PR 17453 bfd/ * libbfd.c (COERCE16, COERCE32, COERCE64): Use unsigned types. (EIGHT_GAZILLION): Delete. binutils/ * dwarf.c (read_leb128): Avoid signed overflow. (read_debug_line_header): Likewise. gas/ * config/tc-i386.c (fits_in_signed_long): Use unsigned param and expression to avoid signed overflow. (fits_in_signed_byte, fits_in_unsigned_byte, fits_in_unsigned_word, fits_in_signed_word, fits_in_unsigned_long): Similarly. * expr.c (operand <'-'>): Avoid signed overflow. * read.c (s_comm_internal): Likewise.
2014-10-14daily updateAlan Modra1-1/+1
2014-10-13Run eh_frame optimisation for relocatable linkAlan Modra3-15/+38
The idea here is to drop .eh_frame FDEs corresponding to dropped comdat group sections or linkonce sections, but not perform changes in encoding. bfd/ PR 17467 * elf-eh-frame.c (ENSURE_NO_RELOCS): Don't stop at first NONE reloc. (_bfd_elf_parse_eh_frame): When relocatable output, don't set flags enabling conversion of CIEs and FDEs to use relative encoding. (find_merged_cie): Similarly. (_bfd_elf_write_section_eh_frame): Don't edit FDEs when relocatable, except for CIE pointer. * elflink.c (bfd_elf_reloc_symbol_deleted_p): Return true for relocs against symbols in dropped comdat group sections. (bfd_elf_discard_info): Do some eh_frame optimisation when relocatable. ld/ * ldlang.c (lang_add_section): Set up map_head.s and map_tail.s when relocatable.
2014-10-13daily updateAlan Modra1-1/+1
2014-10-12daily updateAlan Modra1-1/+1
2014-10-11daily updateAlan Modra1-1/+1
2014-10-10daily updateAlan Modra1-1/+1
2014-10-09This is a series of patches that add support for the SPARC M7 cpu toJose E. Marchesi2-0/+12
binutils. They were discussed and approved here: https://sourceware.org/ml/binutils/2014-10/msg00038.html
2014-10-09daily updateAlan Modra1-1/+1
2014-10-08daily updateAlan Modra1-1/+1
2014-10-07daily updateAlan Modra1-1/+1
2014-10-06daily updateAlan Modra1-1/+1
2014-10-05daily updateAlan Modra1-1/+1
2014-10-04Discard zero address range eh_frame FDEsAlan Modra3-6/+35
These are useless because they can't match any address. In fact, worse than useless because the .eh_frame_hdr lookup table matching addresses to FDEs does not contain information about the FDE range. The table is sorted by address; Range is inferred by the address delta from one entry to the next. So if a zero address range FDE is followed by a normal non-zero range FDE for the same address, everything is good. However, the qsort could just as easily sort the FDEs in the other order, in which case the normal FDE would effectively be seen to have a zero range. bfd/ PR 17447 * elf-bfd.h (struct eh_cie_fde): Comment re NULL u.fde.cie_inf. * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Mark zero address range FDEs for discarding. (vma_compare): Sort on range after address. (_bfd_elf_gc_mark_fdes): Test for NULL u.fde.cie_inf. (_bfd_elf_discard_section_eh_frame): Likewise. Write "FDE" in error message rather than "fde". (_bfd_elf_write_section_eh_frame_hdr): Write "PC" and "FDE" in error message. ld/testsuite/ * ld-elf/eh1.s: Don't create FDEs with zero address ranges. * ld-elf/eh3.s: Likewise. * ld-elf/eh1.d, * ld-elf/eh2.d, * ld-elf/eh3.d: Adjust. * ld-mips-elf/eh-frame1-n32.d: Warning match update. * ld-mips-elf/eh-frame1-n64.d: Likewise. * ld-mips-elf/eh-frame2-n32.d: Likewise. * ld-mips-elf/eh-frame2-n64.d: Likewise.
2014-10-04daily updateAlan Modra1-1/+1
2014-10-03daily updateAlan Modra1-1/+1
2014-10-02daily updateAlan Modra1-1/+1
2014-10-01daily updateAlan Modra1-1/+1