aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-10-06x86: Add COPY_INPUT_RELOC_PH.J. Lu4-14/+17
Add COPY_INPUT_RELOC_P which returns TRUE if input relocation should be copied to output. * elfxx-x86.h (COPY_INPUT_RELOC_P): New. * elf32-i386.c (elf_i386_relocate_section): Use it. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2017-10-06x86: Add GENERATE_DYNAMIC_RELOCATION_PH.J. Lu4-57/+59
Add GENERATE_DYNAMIC_RELOCATION_P which returns TRUE if dynamic relocation should be generated. * elf32-i386.c (X86_SIZE_TYPE_P): New. (elf_i386_relocate_section): Use GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (X86_SIZE_TYPE_P): New. (elf_x86_64_relocate_section): Use GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): New.
2017-10-06x86: Add POINTER_LOCAL_IFUNC_P/PLT_LOCAL_IFUNC_PH.J. Lu4-16/+25
Add POINTER_LOCAL_IFUNC_P which returns TRUE for pointer reference to local IFUNC symbol. Add PLT_LOCAL_IFUNC_P which returns TRUE for PLT reference to local IFUNC symbol. * elfxx-x86.h (POINTER_LOCAL_IFUNC_P): New. (PLT_LOCAL_IFUNC_P): Likewise. * elf32-i386.c (elf_i386_relocate_section): Use them. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2017-10-06x86: Add GENERATE_RELATIVE_RELOC_PH.J. Lu4-8/+20
Add GENERATE_RELATIVE_RELOC_P which returns TRUE if dynamic relative relocation should be generated. * elfxx-x86.h (GENERATE_RELATIVE_RELOC_P): New. * elf32-i386.c (elf_i386_relocate_section): Use it. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2017-10-06x86: Add RESOLVED_LOCALLY_PH.J. Lu1-0/+6
Add RESOLVED_LOCALLY_P which returns TRUE if symbol is resolved to local definition at link-time. * elfxx-x86.h (RESOLVED_LOCALLY_P): New. * elf32-i386.c (elf_i386_relocate_section): Use it. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2017-10-06Add RESOLVED_LOCALLY_PH.J. Lu3-34/+21
2017-10-06x86: Add NEED_DYNAMIC_RELOCATION_PH.J. Lu4-85/+62
Add NEED_DYNAMIC_RELOCATION_P which returns TRUE if dynamic relocation is needed. * elf32-i386.c (X86_PCREL_TYPE_P): New. (elf_i386_check_relocs): Use NEED_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (IS_X86_64_PCREL_TYPE): Renamed to ... (X86_PCREL_TYPE_P): This. (elf_x86_64_check_relocs): Use NEED_DYNAMIC_RELOCATION_P. Replace IS_X86_64_PCREL_TYPE with X86_PCREL_TYPE_P. (elf_x86_64_relocate_section): Replace IS_X86_64_PCREL_TYPE with X86_PCREL_TYPE_P. * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): New.
2017-10-06x86: Add TLS_TRANSITION_IE_TO_LE_PH.J. Lu4-8/+15
Add TLS_TRANSITION_IE_TO_LE_P which returns TRUE if TLS IE->LE transition is OK. * elfxx-x86.h (TLS_TRANSITION_IE_TO_LE_P): New. * elf32-i386.c (elf_i386_tls_transition): Use it. * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
2017-10-05powerpc: Dump dynamic relocation info to the map fileH.J. Lu2-8/+32
Dump dynamic relocation info to the map file when generating dynamic relocation in read-only section relocations if -Map is used. * elf32-ppc.c (readonly_dynrelocs): Add a link_info argument. Dump dynamic relocation in read-only section with minfo if needed. (ppc_elf_adjust_dynamic_symbol): Pass NULL to readonly_dynrelocs. (maybe_set_textrel): Likewise. (ppc_elf_size_dynamic_sections): Dump dynamic relocation in read-only section with minfo.
2017-10-06Automatic date update in version.inGDB Administrator1-1/+1
2017-10-05Handle the NT_ARM_VFP core dump note on FreeBSD.John Baldwin2-0/+7
bfd/ChangeLog: * elf.c (elfcore_grok_freebsd_note): Handle NT_ARM_VFP.
2017-10-05tile: Dump dynamic relocation info to the map fileH.J. Lu3-2/+26
Dump dynamic relocation info to the map file when generating dynamic relocation in read-only section relocations if -Map is used. * elf32-tilepro.c (readonly_dynrelocs): Dump dynamic relocation in read-only section with minfo. (tilepro_elf_size_dynamic_sections): Likewise. * elfxx-tilegx.c (readonly_dynrelocs): Likewise. (tilegx_elf_size_dynamic_sections): Likewise.
2017-10-05bfd_set_input_errorPedro Alves5-21/+48
A downside to the 2017-10-04 PR22245 fix is that bfd_set_error can now silently accept invalid errors if/when someone passes the a value of the wrong enumeration type, which previously would be caught by the -Wenum-conversion warning. PR 22245 * bfd.c (bfd_set_error): Revert 2017-10-04 change. Remove ellipsis parameter. Split out bfd_error_on_input code to.. (bfd_set_input_error): .. New function. * archive.c (_bfd_write_archive_contents): Use bfd_set_input_error. * vms-lib.c (_bfd_vms_lib_write_archive_contents): Likewise. * bfd-in2.h: Regenerate.
2017-10-05bfd_error_on_input is for archivesAlan Modra2-1/+6
* elflink.c (elf_link_input_bfd): Correct ctor/dtor in init_array/ fini_array error value.
2017-10-05Automatic date update in version.inGDB Administrator1-1/+1
2017-10-05PR21167, relocation sections not included in groupsAlan Modra2-18/+39
This fixes a wart I've known about for years, but haven't done anything about because BFD treats relocation sections as an adjunct to the section they relocate. SHF_GROUP on the section thus implicitly applies to its relocation section(s), but it is an error that the reloc sections aren't part of the group. Like many patches to gas, this wasn't as straightforward as it could be due to a number of backends, i386, cr16 and others, removing relocs in tc_get_reloc rather than marking them as "done" earlier in md_apply_reloc. So it isn't possible for the group support to reliably detect the presence of relocs by looking at fixups earlier than write_relocs. However the group support needs to create signature symbols, and that must be done before the symbol table is frozen, before write_relocs. So split off the group sizing from elf_adjust_symtab and put it in elf_frob_file_after_relocs. bfd/ PR 21167 * elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from groups. (_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP flag from section. (elf_fake_sections): Adjust calls. Exit immediately on failure. (bfd_elf_set_group_contents): Add associated reloc section indices to group contents gas/ PR 21167 * config/obj-elf.c (struct group_list): Delete elt_count. (groups): New static. (build_group_lists): Don't count elements. (elf_adjust_symtab): Use groups rather than auto list. Set up pointer from group member to SHT_GROUP section. Don't size SHT_GROUP section or clean up here.. (elf_frob_file_after_relocs): ..do so here instead. * testsuite/gas/arc/jli-1.d, * testsuite/gas/elf/groupautob.d, * testsuite/gas/mips/compact-eh-eb-2.d, * testsuite/gas/mips/compact-eh-eb-5.d, * testsuite/gas/mips/compact-eh-el-2.d, * testsuite/gas/mips/compact-eh-el-5.d: Adjust. ld/ PR 21167 * testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04PowerPC64 ELFv2 symbols not needed in get_synthetic_symtabAlan Modra2-66/+80
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't sort or classify symbols for ELFv2.
2017-10-04PR22245, Fix potential UB in bfd_set_errorPavel I. Kryukov3-3/+10
Passing enum as a first argument to variadic argument function may lead to undefined behavior. The explanation on CERT site: https://www.securecoding.cert.org/confluence/display/cplusplus/ EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start The bug was found by Kirill Nedostoev (nedostoev.ka@phystech.edu) when he tried to build GNU binutils with Clang 7. PR 22245 * bfd.c (bfd_set_error): Avoid UB on passing arg to va_start that undergoes default promotion. * bfd-in2.h: Regenerate.
2017-10-04Automatic date update in version.inGDB Administrator1-1/+1
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.