Kamil Rytarowski [Wed, 2 Sep 2020 17:02:13 +0000 (19:02 +0200)]
Build nat/netbsd-nat.o for the NetBSD native target
gdb/ChangeLog:
* configure.nat (NATDEPFILES): Add nat/netbsd-nat.o when needed.
Kamil Rytarowski [Wed, 2 Sep 2020 16:53:41 +0000 (18:53 +0200)]
Register a placeholder for NetBSD shared functions in gdb/nat
gdb/ChangeLog:
* netbsd-nat.h: New file.
* netbsd-nat.c: Likewise.
Kamil Rytarowski [Wed, 2 Sep 2020 16:20:53 +0000 (18:20 +0200)]
Add handle_eintr to wrap EINTR handling in syscalls
gdbsupport/ChangeLog:
* eintr.h: New file.
Nick Clifton [Thu, 10 Sep 2020 12:23:11 +0000 (13:23 +0100)]
Stop symbols generated by the annobin gcc plugin from breaking the disassembly of PowerPC binaries.
* ppc-dis.c (ppc_symbol_is_valid): New function. Returns false
for hidden, local, no-type symbols.
(disassemble_init_powerpc): Point the symbol_is_valid field in the
info structure at the new function.
Cooper Qu [Thu, 10 Sep 2020 09:37:05 +0000 (17:37 +0800)]
CSKY: Enable extend lrw by default for CK802, CK803 and CK860.
gas/
* config/tc-csky.c (md_begin): Enable extend lrw by default for
CK802, CK803 and CK860.
Cooper Qu [Thu, 10 Sep 2020 09:36:51 +0000 (17:36 +0800)]
CSKY: Add L2Cache instructions for CK860.
opcodes/
* csky-opc.h (csky_v2_opcodes): Add L2Cache instructions.
* testsuite/gas/csky/cskyv2_ck860.d : Adjust to icache.iva
opcode fixing.
Cooper Qu [Thu, 10 Sep 2020 09:36:24 +0000 (17:36 +0800)]
CSKY: Add new arches while refine the cpu option process.
Add arches CK804, CK805 and CK800. CK800 is an special arch which
support all instructions for CSKYV2. Refine the cpu tables to
simplify adding a new cpu.
Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (struct csky_cpu_info): Add new members
isa_flag, features and ver.
(struct csky_cpu_feature): New.
(struct csky_cpu_version): New.
(CSKY_FEATURE_MAX): Define.
(CSKY_CPU_REVERISON_MAX): Define.
(FEATURE_DSP_EXT, FEATURE_DSP, FEATURE_MMU, FEATURE_VDSP,
FEATURE_FLOAT, FEATURE_TRUST, FEATURE_JAVA, FEATURE_SHIELD):
Define, each standard one collection of instructions.
(CSKY_FEATURES_DEF_NULL, CSKY_FEATURES_DEF_e,
CSKY_FEATURES_DEF_t, CSKY_FEATURES_DEF_f, CSKY_FEATURES_DEF_v,
CSKY_FEATURES_DEF_ef, CSKY_FEATURES_DEF_jt,
CSKY_FEATURES_DEF_efht, CSKY_FEATURES_DEF_efv,
CSKY_FEATURES_DEF_eft, CSKY_FEATURES_DEF_d,
CSKY_FEATURES_DEF_df, CSKY_FEATURES_DEF_ft,
CSKY_FEATURES_DEF_tv, CSKY_FEATURES_DEF_fv,
CSKY_FEATURES_DEF_dft, CSKY_FEATURES_DEF_dfv,
CSKY_FEATURES_DEF_ftv, CSKY_FEATURES_DEF_eftv): Define,
the features combination used by cpu.
(CSKY_CPU_REVERISON_r0p0, CSKY_CPU_REVERISON_r1p0,
CSKY_CPU_REVERISON_r2p0, CSKY_CPU_REVERISON_r3p0,
CSKY_CPU_REVERISON_RESERVED, CSKY_CPU_REVERISON_R3):
Define, version information used by cpu.
(csky_cpus): Refine, and add CK804, CK805 and CK800.
(parse_cpu): Refine.
(parse_arch): Refine.
(md_show_usage): Refine.
(md_begin): Refine.
include/
* opcode/csky.h (CSKY_ARCH_804): Define.
(CSKY_ARCH_805): Define.
(CSKY_ARCH_800): Define.
Alan Modra [Thu, 10 Sep 2020 09:16:14 +0000 (18:46 +0930)]
Re: PR26580, Size and alignment of commons vs as-needed shared lib
Some MIPS targets, for reasons I didn't analyse, use the larger common
symbol in a shared lib rather than a smaller common in an executable.
That doesn't seem unreasonable, so allow that to pass for pr26580-2.
bfin-elf complains about not supporting copy relocs, but it's quite
silly to want a copy reloc for common symbols, so leave the fail
there. mn10300-elf and score-elf both fail the test with "PHDR
segment not covered by LOAD segment". Other tests fail similarly so
one more doesn't hurt. The failure is a consequence of supporting
dynamic objects but setting EMBEDDED in ld scripts.
PR 26580
* testsuite/ld-elf/pr26580-2.sd: Accept undefined symbol.
Alan Modra [Thu, 10 Sep 2020 07:40:57 +0000 (17:10 +0930)]
Re: lto-18 test
Extend the test a little to archives, not that we expect this to
fail. Nor has the lto-18 test ever failed without -flto.
* testsuite/ld-plugin/lto-18b.c (select): Remove.
* testsuite/ld-plugin/lto-18c.c (select): Remove.
* testsuite/ld-plugin/lto.exp: Build archives for lto-18 too,
and run static versions of the test.
Nick Clifton [Thu, 10 Sep 2020 08:58:15 +0000 (09:58 +0100)]
Fix compile time warnings when building for the CSKY target on a 32-bit host.
incldue * opcode/csky.h (CSKY_ISA_FLOAT_7E60): Use a long long type for
this value.
opcodes * csky-dis.c (csky_output_operand): Coerce the immediate values to
long before printing.
Alan Modra [Thu, 10 Sep 2020 04:42:52 +0000 (14:12 +0930)]
sprintf arg overlaps destination
* csky-dis.c (csky_output_operand): Don't sprintf str to itself.
GDB Administrator [Thu, 10 Sep 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 16 Jun 2020 17:28:23 +0000 (11:28 -0600)]
Fix latent bug in ada-lang.c:remove_extra_symbols
I believe ada-lang.c:remove_extra_symbols has a latent bug. This
function loops over a vector of symbols, removing duplicates according
to some criteria.
At the end of the loop it does:
if (remove_p)
syms->erase (syms->begin () + i);
i += 1;
However, this seems wrong to me -- when removing the i'th element,
this code still increments "i", thus skipping an element.
At first I thought this was a regression from the patches to remove
cleanups from ada-lang.c (this was when std::vector was introduced);
but I found that instead the bug seems to be older:
if (remove_p)
{
for (j = i + 1; j < nsyms; j += 1)
syms[j - 1] = syms[j];
nsyms -= 1;
}
i += 1;
No test, as I don't know how to write one.
As this is Ada-specific, and was already reviewed internally by Joel,
I am checking it in.
gdb/ChangeLog
2020-09-09 Tom Tromey <tromey@adacore.com>
* ada-lang.c (remove_extra_symbols): Do not increment when
removing an element
Nick Clifton [Wed, 9 Sep 2020 14:00:55 +0000 (15:00 +0100)]
Fix thinko in the code to check coff archive elements.
* cofflink.c (coff_link_check_archive_element): Move the check for
coff type input to the start of the function.
Alan Modra [Wed, 9 Sep 2020 12:40:47 +0000 (22:10 +0930)]
power10 on ppc32
We don't support power10 on ppc32, mainly because some instructions
have 34-bit fields for which we don't have relocations on ppc32.
If you try to assemble typical code, you'll see errors saying
"reloc ... not supported by object file format". Also, on 32-bit
hosts with binutils configured without a 64-bit bfd, you'll see errors
saying "bignum invalid" when using large offsets. But let's not kill
output of prefix insns entirely on 32-bit hosts.
* config/tc-ppc.c (md_assemble): Emit prefix insn by parts when
valueT is smaller than 64 bits.
Cooper Qu [Mon, 7 Sep 2020 09:25:14 +0000 (17:25 +0800)]
CSKY: Change mvtc and mulsw's ISA flag.
gas/
* config/tc-csky.c (CSKYV2_ISA_DSP): CSKY_ISA_DSPE60.
(CSKY_ISA_860): Likewise.
include/
* opcode/csky.h (CSKY_ISA_DSPE60): Define.
opcodes/
* csky-opc.h (csky_v2_opcodes): Change mvtc and mulsw's
ISA flag.
Cooper Qu [Mon, 7 Sep 2020 09:25:02 +0000 (17:25 +0800)]
CSKY: Support option -mfloat-abi.
The option corresponds to GCC to control the float calling conversion,
and the value will be stored in .csky.attributes section.
Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (float_abi): New.
(md_longopts): Add mfloat-abi.
(struct sky_option_value_table): New.
(csky_float_abis): New, the possible values for -mfloat-abi.
(parse_float_abi): New funtion.
(md_show_usage): Show help information for -mfloat-abi.
(set_csky_attribute): Store float-abi value.
Cooper Qu [Mon, 7 Sep 2020 09:24:11 +0000 (17:24 +0800)]
CSKY: Add FPUV3 instructions, which supported by ck860f.
Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (float_work_fpuv3_fmovi): New function,
helper function to encode fpuv3 fmovi instructions.
(float_work_fpuv3_fstore): New function.
(struct literal): Add new member 'offset'.
(csky_cpus): New cpu CK860f.
(enter_literal): Return literal pool pointer instead of offset.
(parse_rt): Adjust the change of enter_literal.
(parse_rtf): Likewise.
(v1_work_lrw): Likewise.
(v1_work_jbsr): Likewise.
(v2_work_lrw): Likewise.
(v2_work_jbsr): Likewise.
(v2_work_jsri): Likewise.
(vdsp_work_vlrw): Likewise.
(is_freglist_legal): Add handler for FPUV3.
(parse_type_freg): Likewise.
(is_imm_within_range): Set e.X_add_number if it is a signed and
negtive number.
(get_operand_value): Add handler for OPRND_TYPE_IMM9b,
OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI
and OPRND_TYPE_DFLOAT_FMOVI.
(float_to_half): Convert float number to harf float.
opcodes/
* csky-dis.c (csky_output_operand): Add handlers for
OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
OPRND_TYPE_DFLOAT_FMOVI. Refine OPRND_TYPE_FREGLIST_DASH
to support FPUV3 instructions.
* csky-opc.h (enum operand_type): New enum OPRND_TYPE_IMM9b,
OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
OPRND_TYPE_DFLOAT_FMOVI.
(OPRND_MASK_4_5, OPRND_MASK_6, OPRND_MASK_6_7, OPRND_MASK_6_8,
OPRND_MASK_7, OPRND_MASK_7_8, OPRND_MASK_17_24,
OPRND_MASK_20, OPRND_MASK_20_21, OPRND_MASK_20_22,
OPRND_MASK_20_23, OPRND_MASK_20_24, OPRND_MASK_20_25,
OPRND_MASK_0_3or5_8, OPRND_MASK_0_3or6_7, OPRND_MASK_0_3or25,
OPRND_MASK_0_4or21_24, OPRND_MASK_5or20_21,
OPRND_MASK_5or20_22, OPRND_MASK_5or20_23, OPRND_MASK_5or20_24,
OPRND_MASK_5or20_25, OPRND_MASK_8_9or21_25,
OPRND_MASK_8_9or16_25, OPRND_MASK_4_6or20, OPRND_MASK_5_7or20,
OPRND_MASK_4_5or20or25, OPRND_MASK_4_6or20or25,
OPRND_MASK_4_7or20or25, OPRND_MASK_6_9or17_24,
OPRND_MASK_6_7or20, OPRND_MASK_6or20, OPRND_MASK_7or20,
OPRND_MASK_5or8_9or16_25, OPRND_MASK_5or8_9or20_25): Define.
(csky_v2_opcodes): Add FPUV3 instructions.
include/
* opcode/csky.h (CSKY_ISA_FLOAT_7E60): Define.
Alan Modra [Wed, 9 Sep 2020 07:08:36 +0000 (16:38 +0930)]
PR26578, memory leak in parse_gnu_debugaltlink
The associated check function doesn't do anything with its "data"
param, so nothing to adjust there.
PR 26578
* dwarf.c (parse_gnu_debugaltlink): Don't alloc build_id_data.
(load_separate_debug_files): Use a stack var for build_id_data.
Alan Modra [Wed, 9 Sep 2020 02:46:23 +0000 (12:16 +0930)]
lto-18 test
Demonstrates a reason to use IR symbols when deciding an --as-needed
library should be loaded.
* testsuite/ld-plugin/lto-18a.c,
* testsuite/ld-plugin/lto-18b.c,
* testsuite/ld-plugin/lto-18c.c,
* testsuite/ld-plugin/lto-18d.c,
* testsuite/ld-plugin/lto-18.out: New test.
* testsuite/ld-plugin/lto.exp: Run it.
GDB Administrator [Wed, 9 Sep 2020 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Tue, 8 Sep 2020 23:08:48 +0000 (08:38 +0930)]
Re: MSP430: Support relocations for subtract expressions in .uleb128 directives
Put the prototype where it won't disappear on the next regen of libbfd.h.
* libbfd-in.h (_bfd_write_unsigned_leb128): Declare.
* libbfd.h: Regenerate.
David Faust [Tue, 8 Sep 2020 18:39:07 +0000 (11:39 -0700)]
bpf: simulator: correct div, mod insn semantics
The div and mod eBPF instructions are unsigned, but the semantic
specification for the simulator incorrectly used signed operators.
Correct them to unsigned versions, and correct the ALU tests in
the simulator (which incorrectly assumed signed semantics).
Tested in bpf-unknown-none.
cpu/ChangeLog:
2020-09-08 David Faust <david.faust@oracle.com>
* bpf.cpu (define-alu-instructions): Correct semantic operators
for div, mod to unsigned versions.
sim/ChangeLog:
2020-09-08 David Faust <david.faust@oracle.com>
* bpf/sem-be.c: Regenerate.
* bpf/sem-le.c: Likewise.
sim/testsuite/ChangeLog:
2020-09-08 David Faust <david.faust@oracle.com>
* sim/bpf/alu.s: Correct div and mod tests.
* sim/bpf/alu32.s: Likewise.
H.J. Lu [Tue, 8 Sep 2020 17:01:45 +0000 (10:01 -0700)]
Pass --disable-reloc-section on PE targets for PR 25662 test
Pass --disable-reloc-section on PE targets for PR 25662 test since
commit
514b4e191d5f46de8e142fe216e677a35fa9c4bb
Author: Jeremy Drake <sourceware-bugzilla@jdrake.com>
Date: Thu Aug 27 12:58:27 2020 +0100
Change the default characteristics of DLLs built by the linker to more secure settings.
defaulted to --enable-reloc-section.
PR ld/26587
* testsuite/binutils-all/objcopy.exp: Pass --disable-reloc-section
to ld on PE targets for PR 25662 test.
Tom Tromey [Tue, 8 Sep 2020 16:20:44 +0000 (10:20 -0600)]
Do not adjust mtime timezone on Windows
PR win32/25302 notes that gdb will crash when trying to "run" even a
simple program on Windows. The essential bug here is that the BFD
cache can easily be corrupted -- I have sent a separate patch for
that.
The particular reason that the cache is corrupted on Windows is that
gnulib overrides "stat" to make it do timezone adjustment -- but BFD
does not use this version of stat. The difference here triggers the
latent cache bug, but can also cause other bugs as well; in particular
it can cause spurious warnings about source files being newer.
This patch simply removes the stat override on mingw, making gnulib
and BFD agree.
I tested this by backing out the local AdaCore changes to work around
this bug and then verifying that I could reproduce it. Then, I
applied this patch and verified that "run" works again.
2020-09-08 Tom Tromey <tromey@adacore.com>
PR win32/25302:
* update-gnulib.sh: Apply stat patch.
* patches/0001-use-windows-stat: New file.
* import/m4/stat.m4: Update.
* configure: Rebuild.
Tom Tromey [Tue, 8 Sep 2020 16:35:22 +0000 (10:35 -0600)]
Fix uninitialized warning in gdb_bfd_open
The previous patch introduced an uninitialized warning in
gdb_bfd_open. The problem was that "abfd" was being used without
being initialized.
This patch fixes the problem by calling bfd_fopen in the branch where
"fstat" has failed.
gdb/ChangeLog
2020-09-08 Tom Tromey <tromey@adacore.com>
* gdb_bfd.c (gdb_bfd_open): Call bfd_fopen when fstat fails.
Tom Tromey [Tue, 8 Sep 2020 16:13:51 +0000 (10:13 -0600)]
Avoid hash table corruption in gdb_bfd.c
gdb caches BFDs that come from ordinary files. This code turns out to
have a bug where the hash table can become corrupted, causing gdb to
crash.
When gdb_bfd_open opens the BFD, it uses fstat to get the BFD's mtime.
This is used when inserting the entry into gdb_bfd_cache. Then, the
function creates the gdb_bfd_data object as a side effect of calling
new_reference. This object is used when finding objects in the hash
table, and its constructor uses bfd_get_mtime. So, if the file
changes between the time the BFD is put into the cache and the time
that this object is created, the hash table will be incorrect. When
the BFD is later deleted, its entry in the hash table will not be
found, and at this point the hash table will point to invalid memory.
This patch fixes the bug by ensuring that the mtime, and other
relevant attributes comgin from stat, that are used for insertion are
also used when creating the gdb_bfd_data.
This obsoletes an earlier patch that had split this into two parts
(surrounding a patch to use bfd_stat more consistently). This version
merges the two patches, in the interest of correctness.
gdb/ChangeLog
2020-09-08 Tom Tromey <tromey@adacore.com>
PR win32/25302:
* gdb_bfd.c (gdb_bfd_data): Add "st" parameter.
(gdb_bfd_init_data): New function.
(gdb_bfd_open, gdb_bfd_ref): Use gdb_bfd_init_data.
Jozef Lawrynowicz [Tue, 8 Sep 2020 15:13:48 +0000 (16:13 +0100)]
MSP430: Support relocations for subtract expressions in .uleb128 directives
Link-time relaxations of branches are common for MSP430, given that GCC
can generate pessimal branch instructions, and the
-mcode-region=either/-mdata-region=either options to shuffle sections
can further change the type of branch instruction required.
These relaxations can result in invalid code when .uleb128
directives, used in the .gcc_except_table section, are used to calculate
the distance between two labels. A value for the .uleb128 directive is
calculated at assembly-time, and can't be updated at link-time, even if
relaxation causes the distance between the labels to change.
This patch adds relocations for subtract expressions in .uleb128
directives, to allow the linker to re-calculate the value of these
expressions after relaxation has been performed.
bfd/ChangeLog:
* bfd-in2.h (bfd_reloc_code_real): Add
BFD_RELOC_MSP430_{SET,SUB}_ULEB128.
* elf32-msp430.c (msp430_elf_ignore_reloc): New.
(elf_msp430_howto_table): Add R_MSP430{,X}_GNU_{SET,SUB}_ULEB128.
(msp430_reloc_map): Add R_MSP430_GNU_{SET,SUB}_ULEB128.
(msp430x_reloc_map): Add R_MSP430X_GNU_{SET,SUB}_ULEB128.
(write_uleb128): New.
(msp430_final_link_relocate): Handle R_MSP430{,X}_GNU_{SET,SUB}_ULEB128.
* libbfd.c (_bfd_write_unsigned_leb128): New.
* libbfd.h (_bfd_write_unsigned_leb128): New prototype.
Add BFD_RELOC_MSP430_{SET,SUB}_ULEB128.
* reloc.c: Document BFD_RELOC_MSP430_{SET,SUB}_ULEB128.
binutils/ChangeLog:
* readelf.c (target_specific_reloc_handling): Handle
R_MSP430{,X}_GNU_{SET,SUB}_ULEB128.
gas/ChangeLog:
* config/tc-msp430.c (msp430_insert_uleb128_fixes): New.
(msp430_md_end): Call msp430_insert_uleb128_fixes.
include/ChangeLog:
* elf/msp430.h (elf_msp430_reloc_type): Add
R_MSP430_GNU_{SET,SUB}_ULEB128.
(elf_msp430x_reloc_type): Add R_MSP430X_GNU_{SET,SUB}_ULEB128.
ld/ChangeLog:
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
* testsuite/ld-msp430-elf/uleb128.s: New test.
* testsuite/ld-msp430-elf/uleb128_430.d: New test.
* testsuite/ld-msp430-elf/uleb128_430x.d: New test.
Alex Coplan [Tue, 8 Sep 2020 13:22:59 +0000 (14:22 +0100)]
aarch64: Add -mcpu option for Cortex-R82
This adds support for the Arm Cortex-R82 CPU in AArch64 GAS. For more
information about this processor, see [0].
[0] : https://developer.arm.com/ip-products/processors/cortex-r/cortex-r82
gas/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* config/tc-aarch64.c (aarch64_cpus): Add Cortex-R82.
* doc/c-aarch64.texi: Document -mcpu=cortex-r82.
Alex Coplan [Tue, 8 Sep 2020 13:21:44 +0000 (14:21 +0100)]
aarch64: Add support for Armv8-R system registers
This patch adds support for the system registers introduced in Armv8-R
AArch64.
gas/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* config/tc-aarch64.c (parse_sys_reg): Also pass sysreg name to
validation function.
(parse_sys_ins_reg): Likewise.
(print_operands): Pass CPU features to aarch64_print_operand().
* testsuite/gas/aarch64/v8-r-bad-sysregs.d: New test.
* testsuite/gas/aarch64/v8-r-bad-sysregs.l: Error output.
* testsuite/gas/aarch64/v8-r-bad-sysregs.s: Input.
* testsuite/gas/aarch64/v8-r-sysregs-need-arch.d: New test.
* testsuite/gas/aarch64/v8-r-sysregs-need-arch.l: Error output.
* testsuite/gas/aarch64/v8-r-sysregs.d: New test.
* testsuite/gas/aarch64/v8-r-sysregs.s: Input for previous two tests.
include/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* opcode/aarch64.h (aarch64_sys_ins_reg_supported_p): Also take
system register name in order to simplify validation for v8-R.
(aarch64_print_operand): Also take CPU feature set, as disassembly for
system registers now depends on arch variant.
opcodes/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* aarch64-dis.c (print_operands): Pass CPU features to
aarch64_print_operand().
* aarch64-opc.c (aarch64_print_operand): Use CPU features to determine
preferred disassembly of system registers.
(SR_RNG): Refactor to use new SR_FEAT2 macro.
(SR_FEAT2): New.
(SR_V8_1_A): New.
(SR_V8_4_A): New.
(SR_V8_A): New.
(SR_V8_R): New.
(SR_EXPAND_ELx): New.
(SR_EXPAND_EL12): New.
(aarch64_sys_regs): Specify which registers are only on
A-profile, add R-profile system registers.
(ENC_BARLAR): New.
(PRBARn_ELx): New.
(PRLARn_ELx): New.
(aarch64_sys_ins_reg_supported_p): Reject EL3 registers for
Armv8-R AArch64.
Alex Coplan [Tue, 8 Sep 2020 13:18:38 +0000 (14:18 +0100)]
aarch64: Add support for Armv8-R DFB alias
This adds support for the DFB alias introduced in Armv8-R AArch64.
gas/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* testsuite/gas/aarch64/dfb.d: New test.
* testsuite/gas/aarch64/dfb.s: Input.
opcodes/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* aarch64-tbl.h (aarch64_feature_v8_r): New.
(ARMV8_R): New.
(V8_R_INSN): New.
(aarch64_opcode_table): Add dfb.
* aarch64-opc-2.c: Regenerate.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
Alex Coplan [Tue, 8 Sep 2020 13:13:45 +0000 (14:13 +0100)]
aarch64: Add base support for Armv8-R
This patch adds the basic infrastructure needed to support Armv8-R in
AArch64 binutils: new command-line flags, new feature bits, a new BFD
architecture, and support for differentiating between architecture
variants in the disassembler.
The new command-line options added by this patch are -march=armv8-r in
GAS and -m aarch64:armv8-r in objdump.
The disassembler support is necessary since Armv8-R AArch64 introduces a
system register (VSCTLR_EL2) which shares an encoding with a different
system register (TTBR0_EL2) in Armv8-A. This also allows us to use the
correct preferred disassembly for the new DFB alias introduced in
Armv8-R.
bfd/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* archures.c (bfd_mach_aarch64_8R): New.
* bfd-in2.h: Regenerate.
* cpu-aarch64.c (bfd_aarch64_arch_v8_r): New.
(bfd_aarch64_arch_ilp32): Update tail pointer.
gas/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* config/tc-aarch64.c (aarch64_archs): Add armv8-r.
* doc/c-aarch64.texi: Document -march=armv8-r.
include/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* opcode/aarch64.h (AARCH64_FEATURE_V8_A): New.
(AARCH64_FEATURE_V8_R): New.
(AARCH64_ARCH_V8): Include new A-profile feature bit.
(AARCH64_ARCH_V8_R): New.
opcodes/ChangeLog:
2020-09-08 Alex Coplan <alex.coplan@arm.com>
* aarch64-dis.c (arch_variant): New.
(determine_disassembling_preference): Disassemble according to
arch variant.
(select_aarch64_variant): New.
(print_insn_aarch64): Set feature set.
Alan Modra [Tue, 8 Sep 2020 03:32:31 +0000 (13:02 +0930)]
PR26580, Size and alignment of commons vs as-needed shared lib
Two pieces to this puzzle:
1) Revert HJ's fix for PR13250 so that size and alignment isn't
sticky, instead attack the real underlying problem that
_bfd_generic_link_add_one_symbol does the wrong thing in making a
common section in a shared library bfd.
2) Save and restore common u.c.p fields, which hold the section and
alignment.
A better fix for (2) would be to throw away all of that horrible code
saving and restoring the hash table when loading as-needed library
symbols, and instead do a scan over as-needed library symbols before
adding anything.
bfd/
PR 13250
PR 26580
* elflink.c (_bfd_elf_merge_symbol): Make "override" a bfd**.
Return oldbfd in override when old common should override new
common.
(_bfd_elf_add_default_symbol): Adjust to suit.
(elf_link_add_object_symbols): Likewise. Pass "override" to
_bfd_generic_link_add_one_symbol. Save and restore common u.c.p
field for --as-needed shared libraries. Revert pr13250 changes.
ld/
* testsuite/ld-elf/pr26580-a.s,
* testsuite/ld-elf/pr26580-b.s,
* testsuite/ld-elf/pr26580-1.sd,
* testsuite/ld-elf/pr26580-2.sd: New tests
* testsuite/ld-elf/comm-data.exp: Run new tests.
* testsuite/ld-elf/pr26580-a.c,
* testsuite/ld-elf/pr26580-b.c,
* testsuite/ld-elf/pr26580-3.out,
* testsuite/ld-elf/pr26580-4.out: New tests.
* testsuite/ld-elf/shared.exp: Run new tests.
Alan Modra [Tue, 8 Sep 2020 09:27:15 +0000 (18:57 +0930)]
sync libiberty from gcc
config/
Sync from gcc
2020-07-15 H.J. Lu <hjl.tools@gmail.com>
PR bootstrap/96202
* cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET
support in stage1 nor for build support.
libiberty/
* configure: Regenerate.
Sync from gcc
2020-09-08 Alan Modra <amodra@gmail.com>
* d-demangle.c: Include limits.h.
(ULONG_MAX, UINT_MAX): Provide fall-back definition.
(dlang_number): Simplify and correct overflow test. Only
write *ret on returning non-NULL. Make "ret" an unsigned long*.
Only succeed for result of [0,UINT_MAX].
(dlang_decode_backref): Simplify and correct overflow test.
Only write *ret on returning non-NULL. Only succeed for
result [1,MAX_LONG].
(dlang_backref): Remove now unnecessary range check.
(dlang_symbol_name_p): Likewise.
(string_need): Take a size_t n arg, and use size_t tem.
(string_append): Use size_t n.
(string_appendn, string_prependn): Take a size_t n arg.
(TEMPLATE_LENGTH_UNKNOWN): Define as -1UL.
(dlang_lname, dlang_parse_template): Take an unsigned long len
arg.
(dlang_symbol_backref, dlang_identifier, dlang_parse_integer),
(dlang_parse_integer, dlang_parse_string),
(dlang_parse_arrayliteral, dlang_parse_assocarray),
(dlang_parse_structlit, dlang_parse_tuple),
(dlang_template_symbol_param, dlang_template_args): Use
unsigned long variables.
* testsuite/d-demangle-expected: Add new tests.
2020-08-04 Iain Buclaw <ibuclaw@gdcproject.org>
* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
parameter storage classes.
(dlang_type): Remove identifier type.
* testsuite/d-demangle-expected: Update tests.
2020-08-03 Richard Biener <rguenther@suse.de>
PR lto/96385
* simple-object-elf.c
(simple_object_elf_copy_lto_debug_sections): Localize global
UNDEFs and reuse the prevailing name.
2020-07-10 Ian Lance Taylor <iant@golang.org>
PR demangler/96143
* cp-demangle.c (d_lambda): Don't add substitution candidate.
* testsuite/demangle-expected: Update a few existing test cases
accordingly, and add a new test case.
2020-07-04 Jason Merrill <jason@redhat.com>
* cp-demangle.c (cplus_demangle_operators): Add di, dx, dX.
(d_expression_1): Handle di and dX.
(is_designated_init, d_maybe_print_designated_init): New.
(d_print_comp_inner): Use d_maybe_print_designated_init.
* testsuite/demangle-expected: Add designator tests.
2020-06-25 Nick Clifton <nickc@redhat.com>
* bsearch.c (bsearch): Remove use of register keyword.
* bsearch_r.c (bsearch_r): Likewise.
Tom de Vries [Tue, 8 Sep 2020 09:51:29 +0000 (11:51 +0200)]
[gdb/testsuite] Fix gdb.dwarf2/frame-inlined-in-outer-frame.exp
I'm running into the following FAIL:
...
(gdb) starti ^M
Starting program: frame-inlined-in-outer-frame frame^M
^M
^M
Program stopped.^M
0x0000000000401000 in _start ()^M
(gdb) PASS: gdb.dwarf2/frame-inlined-in-outer-frame.exp: frame
frame^M
(gdb) FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into foo
stepi^M
0x0000000000401001 in foo ()^M
...
The problem is that the .exp file issues a gdb_starti_cmd without consuming
the resulting prompt. Consequently, the gdb_test issuing the frame command
consumes that prompt, and things are out-of-sync from that point onwards.
Fix this by consuming the gdb prompt after gdb_starti_cmd.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-09-08 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/frame-inlined-in-outer-frame.exp: Consume gdb prompt
after gdb_starti_cmd.
Nick Clifton [Tue, 8 Sep 2020 08:49:15 +0000 (09:49 +0100)]
Stop the plugin handler from ignoring unknown symbol types when conanicalizing weak definitions.
* plugin.c (bfd_plugin_canonicalize_symtab): Handle the case of an
unrecognized symbol type in a weak definition.
GDB Administrator [Tue, 8 Sep 2020 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in
Tankut Baris Aktemur [Mon, 7 Sep 2020 12:40:40 +0000 (14:40 +0200)]
gdb/infrun: use switch_to_target_no_thread to switch the target
Use the available `switch_to_target_no_thread` function to switch the
target. This is a refactoring.
gdb/ChangeLog:
2020-09-07 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infrun.c (fetch_inferior_event): Use
`switch_to_target_no_thread` to switch the target.
Mark Wielaard [Mon, 7 Sep 2020 13:03:20 +0000 (14:03 +0100)]
gas: Output directory and file names in .debug_line_str for DWARF5
* dwarf2dbg.c (add_line_strp): New function.
(out_dir_and_file_list): Take line_seg and sizeof_offset as
arguments, Use DW_FORM_line_strp for dir and file. Call
add_line_strp and set symbol offset for DWARF2_LINE_VERSION 5.
(out_debug_line): Call out_dir_and_file_list with line_seg and
sizeof_offset.
* gas/testsuite/gas/elf/dwarf-5-file0.d: Expect indirect line
strings.
Mark Wielaard [Mon, 7 Sep 2020 12:04:45 +0000 (13:04 +0100)]
gas: Output .debug_rnglists for DWARF 5.
* dwarf2dbg.c (DWARF2_RNGLISTS_VERSION): New constant.
(out_debug_ranges): Add ranges_sym argument and set it.
(out_debug_rnglists): New function.
(out_debug_info): Change ranges_seg argument to ranges_sym
and use it to set DW_AT_ranges value.
(dwarf2_finish): Remove ranges_seg, add ranges_sym. For
DWARF2_VERSION 5 call out_debug_rnglists.
Mark Wielaard [Mon, 7 Sep 2020 11:08:07 +0000 (12:08 +0100)]
gas: Make sure to only add an md5 to a .file when requested.
* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
FALSE.
* gas/testsuite/gas/elf/dwarf-5-file0.s: Add a random bignum.
GDB Administrator [Mon, 7 Sep 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 6 Sep 2020 21:50:59 +0000 (15:50 -0600)]
Remove unused declaration from symfile.h
dwarf2_free_objfile no longer exists, so this patch removes its
declaration from symfile.h.
gdb/ChangeLog
2020-09-06 Tom Tromey <tom@tromey.com>
* symfile.h (dwarf2_free_objfile): Don't declare.
GDB Administrator [Sun, 6 Sep 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 5 Sep 2020 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Fri, 4 Sep 2020 09:49:18 +0000 (19:19 +0930)]
PR26574, heap buffer overflow in _bfd_elf_slurp_secondary_reloc_section
A horribly fuzzed object with section headers inside the ELF header.
Disallow that, and crazy reloc sizes.
PR 26574
* elfcode.h (elf_object_p): Sanity check section header offset.
* elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check
sh_entsize.
Alan Modra [Fri, 4 Sep 2020 04:24:21 +0000 (13:54 +0930)]
Allow plugin syms to mark as-needed shared libs needed
We must tell LTO about symbols in all shared libraries loaded. That
means we can't load extra shared libraries after LTO recompilation, at
least, not those that affect the set of symbols that LTO cares about,
the IR symbols.
This change will likely result in complaints about --as-needed
libraries being loaded unnecessarily, but being correct is more
important than being optimal. One of the PR15146 tests regresses, and
while that could be hidden by disabling the missing dso message by
making it conditional on h->root.non_ir_ref_regular, that would just
be sweeping a problem under the rug.
bfd/
PR 15146
PR 26314
PR 26530
* elflink.c (elf_link_add_object_symbols): Do set def_regular
and ref_regular for IR symbols. Don't clear dynsym, allowing
IR symbols to load --as-needed shared libraries, but prevent
IR symbols from becoming dynamic.
ld/
* testsuite/ld-plugin/lto.exp: Don't run pr15146 tests.
* testsuite/ld-plugin/pr15146.d: Delete.
* testsuite/ld-plugin/pr15146a.c: Delete.
* testsuite/ld-plugin/pr15146b.c: Delete.
* testsuite/ld-plugin/pr15146c.c: Delete.
* testsuite/ld-plugin/pr15146d.c: Delete.
H.J. Lu [Fri, 4 Sep 2020 00:17:19 +0000 (17:17 -0700)]
ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS
* testsuite/config/default.exp: Change NOSANTIZE_CFLAGS to
NOSANITIZE_CFLAGS.
* testsuite/ld-elf/dwarf.exp: Likewise.
* testsuite/ld-elf/indirect.exp: Likewise.
* testsuite/ld-elf/linux-x86.exp: Likewise.
* testsuite/ld-elf/shared.exp: Likewise.
* testsuite/ld-elf/tls.exp: Likewise.
* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-plugin/plugin.exp: Likewise.
* testsuite/ld-scripts/crossref.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.
* testsuite/ld-size/size.exp: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
GDB Administrator [Fri, 4 Sep 2020 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Alok Kumar Sharma [Thu, 3 Sep 2020 16:35:18 +0000 (22:05 +0530)]
Allow Flang kind printing in complex.exp,pointer-to-pointer.exp,vla-ptr-info.exp
In the test cases complex.exp,pointer-to-pointer.exp,vla-ptr-info.exp
fortran.exp routines are not used, which are to determine the type/kind
string. Due to this these test incorrectly fail for Flang.
Now test cases are modified to use fortran.exp routines. fortran.exp
file is modified to add absent routines fortran_complex8 and
fortran_complex16.
gdb/testsuite/ChangeLog
* lib/fortran.exp (fortran_complex8): New proc.
(fortran_complex16): New proc.
* gdb.fortran/complex.exp: Use routines from fortran.exp
* gdb.fortran/pointer-to-pointer.exp: Likewise.
* gdb.fortran/vla-ptr-info.exp: Likewise.
Alok Kumar Sharma [Thu, 3 Sep 2020 16:21:01 +0000 (21:51 +0530)]
Support printing of 16 byte real/complex type for Flang compiler
Currently GDB is not able to print correct value for real/complex type
from binary generated from Flang compiler. This is due to GDB not able
to recognise and determine correct format floatformats_ia64_quad and
instead falling back to default_floatformat_for_type. This leads
incorrect output.
Now function i386_floatformat_for_type is fixed to correctly identify
Flang generated 16 byte real/complex type.
gdb/ChangeLog
* gdb/i386-tdep.c (i386_floatformat_for_type): Added conditions
to match 16 byte real/complex type generated by Flang compiler.
Jose E. Marchesi [Thu, 3 Sep 2020 14:24:51 +0000 (16:24 +0200)]
bpf: several small fixes in the simulator
This patch fixes the following problems:
- Missing includes in several files leading to implicit function
declarations.
- Missing prototype for bpf_trace_printk in bpf-helpers.h
- The simulator bitsize was set to 32 bits, causing truncation of
the program counter.
Tested in bpf-unknown-none.
sim/ChangeLog:
2020-09-03 Jose E. Marchesi <jose.marchesi@oracle.com>
* bpf/bpf.c: Include bpf-helpers.h.
* bpf/bpf-helpers.h: Provide a prototype for bpf_trace_printk.
* bpf/configure.ac: Set simulator bitsize to 64.
* bpf/configure (includedir): Regenerate.
* bpf/sim-if.c: Include stdlib.h.
* bpf/traps.c: Likewise.
Jose E. Marchesi [Thu, 3 Sep 2020 13:22:05 +0000 (15:22 +0200)]
sim: better handle builds of primary targets lacking sims
When building with a primary target that doesn't feature a simulator,
one would expect for nothing to be done in sim/. However, a
$(top_builddir)/sim/testsuite directory is created, with a Makefile
containing a rule like:
check-DEJAGNU: site.exp
echo "Dejagnu-checking in `pwd` directory ..."
rootme=`pwd`; export rootme; echo rootme = $$rootme; \
srcdir=`cd ${srcdir}; pwd`; export srcdir ; echo srcdir = $$srcdir; \
EXPECT=${EXPECT} ; export EXPECT ; echo EXPECT = $$EXPECT; \
if [ -f $$rootme/../../expect/expect ]; then \
TCL_LIBRARY=`cd $$srcdir/../../tcl/library && pwd`; \
export TCL_LIBRARY; \
fi; \
echo TCL_LIBRARY = $$TCL_LIBRARY; \
runtest=$(RUNTEST); echo runtest = $$runtest; \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
$$runtest $(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
Consequently, when `make check' recurses into sim/testsuite, the above
rule is executed. Until now, the desired effect (of doing nothing)
was achieved because `runtest --version' fails due to a malformed
site.exp being generated in objdir: it is malformed because the
primary target doesn't configure a $sim_arch. i.e. this was doing the
right thing just by chance.
However, the git version of dejagnu seems to have changed in a way
runtest doesn't try to load site.exp when it gets --version. The net
effect is that the rule above tries to actually run the tests, failing
miserably.
This little patch makes sim/configure to not recurse into
sim/testsuite if the primary target didn't configure a simulator.
Tested with:
- A simulator target (bpf-unkonwn-none).
- A simulator-less target (x86_64-linux-gnu).
- A simulator-less target and --build-targets=all.
sim/ChangeLog:
2020-09-03 Jose E. Marchesi <jose.marchesi@oracle.com>
* configure.ac: Do not configure sim/testsuite nor sim/igen if the
primary target doesn't have a simulator.
* configure: Regenerate.
Mark Wielaard [Tue, 1 Sep 2020 13:29:56 +0000 (15:29 +0200)]
gas: Use DW_FORM_sec_offset for DWARF version 4 or higher.
Older DWARF versions used DW_FORM_data4 or DW_FORM_data8 for offsets
into sections for e.g. DW_AT_stmt_list ot DW_AT_ranges. But version 4
introduced a dedicated form for such section offsets. Make sure to emit
the proper form for newer DWARF versions.
gas/ChangeLog:
* dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_sec_offset for DWARF
version 4 or higher.
Nick Clifton [Thu, 3 Sep 2020 15:11:43 +0000 (16:11 +0100)]
Fix a division by zero error when processing secondary relocs in a fuzzed input file.
PR 26521
* elf.c (_bfd_elf_write_secondary_reloc_section): Check for
secondary reloc sections with a zero sh_entsize field.
Tom de Vries [Thu, 3 Sep 2020 10:30:10 +0000 (12:30 +0200)]
[gdb/breakpoint, PIE] Handle setting breakpoint on label without address
When adding:
...
if ![runto_main] then {
fail "can't run to main"
return 0
}
...
to test-case gdb.base/label-without-address.exp and running it with target
board unix/-fPIE/-pie, we run into:
...
(gdb) break main:L1^M
Breakpoint 2 at 0x555555554000: file label-without-address.c, line 22.^M
...
That is, for a label with optimized-out address, we set a breakpoint at the
relocation base.
The root cause is that the dwarf reader, despite finding that attribute
DW_AT_low_pc is missing, still tags the L1 symbol as having LOC_LABEL, which
means it has a valid address, which defaults to 0.
Fix this by instead tagging the L1 symbol with LOC_OPTIMIZED_OUT.
Tested on x86_64-linux.
gdb/ChangeLog:
2020-09-03 Tom de Vries <tdevries@suse.de>
PR breakpoint/26546
* dwarf2/read.c (new_symbol): Tag label symbol without DW_AT_low_pc as
LOC_OPTIMIZED_OUT instead of LOC_LABEL.
gdb/testsuite/ChangeLog:
2020-09-03 Tom de Vries <tdevries@suse.de>
PR breakpoint/26546
* gdb.base/label-without-address.exp: Runto main first.
Nelson Chu [Wed, 19 Aug 2020 03:49:24 +0000 (11:49 +0800)]
RISC-V: Minor cleanup and typos when merging elf attributes.
bfd/
* elfnn-riscv.c (riscv_i_or_e_p): Minor cleanup for warnings/errors.
(riscv_merge_std_ext): Likewise.
(riscv_merge_arch_attr_info): Likewise.
(riscv_merge_attributes): Likewise and fix comment typos.
ld/
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Remove
the useless `warnings` keywords.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
Nelson Chu [Tue, 18 Aug 2020 09:48:34 +0000 (17:48 +0800)]
RISC-V: Report warnings rather than errors for the mis-matched ISA versions.
Same as the privileged spec attributes check - different ISA versions
should be compatible, unless there are some known conflicts. Therefore,
we should allow to link objects with different ISA versions, and update
the output ISA versions once the corresponding input ones are newer.
But it's better to also warn people that the conflicts may happen when
the ISA versions are mis-matched.
bfd/
* elfnn-riscv.c (riscv_version_mismatch): Change the return type
from void to bfd_boolean. Report warnings rather than errors
when the ISA versions are mis-matched. Afterwards, remember to
update the output ISA versions to the newest ones.
(riscv_merge_std_ext): Allow to link objects with different
standard ISA versions. Try to add output ISA versions to
merged_subsets first.
(riscv_merge_multi_letter_ext): Likewise. But for standard additional
ISA and non-standard ISA versions.
ld/
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Update the
message from error to warning.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: New testcases.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s: Likewise.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
Kito Cheng [Tue, 7 Jul 2020 02:30:36 +0000 (19:30 -0700)]
RISC-V: Improve the error message for the mis-matched ISA versions.
Consider the updated attr-merge-arch-failed-01.d testcase. Extension
A's version are mis-matched between attr-merge-arch-failed-01a.s and
attr-merge-arch-failed-01b.s. But the old binutils reports that the
mis-matched extension is M rather than A. This commit is used to fix
the wrong mis-matched error message.
Besides, when parsing the arch string in the riscv_parse_subset, it
shouldn't be NULL or empty. However, it might be empty when we failed
to merge the arch string in the riscv_merge_attributes. Since we should
already issue the correct error message in another side, and the message
- ISA string must begin with rv32 or rv64 - is meaninglesss when the arch
string is empty, so do not issue it.
bfd/
* elfnn-riscv.c (riscv_merge_std_ext): Fix to report the correct
error message when the versions of extension are mis-matched.
* elfxx-riscv.c (riscv_parse_subset): Don't issue the error when
the string is empty.
ld/
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise.
Alan Modra [Thu, 3 Sep 2020 00:04:37 +0000 (09:34 +0930)]
heap use after free in xcoff_archive_info_eq
Using an input file objalloc memory for anything that isn't created
when opening the bfd is not a good idea. The problem is that this
memory can disappear if bfd_free_cached_info is called or when bfd
closes files in order to keep the number of open files reasonable.
bfd/
* xcofflink.c (xcoff_get_archive_info): Allocate xcoff_archive_info
on the output bfd objalloc memory.
ld/
* testsuite/ld-scripts/sysroot-prefix.exp (single_sysroot_prefix_test):
Log $scriptname.
GDB Administrator [Thu, 3 Sep 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 2 Sep 2020 18:36:50 +0000 (14:36 -0400)]
gdb: remove maint_print_section_data
Since the "maintenance info sections" helper functions are not used
through a callback with a void* parameter anymore, the
maint_print_section_data is not needed anymore. Remove it, replace it
with regular parameters.
Break out the index digits computation in its own function.
gdb/ChangeLog:
* maint.c (index_digits): New function.
(struct maint_print_section_data): Remove.
(print_bfd_section_info): Remove print_data parameter, add arg
and index_digits.
(print_objfile_section_info): Likewise.
(print_bfd_section_info_maybe_relocated): Likewise (plus
objfile).
(maintenance_info_sections): Adjust calls.
Change-Id: Idfeca5e7e0a95e72fade15cb1488058865c0258e
Tom Tromey [Mon, 10 Aug 2020 11:21:06 +0000 (05:21 -0600)]
Do not auto-dereference null pointers in Ada MI varobj
The Ada varobj code automatically dereferences access types. This is
often handy, but it also does so for null pointers -- showing children
with empty values.
These children are weird, but even weirder when a variant type is
involved, because only the non-varying parts of the type are
displayed. This behavior conflicts a bit with my ongoing quest to
move the Ada code to use DWARF rather than gnat encodings, in that
reproducing this behavior with the DWARF code seems rather hacky.
So, this patch instead changes the Ada varobj code so that it does not
automatically dereference null pointers.
As this patch only affects Ada, and it was already reviewed internally
by Joel, I am checking it in.
2020-09-02 Tom Tromey <tromey@adacore.com>
* ada-varobj.c (ada_varobj_get_ptr_number_of_children): Return 0
for null pointers.
(ada_varobj_adjust_for_child_access): Special-case null pointers.
gdb/testsuite/ChangeLog
2020-09-02 Tom Tromey <tromey@adacore.com>
* gdb.ada/mi_var_access.exp: Test children of access variable.
* gdb.ada/mi_var_access/mi_access.adb: Add new stop markers.
* gdb.ada/mi_var_array.exp: Update.
Alan Modra [Wed, 2 Sep 2020 01:30:15 +0000 (11:00 +0930)]
ubsan: v850-opc.c:412 left shift cannot be represented
include/
* opcode/v850.h (struct v850_operand <insert>): Make param op an
unsigned long.
opcodes/
* v850-opc.c (insert_i5div1, insert_i5div2, insert_i5div3),
(insert_d5_4, insert_d8_6, insert_d8_7, insert_v8, insert_d9),
(insert_u16_loop, insert_d16_15, insert_d16_16, insert_d17_16),
(insert_d22, insert_d23, insert_d23_align1, insert_i9, insert_u9),
(insert_spe, insert_r4, insert_POS, insert_WIDTH, insert_SELID),
(insert_VECTOR8, insert_VECTOR5, insert_CACHEOP, insert_PREFOP),
(nsert_IMM10U, insert_SRSEL1, insert_SRSEL2): Use unsigned long
for value parameter and update code to suit.
(extract_d9, extract_d16_15, extract_d16_16, extract_d17_16),
(extract_d22, extract_d23, extract_i9): Use unsigned long variables.
Alan Modra [Wed, 2 Sep 2020 01:17:33 +0000 (10:47 +0930)]
ubsan: i386-dis.c
i386-dis.c:12207 left shift of 128 by 24 places cannot be represented in type 'long int'
i386-dis.c:12220 left shift of 128 by 24 places cannot be represented in type 'long int'
i386-dis.c:12222 left shift of 1 by 31 places cannot be represented in type 'long int'
i386-dis.c:12222 signed integer overflow:
162254319 - -
2147483648 cannot be represented in type 'long int'
* i386-dis.c (OP_E_memory): Don't cast to signed type when
negating.
(get32, get32s): Use unsigned types in shift expressions.
Alan Modra [Wed, 2 Sep 2020 01:14:32 +0000 (10:44 +0930)]
ubsan: csky-dis.c:1038 left shift cannot be represented
* csky-dis.c (print_insn_csky): Use unsigned type for "given".
Alan Modra [Wed, 2 Sep 2020 01:12:53 +0000 (10:42 +0930)]
ubsan: crx-dis.c:571 left shift of negative value
* crx-dis.c: Whitespace.
(print_arg): Use unsigned type for longdisp and mask variables,
and for left shift constant.
Alan Modra [Wed, 2 Sep 2020 01:05:10 +0000 (10:35 +0930)]
ubsan: *-ibld.c
bfin-dis.c:160 shift exponent 32 is too large for 32-bit type 'long unsigned int'
bpf-ibld.c:196 left shift of 1 by 31 places cannot be represented in type 'long int'
bpf-ibld.c:196 negation of -
2147483648 cannot be represented in type 'long int'; cast to an unsigned type to negate this
itself
bpf-ibld.c:197 left shift of 1 by 31 places cannot be represented in type 'long int'
bpf-ibld.c:197 signed integer overflow: -
2147483648 - 1 cannot be represented in type 'long int'
bpf-ibld.c:501 left shift of 1 by 31 places cannot be represented in type 'long int'
* cgen-ibld.in (insert_normal, extract_normal): Use 1UL in left shift.
* bpf-ibld.c: Regenerate.
* epiphany-ibld.c: Regenerate.
* fr30-ibld.c: Regenerate.
* frv-ibld.c: Regenerate.
* ip2k-ibld.c: Regenerate.
* iq2000-ibld.c: Regenerate.
* lm32-ibld.c: Regenerate.
* m32c-ibld.c: Regenerate.
* m32r-ibld.c: Regenerate.
* mep-ibld.c: Regenerate.
* mt-ibld.c: Regenerate.
* or1k-ibld.c: Regenerate.
* xc16x-ibld.c: Regenerate.
* xstormy16-ibld.c: Regenerate.
Alan Modra [Wed, 2 Sep 2020 01:03:07 +0000 (10:33 +0930)]
ubsan: bfin-dis.c:160 shift exponent 32 is too large
* bfin-dis.c (MASKBITS): Use SIGNBIT.
Alan Modra [Wed, 2 Sep 2020 00:59:21 +0000 (10:29 +0930)]
ubsan: expr.c:1725,1741 signed integer overflow
* expr.c (add_to_result, subtract_from_result): Use unsigned
addition and subtraction.
Alan Modra [Wed, 2 Sep 2020 00:56:31 +0000 (10:26 +0930)]
ubsan: tc-z80.c:3656 shift exponent 32 is too large
* config/tc-z80.c (is_overflow): Avoid too large shift.
Alan Modra [Wed, 2 Sep 2020 00:54:31 +0000 (10:24 +0930)]
ubsan: tc-sparc.c:1146 left shift cannot be represented
* config/tc-sparc.c (in_signed_range): Use an unsigned type for
sign mask.
Alan Modra [Wed, 2 Sep 2020 00:52:39 +0000 (10:22 +0930)]
ubsan: tc-nios2.c:1403 shift exponent 32 is too large
* config/tc-nios2.c (md_apply_fix): Avoid too large shift.
Alan Modra [Wed, 2 Sep 2020 00:50:53 +0000 (10:20 +0930)]
ubsan: tc-mips.c:9606 shift exponent 32 is too large
* config/tc-mips.c (load_register): Avoid too large shift.
Alan Modra [Wed, 2 Sep 2020 00:47:21 +0000 (10:17 +0930)]
ubsan: tc-d30v.c left shift cannot be represented
* config/tc-d30v.c (parallel_ok): Use 1UL for left shift expression.
Alan Modra [Wed, 2 Sep 2020 00:45:09 +0000 (10:15 +0930)]
ubsan: rx-parse.y:1743 shift exponent 32 is too large
* config/rx-parse.y (rx_intop): Avoid too large shifts.
(rx_intop, rx_uintop, rx_disp3op, rx_disp5op, displacement),
(rtsd_immediate): Use correctly typed unsigned variables.
Alan Modra [Wed, 2 Sep 2020 00:40:45 +0000 (10:10 +0930)]
ubsan: obj-macho.c:503 left shift cannot be represented
* config/obj-macho.c (obj_mach_o_zerofill): Correct type of
constant shifted left.
Alan Modra [Wed, 2 Sep 2020 00:38:11 +0000 (10:08 +0930)]
ubsan: bfin-lex.l:503 left shift cannot be represented
* config/bfin-lex.l: Use an unsigned type for "value".
Alan Modra [Wed, 2 Sep 2020 00:35:52 +0000 (10:05 +0930)]
ubsan: objdump.c:3009 negation of -
2147483648
* objdump.c (disassemble_bytes): Use an unsigned type for "addend".
Alan Modra [Wed, 2 Sep 2020 00:33:14 +0000 (10:03 +0930)]
ubsan elfnn-aarch64.c:7142 shift exponent 32 is too large
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Correct type
of constant shifted left.
Alan Modra [Wed, 2 Sep 2020 00:29:16 +0000 (09:59 +0930)]
ubasn: elf32-pru.c:570 left shift of negative value
* elf32-pru.c (pru_elf32_do_ldi32_relocate): Use an unsigned
type for "relocation".
Alan Modra [Tue, 1 Sep 2020 11:53:52 +0000 (21:23 +0930)]
32-bit host pdp11 breakage
If bfd_vma is 32 bits, gcc complains about shift counts exceeding
width of the type.
* config/tc-pdp11.c (md_number_to_chars): Condition nbytes=8 code
on BFD64.
Cooper Qu [Wed, 2 Sep 2020 06:06:03 +0000 (14:06 +0800)]
CSKY: Add CPU CK803r3.
Move divul and divsl to CSKYV2_ISA_3E3R3 instruction set, which is
enabled by ck803r3, and it's still a part of enhance DSP instruction
set.
gas/
* config/tc-csky.c (csky_cpus): Add ck803r3.
(CSKY_ISA_803R3): Define.
(CSKY_ISA_803R2): Refine, use CSKY_ISA_803R1.
include/
* opcode/csky.h (CSKYV2_ISA_3E3R3): Define.
opcodes/
* csky-opc.h (csky_v2_opcodes): Move divul and divsl
to CSKYV2_ISA_3E3R3 instruction set.
Cooper Qu [Wed, 2 Sep 2020 06:05:49 +0000 (14:05 +0800)]
CSKY: Fix Encode of mulsws.
gas/
* testsuite/gas/csky/cskyv2_dsp.d : Fix Encode of mulsws.
opcodes/
* csky-opc.h (csky_v2_opcodes): Fix Encode of mulsws.
Cooper Qu [Wed, 2 Sep 2020 06:04:52 +0000 (14:04 +0800)]
CSKY: Refine literals pool dump process and float register parser.
gas/
* config/tc-csky.c (struct literal): New member bignum.
(dump_literals): Handle big constant.
(enter_literal): Likewise.
(parse_type_freg): Handle vector register.
GDB Administrator [Wed, 2 Sep 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 1 Sep 2020 16:54:38 +0000 (12:54 -0400)]
gdb: change bcache::insert `added` parameter to bool
It is currently an int, but it is used as a bool.
gdb/ChangeLog:
* bcache.h (struct bcache) <insert>: Change type of `added` to
pointer to bool.
* bcache.c (bcache::insert): Likewise.
* gdbtypes.c (check_types_worklist): Adjust.
* psymtab.c (add_psymbol_to_bcache): Adjust.
Change-Id: I06b1041636c656782a89cb6106c9ae2593f61616
H.J. Lu [Tue, 1 Sep 2020 14:10:56 +0000 (07:10 -0700)]
ELF: Document the .tls_common directive
Document the .tls_common directive added by
commit
b8871f357fdfa9c0c06d2d3e5600391d8c994f37
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Feb 22 09:18:52 2016 -0800
Properly implement STT_COMMON
* doc/as.texi: Document the .tls_common directive.
Alan Modra [Mon, 31 Aug 2020 22:18:02 +0000 (07:48 +0930)]
mep: ubsan: mep-ibld.c:1635,1645,1652 left shift of negative value
cpu/
* mep-core.cpu (f-8s8a2, f-12s4a2, f-17s16a2): Multiply signed
value by two rather than shifting left.
(f-24s5a2n): Similarly multiply signed f-24s5a2n-hi to extract.
opcodes/
* mep-ibld.c: Regenerate.
Alan Modra [Tue, 1 Sep 2020 03:08:03 +0000 (12:38 +0930)]
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.
Alan Modra [Tue, 1 Sep 2020 02:05:37 +0000 (11:35 +0930)]
PR26420, PR26421, PR26425, PR26427 UBSAN: tc-arm.c left shifts
PR 26420
PR 26421
PR 26425
PR 26427
* config/tc-arm.c (struct arm_it): Make size, size_req, cond and
uncond_value unsigned.
(parse_vfp_reg_list): Make setmask unsigned, vpr_str_len size_t.
(parse_big_immediate): Cast generic_bignum elements to unsigned.
(encode_thumb32_immediate): Shift left 0xffU.
(double_to_single): Make sign unsigned. Tidy.
(move_or_literal_pool): Cast LITTLE_NUM elements to uint64_t or
valueT.
(vfp_or_neon_is_neon): Adjust inst.uncond_value expression.
(md_assemble): Likewise.
(handle_pred_state): Make cond unsigned.
(thumb32_negate_data_op): Make variables unsigned.
(md_apply_fix): Make value and newval unsigned, adjust uses.
Alan Modra [Mon, 31 Aug 2020 23:29:05 +0000 (08:59 +0930)]
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.
Alan Modra [Mon, 31 Aug 2020 22:33:52 +0000 (08:03 +0930)]
PR26423 UBSAN: elf32-arm.c:10237 left shift cannot be represented
PR 26423
* elf32-arm.c (calculate_group_reloc_mask): Use 3u in shift.
Kevin Buettner [Tue, 11 Aug 2020 16:36:12 +0000 (09:36 -0700)]
corefile.exp: XFAIL warning-free test when testing on docker
When testing on docker using the AUFS storage driver, loading a core
file will often print a number of warnings. Here's an example (with
the pathname shortened somewhat):
warning: Can't open file /var/lib/docker/aufs/diff/d07..e21/lib/x86_64-linux-gnu/libc-2.27.so during file-backed mapping note processing
The "warning-free" test in gdb.base/corefile.exp will fail if any
warnings are printed, but this particular warning is unavoidable when
running in the docker environment. Fortunately, the path mentions
both "docker" and "aufs", making it easy to XFAIL this case.
gdb/testsuite/ChangeLog:
* gdb.base/corefile.exp (warning-free): XFAIL test when running
on docker w/ AUFS storage driver.
Kevin Buettner [Fri, 7 Aug 2020 20:07:44 +0000 (13:07 -0700)]
Work around incorrect/broken pathnames in NT_FILE note
Luis Machado reported some regressions after I pushed recent core file
related patches fixing BZ 25631:
FAIL: gdb.base/corefile.exp: backtrace in corefile.exp
FAIL: gdb.base/corefile.exp: core-file warning-free
FAIL: gdb.base/corefile.exp: print func2::coremaker_local
FAIL: gdb.base/corefile.exp: up in corefile.exp
FAIL: gdb.base/corefile.exp: up in corefile.exp (reinit)
This commit fixes these regressions. Thanks to Luis for testing
an earlier version of the patch. (I was unable to reproduce these
regressions in various test environments that I created.)
Luis is testing in a docker container which is using the AUFS storage
driver. It turns out that the kernel is placing docker host paths in
the NT_FILE note instead of paths within the container.
I've made a similar docker environment (though apparently not similar
enough to reproduce the regressions). This is one of the paths that
I see mentioned in the warning messages printed while loading the
core file during NT_FILE note processing - note that I've shortened
the path component starting with "d07c4":
/var/lib/docker/aufs/diff/d07c4...21/lib/x86_64-linux-gnu/ld-2.27.so
This is a path on the docker host; it does not exist in the
container. In the docker container, this is the path:
/lib/x86_64-linux-gnu/ld-2.27.so
My first thought was to disable all NT_FILE mappings when any path was
found to be bad. This would have caused GDB to fall back to accessing
memory using the file stratum as it did before I added the NT_FILE
note loading code. After further consideration, I realized that we
could do better than this. For file-backed memory access, we can
still use the NT_FILE mappings when available, and then attempt to
access memory using the file stratum constrained to those address
ranges corresponding to the "broken" mappings.
In order to test it, I made some additions to corefile2.exp in which
the test case's executable is renamed. The core file is then loaded;
due to the fact that the executable has been renamed, those mappings
will be unavailable. After loading the core file, the executable is
renamed back to its original name at which point it is loaded using
GDB's "file" command. The "interesting" tests are then run. These
tests will print out values in file-backed memory regions along with
mmap'd regions placed within/over the file-backed regions. Despite
the fact that the executable could not be found during the NT_FILE
note processing, these tests still work correctly due to the fact that
memory is available from the file stratum combined with the fact that
the broken NT_FILE mappings are used to prevent file-backed access
outside of the "broken" mappings.
gdb/ChangeLog:
* corelow.c (unordered_set): Include.
(class core_target): Add field 'm_core_unavailable_mappings'.
(core_target::build_file_mappings): Print only one warning
per inaccessible file. Add unavailable/broken mappings
to m_core_unavailable_mappings.
(core_target::xfer_partial): Call...
(core_target::xfer_memory_via_mappings): New method.
gdb/testsuite/ChangeLog:
* gdb.base/corefile2.exp (renamed binfile): New tests.
Simon Marchi [Tue, 1 Sep 2020 01:06:06 +0000 (21:06 -0400)]
gdb: change type of field_info::non_public_fields to bool
gdb/ChangeLog:
* dwarf2/read.c (struct field_info) <non_public_fields>: Change
type to bool.
(dwarf2_add_field): Use true instead of 1.
Change-Id: I7e9c86429402c28d4f15861d17976b9c50049f94
Simon Marchi [Tue, 1 Sep 2020 01:05:37 +0000 (21:05 -0400)]
gdb: fix indentation of struct field_info
The indentation is off, fix it before doing other changes.
gdb/ChangeLog:
* dwarf2/read.c (struct field_info): Fix indentation.
Change-Id: Ife6a3d017abcf0a33e49e47e51429e95d504343c
GDB Administrator [Tue, 1 Sep 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 31 Aug 2020 17:31:01 +0000 (13:31 -0400)]
gdb: fix nits in previous patches
I forgot to fix some nits pointed out in review before merging the
"frame inlined in outer frame series", this patch fixes them.
gdb/ChangeLog:
* frame-unwind.h (frame_prev_register_ftype): Fix adjective
ordering in comment.
* frame.c (frame_id_eq): Fix indentation.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-reg-undefined.exp: Remove spurious #.
Change-Id: Iaddde9677fc3f68382558d1a16f5a0b4beb78bac
Scott Linder [Mon, 31 Aug 2020 17:24:20 +0000 (13:24 -0400)]
gdb: support frames inlined into the outer frame
Remove the restriction (gdb_assert) that prevents creating frames
inlined in the outer frame. Like for frames inlined in a standard frame
(FID_STACK_VALID), a frame inlined into the outer frame will have:
- artificial_depth greater than 0
- code_addr equal to the first executed instruction in the block
corresponding to the inlined function
It will however have its stack_status set to FID_STACK_OUTER, like the
outer frame.
This is not typically seen on your everyday system (e.g. a Linux /
x86-64 process), because the outer frame would be for instance the
_start function, probably written in assembly and very unlikely to have
anything inlined in it. However this could happen in more "bare-metal"
scenarios. In particular, this was seen in ROCm GDB [1], where the
compiler does inline functions in the top-level kernel functions (kernel
in the sense of compute kernel, not userspace vs kernel).
I however wrote a test that replicates the issue on x86-64 and a few
other arches I had access to. Since we need to control precisely the
emitted DWARF CFI, I didn't find another way than to write it in
assembly. The DWARF is generated using the testsuite's DWARF assembler,
except the unwind information, which is written using CFI directives
(and therefore generated by the actual assembler). I think the test is
adequately commented, but if anything is unclear, just ask and I'll add
more info.
[1] https://github.com/ROCm-Developer-Tools/ROCgdb/
gdb/ChangeLog:
YYYY-MM-DD Scott Linder <scott@scottlinder.com>
YYYY-MM-DD Simon Marchi <simon.marchi@efficios.com>
* inline-frame.c (inline_frame_this_id): Remove assert that prevents
inline frame ids in outer frame.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/frame-inlined-in-outer-frame.exp: New file.
* gdb.dwarf2/frame-inlined-in-outer-frame.S: New file.
Change-Id: I8aa129c667dccc31590ffdf426586418493a6ebe