aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2020-08-31PR26493 UBSAN: elfnn-riscv.c left shift of negative valueAlan Modra2-3/+10
include/ PR 26493 * opcode/riscv.h (OP_MASK_CSR, OP_MASK_CUSTOM_IMM) (OP_MASK_FUNCT7, OP_MASK_RS3): Make unsigned. bfd/ PR 26493 * elfnn-riscv.c (riscv_make_plt_header): Cast PLT_HEADER_SIZE to unsigned when using with RISCV_ITYPE. (_bfd_riscv_relax_call): Use an unsigned foff.
2020-08-31PR26476, PR26477 UBSAN: elfxx-mips.c:2695,5370 cannot be representedAlan Modra2-5/+14
PR 26476 PR 26477 * elfxx-mips.c (CRINFO_CTYPE, CRINFO_RTYPE, CRINFO_DIST2TO), (CRINFO_RELVADDR): Make unsigned. (mips_elf_nullify_got_load): Use unsigned constant when shifting into sign bit.
2020-08-31PR26466 UBSAN: elf32-mep.c:300 left shift of negative valueAlan Modra3-50/+57
PR 26466 * mep-relocs.pl (emit_apply): Handle HI16S adjustment. Use "u" variable and rewrite signed overflow check. * elf32-mep.c: Regenerate. (mep_final_link_relocate): Delete "s".
2020-08-31PR26461 UBSAN: elfxx-ia64.c:747 cannot be representedAlan Modra2-3/+9
PR 26461 * elfxx-ia64.c (ia64_elf_install_value): Make expressions unsigned that might shift values into sign bit.
2020-08-31PR26445 UBSAN: elf32-csky.c:4115 left shift of negative valueAlan Modra2-12/+18
PR 26445 * elf32-csky.c (csky_relocate_contents): Make relocation a bfd_vma, and similarly for variables dealing with overflow.
2020-08-31PR26442 UBSAN: elf32-crx.c:512 cannot be represented in intAlan Modra2-14/+13
PR 26442 * elf32-crx.c (crx_elf_final_link_relocate): Calculate reloc_bits without undefined behaviour. Tidy excess casts.
2020-08-31mn10300: ubsan: shift exponent too largeAlan Modra2-8/+16
* elf-m10300.c (mn10300_elf_relax_delete_bytes): Calculate alignment from reloc addend after reloc type R_MN10300_ALIGN is found.
2020-08-31Automatic date update in version.inGDB Administrator1-1/+1
2020-08-30PR26435, PR26436 UBSAN: elf32-cr16.c:928 left shiftAlan Modra2-4/+8
PR 26435 PR 26436 * elf32-cr16.c (cr16_elf_final_link_relocate): Calculate reloc_bits without undefined behaviour.
2020-08-30Automatic date update in version.inGDB Administrator1-1/+1
2020-08-29Include members in the variable table used when resolving ↵Nick Clifton2-2/+9
DW_AT_specification tags. PR 26520 * dwarf2.c (scan_unit_for_symbols): Add member entries to the variable table.
2020-08-29correct pr number in changelogAlan Modra1-1/+1
2020-08-29PR26459 UBSAN: elfnn-ia64.c:1945 null pointer bsearchAlan Modra2-19/+27
PR 26495 * elfnn-ia64.c (get_dyn_sym_info): Don't bsearch or look at last element when count is zero. bfd_realloc when shrinking.
2020-08-29Automatic date update in version.inGDB Administrator1-1/+1
2020-08-28PR26418 UBSAN: cache.c:386 null pointer fwriteAlan Modra2-2/+8
And some more. PR 26418 * ecofflink.c (bfd_ecoff_write_accumulated_debug): Don't write zero size buffers.
2020-08-28PR26418 UBSAN: cache.c:386 null pointer fwriteAlan Modra2-1/+6
The previous "fix" tested the wrong value. PR 26418 * ecofflink.c (WRITE): Really don't write zero size chunks.
2020-08-28Prevent the linker from overestimating the alignment requirement of common ↵Tuckker2-2/+13
symbols on targets with octets that are larger than one byte. PR 26543 * linker.c (bfd_generic_define_common_symbol): Force the alignment to 1 if the section has now alignment requirement.
2020-08-28CSKY: Support attribute section.Cooper Qu2-54/+320
bfd * elf32-csky.c (csky_archs): Fix arch names. (csky_find_arch_with_name): New. (elf32_csky_merge_attributes): New. (csky_elf_merge_private_bfd_data): Add process of merge attribute section. (elf32_csky_obj_attrs_arg_type): New. (elf32_csky_obj_attrs_handle_unknown): New. (elf_backend_obj_attrs_vendor): Define. (elf_backend_obj_attrs_section): Define. (elf_backend_obj_attrs_arg_type): Define. (elf_backend_obj_attrs_section_type): Define. binutils/ * readelf.c (get_csky_section_type_name): New. (get_section_type_name): Add handler for CSKY. (display_csky_attribute): New. (process_arch_specific): Add handler for CSKY. * testsuite/binutils-all/strip-3.d: Remove .csky.attributes section. elfcpp/ * elfcpp.h (enum SHT): New enum SHT_CSKY_ATTRIBUTES. gas/ * gas/config/tc-csky.c (md_begin): Set attributes. (isa_flag): Change type to unsigned 64 bits. (struct csky_cpu_info): Likewise. (struct csky_macro_info): Likewise. (set_csky_attribute): New. * testsuite/gas/csky/802j.d: Ignore .csky.attributes section. * testsuite/gas/csky/all.d: Likewise. * testsuite/gas/csky/bsr1.d: Likewise. * testsuite/gas/csky/csky_vdsp.d: Likewise. * testsuite/gas/csky/cskyv2_all.d: Likewise. * testsuite/gas/csky/cskyv2_ck803r2.d: Likewise. * testsuite/gas/csky/cskyv2_ck860.d: Likewise. * testsuite/gas/csky/cskyv2_dsp.d: Likewise. * testsuite/gas/csky/cskyv2_elrw.d: Likewise. * testsuite/gas/csky/cskyv2_float.d: Likewise. * testsuite/gas/csky/enhance_dsp.d: Likewise. * testsuite/gas/csky/java.d: Likewise. * testsuite/gas/csky/v1_float.d: Likewise. * testsuite/gas/csky/v2_float_part1.d: Likewise. * testsuite/gas/csky/v2_float_part2.d: Likewise. * testsuite/gas/csky/v2_tls_gd.d: Likewise. * testsuite/gas/csky/v2_tls_ie.d: Likewise. * testsuite/gas/csky/v2_tls_ld.d: Likewise. * testsuite/gas/csky/v2_tls_le.d: Likewise. * testsuite/gas/elf/elf.exp: Add handler for CSKY. * testsuite/gas/elf/section2.e-csky: New. include/ * elf/csky.h (SHT_CSKY_ATTRIBUTES): Define. (Tag_CSKY_ARCH_NAME): New enum constant. (Tag_CSKY_CPU_NAME): Likewise. (Tag_CSKY_ISA_FLAGS): Likewise. (Tag_CSKY_DSP_VERSION): Likewise. (Tag_CSKY_VDSP_VERSION): Likewise. (Tag_CSKY_FPU_VERSION): Likewise. (Tag_CSKY_FPU_ABI): Likewise. (Tag_CSKY_FPU_ROUNDING): Likewise. (Tag_CSKY_FPU_DENORMAL): Likewise. (Tag_CSKY_FPU_Exception): Likewise. (Tag_CSKY_FPU_NUMBER_MODULE): Likewise. (Tag_CSKY_FPU_HARDFP): Likewise. (Tag_CSKY_MAX): Likewise. (VAL_CSKY_DSP_VERSION_EXTENSION): Likewise. (VAL_CSKY_DSP_VERSION_2): Likewise. (VAL_CSKY_VDSP_VERSION_1): Likewise. (VAL_CSKY_VDSP_VERSION_2): Likewise. (VAL_CSKY_FPU_ABI_SOFT): Likewise. (VAL_CSKY_FPU_ABI_SOFTFP): Likewise. (VAL_CSKY_FPU_ABI_HARD): Likewise. (VAL_CSKY_FPU_HARDFP_HALF): Likewise. (VAL_CSKY_FPU_HARDFP_SINGLE): Likewise. (VAL_CSKY_FPU_HARDFP_DOUBLE): Likewise. * opcode/csky.h (CSKY_ISA_VDSP_V2): Define. CSKYV1_ISA_E1: Change to long constant type. CSKYV2_ISA_E1: Likewise. CSKYV2_ISA_1E2: Likewise. CSKYV2_ISA_2E3: Likewise. CSKYV2_ISA_3E7: Likewise. CSKYV2_ISA_7E10: Likewise. CSKYV2_ISA_3E3R1: Likewise. CSKYV2_ISA_3E3R2: Likewise. CSKYV2_ISA_10E60: Likewise. CSKY_ISA_TRUST: Likewise. CSKY_ISA_CACHE: Likewise. CSKY_ISA_NVIC: Likewise. CSKY_ISA_CP: Likewise. CSKY_ISA_MP: Likewise. CSKY_ISA_MP_1E2: Likewise. CSKY_ISA_JAVA: Likewise. CSKY_ISA_MAC: Likewise. CSKY_ISA_MAC_DSP: Likewise. CSKY_ISA_DSP: Likewise. CSKY_ISA_DSP_1E2: Likewise. CSKY_ISA_DSP_ENHANCE: Likewise. CSKY_ISA_FLOAT_E1: Likewise. CSKY_ISA_FLOAT_1E2: Likewise. CSKY_ISA_FLOAT_1E3: Likewise. CSKY_ISA_FLOAT_3E4: Likewise. CSKY_ISA_VDSP: Likewise. ld/ * emulparams/cskyelf.sh: Support attribute section. * testsuite/ld-csky/tls-le-v1.d: Match .csky.attributes section. * ld/testsuite/ld-csky/tls-le.d: Likewise. * testsuite/ld-elf/non-contiguous.ld: Ignore .csky.attributes section. opcodes/ * csky-dis.c (CSKY_DEFAULT_ISA): Define. (csky_dis_info): Add member isa. (csky_find_inst_info): Skip instructions that do not belong to current CPU. (csky_get_disassembler): Get infomation from attribute section. (print_insn_csky): Set defualt ISA flag. * csky.h (CSKY_ISA_VDSP_2): Rename from CSKY_ISA_VDSP_V2. * csky-opc.h (struct csky_opcode): Change isa_flag16 and isa_flag32'type to unsigned 64 bits.
2020-08-28Fixes for testsuite failures introduced by the changes made for PR 19011.Nick Clifton2-3/+16
PR19011 bfd * cofflink.c (_bfd_coff_generic_relocate_section): Provide a value for undefined symbols which will not generate extra warning messages about truncated relocs. ld * testsuite/lib/ld-lib.exp (ld_link_defsyms): For PE based targets define the __main and ___main symbols in terms of the main symbol.
2020-08-28RISC-V: Treat R_RISCV_CALL and R_RISCV_CALL_PLT as the same in check_relocs.Nelson Chu2-9/+17
In fact, we can treate these two relocation as the same one in the riscv_elf_check_relocs. I have heard that RISC-V lld had made this improvement, and so had GNU AARCH64, they only need R_AARCH64_CALL26 for calls rather than two seperate relocations. Beside, the following PLT issue for RISC-V 32-bit glibc seems to be fixed by applying at least this patch. <https://sourceware.org/pipermail/libc-alpha/2020-August/117214.html> I have ran the toolchain regression, and everything seems fine for now. bfd/ * elfnn-riscv.c (riscv_elf_check_relocs): Treat R_RISCV_CALL and R_RISCV_CALL_PLT as the same in the riscv_elf_check_relocs. (riscv_elf_relocate_section): Remove the R_RISCV_CALL for the unresolved reloc checks. ld/ testsuite/ld-riscv-elf/lib-nopic-01a.s: Use R_RISCV_JAL rather than R_RISCV_CALL. testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise. testsuite/ld-riscv-elf/lib-nopic-01b.s: Likewise.
2020-08-28Automatic date update in version.inGDB Administrator1-1/+1
2020-08-27Fix PR binutils/26356 on hppa*-*-hpux*.John David Anglin2-2/+18
PR 26356 * som.c (som_bfd_copy_private_section_data): Issue error when a subspace is specified without its containing space. * testsuite/binutils-all/objcopy.exp (objcopy --reverse-bytes): Add "-j $PRIVATE$" to command on hppa*-*-hpux*. * testsuite/lib/utils-lib.exp (default_binutils_run): Remove existing dollar-sign quotes before quoting. Do this prior to generating log output.
2020-08-27PR26469 UBSAN: elflink.c:8742 shift exponent 6148914691236511722Alan Modra5-25/+69
PR 26469 * elflink.c: Include limits.h. (CHAR_BIT): Provide fallback define. (set_symbol_value): Correct complex reloc comment. (undefined_reference): Set bfd_error. (BINARY_OP_HEAD, BINARY_OP_TAIL): Split out from.. (BINARY_OP): ..this. (eval_symbol): Limit shifts. Force unsigned for left shift. Catch divide by zero. * configure.ac (AC_CHECK_HEADERS): Combine, sort and add limits.h. * configure: Regenerate. * config.in: Regenerate.
2020-08-27PR26462 UBSAN: reloc.c:473 shift exponent 4294967295Alan Modra2-0/+8
PR 26462 * reloc.c (bfd_check_overflow): Return early if zero bitsize.
2020-08-27arm-symbianelf segfaultAlan Modra2-1/+8
Yes, the target is marked obsolete due to this and other segfaults, but this one is easy enough to fix. * elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault on sym_sec not being output.
2020-08-27Re: commit eae0b5c3b2d6bAlan Modra2-3/+7
PR 26416 * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Correct "dynamic".
2020-08-27Automatic date update in version.inGDB Administrator1-1/+1
2020-08-26Fix sanitization problems in the BFD library when running the linker ↵Nick Clifton2-7/+13
testsuite for the AVR target. PR 26433 * elf32-avr.c (avr_final_link_relocate): Fix undefined shift behaviour. (avr_elf32_load_records_from_section): Use bfd_get_16 and bfd_get_32 to load values from potentially unaligned pointers.
2020-08-26Fix sanitization problems running the linker testsuite for the alpha-elf target.Nick Clifton2-11/+27
PR 26416 * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Test for and ignore local symbols. (elf64_alpha_relax_got_load): Do not check for local dynamic symbols. (OP_LDA, OP_LDAH, OP_LDQ, OP_BR, OP_BSR): Use unsigned constant values. (INSN_A) Cast the A parameter to unsigned. (INSN_AB): Define in terms of INSN_A. (INSN_ABC): Likewise. (INSN_ABO): Likewise. (INSN_AD): Likewise.
2020-08-26Fix a sanitization problem running the linker testsuite for the AArch64 target.Nick Clifton2-1/+8
PR 26411 * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use an unsigned long constant when creating a mask to test for alignment issues.
2020-08-26PR26507 UBSAN: elf32-xtensa.c:6013 null pointer bsearchAlan Modra2-6/+14
PR 26507 * elf32-xtensa.c (find_removed_literal): Don't bsearch empty map.
2020-08-26PR26506 UBSAN: elf32-xtensa.c:3203 null pointer memcpyAlan Modra2-0/+9
PR 26506 * elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early when section is empty.
2020-08-26PR26498 UBSAN: elf32-spu.c:2292 left shift overflowAlan Modra2-2/+8
PR 26498 * elf32-spu.c (find_function_stack_adjust): Use unsigned vars to avoid UB left shift.
2020-08-26PR 26484-26488, 26490 UBSAN &h->elf null pointerAlan Modra2-18/+40
PR 26484 PR 26485 PR 26486 PR 26487 PR 26488 PR 26490 * elf64-ppc.c (is_tls_get_addr): Avoid UB &h->elf when h is NULL. (ppc64_elf_tls_setup): Likewise. (branch_reloc_hash_match): Likewise. (build_plt_stub): Likewise. (ppc64_elf_relocate_section): Likewise.
2020-08-26PR26478 UBSAN: mmo.c:2941 null pointer memcpyAlan Modra2-1/+7
PR 26478 * mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
2020-08-26PR26475 UBSAN: elfxx-mips.c:12180 null pointer memsetAlan Modra2-1/+8
Another memset(0,0,0) PR 26475 * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Check sstubs->contents != NULL.
2020-08-26PR26453 UBSAN: som.c:2885 null pointer memcpyAlan Modra2-0/+8
PR 26453 * som.c (som_prep_for_fixups): Return early when no symbols.
2020-08-26PR26418 UBSAN: cache.c:386 null pointer fwriteAlan Modra2-4/+11
PR 26418 * ecofflink.c (WRITE): Don't write size 0 chunks.
2020-08-26asan: alpha-vms: mmember access within null pointerAlan Modra2-7/+15
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
2020-08-26PR26415 UBSAN: vms-misc.c:636 left shift cannot be representedAlan Modra2-2/+7
An unsigned short value is promoted to int, thus triggering UB on a left shift of a positive value that results in a negative int. PR 26415 * vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars.
2020-08-26bpf: add xBPF ISADavid Faust4-1/+30
This patch adds support for xBPF, another ISA targetting the BPF virtual architecture. For now, the primary difference between eBPF and xBPF is that xBPF supports indirect calls through the 'call %reg' form of the call instruction. bfd/ * archures.c (bfd_mach_xbpf): Define. * bfd-in2.h: Regenerate. * cpu-bpf.c (bfd_xbpf_arch) New. (bfd_bpf_arch) Update next in list field to point to xbpf arch. cpu/ * bpf.cpu (arch bpf): Add xbpf mach and isas. (define-xbpf-isa) New pmacro. (all-isas) Add xbpfle,xbpfbe. (endian-isas): New pmacro. (mach xbpf): New. (model xbpf-def): Likewise. (h-gpr): Add xbpf mach. (f-dstle, f-srcle, dstle, srcle): Add xbpfle isa. (f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa. (define-alu-insn-un): Use new endian-isas pmacro. (define-alu-insn-bin, define-alu-insn-mov): Likewise. (define-endian-insn, define-lddw): Likewise. (dlind, dxli, dxsi, dsti): Likewise. (define-cond-jump-insn, define-call-insn): Likewise. (define-atomic-insns): Likewise. gas/ * config/tc-bpf.c: Add option -mxbpf to select xbpf isa. * testsuite/gas/bpf/indcall-1.d: New file. * testsuite/gas/bpf/indcall-1.s: Likewise. * testsuite/gas/bpf/indcall-bad-1.l: Likewise. * testsuite/gas/bpf/indcall-bad-1.s: Likewise. * testsuite/gas/bpf/bpf.exp: Run new tests. opcodes/ * bpf-desc.c: Regenerate. * bpf-desc.h: Likewise. * bpf-opc.c: Likewise. * bpf-opc.h: Likewise. * disassemble.c (disassemble_init_for_target): Set bits for xBPF ISA when appropriate.
2020-08-26Re: CSKY: Add new arch CK860Alan Modra2-0/+5
bfd-in2.h is a generated file. Put the new machine where it belongs. * archures.c (bfd_mach_ck860): Define.
2020-08-26Automatic date update in version.inGDB Administrator1-1/+1
2020-08-25Fix the linker's handling of DWARF-5 line number tables.Mark Wielaard2-2/+136
When building with gcc with -gdwarf-5 ld tests (including ld-elf/dwarf.exp) fail because they try to read the .debug_ranges section. But DWARF5 introduces a new .debug_rnglists section that encodes the address ranges more efficiently. Implement reading the debug_rnglists in bfd/dwarf2.c. Which makes all tests pass again and fixes several gcc testsuite tests when defaulting to DWARF5. * dwarf2.c (struct dwarf2_debug_file): Add dwarf_rnglists_buffer and dwarf_rnglists_size fields. (dwarf_debug_sections): Add debug_rnglists. (dwarf_debug_section_enum): Likewise. (read_debug_rnglists): New function. (read_rangelist): New function to call either read_ranges or read_rnglists. Rename original function to... (read_ranges): ...this. (read_rnglists): New function.
2020-08-25PR26505, ASAN: xstormy16_elf_relax_section elf32-xstormy16.c:595Alan Modra2-1/+8
PR 26505 * elf32-xstormy16.c (xstormy16_elf_relax_section): Check is_elf_hash_table before accessing elf fields.
2020-08-25PR26482, ASAN: _bfd_xcoff_sizeof_headers coff-rs6000.c:2585Alan Modra2-5/+13
PR 26482 * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Ignore sections that won't be output.
2020-08-25PR26463, ASAN: m32c_elf_relax_section elf32-m32c.c:1448Alan Modra2-1/+8
PR 26463 * elf32-m32c.c (m32c_elf_relax_section): Check is_elf_hash_table before accessing elf fields.
2020-08-25PR26452, ASAN: som_compute_checksum som.c:4293Alan Modra2-5/+12
PR 26452 * som.c (som_compute_checksum): XOR 32-bit words in header, not unsigned long sized words.
2020-08-25PR26430, ASAN: nacl_modify_segment_map elf-nacl.c:164Alan Modra2-5/+12
PR 26430 * elf-nacl.c (nacl_modify_segment_map): Correct alloc size and amount copied for elf_segment_map defined with one element sections array.
2020-08-25PR26422, ASAN: elf32_arm_final_link_relocate elf32-arm.c:10351Alan Modra2-35/+28
Always reading 32 bits in order to extract addends from instruction fields is wrong when the field size is smaller. It also leads to reading past the end of the section. This patch tidies that by reading the proper field size, which allows some later refetching of addends to disappear. PR 26422 * elf32-arm.c (elf32_arm_final_link_relocate): Use the appropriate bfd_get_x size function to read addends out of fields. Apply rightshift adjustment too. Don't apply the now unnecessary howto->size shift to branch REL addends. Don't refetch R_ARM_ABS8 and R_ARM_ABS16 addends. Don't refetch thumb branch addends. Correct R_ARM_THM_JUMP6 addend.