aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-10-09PR22212, memory leak in nmAlan Modra2-0/+10
PR 22212 * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free funcinfo_hash_table and varinfo_hash_table.
2017-10-08sh: Dump dynamic relocation info to the map fileH.J. Lu2-1/+14
Dump dynamic relocation info to the map file when generating dynamic relocation in read-only section relocations if -Map is used. * elf32-sh.c (readonly_dynrelocs): Dump dynamic relocation in read-only section with minfo. (sh_elf_size_dynamic_sections): Likewise.
2017-10-08sparc: Remove a strayed commentH.J. Lu2-2/+5
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Remove a strayed comment.
2017-10-09Automatic date update in version.inGDB Administrator1-1/+1
2017-10-08tilegx: Set this_hdr.sh_entsize only if section size > 0H.J. Lu2-9/+14
This fixes: /export/build/gnu/binutils-cross/build-tilegx-linux/ld/ld-new -o tmpdir/comm-data -z norelro -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf -T comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o sh: line 1: 9208 Segmentation fault (core dumped) /export/build/gnu/binutils-cross/build-tilegx-linux/ld/ld-new -o tmpdir/comm-data -z norelro -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf -T comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o 2>&1 FAIL: Common symbol override test * elfxx-tilegx.c (tilegx_elf_finish_dynamic_sections): Set this_hdr.sh_entsize only if section size > 0.
2017-10-08Reformat elf_x86_allocate_dynrelocsH.J. Lu2-2/+5
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Reformat.
2017-10-07sparc: Dump dynamic relocation info to the map fileH.J. Lu2-1/+16
Dump dynamic relocation info to the map file when generating dynamic relocation in read-only section relocations if -Map is used. * elfxx-sparc.c (readonly_dynrelocs): Dump dynamic relocation in read-only section with minfo. (_bfd_sparc_elf_size_dynamic_sections): Likewise.
2017-10-08Automatic date update in version.inGDB Administrator1-1/+1
2017-10-07Automatic date update in version.inGDB Administrator1-1/+1
2017-10-06x86: Update UNDEFINED_WEAK_RESOLVED_TO_ZERO commentsH.J. Lu2-7/+9
* elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Update comments.
2017-10-06x86: Use zero_undefweak in elf_x86_link_hash_entryH.J. Lu5-17/+29
Replace has_got_reloc and has_non_got_reloc in elf_x86_link_hash_entry with zero_undefweak: Bit 0: Symbol has no GOT nor PLT relocations. Bit 1: Symbol has non-GOT/non-PLT relocations in text sections. zero_undefweak is initialized to 1 and undefined weak symbol should be resolved to 0 if zero_undefweak > 0. * elf32-i386.c (elf_i386_check_relocs): Replace has_got_reloc and has_non_got_reloc with zero_undefweak. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_newfunc): Initialize zero_undefweak to 1. (_bfd_x86_elf_copy_indirect_symbol): Replace has_got_reloc and has_non_got_reloc with zero_undefweak. * elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace has_got_reloc and has_non_got_reloc with zero_undefweak. (elf_x86_link_hash_entry): Likewise.
2017-10-06Account for padding in FreeBSD/mipsn32 NT_PRSTATUS notes.John Baldwin5-0/+81
Add a new ELF backend method to grok FreeBSD NT_PRSTATUS core dump notes. Define a method for MIPS N32 to override the default elfcore_grok_freebsd_prstatus that accounts for additional padding between pr_pid and pr_reg that is not present in other 32-bit FreeBSD platforms. * elf-bfd.h (struct elf_backend_data): Add `elf_backend_grok_freebsd_prstatus'. * elf.c (elfcore_grok_freebsd_note): Call `elf_backend_grok_freebsd_prstatus' to handle NT_PRSTATUS if present. * elfn32-mips.c (elf_n32_mips_grok_freebsd_prstatus): New function. (elf_backend_grok_freebsd_prstatus): Define. * elfxx-target.h (elf_backend_grok_freebsd_prstatus): Define. (elfNN_bed): Initialize `elf_backend_grok_freebsd_prstatus'.
2017-10-06Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOCH.J. Lu2-15/+28
Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC to avoid potential dangling else problems. * elfxx-x86.h (COPY_INPUT_RELOC_P): Add "do/while(0);". (VERIFY_COPY_RELOC): Likewise.
2017-10-06x86: Add VERIFY_COPY_RELOCH.J. Lu4-14/+17
Add VERIFY_COPY_RELOC to verify that symbol supports copy relocation. * elfxx-x86.h (VERIFY_COPY_RELOC): New. * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it. * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
2017-10-06x86: Add VERIFY_PLT_ENTRYH.J. Lu4-23/+20
Add VERIFY_PLT_ENTRY to verify that symbol has an entry in the procedure linkage table. * elfxx-x86.h (VERIFY_PLT_ENTRY): New. * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it. * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
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.