aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-10-04Use std::string in mdebugread.cTom Tromey2-14/+10
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.
2018-10-04Avoid shadowing in gdbserverTom Tromey4-21/+31
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".
2018-10-04Simple -Wshadow=local fixesTom Tromey67-513/+639
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.
2018-10-04Fix undefined behavior, don't pass NULL to fwriteSimon Marchi2-1/+7
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.
2018-10-05or1k: Add OpenRISC gas documentationStafford Horne6-0/+321
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.
2018-10-05or1k: Add the l.muld, l.muldu, l.macu, l.msbu insnsRichard Henderson23-355/+1454
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.
2018-10-05or1k: Add the l.adrp insn and supporting relocationsStafford Horne35-325/+1251
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.
2018-10-05or1k: Fix messages for relocations in shared librariesStafford Horne2-58/+98
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.
2018-10-05or1k: Add relocations for high-signed and low-storesRichard Henderson24-613/+1199
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.
2018-10-05Automatic date update in version.inGDB Administrator1-1/+1
2018-10-05[gdb/python] Fix cpychecker error in pspy_solib_nameTom de Vries2-1/+6
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.
2018-10-05[gdb/python] Fix cpychecker error in recpy_bt_gotoTom de Vries2-2/+9
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.
2018-10-04reformat parameters of gdb/psymtab.c::recursively_search_psymtabsJoel Brobecker2-1/+8
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.
2018-10-04RISC-V: Delete zero-size .tdata.dyn section.Jim Wilson2-1/+7
bfd/ * elfnn-riscv.c (riscv_elf_size_dynamic_sections): In dynobj->sections loop, handle htab->sdyntdata section.
2018-10-04Simplify complaints even moreTom Tromey8-82/+36
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.
2018-10-04Only print "no debugging symbols" message onceTom Tromey2-1/+11
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.
2018-10-04Clean up "Reading symbols" outputTom Tromey27-77/+86
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.
2018-10-04Make complaint output prettierTom Tromey5-4/+16
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.
2018-10-04Use filtered printing when reading symbolsTom Tromey3-38/+48
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.
2018-10-04Fix off-by-one error in complaint_internalTom Tromey2-1/+6
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.
2018-10-04Remove some leftovers from complaintsTom Tromey2-4/+5
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.
2018-10-04pr23658-1.d: Also xfail ft32-* and xgate-*H.J. Lu2-2/+7
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-*.
2018-10-04Avoid pagination in attach.expTom Tromey2-2/+9
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.
2018-10-04Add self to gdb/MAINTAINERSRainer Orth2-2/+7
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.
2018-10-04bfd: amend ChangeLog entryJose E. Marchesi1-1/+1
2018-10-04bfd,sparc: fix the .dynsym sh_index when stripping all symbols in ldJose E. Marchesi3-24/+26
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.
2018-10-03Avoid two uninitialized warnings from gccTom Tromey3-2/+9
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".
2018-10-04Automatic date update in version.inGDB Administrator1-1/+1
2018-10-03Remove struct keyword in range-based forSimon Marchi2-1/+6
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.
2018-10-03Add --enable-ubsanTom Tromey9-0/+193
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.
2018-10-03Avoid undefined behavior in expression dumpingTom Tromey3-1/+13
-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.
2018-10-03Avoid undefined behavior in ada_operator_lengthTom Tromey2-2/+12
-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.
2018-10-03Avoid undefined behavior in read_signed_leb128Tom Tromey2-3/+7
-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.
2018-10-03Avoid undefined behavior in parse_numberTom Tromey2-6/+8
-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.
2018-10-03Avoid undefined behavior in read_subrange_typeTom Tromey2-2/+7
-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.
2018-10-03Avoid undefined behavior in extract_integerTom Tromey2-1/+5
-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.
2018-10-03Use unsigned as base type for some enumsTom Tromey7-5/+23
-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.
2018-10-03Change dwarf2_frame_state_reg_info::reg to be std::vectorTom Tromey3-36/+35
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.
2018-10-03Do not pass NULL to memcpyTom Tromey2-2/+7
-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.
2018-10-03ELF: Add testcases for PR ld/23658H.J. Lu11-0/+152
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.
2018-10-03tid-parse.c tid_is_in_list correct 'See' comment.Philippe Waroquiers2-1/+5
Refer to tid-parse.h and tid_is_in_list is explained there.
2018-10-03ELF: Group and sort output note sections by section alignmentsH.J. Lu2-1/+145
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.
2018-10-03ELF: Group PT_NOTE segments by section alignmentsH.J. Lu2-30/+37
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.
2018-10-03AArch64: Add MOVPRFX tests and update testsuiteTamar Christina72-0/+949
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.
2018-10-03AArch64: Constraint disassembler and assembler changes.Tamar Christina10-256/+365
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.
2018-10-03AArch64: Close sequences at the end of sectionsTamar Christina3-0/+27
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.
2018-10-03AArch64: Add SVE constraints verifier.Tamar Christina7-5/+382
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.
2018-10-03AArch64: Refactor verifiers to make more general.Tamar Christina5-8/+24
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.
2018-10-03AArch64: Refactor err_type.Tamar Christina4-14/+29
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.
2018-10-03AArch64: Wire through instr_sequenceTamar Christina8-11/+71
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.