aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-10-03Automatic date update in version.inGDB Administrator1-1/+1
2017-10-02Fix powerpc comment typoAlan Modra3-2/+7
* elf32-ppc.c (ppc_elf_relocate_section): Fix comment typo. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
2017-10-02Automatic date update in version.inGDB Administrator1-1/+1
2017-10-01PR21957, addr2line incorrectly handles non-increasing sequences in line tableAlan Modra2-4/+9
PR 21957 * dwarf2.c (new_line_sorts_after): Remove end_sequence comparison. (add_line_info): Always put end_sequence last.
2017-10-01PR22047, Heap out of bounds read in parse_comp_unitAlan Modra2-38/+22
Like the PR22230 fix, we can allocate a buffer with an extra byte rather than letting bfd_simple_get_relocated_section_contents malloc and return a buffer. Much better than allocating another buffer afterwards. PR 22047 * dwarf2.c (read_section): Allocate buffer with extra byte for bfd_simple_get_relocated_section_contents rather than copying afterwards.
2017-10-01Automatic date update in version.inGDB Administrator1-1/+1
2017-09-30Automatic date update in version.inGDB Administrator1-1/+1
2017-09-29Fail when string merge can't alloc memoryAlan Modra2-7/+15
I was looking at Debian bug #874674 again today, and think I might have spotted the problem. It appears that merge.c tries to cope with memory allocation failures in some circumstances, but doesn't quite manage to get everything right. This patch will make ld report memory allocation failures instead of silently not merging strings. * merge.c (merge_strings): Return FALSE on malloc failure. (_bfd_merge_sections): Return failures from record_section and merge_strings.
2017-09-29Automatic date update in version.inGDB Administrator1-1/+1
2017-09-28PR22220, BFD linker wrongly marks symbols as PREVAILING_DEF_IRONLYAlan Modra2-0/+16
non_ir_ref_dynamic wasn't being set in the case where we have a versioned dynamic symbol definition with a non-versioned matching IR symbol. bfd/ PR 22220 * elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in a case where plugin_notice isn't called. ld/ * testsuite/ld-plugin/pr22220.h, * testsuite/ld-plugin/pr22220lib.cc, * testsuite/ld-plugin/pr22220lib.ver, * testsuite/ld-plugin/pr22220main.cc: New test. * testsuite/ld-plugin/lto.exp: Run it.
2017-09-28Automatic date update in version.inGDB Administrator1-1/+1
2017-09-27nds32: Fix a tautological comparison.Kuan-Lin Chen2-1/+6
2017-09-27Automatic date update in version.inGDB Administrator1-1/+1
2017-09-26x86-64: Don't pass output_bfd to info->callbacks->minfoH.J. Lu2-1/+6
Don't pass output_bfd to info->callbacks->minfo when dumping local IFUNC functions in the map file. PR ld/22199 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't pass output_bfd to info->callbacks->minfo.
2017-09-26Fix an assertion failure when parsing a fuzzed x86_64 ELF binary.Nick Clifton2-1/+9
PR 22172 * elf64-x86-64.c (elf_x86_64_info_to_howto): Do not trigger an assertion failure if elf_x86_64_rtype_to_howto has already issued an error message.
2017-09-26Tidy reading data in read_formatted_entriesAlan Modra2-30/+13
Using read_attribute_value accomplishes two things: It checks for unexpected formats, and ensures the buffer pointer always increments. PR 22210 * dwarf2.c (read_formatted_entries): Use read_attribute_value to read data.
2017-09-26Avoid needless resource usage when processing a corrupt DWARF directory or ↵Nick Clifton2-0/+17
file name table. PR 22210 * dwarf2.c (read_formatted_entries): Fail early if we know that the loop parsing data entries will overflow the end of the section.
2017-09-26PR22209, invalid memory read in find_abstract_instance_nameAlan Modra2-15/+52
This patch adds bounds checking for DW_FORM_ref_addr die refs, and calculates them relative to the first .debug_info section. See the big comment for why calculating relative to the current .debug_info section was wrong for relocatable object files. PR 22209 * dwarf2.c (struct comp_unit): Delete sec_info_ptr field. (find_abstract_instance_name): Calculate DW_FORM_ref_addr relative to stash->info_ptr_memory, and check die_ref is within that memory. Set info_ptr_end correctly when another CU is refd. Check die_ref for DW_FORM_ref4 etc. is within CU.
2017-09-26PR22205, .debug_line file table NULL filenameAlan Modra2-22/+20
The PR22200 fuzzer testcase found one way to put NULLs into .debug_line file tables. PR22205 finds another. This patch gives up on trying to prevent NULL files in the file table and instead just copes with them. Arguably, this is better than giving up and showing no info from .debug_line. I've also fixed a case where the fairly recent DWARF5 support in handling broken DWARG could result in uninitialized memory reads, and made a small tidy. PR 22205 * dwarf2.c (concat_filename): Return "<unknown>" on NULL filename. (read_formatted_entries): Init "fe". (decode_line_info <DW_LNE_define_file>): Use line_info_add_file_name.
2017-09-26PR22204, Lack of DW_LNE_end_sequence causes "infinite" loopAlan Modra2-1/+7
PR 22204 * dwarf2.c (decode_line_info): Ensure line_ptr stays within bounds in inner loop.
2017-09-26Automatic date update in version.inGDB Administrator1-1/+1
2017-09-25PR22202, buffer overflow in parse_dieAlan Modra2-18/+45
There was a complete lack of sanity checking in dwarf1.c PR 22202 * dwarf1.c (parse_die): Sanity check pointer against section limit before dereferencing. (parse_line_table): Likewise.
2017-09-25PR22201, DW_AT_name with out of bounds referenceAlan Modra2-2/+11
DW_AT_name ought to always have a string value. PR 22201 * dwarf2.c (scan_unit_for_symbols): Ignore DW_AT_name unless it has string form. (parse_comp_unit): Likewise.
2017-09-25PR22200, DWARF5 .debug_line sanity checkAlan Modra2-0/+12
The format_count entry can't be zero unless the count is also zero. PR 22200 * dwarf2.c (read_formatted_entries): Error on format_count zero.
2017-09-25Automatic date update in version.inGDB Administrator1-1/+1
2017-09-24PR22197, buffer overflow in bfd_get_debug_link_info_1Alan Modra2-1/+7
PR 22197 * opncls.c (bfd_get_debug_link_info_1): Properly check that crc is within section bounds.
2017-09-24PR22191, memory leak in dwarf2.cAlan Modra2-2/+11
table->sequences is a linked list before it is replaced by a bfd_alloc array in sort_line_sequences. PR 22191 * dwarf2.c (decode_line_info): Properly free line sequences on error.
2017-09-24PR22187, infinite loop in find_abstract_instance_nameAlan Modra2-25/+61
This patch prevents the simple case of infinite recursion in find_abstract_instance_name by ensuring that the attributes being processed are not the same as the previous call. The patch also does a little cleanup, and leaves in place some changes to the nested_funcs array that I made when I wrongly thought looping might occur in scan_unit_for_symbols. PR 22187 * dwarf2.c (find_abstract_instance_name): Add orig_info_ptr and pname param. Return status. Make name const. Don't abort, return an error. Formatting. Exit if current info_ptr matches orig_info_ptr. Update callers. (scan_unit_for_symbols): Start at nesting_level of zero. Make nested_funcs an array of structs for extensibility. Formatting.
2017-09-24PR22186, divide-by-zero in decode_line_infoAlan Modra2-0/+8
PR 22186 * dwarf2.c (decode_line_info): Fail on lh.line_range of zero rather than dividing by zero.
2017-09-24PR22169, heap-based buffer overflow in read_1_byteAlan Modra2-3/+9
The .debug_line header length field doesn't include the length field itself, ie. it's the size of the rest of .debug_line. PR 22169 * dwarf2.c (decode_line_info): Correct .debug_line unit_length check.
2017-09-24PR22167, NULL pointer dereference in scan_unit_for_symbolsAlan Modra2-1/+7
PR 22167 * dwarf2.c (scan_unit_for_symbols): Check u.blk->data is non-NULL.
2017-09-24PR22166, SHT_GNU_verneed memory allocationAlan Modra2-2/+10
The sanity check covers the previous minimim size, plus that the size is at least enough for sh_info verneed entries. Also, since we write all verneed fields or exit with an error, there isn't any need to zero the memory allocated for verneed entries. PR 22166 * elf.c (_bfd_elf_slurp_version_tables): Test sh_info on SHT_GNU_verneed section for sanity. Don't zalloc memory for verref.
2017-09-24Automatic date update in version.inGDB Administrator1-1/+1
2017-09-23Automatic date update in version.inGDB Administrator1-1/+1
2017-09-22x86: Guard against corrupted PLTH.J. Lu2-0/+10
There should be only one entry in PLT for a given symbol. Set howto to NULL after processing a PLT entry to guard against corrupted PLT so that the duplicated PLT entries are skipped. PR binutils/22170 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Guard against corrupted PLT.
2017-09-22Update ChangeLog entry for PR 22163H.J. Lu1-1/+1
2017-09-22x86: Return -1 if bfd_canonicalize_dynamic_reloc returns 0H.J. Lu2-1/+7
Stop if bfd_canonicalize_dynamic_reloc returns 0. PR ld/22163 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Also return -1 if bfd_canonicalize_dynamic_reloc returns 0.
2017-09-22bfd/version.h: Add rationale for BFD_VERSION_DATEPedro Alves2-0/+23
bfd/ChangeLog: 2017-09-22 Pedro Alves <palves@redhat.com> Alan Modra <amodra@gmail.com> * version.h: Add comment.
2017-09-22Automatic date update in version.inGDB Administrator1-1/+1
2017-09-21S/390: Fix Elf note swap s390_gs_bc vs. s390_gs_cbAndreas Arnez2-2/+8
Fix two typos that resulted in swapping the BFD names for the core note register sections NT_S390_GS_CB and NT_S390_GS_BC. bfd/ChangeLog: * elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and NT_S390_GS_BC, correct the previously swapped invocations of elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb.
2017-09-21Automatic date update in version.inGDB Administrator1-1/+1
2017-09-20Automatic date update in version.inGDB Administrator1-1/+1
2017-09-19PowerPC64 stubs don't match calculated sizeAlan Modra2-6/+7
After the PR 21411 fix, the linker generated .eh_frame for ppc64 glink can be edited by the generic code. The sequence of events goes something like: 1) Some object file adds .eh_frame aligned to 8, making the output .eh_frame aligned to at least 8, so linker generated .eh_frame FDE is padded to an 8 byte boundary. 2) All .eh_frame past the glink .eh_frame is garbage collected. 3) Generic code detects that last FDE (the glink .eh_frame) doesn't need to be padded to an 8 byte boundary, reducing size from 88 to 84. 4) elf64-ppc.c check fails. PR 21441 * elf64-ppc.c (ppc64_elf_build_stubs): Don't check glink_eh_frame size.
2017-09-19PR22150, ld keeps a version reference for gc'd symbolsAlan Modra2-117/+118
elf_gc_sweep_symbol should run after verdefs are calculated, since the verdef code creates symbols for the versions. However, elf_gc_sweep_symbol needs to run before verrefs so as to not emit useless verrefs for symbols that are gc'd. I've also removed a _bfd_elf_link_renumber_dynsyms calls added by Maciej after I fussed about it when reviewing. On further examination the call appears to be unnecessary. Looking at renumber_dynsyms also made me realize that the test to exclude .gnu.version has been wrong since 2016-04-26 (git commit d5486c4372), so fix that too. PR 22150 * elflink.c (bfd_elf_size_dynamic_sections): Garbage collect symbols before calculating verrefs. Don't renumber dynsyms after gc. Exclude .gnu.version when zero or one dynsym. Localize some vars and reindent.
2017-09-19Automatic date update in version.inGDB Administrator1-1/+1
2017-09-18Check error return from bfd_canonicalize_dynamic_relocH.J. Lu2-0/+8
Since bfd_canonicalize_dynamic_reloc returns -1 on error, check it in _bfd_x86_elf_get_synthetic_symtab. PR ld/22148 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Check error return from bfd_canonicalize_dynamic_reloc.
2017-09-18Automatic date update in version.inGDB Administrator1-1/+1
2017-09-17Automatic date update in version.inGDB Administrator1-1/+1
2017-09-16Automatic date update in version.inGDB Administrator1-1/+1
2017-09-15Error when 32-bit ar tries to handle 4G or larger filesAlan Modra2-0/+12
We used to silently truncate the size returned by stat() to 32 bits. While it is possible to make binutils handle a 64-bit off_t on a 32-bit host, to me the effort needed doesn't seem worth the benefit. Instead, error if we truncate the size. I've written the test the way I have to avoid a signed/unsigned warning. PR 22116 * archive.c (bfd_ar_hdr_from_filesystem): Detect when status.st_size overflows bfd_size_type.