Alan Modra
26009aa763
ubsan elfnn-aarch64.c:7142 shift exponent 32 is too large
...
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Correct type
of constant shifted left.
2020-09-02 16:30:42 +09:30
Alan Modra
2f26cc79cc
ubasn: elf32-pru.c:570 left shift of negative value
...
* elf32-pru.c (pru_elf32_do_ldi32_relocate): Use an unsigned
type for "relocation".
2020-09-02 16:30:42 +09:30
GDB Administrator
7d0a7dce39
Automatic date update in version.in
2020-09-02 00:00:09 +00:00
Alan Modra
821e059c26
arm: ubsan: shift exponent 4G
...
* reloc.c (N_ONES): Handle N=0.
* elf32-arm.c (elf32_arm_howto_table_1): Set complain_overflow_dont
for R_ARM_TLS_DESCSEQ and R_ARM_THM_TLS_DESCSEQ.
2020-09-01 16:02:48 +09:30
Alan Modra
f911bb2201
PR26429 UBSAN: elf32-arm.c load /store misaligned address
...
PR 26429
* elf32-arm.c (elf32_arm_allocate_local_sym_info): Allocate arrays
in descending order of alignment.
2020-09-01 16:02:48 +09:30
Alan Modra
00c91124d4
PR26423 UBSAN: elf32-arm.c:10237 left shift cannot be represented
...
PR 26423
* elf32-arm.c (calculate_group_reloc_mask): Use 3u in shift.
2020-09-01 16:02:48 +09:30
GDB Administrator
6a42ec96ca
Automatic date update in version.in
2020-09-01 00:00:09 +00:00
Alan Modra
1174d92070
PR26493 UBSAN: elfnn-riscv.c left shift of negative value
...
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-31 20:28:10 +09:30
Alan Modra
227d539b17
PR26476, PR26477 UBSAN: elfxx-mips.c:2695,5370 cannot be represented
...
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-31 20:28:10 +09:30
Alan Modra
1a211fc7d8
PR26466 UBSAN: elf32-mep.c:300 left shift of negative value
...
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-31 20:28:10 +09:30
Alan Modra
108f6f97bd
PR26461 UBSAN: elfxx-ia64.c:747 cannot be represented
...
PR 26461
* elfxx-ia64.c (ia64_elf_install_value): Make expressions unsigned
that might shift values into sign bit.
2020-08-31 20:28:10 +09:30
Alan Modra
f2173852cf
PR26445 UBSAN: elf32-csky.c:4115 left shift of negative value
...
PR 26445
* elf32-csky.c (csky_relocate_contents): Make relocation a bfd_vma,
and similarly for variables dealing with overflow.
2020-08-31 20:28:09 +09:30
Alan Modra
c1f138f955
PR26442 UBSAN: elf32-crx.c:512 cannot be represented in int
...
PR 26442
* elf32-crx.c (crx_elf_final_link_relocate): Calculate reloc_bits
without undefined behaviour. Tidy excess casts.
2020-08-31 20:28:09 +09:30
Alan Modra
8f383897b6
mn10300: ubsan: shift exponent too large
...
* elf-m10300.c (mn10300_elf_relax_delete_bytes): Calculate
alignment from reloc addend after reloc type R_MN10300_ALIGN is
found.
2020-08-31 20:28:08 +09:30
GDB Administrator
18856f435e
Automatic date update in version.in
2020-08-31 00:00:07 +00:00
Alan Modra
34d8e6d0c5
PR26435, PR26436 UBSAN: elf32-cr16.c:928 left shift
...
PR 26435
PR 26436
* elf32-cr16.c (cr16_elf_final_link_relocate): Calculate reloc_bits
without undefined behaviour.
2020-08-30 19:37:15 +09:30
GDB Administrator
c44ea3aef6
Automatic date update in version.in
2020-08-30 00:00:07 +00:00
Nick Clifton
e6f04d55f6
Include members in the variable table used when resolving DW_AT_specification tags.
...
PR 26520
* dwarf2.c (scan_unit_for_symbols): Add member entries to the
variable table.
2020-08-29 08:03:15 +01:00
Alan Modra
55b8e31a7a
correct pr number in changelog
2020-08-29 13:58:47 +09:30
Alan Modra
736c9875c0
PR26459 UBSAN: elfnn-ia64.c:1945 null pointer bsearch
...
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-29 13:16:42 +09:30
GDB Administrator
9b5f4ffe1b
Automatic date update in version.in
2020-08-29 00:00:09 +00:00
Alan Modra
07319accdf
PR26418 UBSAN: cache.c:386 null pointer fwrite
...
And some more.
PR 26418
* ecofflink.c (bfd_ecoff_write_accumulated_debug): Don't write
zero size buffers.
2020-08-28 23:15:20 +09:30
Alan Modra
7ca371dba5
PR26418 UBSAN: cache.c:386 null pointer fwrite
...
The previous "fix" tested the wrong value.
PR 26418
* ecofflink.c (WRITE): Really don't write zero size chunks.
2020-08-28 21:59:29 +09:30
Tuckker
1e597a8997
Prevent the linker from overestimating the alignment requirement of common 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-28 13:27:16 +01:00
Cooper Qu
0861f561eb
CSKY: Support attribute section.
...
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-28 17:23:24 +08:00
Nick Clifton
6194b866b7
Fixes for testsuite failures introduced by the changes made for PR 19011.
...
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-28 09:43:13 +01:00
Nelson Chu
3b1450b38c
RISC-V: Treat R_RISCV_CALL and R_RISCV_CALL_PLT as the same in check_relocs.
...
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-28 09:37:35 +08:00
GDB Administrator
f2f08254b1
Automatic date update in version.in
2020-08-28 00:00:10 +00:00
John David Anglin
9e7ed8b080
Fix PR binutils/26356 on hppa*-*-hpux*.
...
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-27 15:25:03 +00:00
Alan Modra
4b69ce9b91
PR26469 UBSAN: elflink.c:8742 shift exponent 6148914691236511722
...
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-27 22:05:00 +09:30
Alan Modra
cd570d497e
PR26462 UBSAN: reloc.c:473 shift exponent 4294967295
...
PR 26462
* reloc.c (bfd_check_overflow): Return early if zero bitsize.
2020-08-27 21:56:33 +09:30
Alan Modra
2ac865acf0
arm-symbianelf segfault
...
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-27 21:56:33 +09:30
Alan Modra
c415c83bd9
Re: commit eae0b5c3b2
...
PR 26416
* elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Correct "dynamic".
2020-08-27 21:56:33 +09:30
GDB Administrator
f2e5245f41
Automatic date update in version.in
2020-08-27 00:00:10 +00:00
Nick Clifton
8c51f2f291
Fix sanitization problems in the BFD library when running the linker 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-26 17:43:39 +01:00
Nick Clifton
eae0b5c3b2
Fix sanitization problems running the linker testsuite for the alpha-elf target.
...
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-26 16:26:13 +01:00
Nick Clifton
b74a6c6086
Fix a sanitization problem running the linker testsuite for the AArch64 target.
...
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-26 15:51:56 +01:00
Alan Modra
4d43072582
PR26507 UBSAN: elf32-xtensa.c:6013 null pointer bsearch
...
PR 26507
* elf32-xtensa.c (find_removed_literal): Don't bsearch empty map.
2020-08-26 23:23:45 +09:30
Alan Modra
252e57fdd4
PR26506 UBSAN: elf32-xtensa.c:3203 null pointer memcpy
...
PR 26506
* elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early
when section is empty.
2020-08-26 23:23:45 +09:30
Alan Modra
2d0ce6779c
PR26498 UBSAN: elf32-spu.c:2292 left shift overflow
...
PR 26498
* elf32-spu.c (find_function_stack_adjust): Use unsigned vars to
avoid UB left shift.
2020-08-26 23:23:45 +09:30
Alan Modra
9e51d549d7
PR 26484-26488, 26490 UBSAN &h->elf null pointer
...
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-26 23:23:45 +09:30
Alan Modra
00bc5e68b2
PR26478 UBSAN: mmo.c:2941 null pointer memcpy
...
PR 26478
* mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
2020-08-26 23:23:45 +09:30
Alan Modra
55e61b8ad9
PR26475 UBSAN: elfxx-mips.c:12180 null pointer memset
...
Another memset(0,0,0)
PR 26475
* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Check
sstubs->contents != NULL.
2020-08-26 23:23:44 +09:30
Alan Modra
66ad6b4458
PR26453 UBSAN: som.c:2885 null pointer memcpy
...
PR 26453
* som.c (som_prep_for_fixups): Return early when no symbols.
2020-08-26 23:23:44 +09:30
Alan Modra
9863cbb7bd
PR26418 UBSAN: cache.c:386 null pointer fwrite
...
PR 26418
* ecofflink.c (WRITE): Don't write size 0 chunks.
2020-08-26 23:23:44 +09:30
Alan Modra
c01de19363
asan: alpha-vms: mmember access within null pointer
...
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
2020-08-26 23:23:44 +09:30
Alan Modra
b4e125d935
PR26415 UBSAN: vms-misc.c:636 left shift cannot be represented
...
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-26 23:23:44 +09:30
David Faust
4449c81a85
bpf: add xBPF ISA
...
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-26 15:39:00 +02:00
Alan Modra
13f8a2465e
Re: CSKY: Add new arch CK860
...
bfd-in2.h is a generated file. Put the new machine where it belongs.
* archures.c (bfd_mach_ck860): Define.
2020-08-26 11:43:03 +09:30
GDB Administrator
3c68b07e84
Automatic date update in version.in
2020-08-26 00:00:10 +00:00