GDB Administrator [Sun, 7 Oct 2018 00:01:19 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 3 Sep 2018 21:23:48 +0000 (15:23 -0600)]
Call nonl before wgetch in TUI
PR tui/28819 points out that, in the TUI, the C-j and C-m keys cannot
be bound differently in one's ~/.inputrc. However, this works in
other readline applications.
The bug is that the TUI uses curses' "nl" mode, which causes wgetch to
return the same value for both keys. There is a "nonl" mode, but it
also affects output.
This patch fixes the bug by arranging to call nonl before reading a
key and then nl afterward. This avoids any potential problem with
changing the output if gdb was to use nonl globally.
gdb/ChangeLog
2018-10-06 Tom Tromey <tom@tromey.com>
PR tui/28819:
* tui/tui-io.c (gdb_wgetch): New function.
(tui_mld_getc, tui_getc): Use it.
Sergio Durigan Junior [Sat, 6 Oct 2018 15:23:02 +0000 (11:23 -0400)]
Update string expected from "help info proc" on gdb.base/info-proc.exp
Commit
73f1bd769a5 ("Make the "info proc" documentation more
consistent.") updated the output from "help info proc", but forgot to
update the test on gdb.base/info-proc.exp. This obvious patch does
that.
Checked-in as obvious.
gdb/testsuite/ChangeLog:
2018-10-06 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/info-proc.exp: Update string expected from "help info
proc".
GDB Administrator [Sat, 6 Oct 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 5 Oct 2018 18:56:42 +0000 (11:56 -0700)]
x86: Add Intel ENCLV to assembler and disassembler
gas/
* testsuite/gas/i386/se1.s: Add enclv.
* testsuite/gas/i386/x86-64-se1.s: Likewise.
* testsuite/gas/i386/se1.d: Updated.
* testsuite/gas/i386/x86-64-se1.d: Likewise.
opcodes/
* i386-dis.c (rm_table): Add enclv.
* i386-opc.tbl: Add enclv.
* i386-tbl.h: Regenerated.
Tom Tromey [Fri, 5 Oct 2018 13:28:16 +0000 (07:28 -0600)]
Fix -Wshadow=local warning in sol_thread_target::wait
Rainer pointed out that -Wshadow=local broke the Solaris build.
This fixes it.
gdb/ChangeLog
2018-10-05 Tom Tromey <tom@tromey.com>
* sol-thread.c (sol_thread_target::wait): Rename inner
"save_ptid".
Alan Modra [Fri, 5 Oct 2018 10:22:55 +0000 (19:52 +0930)]
Set correct SHT_NOTE type for .note.spu_name
* elf32-spu.c (spu_elf_create_sections): Make .note.spu_name
SHT_NOTE.
Sudakshina Das [Fri, 5 Oct 2018 09:51:22 +0000 (10:51 +0100)]
[Arm, 3/3] Add Execution and Data Prediction instructions for AArch32
This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)
This patch adds the Execution and Data Prediction Restriction
instructions (that is, cfprctx, dvprxtc, cpprctx). These are all
aliases to MCR and are disassembled as such.
This instruction is retrospectively made optional for all versions of
the architecture from ARMv8.0 to ARMv8.4 and is mandatory from
ARMv8.5. Hence adding a new +predres for older versions of the
architecture.
*** include/ChangeLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* opcode/arm.h (ARM_EXT2_PREDRES): New.
(ARM_ARCH_V8_5A): Add ARM_EXT2_PREDRES by default.
*** gas/ChangeLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (arm_ext_predres): New.
(insns): Add new cfprctx, dvprctx and cpprctx instructions.
(arm_extensions): Add "predres".
* doc/c-arm.texi: Document the above.
* testsuite/gas/arm/predres-bad.d: New test.
* testsuite/gas/arm/predres-bad.l: New test.
* testsuite/gas/arm/predres.s: New test.
* testsuite/gas/arm/predres1.d: New test.
* testsuite/gas/arm/predres2.d: New test.
Sudakshina Das [Fri, 5 Oct 2018 09:49:53 +0000 (10:49 +0100)]
[Arm, 2/3] Add instruction SB for AArch32
This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)
This patch adds the instruction SB. This instruction is
retrospectively made optional for all versions of the architecture
from ARMv8.0 to ARMv8.4 and is mandatory from ARMv8.5. Hence adding a
new "+sb" for older archtectures.
*** include/ChangeLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* opcode/arm.h (ARM_EXT2_SB): New.
(ARM_ARCH_V8_5A): Add ARM_EXT2_SB by default.
*** opcodes/ChangeLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (arm_opcodes): Add sb.
(thumb32_opcodes): Likewise.
*** gas/ChangeLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (arm_ext_sb): New.
(insns): Add new sb instruction.
(arm_extensions): Add "sb".
* doc/c-arm.texi: Document the above.
* testsuite/gas/arm/sb-bad.d: New test.
* testsuite/gas/arm/sb-bad.l: New test.
* testsuite/gas/arm/sb-thumb1.d: New test.
* testsuite/gas/arm/sb-thumb2.d: New test.
* testsuite/gas/arm/sb.s: New test.
* testsuite/gas/arm/sb1.d: New test.
* testsuite/gas/arm/sb2.d: New test.
Sudakshina Das [Fri, 5 Oct 2018 09:47:29 +0000 (10:47 +0100)]
[Arm, 1/3] Add -march=armv8.5-a and related internal feature macros to AArch32
This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)
This is the first of the patch series and adds -march=armv8.5-a and
other internal feature marcos needed for it.
*** gas/ChangeLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (arm_archs): New entry for armv8.5-a.
(cpu_arch_ver): Likewise.
* doc/c-arm.texi: Add documentation for the same.
* testsuite/gas/arm/attr-march-armv8_5-a.d: New.
*** include/ChnageLog ***
2018-10-05 Sudakshina Das <sudi.das@arm.com>
* opcode/arm.h (ARM_EXT2_V8_5A): New.
(ARM_AEXT2_V8_5A, ARM_ARCH_V8_5A): New.
Tom Tromey [Sat, 21 Apr 2018 22:09:10 +0000 (16:09 -0600)]
Add -Wshadow=local
This adds -Wshadow=local to configure.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS): Add -Wshadow=local.
gdb/gdbserver/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
Tom Tromey [Sun, 22 Apr 2018 16:46:03 +0000 (10:46 -0600)]
Shadowing fix in gdbscm_frame_read_var
-Wshadow=local pointed out that the shadowing in gdbscm_frame_read_var
means that the ultimate call to read_var_value will always be passed
block==NULL. The fix is to remove the inner declaration.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* guile/scm-frame.c (gdbscm_frame_read_var): Remove inner
declaration of "block".
Tom Tromey [Sun, 22 Apr 2018 16:11:32 +0000 (10:11 -0600)]
Avoid shadowing in fdwalk
-Wshadow=local caught this buglet. fdwalk redeclares "result" in the
inner scope, meaning that this function will always return 0, even on
error.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* common/filestuff.c (fdwalk): Remove inner declaration of
"result".
Tom Tromey [Sun, 22 Apr 2018 04:42:00 +0000 (22:42 -0600)]
Fix latent bug in msp430-tdep.c
-Wshadow=local found this latent bug. msp430-tdep.c does:
const gdb_byte *arg_bits;
{
/* Aggregates of any size are passed by reference. */
gdb_byte struct_addr[4];
[...
arg_bits = struct_addr;
}
... use arg_bits
Here, arg_bits can point to an object that's gone out of scope.
The fix is to hoist the inner "struct_addr" buffer to an outer scope,
and rename it to avoid shadowing.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* msp430-tdep.c (msp430_push_dummy_call): Rename inner
"structs_addr" and hoist declaration.
Tom Tromey [Sun, 22 Apr 2018 16:46:51 +0000 (10:46 -0600)]
Avoid shadowing in linux-tdep.c
This is one of the uglier changes to avoid local shadowing. Because
obstack.h uses statement expressions, in some cases a nested obstack
call will result in shadowing. Rather than try to fix obstack.h, this
patch simply works around the one instance of this problem.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* linux-tdep.c (linux_make_mappings_corefile_notes): Introduce new
variable "size".
Tom Tromey [Sun, 22 Apr 2018 16:26:18 +0000 (10:26 -0600)]
Use std::string in mdebugread.c
This changes a couple of spots in mdebugread to use std::string rather
than manual management. This is simpler, and also avoids shadowing by
renaming the variable in question.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* mdebugread.c (parse_partial_symbols): Use std::string.
Tom Tromey [Sun, 22 Apr 2018 16:50:27 +0000 (10:50 -0600)]
Avoid shadowing in gdbserver
This fixes a few instances of shadowing in gdbserver. These are all
simple fixes.
gdb/gdbserver/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* server.c (handle_status): Rename inner "thread".
(process_serial_event): Declare "res" in 'm' case.
* linux-low.c (last_thread_of_process_p, find_lwp_pid)
(iterate_over_lwps): Rename inner "thread".
(linux_qxfer_libraries_svr4): Rename inner "len".
* gdbthread.h (find_thread_in_random): Rename inner "thread".
Tom Tromey [Sat, 21 Apr 2018 22:16:27 +0000 (16:16 -0600)]
Simple -Wshadow=local fixes
This fixes all the straightforward -Wshadow=local warnings in gdb. A
few standard approaches are used here:
* Renaming an inner (or outer, but more commonly inner) variable;
* Lowering a declaration to avoid a clash;
* Moving a declaration into a more inner scope to avoid a clash,
including the special case of moving a declaration into a loop header.
I did not consider any of the changes in this patch to be particularly
noteworthy, though of course they should all still be examined.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* ctf.c (SET_ARRAY_FIELD): Rename "u32".
* p-valprint.c (pascal_val_print): Split inner "i" variable.
* xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop
header.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in
more inner scope.
* xcoffread.c (read_xcoff_symtab): Rename inner "symbol".
* varobj.c (varobj_update): Rename inner "newobj",
"type_changed".
* valprint.c (generic_emit_char): Rename inner "buf".
* valops.c (find_overload_match): Rename inner "temp".
(value_struct_elt_for_reference): Declare "v" in more inner
scope.
* v850-tdep.c (v850_push_dummy_call): Rename "len".
* unittests/array-view-selftests.c (run_tests): Rename inner
"vec".
* tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop
header.
* tracepoint.c (merge_uploaded_trace_state_variables): Declare
"tsv" in more inner scope.
(print_one_static_tracepoint_marker): Rename inner
"tuple_emitter".
* tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower.
(tic6x_push_dummy_call): Don't redeclare "addr".
* target-float.c: Declare "dto" lower.
* symtab.c (lookup_local_symbol): Rename inner "sym".
(find_pc_sect_line): Rename inner "pc".
* stack.c (print_frame): Don't redeclare "gdbarch".
(return_command): Rename inner "gdbarch".
* s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner
"sp".
* rust-lang.c (rust_internal_print_type): Declare "i" in loop
header.
* rs6000-tdep.c (ppc_process_record): Rename inner "addr".
* riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner
scope.
* remote.c (remote_target::update_thread_list): Don't redeclare
"tp".
(remote_target::process_initial_stop_replies): Rename inner
"thread".
(remote_target::remote_parse_stop_reply): Don't redeclare "p".
(remote_target::wait_as): Don't redeclare "stop_reply".
(remote_target::get_thread_local_address): Rename inner
"result".
(remote_target::get_tib_address): Likewise.
Simon Marchi [Fri, 5 Oct 2018 02:43:27 +0000 (22:43 -0400)]
Fix undefined behavior, don't pass NULL to fwrite
If a vector that we try to write using file_write is empty, we may end
up passing NULL to fwrite, which triggers UBSan:
.../gdb/dwarf-index-write.c:73:14: runtime error: null pointer passed as argument 1, which is declared to never be null
Avoid it by skipping the write if the vector is empty.
gdb/ChangeLog:
* dwarf-index-write.c (file_write): Don't write if the vector is
empty.
Stafford Horne [Fri, 5 Oct 2018 02:41:42 +0000 (11:41 +0900)]
or1k: Add OpenRISC gas documentation
gas/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* doc/Makefile.am (CPU_DOCS): Add entry for OpenRISC.
* doc/Makefile.in: Regenerated.
* doc/all.texi: Set OPENRISC.
* doc/as.texi: Document OpenRISC.
* doc/c-or1k.texi: New file.
Richard Henderson [Fri, 5 Oct 2018 02:41:41 +0000 (11:41 +0900)]
or1k: Add the l.muld, l.muldu, l.macu, l.msbu insns
Also fix the incorrect definitions of multiply and divide carry and
overflow float.
Changes to the instructions are made in the .cpu file, then we
regenerate the binutils and sim files.
The changes also required a few fixups for tests and additional sim helpers.
cpu/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
Stafford Horne <shorne@gmail.com>
* or1korbis.cpu (insn-opcode-mac): Add opcodes for MACU and MSBU.
(insn-opcode-alu-regreg): Add opcodes for MULD and MULDU.
(l-mul): Fix overflow support and indentation.
(l-mulu): Fix overflow support and indentation.
(l-muld, l-muldu, l-msbu, l-macu): New instructions.
(l-div); Remove incorrect carry behavior.
(l-divu): Fix carry and overflow behavior.
(l-mac): Add overflow support.
(l-msb, l-msbu): Add carry and overflow support.
opcodes/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
Stafford Horne <shorne@gmail.com>
* or1k-desc.c: Regenerate.
* or1k-desc.h: Regenerate.
* or1k-opc.c: Regenerate.
* or1k-opc.h: Regenerate.
* or1k-opinst.c: Regenerate.
sim/common/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* cgen-ops.h (ADDCFDI): New function, add carry flag DI variant.
(ADDOFDI): New function, add overflow flag DI variant.
(SUBCFDI): New function, subtract carry flag DI variant.
(SUBOFDI): New function, subtract overflow flag DI variant.
sim/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* or1k/cpu.h: Regenerate.
* or1k/decode.c: Regenerate.
* or1k/decode.h: Regenerate.
* or1k/model.c: Regenerate.
* or1k/sem-switch.c: Regenerate.
* or1k/sem.c: Regenerate:
sim/testsuite/sim/or1k/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* div.S: Fix tests to match correct overflow/carry semantics.
* mul.S: Likewise.
gas/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* testsuite/gas/or1k/allinsn.s: Add instruction tests for
l.muld, l.muldu, l.macu, l.msb, l.msbu.
* testsuite/gas/or1k/allinsn.d: Add test results for new
instructions.
Stafford Horne [Fri, 5 Oct 2018 02:41:41 +0000 (11:41 +0900)]
or1k: Add the l.adrp insn and supporting relocations
This patch adds the new instruction and relocation as per proposal:
https://openrisc.io/proposals/ladrp
This is to be added to the spec in an upcoming revision. The new instruction
l.adrp loads the page offset of the current instruction offset by
a 21-bit immediate shifted left 13-bits. This is meant to be used with
a 13-bit lower bit page offset. This allows us to free up the got
register r16.
l.adrp r3, foo
l.ori r4, r3, po(foo)
l.lbz r5, po(foo)(r3)
l.sb po(foo)(r3), r6
The relocations we add are:
- BFD_RELOC_OR1K_PLTA26 For PLT jump relocation with PLT entry
asm: plta() implemented using l.ardp, meaning
no need for r16 (the GOT reg)
- BFD_RELOC_OR1K_GOT_PG21 Upper 21-bit Page offset got address
asm: got()
- BFD_RELOC_OR1K_TLS_GD_PG21 Upper 21-bit Page offset with TLS General
asm: tlsgd() Dynamic calculation
- BFD_RELOC_OR1K_TLS_LDM_PG21 Upper 21-bit Page offset with TLS local
asm: tlsldm() dynamic calculation
- BFD_RELOC_OR1K_TLS_IE_PG21 Upper 21-bit Page offset with TLS Initial
asm: gottp() Executable calculation
- BFD_RELOC_OR1K_PCREL_PG21 Default relocation for disp21 (l.adrp
instructions)
- BFD_RELOC_OR1K_LO13 low 13-bit page offset relocation
asm: po() i.e. mem loads, addi etc
- BFD_RELOC_OR1K_SLO13 low 13-bit page offset relocation
asm: po() i.e. mem stores, with split immediate
- BFD_RELOC_OR1K_GOT_LO13, low 13-bit page offset with GOT calcs
asm: gotpo()
- BFD_RELOC_OR1K_TLS_GD_LO13 Lower 13-bit offset with TLS GD calcs
asm: tlsgdpo()
- BFD_RELOC_OR1K_TLS_LDM_LO13 Lower 13-bit offset with TLS LD calcs
asm: tlsldmpo()
- BFD_RELOC_OR1K_TLS_IE_LO13 Lower 13-bit offset with TLS IE calcs
asm: gottppo()
bfd/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* bfd-in2.h: Regenerated.
* elf32-or1k.c: (or1k_elf_howto_table): Fix formatting for
R_OR1K_PLT26, Add R_OR1K_PCREL_PG21, R_OR1K_GOT_PG21,
R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21, R_OR1K_TLS_IE_PG21,
R_OR1K_LO13, R_OR1K_GOT_LO13, R_OR1K_TLS_GD_LO13, R_OR1K_TLS_LDM_LO13,
R_OR1K_TLS_IE_LO13, R_OR1K_SLO13, R_OR1K_PLTA26.
(or1k_reloc_map): Add BFD_RELOC_OR1K_PCREL_PG21,
BFD_RELOC_OR1K_GOT_PG21, BFD_RELOC_OR1K_TLS_GD_PG21,
BFD_RELOC_OR1K_TLS_LDM_PG21, BFD_RELOC_OR1K_TLS_IE_PG21,
BFD_RELOC_OR1K_LO13, BFD_RELOC_OR1K_GOT_LO13,
BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_GD_LO13,
BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_LO13,
BFD_RELOC_OR1K_SLO13, BFD_RELOC_OR1K_PLTA26.
(elf_or1k_link_hash_table): Add field saw_plta.
(or1k_final_link_relocate): Add value calculations for new relocations.
(or1k_elf_relocate_section): Add section relocations for new
relocations.
(or1k_write_plt_entry): New function.
(or1k_elf_finish_dynamic_sections): Add support for PLTA relocations
using new l.adrp instruction. Cleanup PLT relocation code generation.
* libbfd.h: Regenerated.
* reloc.c: Add BFD_RELOC_OR1K_PCREL_PG21, BFD_RELOC_OR1K_LO13,
BFD_RELOC_OR1K_SLO13, BFD_RELOC_OR1K_GOT_PG21, BFD_RELOC_OR1K_GOT_LO13,
BFD_RELOC_OR1K_PLTA26, BFD_RELOC_OR1K_TLS_GD_PG21,
BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_LDM_PG21,
BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_PG21,
BFD_RELOC_OR1K_TLS_IE_LO13.
cpu/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k.opc (parse_disp26): Add support for plta() relocations.
(parse_disp21): New function.
(or1k_rclass): New enum.
(or1k_rtype): New enum.
(or1k_imm16_relocs): Define new PO and SPO relocation mappings.
(parse_reloc): Add new po(), gotpo() and gottppo() for LO13 relocations.
(parse_imm16): Add support for the new 21bit and 13bit relocations.
* or1korbis.cpu (f-disp26): Don't assume SI.
(f-disp21): New pc-relative 21-bit 13 shifted to right.
(insn-opcode): Add ADRP.
(l-adrp): New instruction.
gas/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* config/tc-or1k.c (or1k_apply_fix): Add BFD_RELOC_OR1K_TLS_GD_PG21,
BFD_RELOC_OR1K_TLS_GD_LO13, BFD_RELOC_OR1K_TLS_LDM_PG21,
BFD_RELOC_OR1K_TLS_LDM_LO13, BFD_RELOC_OR1K_TLS_IE_PG21,
BFD_RELOC_OR1K_TLS_IE_LO13.
* testsuite/gas/or1k/allinsn.s: Add test for l.adrp.
* testsuite/gas/or1k/allinsn.d: Add test results for new
instructions.
* testsuite/gas/or1k/reloc-1.s: Add tests to generate
R_OR1K_PLTA26, R_OR1K_GOT_PG21, R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21,
R_OR1K_TLS_IE_PG21, R_OR1K_LO13, R_OR1K_GOT_LO13, R_OR1K_TLS_GD_LO13,
R_OR1K_TLD_LDM_LO13, R_OR1K_TLS_IE_LO13, R_OR1K_LO13, R_OR1K_SLO13
relocations.
* testsuite/gas/or1k/reloc-1.d: Add relocation results for
tests.
* testsuite/gas/or1k/reloc-2.s: Add negative tests for store to
gotpo().
* testsuite/gas/or1k/reloc-2.l: Add expected error test results.
ld/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* testsuite/ld-or1k/or1k.exp: Add test cases for plt generation.
* testsuite/ld-or1k/plt1.dd: New file.
* testsuite/ld-or1k/plt1.s: New file.
* testsuite/ld-or1k/plt1.x.dd: New file.
* testsuite/ld-or1k/plta1.dd: New file.
* testsuite/ld-or1k/plta1.s: New file.
* testsuite/ld-or1k/pltlib.s: New file.
include/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* elf/or1k.h (elf_or1k_reloc_type): Add R_OR1K_PCREL_PG21,
R_OR1K_GOT_PG21, R_OR1K_TLS_GD_PG21, R_OR1K_TLS_LDM_PG21,
R_OR1K_TLS_IE_PG21, R_OR1K_LO13, R_OR1K_GOT_LO13,
R_OR1K_TLS_GD_LO13, R_OR1K_TLS_LDM_LO13, R_OR1K_TLS_IE_LO13,
R_OR1K_SLO13, R_OR1K_PLTA26.
opcodes/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k-asm.c: Regenerated.
* or1k-desc.c: Regenerated.
* or1k-desc.h: Regenerated.
* or1k-dis.c: Regenerated.
* or1k-ibld.c: Regenerated.
* or1k-opc.c: Regenerated.
* or1k-opc.h: Regenerated.
* or1k-opinst.c: Regenerated.
Stafford Horne [Fri, 5 Oct 2018 02:41:41 +0000 (11:41 +0900)]
or1k: Fix messages for relocations in shared libraries
Added checks include:
- Do not allow relocations to global symbols using relocations which are
meant for local symbol relocations.
- Require the use of -fpic when compiling shared libraries.
- Require zero addend for plt relocations.
bfd/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* elf32-or1k.c (or1k_elf_relocate_section): Add error for unknown
relocations. Add error for non zero addend with plt and got
relocations. Add error for got and plt references against dynamic, non
local, symbols. Add error when linking non shared liraries with
flag_pic.
Richard Henderson [Fri, 5 Oct 2018 02:41:40 +0000 (11:41 +0900)]
or1k: Add relocations for high-signed and low-stores
This patch adds the following target relocations:
- BFD_RELOC_HI16_S High 16-bit relocation, for used with signed
asm: ha() lower.
- BFD_RELOC_HI16_S_GOTOFF High 16-bit GOT offset relocation for local
asm: gotoffha() symbols, for use with signed lower.
- BFD_RELOC_OR1K_TLS_IE_AHI16 High 16-bit TLS relocation with initial
asm: gottpoffha() executable calculation, for use with signed
lower.
- BFD_RELOC_OR1K_TLS_LE_AHI16 High 16-bit TLS relocation for local executable
asm: tpoffha() variables, for use with signed lower.
- BFD_RELOC_OR1K_SLO16 Split lower 16-bit relocation, used with
asm: lo() OpenRISC store instructions.
- BFD_RELOC_OR1K_GOTOFF_SLO16 Split lower 16-bit GOT offset relocation for
asm: gotofflo() local symbols, used with OpenRISC store
instructions.
- BFD_RELOC_OR1K_TLS_LE_SLO16 Split lower 16-bit relocation for TLS local
asm: tpofflo() executable variables, used with OpenRISC store
instructions.
bfd/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
Stafford Horne <shorne@gmail.com>
* bfd-in2.h: Regenerated.
* elf32-or1k.c (N_ONES): New macro.
(or1k_elf_howto_table): Fix R_OR1K_PLT26 to complain on overflow.
Add definitions for R_OR1K_TLS_TPOFF, R_OR1K_TLS_DTPOFF,
R_OR1K_TLS_DTPMOD, R_OR1K_AHI16, R_OR1K_GOTOFF_AHI16,
R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16, R_OR1K_SLO16,
R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16.
(or1k_reloc_map): Add entries for BFD_RELOC_HI16_S,
BFD_RELOC_LO16_GOTOFF, BFD_RELOC_HI16_GOTOFF, BFD_RELOC_HI16_S_GOTOFF,
BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16,
BFD_RELOC_OR1K_SLO16, BFD_RELOC_OR1K_GOTOFF_SLO16,
BFD_RELOC_OR1K_TLS_LE_SLO16.
(or1k_reloc_type_lookup): Change search loop to start ad index 0 and
also check results before returning.
(or1k_reloc_name_lookup): Simplify loop to use R_OR1K_max as index
limit.
(or1k_final_link_relocate): New function.
(or1k_elf_relocate_section): Add support for new AHI and SLO
relocations. Use or1k_final_link_relocate instead of generic
_bfd_final_link_relocate.
(or1k_elf_check_relocs): Add support for new AHI and SLO relocations.
* reloc.c: Add new enums for BFD_RELOC_OR1K_SLO16,
BFD_RELOC_OR1K_GOTOFF_SLO16, BFD_RELOC_OR1K_TLS_IE_AHI16,
BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16,
BFD_RELOC_OR1K_TLS_LE_SLO16. Remove unused BFD_RELOC_OR1K_GOTOFF_HI16
and BFD_RELOC_OR1K_GOTOFF_LO16.
* libbfd.h: Regenerated.
cpu/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k.opc: Add RTYPE_ enum.
(INVALID_STORE_RELOC): New string.
(or1k_imm16_relocs): New array array.
(parse_reloc): New static function that just does the parsing.
(parse_imm16): New static function for generic parsing.
(parse_simm16): Change to just call parse_imm16.
(parse_simm16_split): New function.
(parse_uimm16): Change to call parse_imm16.
(parse_uimm16_split): New function.
* or1korbis.cpu (simm16-split): Change to use new simm16_split.
(uimm16-split): Change to use new uimm16_split.
gas/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* testsuite/gas/or1k/allinsn.d (l_ha): Add result for ha() relocation.
* testsuite/gas/or1k/allinsn.s (l_ha): Add test for ha() relocations.
* testsuite/gas/or1k/allinsn.exp: Renamed to or1k.exp.
* testsuite/gas/or1k/or1k.exp: Add reloc-2 list test.
* testsuite/gas/or1k/reloc-1.d: New file.
* testsuite/gas/or1k/reloc-1.s: New file.
* testsuite/gas/or1k/reloc-2.l: New file.
* testsuite/gas/or1k/reloc-2.s: New file.
include/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* elf/or1k.h (elf_or1k_reloc_type): Add R_OR1K_AHI16,
R_OR1K_GOTOFF_AHI16, R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16,
R_OR1K_SLO16, R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16.
ld/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* testsuite/ld-or1k/offsets1.d: New file.
* testsuite/ld-or1k/offsets1.s: New file.
* testsuite/ld-or1k/or1k.exp: New file.
opcodes/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k-asm.c: Regenerate.
GDB Administrator [Fri, 5 Oct 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Tue, 2 Oct 2018 19:47:54 +0000 (21:47 +0200)]
[gdb/python] Fix cpychecker error in pspy_solib_name
When using cpychecker, we run into:
...
gdb/python/py-progspace.c: \
In function ‘PyObject* pspy_solib_name(PyObject*, PyObject*)’:
gdb/python/py-progspace.c:370:25: error: Mismatching type in call to \
PyArg_ParseTuple with format code "K" [-Werror]
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
argument 3 ("&pc") had type
"gdb_py_longest *" (pointing to 64 bits)
but was expecting
"long long unsigned int *" (pointing to 64 bits)
for format code "K"
...
Fix this fixing the type of the variable.
Build and reg-tested on x86_64-linux.
2018-10-05 Tom de Vries <tdevries@suse.de>
* python/py-progspace.c (pspy_solib_name): Fix type mismatch in
PyArg_ParseTuple call.
Tom de Vries [Tue, 2 Oct 2018 19:47:37 +0000 (21:47 +0200)]
[gdb/python] Fix cpychecker error in recpy_bt_goto
When using cpychecker, we run into this error:
...
gdb/python/py-record-btrace.c: \
In function ‘PyObject* recpy_bt_goto(PyObject*, PyObject*)’:
gdb/python/py-record-btrace.c:783:25: error: Mismatching type in call to \
PyArg_ParseTuple with format code "O" [-Werror]
if (!PyArg_ParseTuple (args, "O", &obj))
argument 3 ("&obj") had type
"const struct recpy_element_object * *"
but was expecting
"struct PyObject * *"
for format code "O"
...
Fix this by using a new variable of the expected type instead.
Build and reg-tested on x86_64-linux.
2018-10-05 Tom de Vries <tdevries@suse.de>
* python/py-record-btrace.c (recpy_bt_goto): Fix type mismatch in
PyArg_ParseTuple call.
Joel Brobecker [Thu, 4 Oct 2018 22:04:13 +0000 (18:04 -0400)]
reformat parameters of gdb/psymtab.c::recursively_search_psymtabs
This is just to make sure one of the parameters doesn't end past
the 80 characters limit. And while at it, since all parameters were
on their own line except the first two that were listed on the same
line, it felf more consistent to just split them to have each and
every parameter on their own line.
gdb/ChangeLog:
* psymtab.c (recursively_search_psymtabs): Reformat parameters
to avoid exceeding 80 characters per line limit.
Tested by rebuilding GDB on x86_64-linux.
Jim Wilson [Thu, 4 Oct 2018 20:29:57 +0000 (13:29 -0700)]
RISC-V: Delete zero-size .tdata.dyn section.
bfd/
* elfnn-riscv.c (riscv_elf_size_dynamic_sections): In dynobj->sections
loop, handle htab->sdyntdata section.
Tom Tromey [Mon, 28 May 2018 03:31:14 +0000 (21:31 -0600)]
Simplify complaints even more
This removes the SHORT_FIRST_MESSAGE case from complaints, leaving
only a single case. This allows for the removal of the last argument
to clear_complaints, and also simplifies complaint_internal, removing
an extra allocation in the process.
After this, the "./gdb -iex 'set complaint 1' -nx ./gdb" example will
show:
Reading symbols from ./gdb...
During symbol reading: .debug_ranges entry has start address of zero [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: DW_AT_low_pc 0x0 is zero for DIE at 0x17116c1 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: .debug_line address at offset 0xa22f5 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: unsupported tag: 'DW_TAG_unspecified_type'
During symbol reading: const value length mismatch for 'std::ratio<1,
1000000000>::num', got 8, expected 0
This is a bit wordier but, I think, a bit more clear, as the form of
the message no longer depends on precisely when it was emitted. In
particular if you compare to the output from the 'Clean up "Reading
symbols" output' patch, you can see that earlier gdb would switch from
the prefix-less form to the "During symbol reading" form at a point
that is meaningless to the user (specifically, after psymtab reading
is done and gdb tries to expand a CU).
2018-10-04 Tom Tromey <tom@tromey.com>
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
* complaints.h (clear_complaints): Remove argument.
* complaints.c (enum complaint_series): Remove.
(series): Remove global.
(complaint_internal): Update.
(clear_complaints): Remove argument.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* gdb.cp/maint.exp (test_invalid_name): Update expected output.
* gdb.gdb/complaints.exp (test_short_complaints): Remove.
(test_initial_complaints, test_empty_complaints): Update.
* gdb.dwarf2/dw2-stack-boundary.exp: Update.
Tom Tromey [Mon, 28 May 2018 03:12:58 +0000 (21:12 -0600)]
Only print "no debugging symbols" message once
The "no debugging symbols" message can be confusing in some cases, for
example when gdb finds separate debug info for an objfile, but the
separate debug info does not contain symbols.
For example:
(gdb) file /bin/ls
Reading symbols from /bin/ls...
Reading symbols from .gnu_debugdata for /usr/bin/ls...
(No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
(No debugging symbols found in /bin/ls)
Here, I think the second "no debugging symbols" message is redundant
and confusing.
This patch changes gdb to only emit this message when the objfile in
question does not have a separate debug file. So, in the example
above, the output would now read:
(gdb) file /bin/ls
Reading symbols from /bin/ls...
Reading symbols from .gnu_debugdata for /usr/bin/ls...
(No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
2018-10-04 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_add_with_addrs): Do not print "no
debugging symbols" message if there is a separate debug objfile.
Tom Tromey [Sat, 19 May 2018 17:25:20 +0000 (11:25 -0600)]
Clean up "Reading symbols" output
This patch is another attempt to fix PR cli/19551. Unlike my previous
attempt, it doesn't print progress. Instead, it just changes some
messages and adds newlines to make the output a bit nicer.
It also removes the "done." text that was previously emitted. The
idea here is that it is obvious when gdb is done reading debug info,
as it starts then doing something else; and that while this message
did not provide much benefit to users, it did make it harder to make
the output clean.
After this change the output from "./gdb -iex 'set complaint 1' -nx ./gdb"
reads:
Reading symbols from ./gdb...
.debug_ranges entry has start address of zero [in module /home/tromey/gdb/build/gdb/gdb]
DW_AT_low_pc 0x0 is zero for DIE at 0x17116c1 [in module /home/tromey/gdb/build/gdb/gdb]
.debug_line address at offset 0xa22f5 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading, unsupported tag: 'DW_TAG_unspecified_type'.
During symbol reading, const value length mismatch for 'std::ratio<1,
1000000000>::num', got 8, expected 0.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
PR cli/19551:
* symfile.c (symbol_file_add_with_addrs): Update output.
* psymtab.c (require_partial_symbols): Update output.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
PR cli/19551:
* lib/mi-support.exp (mi_gdb_file_cmd): Update.
* lib/gdb.exp (gdb_file_cmd): Update.
* gdb.stabs/weird.exp (print_weird_var): Update.
* gdb.server/solib-list.exp: Update.
* gdb.multi/remove-inferiors.exp (test_remove_inferiors): Update.
* gdb.mi/mi-cli.exp: Update.
* gdb.linespec/linespec.exp: Update.
* gdb.dwarf2/dw2-stack-boundary.exp: Update.
* gdb.dwarf2/dw2-objfile-overlap.exp: Update.
* gdb.cp/cp-relocate.exp: Update.
* gdb.base/sym-file.exp: Update.
* gdb.base/relocate.exp: Update.
* gdb.base/readnever.exp: Update.
* gdb.base/print-symbol-loading.exp (test_load_core): Update.
* gdb.base/kill-detach-inferiors-cmd.exp: Update.
* gdb.base/dbx.exp (gdb_file_cmd): Update.
* gdb.base/code_elim.exp: Update.
* gdb.base/break-unload-file.exp (test_break): Update.
* gdb.base/break-interp.exp (test_attach_gdb): Update.
* gdb.base/break-idempotent.exp (force_breakpoint_re_set):
Update.
* gdb.base/attach.exp (do_attach_tests): Update.
* gdb.base/sepdebug.exp: Update.
* gdb.python/py-section-script.exp: Update.
Tom Tromey [Thu, 17 May 2018 05:30:43 +0000 (23:30 -0600)]
Make complaint output prettier
Currently complaints are not always printed with a newline. For
example, when I run gdb on itself, I see output like:
(gdb) set complaints 5
(gdb) file ./gdb/gdb
Reading symbols from ./gdb/gdb...DW_AT_low_pc 0x0 is zero for DIE at 0x437dd4 [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0x21bf9 is 0 [in module /home/tromey/gdb/build/gdb/gdb]...DW_AT_low_pc 0x0 is zero for DIE at 0x5a85dd [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0x2dc2d is 0 [in module /home/tromey/gdb/build/gdb/gdb]...DW_AT_low_pc 0x0 is zero for DIE at 0xab6033 [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0x4f683 is 0 [in module /home/tromey/gdb/build/gdb/gdb]...DW_AT_low_pc 0x0 is zero for DIE at 0x10028f0 [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0x75edf is 0 [in module /home/tromey/gdb/build/gdb/gdb]...DW_AT_low_pc 0x0 is zero for DIE at 0x1021364 [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0x76f62 is 0 [in module /home/tromey/gdb/build/gdb/gdb]...done.
That's one very long line. I find it quite difficult to read that,
and I thought it would be better with some newlines, which is what
this patch does. Now the output looks like:
(gdb) file ./gdb
Reading symbols from ./gdb...
DW_AT_low_pc 0x0 is zero for DIE at 0x437dd4 [in module /home/tromey/gdb/build/gdb/gdb]
.debug_line address at offset 0x21bf9 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
DW_AT_low_pc 0x0 is zero for DIE at 0x5a85dd [in module /home/tromey/gdb/build/gdb/gdb]
.debug_line address at offset 0x2dc2d is 0 [in module /home/tromey/gdb/build/gdb/gdb]
done.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
PR cli/22234:
* complaints.c: Emit \n.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
PR cli/22234:
* gdb.dwarf2/dw2-stack-boundary.exp: Update expected output.
* gdb.gdb/complaints.exp (test_short_complaints): Update expected
output.
Tom Tromey [Thu, 17 May 2018 03:52:04 +0000 (21:52 -0600)]
Use filtered printing when reading symbols
While working on this series, I found some unfiltered prints that
didn't make sense -- many things, like complaints, are filtered, while
their context (in this case the "Reading symbols ..." messages) may
not be.
This patch changes some spots in symbol reading to use filtered
prints. I think this is preferable overall; in fact I'd go farther
and say that unfiltered printing should just be removed.
One of these spots was not strictly related (the change to
dump_psymtab), but I left it in partly because it makes psymtab.c
"unfiltered-clean", and partly because it is an example of filtered
and unfiltered printing being mixed in the same function.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_add_with_addrs, symbol_file_clear)
(separate_debug_file_exists, find_separate_debug_file)
(add_symbol_file_command, reread_symbols, allocate_symtab)
(allocate_compunit_symtab): Use filtered printing, not
unfiltered.
* psymtab.c (require_partial_symbols, dump_psymtab)
(allocate_psymtab): Use filtered printing, not unfiltered.
Tom Tromey [Mon, 28 May 2018 03:36:44 +0000 (21:36 -0600)]
Fix off-by-one error in complaint_internal
complaint_internal had an off-by-one error, where it would allow one
extra complaint to be issued.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* complaints.c (complaint_internal): Correctly check complaint
count.
Tom Tromey [Mon, 28 May 2018 03:26:11 +0000 (21:26 -0600)]
Remove some leftovers from complaints
There were a couple of leftovers from earlier patches in
complaints.[ch]. This removes them.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* complaints.h (struct complaints): Remove declaration.
* complaints.c (clear_complaints): Remove an unused variable.
H.J. Lu [Thu, 4 Oct 2018 19:06:33 +0000 (12:06 -0700)]
pr23658-1.d: Also xfail ft32-* and xgate-*
Since ft32-* and xgate-* use generic linker, SHT_NOTE sections aren't
grouped nor sorted.
PR ld/23658
* testsuite/ld-elf/pr23658-1.d: Also xfail ft32-* and xgate-*.
Tom Tromey [Thu, 4 Oct 2018 17:01:53 +0000 (11:01 -0600)]
Avoid pagination in attach.exp
While re-testing the complaint series, I saw some unresolved tests in
attach.exp. In particular, the tests were failing because the pager
was active.
This is partly a new problem, introduced because that series changes
some prints from unfiltered to filtered. However, it is also a latent
bug, which you can see by shrinking your window very small and then
running the test.
This patch avoids the problem by passing -quiet to gdb and arranging
to set the window height and width in one other test.
Arguably instead of -quiet we should disable the pager during gdb's
welcome message. I can do that if it seems desirable; but meanwhile
this patch is safe.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* gdb.base/attach.exp (test_command_line_attach_run): Use -quiet;
set width and height to 0.
(test_command_line_attach_run): Use -quiet.
Rainer Orth [Thu, 4 Oct 2018 12:10:16 +0000 (14:10 +0200)]
Add self to gdb/MAINTAINERS
Joel asked me to add myself to gdb/MAINTAINERS. Done as follows, fixing two
incorrectly indented lines on the way. Installed on master.
* MAINTAINERS (Write After Approval): Add self.
Jose E. Marchesi [Thu, 4 Oct 2018 10:16:11 +0000 (12:16 +0200)]
bfd: amend ChangeLog entry
Jose E. Marchesi [Thu, 4 Oct 2018 09:12:48 +0000 (02:12 -0700)]
bfd,sparc: fix the .dynsym sh_index when stripping all symbols in ld
The SPARC ELF BFD backend uses a hack in order to accomodate the
STT_REGISTER symbols mandated by the SPARC V9 ABI for 64-bit objects.
The hack works as follows:
- Early in `size_dynamic_symbols', it adds the dynamic STT_REGISTER
symbols and the corresponding DT_SPARC_REGISTER tags if needed,
i.e. if the input object has been annotated by the assembler to use
any of the global registers requiring annotations by the ABI.
The STT_REGISTER symbols are not local, but nevertheless they are
added to the end of the dynlocal linked list (eek, yes) to be fixed
"later". This is done so the symbols are emitted in the symtab.
- Consequently, when the `sh_info' field of the .dynsym section is
calculated in `bfd_elf_final_link' to be `local_dynsymcount + 1', it
may have the wrong value, since the real first global symbol is the
first STT_REGISTER symbol.
- However, this temporary inconsistency is fixed in the
`elf64_sparc_output_arch_syms' backend hook: the sh_index is
adjusted to its rightful value. So all is well and good.
However the 2015 changeset
commit
8539e4e89eb4c54bb6668582cd709765a3803588
Author: Alan Modra <amodra@gmail.com>
Date: Thu Jan 15 19:42:59 2015 +1030
Fix ARM fail of gap test
ld-elf/gap test was failing due to the ARM backend attempting to output
arch symbols when ld -s (strip all symbols) is in force. This patch
stops that happening and tidies the code a little.
made the `elf_backend_output_arch_syms' backend hook to not be called
when all symbols are to be stripped. This resulted in an incorrect
sh_index for .dynsym when a link is performed with -s (strip_all), in
64-bit sparc ELF objects.
This patch moves the sh_index adjusting code from the target
`output_arch_syms' to `finish_dynamic_sections'. It also removes the
strip_all check from `elf64_sparc_output_arch_syms', as the function
is no longer called in that case.
Tested in sparc64-linux-gnu and sparc-linux-gnu.
No regressions observed.
bfd/ChangeLog:
2018-10-04 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf64-sparc.c (elf64_sparc_output_arch_syms): Do not correct the
impact of STT_REGISTER symbols in the dynsym sh_index here...
* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): ... but
do it here.
Tom Tromey [Wed, 3 Oct 2018 22:01:12 +0000 (16:01 -0600)]
Avoid two uninitialized warnings from gcc
This avoids a couple of uninitialized warnings from gcc by
initializing the object in question. The one in coffread.c seems like
it could be a latent bug. The one in scm-value.c is harmless, but GCC
can't see that.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* guile/scm-value.c (gdbscm_value_to_string): Initialize
"buffer_contents".
* coffread.c (coff_symtab_read): Initialize "newobj".
GDB Administrator [Thu, 4 Oct 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 3 Oct 2018 18:34:18 +0000 (14:34 -0400)]
Remove struct keyword in range-based for
I get the following error with gcc 6.3.0:
/home/simark/src/binutils-gdb/gdb/dwarf2read.c: In function 'void read_func_scope(die_info*, dwarf2_cu*)':
/home/simark/src/binutils-gdb/gdb/dwarf2read.c:13838:12: error: types may not be defined in a for-range-declaration [-Werror]
for (struct symbol *sym : template_args)
^~~~~~
Removing the struct keyword fixes it.
gdb/ChangeLog:
* dwarf2read.c (read_func_scope): Remove struct keyword in
range-based for.
Tom Tromey [Sat, 18 Aug 2018 21:32:46 +0000 (15:32 -0600)]
Add --enable-ubsan
This adds --enable-ubsan to gdb's configure. By default it is enabled
in development mode, and disabled otherwise. This passes both
-fsanitize=undefined and -fno-sanitize-recover=undefined to
compilations, so that undefined behavior violations will be sure to
cause test failures.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* README: Mention --enable-ubsan.
* NEWS: Mention --enable-ubsan.
* acinclude.m4: Include sanitize.m4.
* configure: Rebuild.
* configure.ac: Call AM_GDB_UBSAN.
* sanitize.m4: New file.
gdb/doc/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Configure Options): Document --enable-ubsan.
Tom Tromey [Sat, 18 Aug 2018 02:34:40 +0000 (20:34 -0600)]
Avoid undefined behavior in expression dumping
-fsanitize=undefined pointed out undefined behavior in
dump_raw_expression like:
runtime error: load of value
2887952, which is not a valid value for type 'exp_opcode'
dump_raw_expression will try to print the opcode for each element of
the expression, even when it is not valid. To allow this, but have it
avoid undefined behavior, this patch sets the underlying type of enum
exp_opcode, and arranges for op_name to handle invalid opcodes more
nicely.
Before this patch, debug-expr.exp shows:
Dump of expression @ 0x60f000007750, before conversion to prefix form:
Language c, 8 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_TYPE 89 Y...............
<unknown
3851920>
107820862850704 ..:..b..........
2 OP_TYPE 89 Y...............
3 OP_VAR_VALUE 40 (...............
4 <unknown
2807568>
107820861806352 ..*..b..........
5 <unknown
2806368>
107820861805152 `.*..b..........
6 OP_VAR_VALUE 40 (...............
7 UNOP_MEMVAL_TYPE 57 9...............
Afterward, the output is:
Dump of expression @ 0x4820f90, before conversion to prefix form:
Language c, 8 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_TYPE 89 Y...............
1 unknown opcode: 176
75444400 .0..............
2 OP_TYPE 89 Y...............
3 OP_VAR_VALUE 40 (...............
4 OP_BOOL
74616912 P.r.............
5 unknown opcode: 128
74615680 ..r.............
6 OP_VAR_VALUE 40 (...............
7 UNOP_MEMVAL_TYPE 57 9...............
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* expression.h (enum exp_opcode): Use uint8_t as base type.
* expprint.c (op_name): Handle invalid opcodes.
Tom Tromey [Sat, 18 Aug 2018 20:51:46 +0000 (14:51 -0600)]
Avoid undefined behavior in ada_operator_length
-fsanitize=undefined pointed out this error:
runtime error: load of value
2887952, which is not a valid value for type 'exp_opcode'
This happens in gdb.ada/complete.exp when processing "complete p
my_glob". This does not parse, so the Ada parser throws an exception;
but then the code in parse_exp_in_context_1 accepts the expression
anyway. However, as no elements have been written to the expression,
undefined behavior results.
The fix is to notice this case in parse_exp_in_context_1. This patch
also adds an assertion to prefixify_expression to enforce this
pre-existing constraint.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* parse.c (prefixify_expression): Add assert.
(parse_exp_in_context_1): Throw exception if the expression is
empty.
Tom Tromey [Sat, 18 Aug 2018 02:19:13 +0000 (20:19 -0600)]
Avoid undefined behavior in read_signed_leb128
-fsanitize=undefined pointed out that read_signed_leb128 had an
undefined left-shift when processing the final byte of a 64-bit leb:
runtime error: left shift of 127 by 63 places cannot be represented in type 'long int'
and an undefined negation:
runtime error: negation of -
9223372036854775808 cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself
Both of these problems are readily avoided by havinng
read_signed_leb128 work in an unsigned type, and then casting to the
signed type at the return.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* dwarf2read.c (read_signed_leb128): Work in ULONGEST.
Tom Tromey [Mon, 30 Jul 2018 02:23:33 +0000 (20:23 -0600)]
Avoid undefined behavior in parse_number
-fsanitize=undefined pointed out that c-exp.y relied on undefined
behavior here:
if (c != 'l' && c != 'u')
n *= base;
...when a large hex constant "just fit" into a LONGEST, causing the
high bit to be set.
This fixes the problem by having the function work in an unsigned
type.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* c-exp.y (parse_number): Work in unsigned. Remove casts.
Tom Tromey [Sun, 29 Jul 2018 23:29:24 +0000 (17:29 -0600)]
Avoid undefined behavior in read_subrange_type
-fsanitize=undefined pointed out an undefined shift of a negative
value in read_subrange_type. The fix is to do the work in an unsigned
type, where this is defined.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* dwarf2read.c (read_subrange_type): Make "negative_mask"
unsigned.
Tom Tromey [Sun, 29 Jul 2018 23:16:03 +0000 (17:16 -0600)]
Avoid undefined behavior in extract_integer
-fsanitize=undefined showed that extract_integer could left-shift a
negative value, which is undefined. This patch fixes the problem by
doing all the work in an unsigned type. This relies on
implementation-defined behavior, but I tend to think we are on safe
ground there. (Also, if need be, violations of this could probably be
detected, either by configure or by a static_assert.)
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* findvar.c (extract_integer): Do work in an unsigned type.
Tom Tromey [Fri, 27 Jul 2018 01:52:47 +0000 (19:52 -0600)]
Use unsigned as base type for some enums
-fsanitize=undefined complains about using operator~ on various enum
types that are used with DEF_ENUM_FLAGS_TYPE. This patch fixes these
problems by explicitly setting the base type for these enums to
unsigned. It also adds a static assert to enum_flags to ensure that
future enums used this way have an unsigned underlying type.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* common/enum-flags.h (enum_flags::operator~): Add static assert.
* symfile-add-flags.h (enum symfile_add_flag): Use unsigned as
base type.
* objfile-flags.h (enum objfile_flag): Use unsigned as base type.
* gdbtypes.h (enum type_instance_flag_value): Use unsigned as base
type.
* c-lang.h (enum c_string_type_values): Use unsigned as base
type.
* btrace.h (enum btrace_thread_flag): Use unsigned as base type.
Tom Tromey [Tue, 28 Aug 2018 22:14:52 +0000 (16:14 -0600)]
Change dwarf2_frame_state_reg_info::reg to be std::vector
This changes dwarf2_frame_state_reg_info::reg to be a std::vector.
This avoids passing NULL to memcpy in the copy constructor when the
original object does not have any registers.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* dwarf2-frame.h (dwarf2_frame_state_reg_info)
<~dwarf2_frame_state_reg_info>: Update.
<dwarf2_frame_state_reg_info>: Update.
<alloc_regs>: Add assertion. Update.
<reg>: Now a std::vector.
<num_regs>: Remove.
<swap>: Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program)
(execute_cfa_program_test, dwarf2_frame_cache): Update.
Tom Tromey [Thu, 26 Jul 2018 23:48:40 +0000 (17:48 -0600)]
Do not pass NULL to memcpy
-fsanitize=undefined pointed out a spot that passes NULL to memcpy,
which is undefined behavior according to the C standard.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* namespace.c (add_using_directive): Don't pass NULL to memcpy.
H.J. Lu [Wed, 3 Oct 2018 21:11:43 +0000 (14:11 -0700)]
ELF: Add testcases for PR ld/23658
Add testcases to verify that all SHT_NOTE sections with the same section
alignment are placed in a single PT_NOTE segment.
PR ld/23658
* testsuite/ld-elf/pr23658-1.d: New file.
* testsuite/ld-elf/pr23658-1a.s: Likewise.
* testsuite/ld-elf/pr23658-1b.s: Likewise.
* testsuite/ld-elf/pr23658-1c.s: Likewise.
* testsuite/ld-elf/pr23658-1d.s: Likewise.
* testsuite/ld-elf/pr23658-2.rd: Likewise.
* testsuite/ld-elf/pr23658-3.d: Likewise.
* testsuite/ld-elf/pr23658-3.s: Likewise.
* testsuite/ld-elf/pr23658-3.t: Likewise.
* testsuite/ld-elf/shared.exp: Run PR ld/23658 tests.
Philippe Waroquiers [Wed, 3 Oct 2018 20:27:52 +0000 (22:27 +0200)]
tid-parse.c tid_is_in_list correct 'See' comment.
Refer to tid-parse.h and tid_is_in_list is explained there.
H.J. Lu [Wed, 3 Oct 2018 20:25:16 +0000 (13:25 -0700)]
ELF: Group and sort output note sections by section alignments
To support putting all adjacent SHT_NOTE sections with the same section
alignment into a single PT_NOTE segment, lang_insert_orphan must group
and sort output note sections by section alignments in both output
section list as well as output section statement list.
PR ld/23658
* ldlang.c (lang_insert_orphan): Group and sort output note
sections by section alignments.
H.J. Lu [Wed, 3 Oct 2018 20:22:26 +0000 (13:22 -0700)]
ELF: Group PT_NOTE segments by section alignments
Alignments of SHT_NOTE sections can be 8 bytes for 64-bit ELF files. We
should put all adjacent SHT_NOTE sections with the same section alignment
into a single PT_NOTE segment even when the section alignment != 4 bytes.
Also check SHT_NOTE section type instead of section name.
PR ld/23658
* elf.c (get_program_header_size): Put all adjacent SHT_NOTE
sections with the same section alignment into a single PT_NOTE
segment. Check SHT_NOTE section type instead of section name.
(_bfd_elf_map_sections_to_segments): Likewise.
Tamar Christina [Wed, 3 Oct 2018 17:52:36 +0000 (18:52 +0100)]
AArch64: Add MOVPRFX tests and update testsuite
This patch adds the tests and expected output for each of the conditions where
the MOVPRFX constraint should apply.
The specific test cases are all documented to indicate what the expected
behavior should be.
gas/
* testsuite/gas/aarch64/sve-movprfx_1.d: New test.
* testsuite/gas/aarch64/sve-movprfx_1.s: New test.
* testsuite/gas/aarch64/sve-movprfx_10.d: New test.
* testsuite/gas/aarch64/sve-movprfx_10.l: New test.
* testsuite/gas/aarch64/sve-movprfx_10.s: New test.
* testsuite/gas/aarch64/sve-movprfx_11.d: New test.
* testsuite/gas/aarch64/sve-movprfx_11.s: New test.
* testsuite/gas/aarch64/sve-movprfx_12.d: New test.
* testsuite/gas/aarch64/sve-movprfx_12.s: New test.
* testsuite/gas/aarch64/sve-movprfx_13.d: New test.
* testsuite/gas/aarch64/sve-movprfx_13.l: New test.
* testsuite/gas/aarch64/sve-movprfx_13.s: New test.
* testsuite/gas/aarch64/sve-movprfx_14.d: New test.
* testsuite/gas/aarch64/sve-movprfx_14.l: New test.
* testsuite/gas/aarch64/sve-movprfx_14.s: New test.
* testsuite/gas/aarch64/sve-movprfx_15.d: New test.
* testsuite/gas/aarch64/sve-movprfx_15.l: New test.
* testsuite/gas/aarch64/sve-movprfx_15.s: New test.
* testsuite/gas/aarch64/sve-movprfx_16.d: New test.
* testsuite/gas/aarch64/sve-movprfx_16.s: New test.
* testsuite/gas/aarch64/sve-movprfx_17.d: New test.
* testsuite/gas/aarch64/sve-movprfx_17.l: New test.
* testsuite/gas/aarch64/sve-movprfx_17.s: New test.
* testsuite/gas/aarch64/sve-movprfx_18.d: New test.
* testsuite/gas/aarch64/sve-movprfx_18.l: New test.
* testsuite/gas/aarch64/sve-movprfx_18.s: New test.
* testsuite/gas/aarch64/sve-movprfx_19.d: New test.
* testsuite/gas/aarch64/sve-movprfx_19.s: New test.
* testsuite/gas/aarch64/sve-movprfx_2.d: New test.
* testsuite/gas/aarch64/sve-movprfx_2.l: New test.
* testsuite/gas/aarch64/sve-movprfx_2.s: New test.
* testsuite/gas/aarch64/sve-movprfx_20.d: New test.
* testsuite/gas/aarch64/sve-movprfx_20.l: New test.
* testsuite/gas/aarch64/sve-movprfx_20.s: New test.
* testsuite/gas/aarch64/sve-movprfx_21.d: New test.
* testsuite/gas/aarch64/sve-movprfx_21.s: New test.
* testsuite/gas/aarch64/sve-movprfx_22.d: New test.
* testsuite/gas/aarch64/sve-movprfx_22.l: New test.
* testsuite/gas/aarch64/sve-movprfx_22.s: New test.
* testsuite/gas/aarch64/sve-movprfx_23.d: New test.
* testsuite/gas/aarch64/sve-movprfx_23.l: New test.
* testsuite/gas/aarch64/sve-movprfx_23.s: New test.
* testsuite/gas/aarch64/sve-movprfx_24.d: New test.
* testsuite/gas/aarch64/sve-movprfx_24.l: New test.
* testsuite/gas/aarch64/sve-movprfx_24.s: New test.
* testsuite/gas/aarch64/sve-movprfx_25.d: New test.
* testsuite/gas/aarch64/sve-movprfx_25.l: New test.
* testsuite/gas/aarch64/sve-movprfx_25.s: New test.
* testsuite/gas/aarch64/sve-movprfx_26.d: New test.
* testsuite/gas/aarch64/sve-movprfx_26.l: New test.
* testsuite/gas/aarch64/sve-movprfx_26.s: New test.
* testsuite/gas/aarch64/sve-movprfx_3.d: New test.
* testsuite/gas/aarch64/sve-movprfx_3.l: New test.
* testsuite/gas/aarch64/sve-movprfx_3.s: New test.
* testsuite/gas/aarch64/sve-movprfx_4.d: New test.
* testsuite/gas/aarch64/sve-movprfx_4.l: New test.
* testsuite/gas/aarch64/sve-movprfx_4.s: New test.
* testsuite/gas/aarch64/sve-movprfx_5.d: New test.
* testsuite/gas/aarch64/sve-movprfx_5.s: New test.
* testsuite/gas/aarch64/sve-movprfx_6.d: New test.
* testsuite/gas/aarch64/sve-movprfx_6.l: New test.
* testsuite/gas/aarch64/sve-movprfx_6.s: New test.
* testsuite/gas/aarch64/sve-movprfx_7.d: New test.
* testsuite/gas/aarch64/sve-movprfx_7.l: New test.
* testsuite/gas/aarch64/sve-movprfx_7.s: New test.
* testsuite/gas/aarch64/sve-movprfx_8.d: New test.
* testsuite/gas/aarch64/sve-movprfx_8.l: New test.
* testsuite/gas/aarch64/sve-movprfx_8.s: New test.
* testsuite/gas/aarch64/sve-movprfx_9.d: New test.
* testsuite/gas/aarch64/sve-movprfx_9.l: New test.
* testsuite/gas/aarch64/sve-movprfx_9.s: New test.
Tamar Christina [Wed, 3 Oct 2018 17:51:11 +0000 (18:51 +0100)]
AArch64: Constraint disassembler and assembler changes.
This patch wires in the new constraint verifiers into the assembler and
disassembler. Because of this the MOVPRFX tests have to be split out from the
generic SVE tests into their own tests so warnings can be ignored.
These tests are only intended to test the encoding correctness and not the
constraints.
gas/
* testsuite/gas/aarch64/sve-movprfx.d: New test.
* testsuite/gas/aarch64/sve-movprfx.s: New test.
* testsuite/gas/aarch64/sve.d: Refactor.
* testsuite/gas/aarch64/sve.s: Refactor.
* testsuite/gas/aarch64/sysreg-diagnostic.d: Update.
opcodes/
* aarch64-asm.c (aarch64_opcode_encode): Apply constraint verifier.
* aarch64-dis.c (print_operands): Refactor to take notes.
(print_verifier_notes): New.
(print_aarch64_insn): Apply constraint verifier.
(print_insn_aarch64_word): Update call to print_aarch64_insn.
* aarch64-opc.c (aarch64_print_operand): Remove attribute, update notes format.
Tamar Christina [Wed, 3 Oct 2018 17:50:15 +0000 (18:50 +0100)]
AArch64: Close sequences at the end of sections
Any open sequence at the end of a section or assembly is considered an error.
This patch adds a check at the end to ensure that all sequences have been closed
and if not reports a warning.
During disassembly it's not possible to detect this condition in the back-end so
the warning is only emitted from the assembler for now.
gas/
* config/tc-aarch64.c (force_automatic_sequence_close,
aarch64_frob_section): New.
* config/tc-aarch64.h (tc_frob_section, aarch64_frob_section): New.
Tamar Christina [Wed, 3 Oct 2018 17:38:42 +0000 (18:38 +0100)]
AArch64: Add SVE constraints verifier.
This patch adds the verification rules for move prefix constraints.
The Arm SVE instruction MOVPRFX introduces[1] constraints on the instruction at
PC+4. Particularly the following constraints are handled by this patch
* MOVPRFX must be followed by an instruction.
* MOVPRFX can only be followed by non-layout altering directives.
* MOVPRFX destination register MUST be used as the destination register in the
instruction at PC+4, and is not allowed to be used in any other position other than
destructive input. This includes registers that architecturally overlap. e.g. x1
should be treated as z1.
* MOVPRFX must be followed by a restricted set of SVE instructions.
* The size of the destination register of MOVPRFX must be equal to that of
the operation at PC+4.
* The predicate register and operation of MOVPRFX must match that of the instruction
at PC+4
* The predicated instruction at PC+4 must use the merging predicate.
* Architectural aliases and pseudo-instructions need to be supported as well.
* MOVPRFX cannot be the last instruction in a sequence
Any failure to adhere to any of these constrains will emit an assembly warning
and a disassembly note.
[1] https://developer.arm.com/docs/ddi0584/latest/arm-architecture-reference-manual-supplement-the-scalable-vector-extension-sve-for-armv8-a
include/
* opcode/aarch64.h (aarch64_inst): Remove.
(enum err_type): Add ERR_VFI.
(aarch64_is_destructive_by_operands): New.
(init_insn_sequence): New.
(aarch64_decode_insn): Remove param name.
opcodes/
* aarch64-opc.c (init_insn_block): New.
(verify_constraints, aarch64_is_destructive_by_operands): New.
* aarch64-opc.h (verify_constraints): New.
gas/
* config/tc-aarch64.c (output_operand_error_report): Order warnings.
Tamar Christina [Wed, 3 Oct 2018 17:37:07 +0000 (18:37 +0100)]
AArch64: Refactor verifiers to make more general.
The current verifiers only take an instruction description and encoded value as
arguments. This was enough when the verifiers only needed to do simple checking
but it's insufficient for the purposes of validating instruction sequences.
This patch adds the required arguments and also a flag to allow a verifier to
distinguish between whether it's being run during encoding or decoding. It also
allows for errors and warnings to be returned by a verifier instead of a simple
pass/fail.
include/
* opcode/aarch64.h (struct aarch64_opcode): Expand verifiers to take
more arguments.
opcodes/
* aarch64-dis.c (aarch64_opcode_decode): Update verifier call.
* aarch64-opc.c (verify_ldpsw): Update arguments.
Tamar Christina [Wed, 3 Oct 2018 17:35:15 +0000 (18:35 +0100)]
AArch64: Refactor err_type.
Previously the ERR_ values were defined as different constants, to make this a
bit more type safe and so they can be more easily re-used I'm changing them into
an actual enum and updating any usages.
include/
* opcode/aarch64.h (enum err_type): New.
(aarch64_decode_insn): Use it.
opcodes/
* aarch64-dis.c (ERR_OK, ERR_UND, ERR_UNP, ERR_NYI): Remove.
(aarch64_decode_insn, print_insn_aarch64_word): Use err_type.
Tamar Christina [Wed, 3 Oct 2018 17:27:52 +0000 (18:27 +0100)]
AArch64: Wire through instr_sequence
This patch introduces aarch64_instr_sequence which is a structure similar to IT
blocks on Arm in order to track instructions that introduce a constraint or
dependency on instruction 1..N positions away from the instruction that opened
the block.
The struct is also wired through to the locations that require it.
gas/
* config/tc-aarch64.c (now_instr_sequence):
(*insn_sequence, now_instr_sequence): New.
(output_operand_error_record, do_encode): Add insn_sequence.
(md_assemble): Update insn_sequence.
(try_to_encode_as_unscaled_ldst, fix_mov_imm_insn, fix_insn):
Pass insn_sequence.
* config/tc-aarch64.h (struct aarch64_segment_info_type):
Add insn_sequence.
include/
* opcode/aarch64.h (struct aarch64_instr_sequence): New.
(aarch64_opcode_encode): Use it.
opcodes/
* aarch64-asm.c (aarch64_opcode_encode): Add insn_sequence.
* aarch64-dis.c (insn_sequence): New.
Tamar Christina [Wed, 3 Oct 2018 17:22:15 +0000 (18:22 +0100)]
AArch64: Mark sve instructions that require MOVPRFX constraints
This patch series is to allow certain instructions such as the SVE MOVPRFX
instruction to apply a constraint/dependency on the instruction at PC+4.
This patch starts this off by marking which instructions impose the constraint
and which instructions must adhere to the constraint. This is done in a
generic way by extending the verifiers.
* The constraint F_SCAN indicates that an instruction opens a sequence and imposes
a constraint on an instructions following it. The length of the sequence depends
on the instruction itself and it handled in the verifier code.
* The C_SCAN_MOVPRFX flag is used to indicate which constrain the instruction is
checked against. An instruction with both F_SCAN and C_SCAN_MOVPRFX starts a
block for the C_SCAN_MOVPRFX instruction, and one with only C_SCAN_MOVPRFX must
adhere to a previous block constraint is applicable.
The SVE instructions in this list have been marked according to the SVE
specification[1].
[1] https://developer.arm.com/docs/ddi0584/latest/arm-architecture-reference-manual-supplement-the-scalable-vector-extension-sve-for-armv8-a
include/
* opcode/aarch64.h (struct aarch64_opcode): Add constraints,
extend flags field size.
(F_SCAN, C_SCAN_MOVPRFX, C_MAX_ELEM): New.
opcodes/
* aarch64-tbl.h (CORE_INSN, __FP_INSN, SIMD_INSN, CRYP_INSN, _CRC_INSN,
_LSE_INSN, _LOR_INSN, RDMA_INSN, FF16_INSN, SF16_INSN, V8_2_INSN,
_SVE_INSN, V8_3_INSN, CNUM_INSN, RCPC_INSN, SHA2_INSN, AES_INSN,
V8_4_INSN, SHA3_INSN, SM4_INSN, FP16_V8_2_INSN, DOT_INSN): Initialize
constraints.
(_SVE_INSNC): New.
(struct aarch64_opcode): (fjcvtzs, ldpsw, ldpsw, esb, psb): Initialize
constraints.
(movprfx): Change _SVE_INSN into _SVE_INSNC, add C_SCAN_MOVPRFX and
F_SCAN flags.
(msb, mul, neg, not, orr, rbit, revb, revh, revw, sabd, scvtf,
sdiv, sdivr, sdot, smax, smin, smulh, splice, sqadd, sqdecd, sqdech,
sqdecp, sqdecw, sqincd, sqinch, sqincp, sqincw, sqsub, sub, subr, sxtb,
sxth, sxtw, uabd, ucvtf, udiv, udivr, udot, umax, umin, umulh, uqadd,
uqdecd, uqdech, uqdecp, uqdecw, uqincd, uqinch, uqincp, uqincw, uqsub,
uxtb, uxth, uxtw, bic, eon, orn, mov, fmov): Change _SVE_INSN into _SVE_INSNC and add
C_SCAN_MOVPRFX and C_MAX_ELEM constraints.
Sandra Loosemore [Wed, 3 Oct 2018 16:16:53 +0000 (09:16 -0700)]
Skip gdb ifunc tests on targets that don't support this feature.
2018-10-03 Sandra Loosemore <sandra@codesourcery.com>
* lib/gdb.exp (skip_ifunc_tests): New.
* gdb.base/gnu-ifunc.exp: Skip if no ifunc support. Handle
other compile failures.
* gdb.compile/compile-ifunc.exp: Skip if no ifunc support.
Millan Wolff [Wed, 3 Oct 2018 11:06:09 +0000 (12:06 +0100)]
Fix the handling of inlined frames in DWARF debug info.
PR 23715
* dwarf2.c (find_abstract_instance): Allow recursive invocations
of find_abstract_instance to override the name variable.
Nick Clifton [Wed, 3 Oct 2018 10:36:11 +0000 (11:36 +0100)]
Updated French translation for the binutils/ subdirectory.
Nick Clifton [Wed, 3 Oct 2018 09:56:59 +0000 (10:56 +0100)]
Updated Portuguese translations for the bfd/ and binutils/ subdirectories.
John Darrington [Mon, 1 Oct 2018 09:24:15 +0000 (11:24 +0200)]
Make print_insn_s12z public.
Gdb can use this function in its stack unwinder.
* include/dis-asm.h (print_insn_s12z): Add declaration.
Tom Tromey [Tue, 2 Oct 2018 22:44:47 +0000 (16:44 -0600)]
Use pulongest in aarch64-linux-tdep.c
I tried a build on macOS today and it failed due to a mismatch between
the printf format and the type in aarch64-linux-tdep.c. This patch
fixes the problem by using pulongest and %s rather than %ld.
gdb/ChangeLog
2018-10-02 Tom Tromey <tom@tromey.com>
* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Use pulongest.
GDB Administrator [Wed, 3 Oct 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Palmer Dabbelt [Tue, 2 Oct 2018 15:26:32 +0000 (08:26 -0700)]
RISC-V: Add fence.tso instruction
The RISC-V memory model has been ratified, and it includes an additional
fence: "fence.tso". This pseudo instruction extends one of the
previously reserved full fence patterns to be less restrictive, and
therefor will execute correctly on all existing microarchitectures.
Thus there is no reason to allow this instruction to be disabled (or
unconverted to a full fence), so it's just unconditionally allowed.
I've added a test case for GAS to check that "fence.tso" correctly
assembles on rv32i-based targets. I checked to see that "fence.tso"
appears in "gas.log", but that's the only testing I've done.
gas/ChangeLog
2018-10-02 Palmer Dabbelt <palmer@sifive.com>
* testsuite/gas/riscv/fence-tso.d: New file.
* testsuite/gas/riscv/fence-tso.s: Likewise.
include/ChangeLog
2018-10-02 Palmer Dabbelt <palmer@sifive.com>
* opcode/riscv-opc.h (MATCH_FENCE_TSO): New define.
(MASK_FENCE_TSO): Likewise.
opcodes/ChangeLog
2018-10-02 Palmer Dabbelt <palmer@sifive.com>
* riscv-opc.c (riscv_opcodes) <fence.tso>: New opcode.
John Darrington [Wed, 29 Aug 2018 19:51:26 +0000 (21:51 +0200)]
Allow remote debugging over a Unix local domain socket.
Extend the "target remote" and "target extended-remote" commands
such that if the filename provided is a Unix local domain (AF_UNIX)
socket, then it'll be treated as such, instead of trying to open
it as if it were a character device.
gdb/ChangeLog:
* NEWS: Mention changed commands.
* ser-uds.c: New file.
* configure.ac (SER_HARDWIRE): Add ser-uds.o.
* configure: Regenerate.
* Makefile.in: Add new file.
* serial.c (serial_open): Check if filename is a socket
and lookup the appropriate interface accordingly.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Connection Commands): Describe
the changes to target remote and target extended-remote
relating to Unix domain sockets.
Cupertino Miranda [Mon, 1 Oct 2018 11:59:43 +0000 (12:59 +0100)]
[ARC] Entries to Changelog for previous commits.
GDB Administrator [Tue, 2 Oct 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Mon, 1 Oct 2018 16:17:54 +0000 (17:17 +0100)]
Fix typo setting user_specified variable when parsing -Z option.
PR 23698
* gprof.c (main): Fix typo setting user_specified variable when
parsing -Z option.
Simon Marchi [Mon, 1 Oct 2018 16:02:57 +0000 (12:02 -0400)]
Fix is_amd64_regs_target check in i386-avx512.exp
As reported by Jan here:
https://sourceware.org/ml/gdb-patches/2018-09/msg00831.html
the check that sets the number of available registers is backwards.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-avx512.exp: Fix setting of nr_regs based on
is_amd64_regs_target.
Alan Hayward [Fri, 24 Aug 2018 09:33:10 +0000 (10:33 +0100)]
Add aarch64-sighandler-regs.exp test
Add Aarch64 test to check register values of a previous frame
can be shown correctly across a signal.
gdb/testsuite/ChangeLog:
* gdb.arch/aarch64-sighandler-regs.c: New test.
* gdb.arch/aarch64-sighandler-regs.exp: New file.
* lib/gdb.exp (skip_aarch64_sve_tests): New proc.
Alan Hayward [Fri, 24 Aug 2018 08:53:57 +0000 (09:53 +0100)]
Aarch64: Detect FP regs in signal frame
Both the VFP and SVE registers may be contained within the reserved space of
the sigcontext and can be found by seraching for MAGIC values. Detect these
and add the registers (including pseudos) to the trad frame cache.
gdb/
* aarch64-linux-tdep.c (AARCH64_SIGCONTEXT_RESERVED_OFFSET): Add
define.
(AARCH64_EXTRA_MAGIC): Likewise.
(AARCH64_FPSIMD_MAGIC): Likewise.
(AARCH64_SVE_MAGIC): Likewise.
(AARCH64_EXTRA_DATAP_OFFSET): Likewise.
(AARCH64_FPSIMD_FPSR_OFFSET): Likewise.
(AARCH64_FPSIMD_FPCR_OFFSET): Likewise.
(AARCH64_FPSIMD_V0_OFFSET): Likewise.
(AARCH64_FPSIMD_VREG_SIZE): Likewise.
(AARCH64_SVE_CONTEXT_VL_OFFSET): Likewise.
(AARCH64_SVE_CONTEXT_REGS_OFFSET): Likewise.
(AARCH64_SVE_CONTEXT_P_REGS_OFFSET): Likewise.
(AARCH64_SVE_CONTEXT_FFR_OFFSET): Likewise.
(AARCH64_SVE_CONTEXT_SIZE): Likewise.
(read_aarch64_ctx): Add function.
(aarch64_linux_sigframe_init): Detect FP registers.
Alan Hayward [Fri, 24 Aug 2018 08:53:09 +0000 (09:53 +0100)]
Aarch64: Move pseudo defines to header
gdb/
* aarch64-tdep.c (AARCH64_Q0_REGNUM): Move to here.
(AARCH64_D0_REGNUM): Likewise.
(AARCH64_S0_REGNUM): Likewise.
(AARCH64_H0_REGNUM): Likewise.
(AARCH64_B0_REGNUM): Likewise.
(AARCH64_SVE_V0_REGNUM): Likewise.
* arch/aarch64.h (AARCH64_Q0_REGNUM): Move from here.
(AARCH64_D0_REGNUM): Likewise.
(AARCH64_S0_REGNUM): Likewise.
(AARCH64_H0_REGNUM): Likewise.
(AARCH64_B0_REGNUM): Likewise.
(AARCH64_SVE_V0_REGNUM): Likewise.
Cupertino Miranda [Wed, 5 Sep 2018 23:50:35 +0000 (00:50 +0100)]
[ARC] Fixed issue with DTSOFF relocs.
Inserted offset in final section in the GOT entry of type DTSOFF soon to be
relocated by the dynamic loader.
bfd/
2018-09-06 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take TLS
section alignment in consideration for this relocation.
* elf32-arc.c (FINAL_SECTSTART): Added this formula macro.
(ARC_TLS_DTPOFF) Updated reloc to use new created macro instead.
Cupertino Miranda [Wed, 1 Aug 2018 16:22:07 +0000 (17:22 +0100)]
[ARC] Fixes TLS failures related to tls-align.
This patch fixes glibc testcase in nptl/tls-align.
bfd/
2018-08-01 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed, fixed
TCB_SIZE offsize to include section alignment.
* elf32-arc.c (arc_special_overflow_checks): Likewise.
include/
2018-08-01 Cupertino Miranda <cmiranda@synopsys.com>
* arc-reloc.def (ARC_TLS_LE_32): Updated reloc formula.
Cupertino Miranda [Fri, 2 Mar 2018 16:44:29 +0000 (17:44 +0100)]
[ARC] PLT information was still being generated when symbol was forced_local.
A change upstream reveiled this issue, triggering an assert when linking glibc.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_check_relocs): Changed.
Cupertino Miranda [Fri, 2 Mar 2018 16:38:14 +0000 (17:38 +0100)]
[ARC] Make sure global symbol is not an indirect or warning.
Problem identified in the context of glibc with latest upstream binutils.
Dynamic symbol space was being reserved but, no actual information for the
symbol was being set. Data for the symbol was kept initialized with -1.
No easy test case was possible to be created.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_check_relocs): Changed.
Cupertino Miranda [Fri, 2 Mar 2018 16:33:48 +0000 (17:33 +0100)]
[ARC] Improved robustness. Return FALSE in case of NULL pointer.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
arc_htab is NULL.
Cupertino Miranda [Fri, 2 Mar 2018 16:16:21 +0000 (17:16 +0100)]
[ARC] Refactored location where GOT information is collected.
Change location where GOT information is collected for ARC target, avoiding
posible use conflicts of the previous .got field in the symbols hash_entry.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (get_got_entry_list_for_symbol): Changed.
* ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
(elf_arc_link_hash_newfunc): Changed.
(arc_elf_link_hash_table_create): Removed old initializations.
(elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
Gary Benson [Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)]
Remove ancient workaround
This commit removes a workaround for a bug in glibc 2.1.3, which
was released 2000-02-24 and superseded 2000-11-09.
gdb/ChangeLog:
* gdb_proc_service.h (gdb_prfpregset_t): Remove typedef.
* proc-service.c (ps_lgetfpregs, ps_lsetfpregs): Use
prfpregset_t instead of gdb_prfpregset_t.
* configure.ac (PRFPREGSET_T_BROKEN): Remove check.
* configure, config.in: Rebuild.
Gary Benson [Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)]
Move duplicated code to common/gdb_proc_service.h
This commit moves now-identical code from gdb/gdb_proc_service.h
and gdb/gdbserver/gdb_proc_service.h into the new shared file
gdb/common/gdb_proc_service.h.
gdb/ChangeLog:
* common/gdb_proc_service.h: New file, factored out from...
* gdb_proc_service.h: Moved common code to the above file.
* Makefile.in (HFILES_NO_SRCDIR): Add the above new file.
gdb/gdbserver/ChangeLog:
* gdb_proc_service.h: Moved common code to
common/gdb_proc_service.h.
Gary Benson [Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)]
Update GDB gdb_proc_service.h workaround to match gdbserver
This commit updates GDB's gdb_proc_service.h to use elf_{g,fp}regset_t
instead of gdb_{g,fp}regset_t if pr{g,fp}regset_t are undefined.
The types have been equivalent on GNU/Linux since at least 2005.
gdb/ChangeLog:
* gdb_proc_service.h: Use elf_gregset_t if prgregset_t is
undefined. Use elf_fpregset_t if prfpregset_t is undefined.
Gary Benson [Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)]
Add workaround from gdbserver's gdb_proc_service.h to GDB
This commit adds a workaround from gdbserver's gdb_proc_service.h
to GDB's. It doesn't seem to have been needed on any glibc as far
back as 2001, but it's possibly required for other C libraries so
I've retained it.
gdb/ChangeLog:
* configure.ac: Check if sys/procfs.h defines elf_fpregset_t.
(AC_CHECK_HEADERS): Check for linux/elf.h.
* configure, config.in: Rebuild.
* gdb_proc_service.h: Include linux/elf.h if sys/procfs.h
doesn't define elf_fpregset_t.
Gary Benson [Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)]
gdb_proc_service.h comment and whitespace synchronization
This commit updates comments and whitespace in GDB's and gdbserver's
gdb_proc_service.h.
gdb/ChangeLog:
* gdb_proc_service.h: Whitespace change.
gdb/gdbserver/ChangeLog:
* gdb_proc_service.h: Synchronize comments and whitespace with
GDB's version of this file.
Tom Tromey [Wed, 26 Sep 2018 11:28:07 +0000 (05:28 -0600)]
Don't check HAVE_UNISTD_H
I noticed some spots that were checking HAVE_UNISTD_H. There is no
need to do this, as <unistd.h> is unconditionally included in many
places in gdb. This sort of cleanup was done once before, in 2013:
2013-07-01 Pedro Alves <palves@redhat.com>
* defs.h: Don't check HAVE_UNISTD_H before including <unistd.h>.
(STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Delete.
* tracepoint.c: Don't check HAVE_UNISTD_H before including
<unistd.h>.
HAVE_UNISTD_H seems to come from gnulib, so there are still mentions
of it in the source.
gdb/ChangeLog
2018-10-01 Tom Tromey <tom@tromey.com>
* unittests/scoped_mmap-selftests.c: Don't check HAVE_UNISTD_H.
* unittests/scoped_fd-selftests.c: Don't check HAVE_UNISTD_H.
* common/scoped_fd.h: Don't check HAVE_UNISTD_H.
Tom Tromey [Sun, 30 Sep 2018 12:00:01 +0000 (06:00 -0600)]
Copy configure option documentation to gdb.texinfo
I realized that while I'd updated the README, I didn't update
gdb.texinfo to document the options to configure.
This patch copies the text from README into gdb.texinfo, adding
Texinfo markup.
gdb/ChangeLog
2018-10-01 Tom Tromey <tom@tromey.com>
* README: Minor change.
gdb/doc/ChangeLog
2018-10-01 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Configure Options): Document configure options.
Markus Metzger [Wed, 26 Sep 2018 13:28:28 +0000 (15:28 +0200)]
testsuite: fix is_amd64_regs_target
Commit
c221b2f Testsuite: Add gdb_can_simple_compile
changed the source file name extension of the test program from .s to .c
resulting in compile fails. This, in turn, causes is_amd64_regs_target
checks to fail. In gdb.btrace/tailcall.exp and others, this causes the
wrong source file to be picked and the test to fail on 64-bit targets.
Change the test source from an assembly program to a C program using
inline assembly.
testsuite/
* lib/gdb.exp (is_amd64_regs_target): Change assembly to C inline
assembly.
GDB Administrator [Mon, 1 Oct 2018 00:01:09 +0000 (00:01 +0000)]
Automatic date update in version.in
Pedro Alves [Sun, 30 Sep 2018 16:12:00 +0000 (17:12 +0100)]
Darwin: Remove unused variables [-Werror=unused-variable]
Building GDB with --host=x86_64-apple-darwin15 using G++ 5.3.0 runs
into a number of -Werror=unused-variable warnings/errors:
../../src/gdb/i386-darwin-nat.c: In function 'void i386_darwin_dr_set(int, CORE_ADDR)':
../../src/gdb/i386-darwin-nat.c:283:7: error: unused variable 'current_pid' [-Werror=unused-variable]
int current_pid;
^
[etc, etc.]
This commit fixes all such warnings.
gdb/ChangeLog:
2018-09-30 Pedro Alves <palves@redhat.com>
* darwin-nat-info.c (darwin_debug_regions_recurse)
(info_mach_exceptions_command): Remove unused local variables.
* darwin-nat.c (darwin_decode_notify_message)
(darwin_nat_target::resume, darwin_nat_target::mourn_inferior)
(darwin_stop_inferior, darwin_setup_exceptions)
(darwin_nat_target::kill, darwin_attach_pid, darwin_ptrace_him)
(darwin_nat_target::attach, darwin_nat_target::detach)
(darwin_read_write_inferior, darwin_read_dyld_info): Remove unused
local variables.
* i386-darwin-nat.c (i386_darwin_dr_set): Remove unused local
variables.
GDB Administrator [Sun, 30 Sep 2018 00:01:07 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 29 Sep 2018 13:32:10 +0000 (07:32 -0600)]
Remove some leftover text in gdb/README
I accidentally left some stray text in gdb/README.
This removes it. I'm checking this in as obvious.
gdb/ChangeLog
2018-09-29 Tom Tromey <tom@tromey.com>
* README: Remove some leftover text.