Jan Kratochvil [Mon, 20 Feb 2017 19:53:21 +0000 (20:53 +0100)]
DWARF-5: Macros
DWARF-5 renamed DW_MACRO_GNU_* to DW_MACRO_*.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (read_file_scope): Rename DW_MACRO_GNU_*.
(dwarf_parse_macro_header): Accept DWARF version 5.
(dwarf_decode_macro_bytes, dwarf_decode_macros): Rename DW_MACRO_GNU_*.
Jan Kratochvil [Mon, 20 Feb 2017 19:53:21 +0000 (20:53 +0100)]
DWARF-5: call sites
this patch updates all call sites related DWARF-5 renames.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* block.c (call_site_for_pc): Rename DW_OP_GNU_*, DW_TAG_GNU_* and
DW_AT_GNU_*.
* common/common-exceptions.h (enum errors): Likewise.
* dwarf2-frame.c (class dwarf_expr_executor): Likewise.
* dwarf2expr.c (dwarf_block_to_dwarf_reg)
(dwarf_expr_context::execute_stack_op): Likewise.
* dwarf2expr.h (struct dwarf_expr_context, struct dwarf_expr_piece):
Likewise.
* dwarf2loc.c (dwarf_evaluate_loc_desc::get_base_type)
(dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value)
(show_entry_values_debug, call_site_to_target_addr)
(func_addr_to_tail_call_list, func_verify_no_selftailcall)
(dwarf_expr_reg_to_entry_parameter, dwarf_entry_parameter_to_value)
(entry_data_value_free_closure, value_of_dwarf_reg_entry)
(value_of_dwarf_block_entry, indirect_pieced_value)
(symbol_needs_eval_context::push_dwarf_reg_entry_value):
(disassemble_dwarf_expression): Likewise.
* dwarf2read.c (process_die, inherit_abstract_dies)
(read_call_site_scope): Likewise.
* gdbtypes.h (struct func_type, struct call_site_parameter)
(struct call_site): Likewise.
* stack.c (read_frame_arg): Likewise.
* std-operator.def (OP_VAR_ENTRY_VALUE): Likewise.
gdb/doc/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Print Settings, Tail Call Frames): Rename DW_OP_GNU_*,
DW_TAG_GNU_* and DW_AT_GNU_*.
gdb/testsuite/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-entry-value-param-dwarf5.S: New file.
* gdb.arch/amd64-entry-value-param-dwarf5.c: New file.
* gdb.arch/amd64-entry-value-param-dwarf5.exp: New file.
* gdb.arch/amd64-entry-value.exp: Rename DW_OP_GNU_*, DW_TAG_GNU_* and
DW_AT_GNU_*.
Jan Kratochvil [Mon, 20 Feb 2017 19:53:21 +0000 (20:53 +0100)]
DWARF-5 basic functionality
this is a kitchen-sink patch for everything that did not fit into its own
patch.
DWO is not yet implemented.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* defs.h (read_unsigned_leb128): New declaration.
* dwarf2loc.c (decode_debug_loclists_addresses): New function.
(decode_debug_loc_dwo_addresses): Update DEBUG_LOC_* to DW_LLE_*.
(dwarf2_find_location_expression): Call also
decode_debug_loclists_addresses. Handle DWARF-5 ULEB128 length.
* dwarf2loc.h (dwarf2_version): New declaration.
* dwarf2read.c (struct dwarf2_per_objfile): Add loclists, line_str,
rnglists.
(dwarf2_elf_names): Add .debug_loclists, .debug_line_str,
.debug_rnglists.
(struct dwop_section_names): Add loclists_dwo.
(dwop_section_names): Add .debug_loclists.dwo.
(struct comp_unit_head): Add unit_type, signature, type_offset_in_tu.
(struct dwarf2_per_cu_data): Add dwarf_version.
(struct dwo_sections): Add loclists.
(struct attr_abbrev): Add implicit_const.
(read_indirect_line_string): New declaration.
(read_unsigned_leb128): Delete declaration.
(rcuh_kind): New definition.
(read_and_check_comp_unit_head): Change parameter
is_debug_types_section to section_kind.
(dwarf2_locate_sections): Handle loclists, line_str and rnglists.
(read_comp_unit_head): Change parameter abfd to section, add parameter
section_kind. Handle DWARF-5.
(error_check_comp_unit_head): Accept also DWARF version 5.
(read_and_check_comp_unit_head): Change parameter
is_debug_types_section to section_kind.
(read_and_check_type_unit_head): Delete function.
(read_abbrev_offset): Handle DWARF-5.
(create_debug_type_hash_table): Add parameter section_kind. Process
only DW_UT_type. Use signature and type_offset_in_tu from struct
comp_unit_head.
(create_debug_types_hash_table): Update create_debug_type_hash_table
caller.
(create_all_type_units): Call create_debug_type_hash_table.
(read_cutu_die_from_dwo, init_cutu_and_read_dies): Change
read_and_check_type_unit_head caller to read_and_check_comp_unit_head
caller.
(skip_one_die): Handle DW_FORM_implicit_const.
(dwarf2_rnglists_process): New function.
(dwarf2_ranges_process): Call dwarf2_rnglists_process for DWARF-5.
(abbrev_table_read_table): Handle DW_FORM_implicit_const.
(read_attribute_value): Handle DW_FORM_implicit_const,
DW_FORM_line_strp.
(read_attribute): Handle DW_FORM_implicit_const.
(read_indirect_string_at_offset_from): New function from
read_indirect_string_at_offset.
(read_indirect_string_at_offset): Call
read_indirect_string_at_offset_from.
(read_indirect_line_string_at_offset): New function.
(read_indirect_string): New function comment.
(read_indirect_line_string): New function.
(read_unsigned_leb128): Make it global.
(dwarf2_string_attr): Handle DWARF-5.
(add_include_dir_stub, read_formatted_entries): New functions.
(dwarf_decode_line_header, dump_die_shallow, cu_debug_loc_section):
Handle DWARF-5.
(per_cu_header_read_in): Update read_comp_unit_head caller.
(dwarf2_version): New function.
* symfile.h (struct dwarf2_debug_sections): Add loclists, line_str and
rnglists.
* xcoffread.c (dwarf2_xcoff_names): Update struct dwarf2_debug_sections
fields.
gdb/testsuite/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-error.exp (file $testfile): Update expected string.
Jan Kratochvil [Mon, 20 Feb 2017 19:53:20 +0000 (20:53 +0100)]
Code cleanup: Refactor abbrev_table_read_table cycle
I find it as an improvement on its own, it prevents more code duplication in
a future patch.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (abbrev_table_read_table): Read the data only once.
Jan Kratochvil [Mon, 20 Feb 2017 19:53:20 +0000 (20:53 +0100)]
Code cleanup: Split dwarf2_ranges_read to a callback
DWARF-5 has .debug_rnglists which is somehow similar to .debug_ranges.
This patch converts dwarf2_ranges_read to dwarf2_ranges_process which can work
with both DWARF kinds of range lists through a callback.
It also simplifies dwarf2_record_block_ranges which can benefit from it.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (dwarf2_ranges_process): New function from
dwarf2_ranges_read.
(dwarf2_ranges_read, dwarf2_record_block_ranges): Use
dwarf2_ranges_process.
Jan Kratochvil [Mon, 20 Feb 2017 19:53:19 +0000 (20:53 +0100)]
Code cleanup: Split create_debug_types_hash_table
DWARF-5 moved .debug_types into .debug_info and so the types reading code needs
to be reused more (in a future patch).
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (create_debug_type_hash_table): New function from
create_debug_types_hash_table.
(create_debug_types_hash_table): Call create_debug_type_hash_table.
(create_all_type_units, open_and_init_dwo_file): Update
create_debug_types_hash_table callers.
Nick Clifton [Mon, 20 Feb 2017 14:40:39 +0000 (14:40 +0000)]
Fix another memory access error in readelf when parsing a corrupt binary.
PR binutils/21156
* dwarf.c (cu_tu_indexes_read): Move into...
(load_cu_tu_indexes): ... here. Change the variable into
tri-state. Change the function into boolean, returning
false if the indicies could not be loaded.
(find_cu_tu_set): Return NULL if the indicies could not be
loaded.
Alan Modra [Mon, 20 Feb 2017 02:54:28 +0000 (13:24 +1030)]
PE ld -r script fixes
PR 15041
* scripttempl/pe.sc: Don't combine sections for ld -r.
* scripttempl/pep.sc: Likewise.
Sergio Durigan Junior [Mon, 20 Feb 2017 13:01:04 +0000 (08:01 -0500)]
Fix thinko on last commit
On fork-child.c:trace_start_error, va_end should refer to 'ap', not
'args. This fixes it.
Sorry about the breakage.
gdb/ChangeLog:
2017-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/16188
* fork-child.c (trace_start_error): Fix thinko. va_end should
refer to 'ap', not 'args'.
Nick Clifton [Mon, 20 Feb 2017 12:52:22 +0000 (12:52 +0000)]
Sync ZLIB with FSF GCC sources, bringing in version 1.2.11.
- Fix deflate stored bug when pulling last block from window
- Permit immediate deflateParams changes before any deflate input
Sergio Durigan Junior [Tue, 14 Feb 2017 23:27:23 +0000 (18:27 -0500)]
PR gdb/16188: Verify PTRACE_TRACEME succeeded
This patch fixes PR gdb/16188, which is about the fact that
fork_inferior doesn't verify the return value of the "traceme_fun"
callback. On most targets, this callback is actually a wrapper to a
ptrace call that does a PTRACE_TRACEME on the forked GDB process that
will eventually become the inferior.
Thanks to Pedro, this second version of the patch is simpler and more
more logical. Basically, two helper functions are added:
trace_start_error and trace_start_error_with_name. The former can be
used when there is a customized error message to be printed to the
user. The latter works like perror_with_name, so you just need to
pass the function that error'd.
Both helper functions mentioned above do basically the same thing:
print the error message to stderr and call _exit, properly terminating
the forked inferior.
Most of the patch takes care of guarding the necessary system calls
against errors on the "traceme_fun" callbacks. It is not right to
call error on these situations, so I've replaced these calls with the
proper helper function call.
Regression-tested on BuildBot.
Thanks,
gdb/ChangeLog:
2017-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
Pedro Alves <palves@redhat.com>
PR gdb/16188
* darwin-nat.c (darwin_ptrace_me): Check if calls to system
calls succeeded.
* fork-child.c (trace_start_error): New function.
(trace_start_error_with_name): Likewise.
* gnu-nat.c (gnu_ptrace_me): Check if call to PTRACE succeeded.
* inf-ptrace.c (inf_ptrace_me): Likewise.
* inferior.h (trace_start_error): New prototype.
(trace_start_error_with_name): Likewise.
Alan Modra [Mon, 20 Feb 2017 10:58:59 +0000 (21:28 +1030)]
fix PR number
Alan Modra [Mon, 20 Feb 2017 06:50:45 +0000 (17:20 +1030)]
Alpha executables segfault when linked with -z,now
PR 21181
* elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
if DT_RELSZ/DT_RELASZ is zero.
Alan Modra [Mon, 20 Feb 2017 02:55:13 +0000 (13:25 +1030)]
Move .stack before debug sections
PR 20199
* emulparams/elf32m32c.sh: Define STACK_ADDR and STACK_SENTINEL
rather than using OTHER_SECTIONS.
* emulparams/elf32mt.sh: Likewise.
* emulparams/elf32rx.sh: Likewise.
* emulparams/elf32rl78.sh: Likewise. Use OTHER_SYMBOLS to
define __rl78_abs__.
* emulparams/shelf.sh: Define STACK_ADDR and STACK_SENTINEL
rather than using OTHER_SECTIONS.
* emulparams/shelf32.sh: Likewise. Use OTHER_SECTIONS for .cranges.
* emulparams/shelf64.sh: Unset OTHER_SECTIONS.
* emulparams/shelf_nbsd.sh: Unset STACK_ADDR not OTHER_SECTIONS.
* emulparams/shelf_uclinux.sh: Likewise.
* emulparams/shlsymbian.sh: Unset STACK_ADDR. Use OTHER_SYMBOLS
to define _stack, not OTHER_SECTIONS.
* scripttempl/elf.sc: Move STACK, TINY_DATA_SECTION, and
TINY_BSS_SECTION before debug sections. Add STACK_SENTINEL.
* scripttempl/arclinux.sc: Likewise.
* scripttempl/elf64hppa.sc: Likewise.
* scripttempl/elfxtensa.sc: Likewise.
* scripttempl/nds32elf.sc: Likewise.
* scripttempl/armbpabi.sc: Move STACK before debug sections.
* scripttempl/elf_chaos.sc: Likewise.
* scripttempl/elfarc.sc: Delete STACK.
* scripttempl/epiphany_4x4.sc: Delete STACK. Move TINY_DATA_SECTION,
TINY_BSS_SECTION, and .stack before debug sections.
Alan Modra [Mon, 20 Feb 2017 01:36:52 +0000 (12:06 +1030)]
Downgrade powerpc register error to warning
PR 21118
* NEWS: Revise powerpc register check.
* config/tc-ppc.c (ppc_optimize_expr, md_assemble): Make "invalid
register expression" a warning.
GDB Administrator [Mon, 20 Feb 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sun, 19 Feb 2017 21:16:56 +0000 (13:16 -0800)]
Fix for aarch64 sim sxtl/uxtl insns, plus another fix for addv.
sim/aarch64/
* simulator.c (do_vec_ADDV): Mov val declaration inside each case,
with type set to input type size.
(do_vec_xtl): Change bias from 3 to 4 for byte case.
sim/testsuite/sim/aarch64/
* bit.s: Change cmp immediates to account for addv bug fix.
* cmtst.s, ldn_single.s, stn_single.s: Likewise.
* xtl.s: New.
GDB Administrator [Sun, 19 Feb 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 18 Feb 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 16 Feb 2017 01:50:29 +0000 (01:50 +0000)]
GAS: Add ECOFF `.aent' pseudo-op support
Implement the ECOFF `.aent' pseudo-op for ECOFF-style `.mdebug' section
support with ELF objects and, for consistency, also with ECOFF objects.
This is so that the same MIPS source can be assembled without and with
`.mdebug' section generation enabled.
Taking the `gas/testsuite/gas/mips/aent.s' test case source as an
example and the `mips-linux' target we have:
$ as -o aent.o aent.s
$ as -mdebug -o aent.o aent.s
aent.s: Assembler messages:
aent.s:10: Error: unknown pseudo-op: `.aent'
$
because for the !ECOFF_DEBUGGING case (which is the default) the
pseudo-op is already handled by the MIPS backend with `s_mips_ent',
however no handler is present for the opposite case.
For the MIPS target this is a functional regression introduced with
commit
ecb4347adecd ("Last take: approval for MIPS_STABS_ELF killing"),
<https://sourceware.org/ml/binutils/2002-06/msg00443.html>, where
support for the `.mdebug' section was added along with its associated
`-mdebug'/`-no-mdebug' command-line options, bringing an inconsistency
between the assembly syntax supported for each of these options as far
as the `.aent' pseudo-op is concerned.
Assembly language documentation available describes the pseudo-op
respectively as follows[1]:
"
.aent name, symno Sets an alternate entry point for the current
procedure. Use this information when you want
to generate information for the debugger. It must
appear inside an .ent/.end pair."
and[2]:
"
.aent name [,symno]
Sets an alternate entry point for the current procedure. Use this
information when you want to generate information for the debugger.
This directive must appear between a pair of .ent and .end directives.
(The optional symno is for compiler use only. It refers to a dense
number in a .T file (symbol table).)"
Copy the approach from `s_mips_ent' then and add `.aent' support to the
`.ent' pseudo-op handler shared between the ELF and ECOFF object file
format backends, by setting BSF_FUNCTION for the symbol requested.
References:
[1] "MIPSpro Assembly Language Programmer's Guide", Silicon Graphics,
Inc., Document Number 007-2418-004, Section 8.1 "Op-Codes", p. 96
<http://techpubs.sgi.com/library/manuals/2000/007-2418-004/pdf/007-2418-004.pdf>
[2] "Digital UNIX Assembly Language Programmer's Guide", Digital
Equipment Corporation, Order Number: AA-PS31D-TE, March 1996,
Chapter 5 "Assembler Directives", p. 5-2
<http://h41361.www4.hpe.com/docs/base_doc/DOCUMENTATION/V40G_PDF/APS31DTE.PDF>
gas/
* ecoff.c (ecoff_directive_ent, add_procedure): Handle `.aent'.
* config/obj-ecoff.c (obj_pseudo_table): Add "aent" entry.
* config/obj-elf.c (ecoff_debug_pseudo_table): Likewise.
* testsuite/gas/mips/aent-2.d: New test.
* testsuite/gas/mips/aent-mdebug.d: New test.
* testsuite/gas/mips/aent-mdebug-2.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
Nick Clifton [Fri, 17 Feb 2017 16:31:09 +0000 (16:31 +0000)]
Fix documentation of the linker's --pop-state command line option.
PR ld/20825
* ld.texinfo (Options): Add missing @item entry for --pop-state.
Nick Clifton [Fri, 17 Feb 2017 15:59:45 +0000 (15:59 +0000)]
Fix illegal memory accesses in readelf when parsing a corrupt binary.
PR binutils/21156
* readelf.c (find_section_in_set): Test for invalid section
indicies.
Nick Clifton [Fri, 17 Feb 2017 15:31:54 +0000 (15:31 +0000)]
Add support to readelf for displaying GNU section types.
* readelf.c (get_section_type_name): Add decoding of GNU section
types.
Nick Clifton [Fri, 17 Feb 2017 11:39:20 +0000 (11:39 +0000)]
Fix potential illegal memory access in ZLIB because of an erroneous declaration of the size of the input buffer.
* compress.c (bfd_get_full_section_contents): Remember to reduce
compressed size by the sizeof the compression header when
decompressing the contents.
Michael Sturm [Wed, 1 Feb 2017 11:22:27 +0000 (12:22 +0100)]
Add support for Intel PKRU register to GDB and GDBserver.
This patch adds support for the registers added by the
Memory Protection Keys for Userspace (PKU aka PKEYs) feature.
Native and remote debugging are covered by this patch.
The XSAVE area is extended with a new state containing
the 32-bit wide PKRU register. The new register is added to
amd64-avx-mpx_avx512-* tdesc, thus it is renamed accordingly. Also,
respective xstate mask X86_XSTATE_AVX_MPX_AVX512_MASK is renamed to
X86_XSTATE_AVX_MPX_AVX512_PKU_MASK to reflect the new feature set
it supports.
For more information, please refer to the
Intel(R) 64 and IA-32 Architectures Software Developer's
Manual - Septemper 2015
http://www.intel.com/content/dam/www/public/us/en/documents/
manuals/64-ia-32-architectures-software-developer-manual-325462.pdf
gdb/Changelog:
2015-12-08 Michael Sturm <michael.sturm@intel.com>
* NEWS: Mention addition of PKU feature.
* amd64-linux-nat.c (amd64_linux_gregset32_reg_offset): Add PKRU register.
* amd64-linux-tdep.c (features/i386/amd64-avx-mpx-avx512-linux.c): Rename
to...
(features/i386/amd64-avx-mpx-avx512-pku-linux.c): ...this.
(amd64_linux_gregset_reg_offset): Add PKRU register.
(amd64_linux_core_read_description): Rename
X86_XSTATE_AVX_MPX_AVX512_MASK,
rename tdesc_amd64_avx_mpx_avx512_pku_linux.
(_initialize_amd64_linux_tdep): Rename
initialize_tdesc_amd64_avx_mpx_avx512_linux.
* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Adjust regnum
calculation.
(tdesc_amd64_avx_mpx_avx512_linux): Rename to...
(tdesc_amd64_avx_mpx_avx512_pku_linux): ...this.
* amd64-tdep.c (features/i386/amd64-avx-mpx-avx512-pku.c): Rename to...
(features/i386/amd64-avx-mpx-avx512-pku.c): ...this.
(amd64_pkeys_names): New register name for raw register PKRU.
(amd64_init_abi): Add code to initialize PKRU tdep variables if feature
is present.
(amd64_target_description): Rename X86_XSTATE_AVX_MPX_AVX512_MASK,
rename tdesc_amd64_avx_mpx_avx512.
(_initialize_amd64_tdep): Rename initialize_tdesc_amd64_avx_mpx_avx512.
* amd64-tdep.h (enum amd64_regnum): Add PKRU register.
(AMD64_NUM_REGS): Adjust regnum calculation.
* i386-linux.nat.c (GETXSTATEREGS_SUPPLIES): Extend range of
registers supplied via XSTATE by PKRU register.
* common/x86-xstate.h (X86_XSTATE_PKRU): New macro.
(X86_XSTATE_AVX_MPX_AVX512_MASK): Add PKRU and renamed mask.
(X86_XSTATE_ALL_MASK): Rename X86_XSTATE_AVX_MPX_AVX512_MASK.
(X86_XSTATE_PKRU_SIZE): New macro.
(X86_XSTATE_MAX_SIZE): Adjust size.
(HAS_PKRU(XCR0)): New macro.
(X86_XSTATE_SIZE): Add checkfor PKRU.
* features/Makefile (WHICH): Rename i386/i386-avx-mpx-avx512,
i386/i386-avx-mpx-avx512-linux, i386/amd64-avx-mpx-avx512,
i386/amd64-avx-mpx-avx512-linux.
(i386/i386-avx-mpx-avx512-expedite): Rename expedite.
(i386/i386-avx-mpx-avx512-linux-expedite): Likewise.
(i386/amd64-avx-mpx-avx512-expedite): Likewise.
(i386/amd64-avx-mpx-avx512-linux-expedite): Likewise.
(XMLTOC): Rename i386/amd64-avx-mpx-avx512-linux.xml,
i386/amd64-avx-mpx-avx512.xml, i386/i386-avx-mpx-avx512-linux.xml,
i386/i386-avx-mpx-avx512.xml.
((outdir)/i386/i386-avx-mpx-avx512.dat): Rename rule, add
i386/32bit-pkeys.xml.
((outdir)/i386/i386-avx-mpx-avx512-pku-linux.dat): Likewise.
((outdir)/i386/amd64-avx-mpx-avx512.dat): Rename rule, add
i386/64bit-pkeys.xml.
((outdir)/i386/amd64-avx-mpx-avx512-linux.dat): Likewise.
* features/i386/32bit-pkeys.xml: New file.
* features/i386/64bit-pkeys.xml: Likewise.
* features/i386/amd64-avx-mpx-avx512-linux-pku.c: Regenerate from
renamed XML file.
* features/i386/amd64-avx-mpx-avx512-linux.xml: Rename to
amd64-avx-mpx-avx512-pku-linux.xml, add 64bit-pkeys.xml
* features/i386/amd64-avx-mpx-avx512.c: Regenerate from
renamed XML file.
* features/i386/amd64-avx-mpx-avx512.xml: Rename to
amd64-avx-mpx-avx512-pku.xml, add 64bit-pkeys.xml.
* features/i386/i386-avx-mpx-avx512-linux.c: Regenerate from
renamed XML file.
* features/i386/i386-avx-mpx-avx512-linux.xml: Rename to
i386-avx-mpx-avx512-pku-linux.xml, add 32bit-pkeys.xml.
* features/i386/i386-avx-mpx-avx512.c: Regenerate from
renamed XML file.
* features/i386/i386-avx-mpx-avx512.xml: Rename to
i386-avx-mpx-avx512-pku.xml, add 32bit-pkeys.xml.
* i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Change to use
I386_PKEYS_NUM_REGS.
* i386-linux-tdep.c (features/i386/i386-avx-mpx-avx512-linux.c): Rename
include.
(i386_linux_gregset_reg_offset): Add PKRU register.
(i386_linux_core_read_description): Rename xstate mask and returned
tdesc for X86_XSTATE_AVX_MPX_AVX512_PKU_MASK.
(_initialize_i386_linux_tdep): Rename
initialize_tdesc_i386_avx_mpx_avx512_linux.
* i386-linux-tdep.h (I386_LINUX_ORIG_EAX_REGNUM): Adjuste regnum
calculation.
(tdesc_i386_avx_mpx_avx512_linux): Rename prototype.
(/* Format of XSAVE...): Add pkru register.
* i386-tdep.c (i386-avx-mpx-avx512.c): Rename include.
(i386_pkeys_names): New register name for raw register PKRU.
(i386_pkru_regnum_p): Add function to look up register number of
PKRU raw register.
(i386_register_reggroup_p): Add code to exclude PKRU from general
register group.
(i386_validate_tdesc_p): Add code to handle PKRU feature, add PKRU
registers if feature is present in xcr0.
(i386_gdbarch_init): Adjust number of registers in architecture. Add code
to initialize PKRU feature variables in tdep structure.
(i386_target_description): Rename xstate mask and returned
tdesc for X86_XSTATE_AVX_MPX_AVX512_PKU_MASK.
(_initialize_i386_tdep): Rename initialize_tdesc_i386_avx_mpx_avx512.
* i386-tdep.h (struct gdbarch_tdep): Add feature variables to tdep
structure.
(enum i386_regnum): Add PKRU register.
(I386_PKEYS_NUM_REGS): New define for number of registers in PKRU feature.
(i386_pkru_regnum_p): New prototype.
* i387-tdep.c (xsave_pkeys_offset): New table for PKRU offsets in
XSAVE buffer.
(XSAVE_PKEYS_ADDR): New macro.
(i387_supply_xsave): Add code to handle PKRU register.
(i387_collect_xsave): Likewise.
* i387-tdep.h (I387_NUM_PKEYS_REGS): New define for number of registers
in PKRU feature.
(I387_PKRU_REGNUM): New macro.
(I387_PKEYSEND_REGNUM): Likewise.
* regformats/i386/amd64_avx_mpx_avx512_pku_linux.dat: Regenerate from
renamed XML file.
* regformats/i386/amd64_avx_mpx_avx512_pku.dat: Likewise.
* regformats/i386/i386/amd64-avx-mpx-avx512-pku.dat: Likewise.
* regformats/i386/i386_avx_mpx_avx512_pku_linux.dat: Likewise.
testsuite/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* gdb.arch/i386-pkru.c: New file.
* gdb.arch/i386-pkru.exp: Likewise.
gdbserver/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* Makefile.in (clean): Rename i386-avx-mpx-avx512.c,
i386-avx-mpx-avx512-linux.c, amd64-avx-mpx-avx512.c,
amd64-avx-mpx-avx512-linux.c.
(i386-avx-mpx-avx512-linux-ipa.o:): Rename rule and source file.
(amd64-avx-mpx-avx512-linux-ipa.o:): Likewise.
(i386-avx-mpx-avx512.c :): Rename rule, source files and dat files.
(i386-avx-mpx-avx512-linux.c :): Likewise.
(amd64-avx-mpx-avx512.c :): Likewise.
(amd64-avx-mpx-avx512-linux.c :): Likewise.
* configure.srv (srv_i386_regobj): Rename i386-avx-mpx-avx512.o.
(srv_i386_linux_regobj): Rename i386-avx-mpx-avx512-linux.o.
(srv_amd64_regobj): Rename amd64-avx-mpx-avx512.o.
(srv_amd64_linux_regobj): Rename amd64-avx-mpx-avx512-linux.o.
(ipa_i386_linux_regobj): Rename i386-avx-mpx-avx512-linux-ipa.o.
(ipa_amd64_linux_regobj): Rename amd64-avx-mpx-avx512-pku-linux-ipa.o.
(srv_i386_32bit_xmlfiles): Add 32bit-pkeys.xml.
(srv_i386_64bit_xmlfiles): Add 64bit-pkeys.xml.
(srv_i386_xmlfiles): Rename i386/i386-avx-mpx-avx512.xml.
(srv_amd64_xmlfiles): Rename i386/amd64-avx-mpx-avx512.xml.
(srv_i386_linux_xmlfiles): Rename i386/i386-avx-mpx-avx512-linux.xml.
(srv_amd64_linux_xmlfiles): Rename di386/amd64-avx-mpx-avx512-linux.xml.
* i387-fp.c (num_pkeys_registers): New variable.
(struct i387_xsave): Add space for pkru values.
(i387_cache_to_fsave): Add code to handle PKRU register.
(i387_xsave_to_cache): Likewise.
* linux-amd64-ipa.c (get_ipa_tdesc): Rename
tdesc_amd64_avx_mpx_avx512_linux.
(initialize_low_tracepoint): Rename
init_registers_amd64_avx_mpx_avx512_linux.
* linux-i386-ipa.c (get_ipa_desc): Rename
tdesc_i386_avx_mpx_avx512_linux.
(initialize_low_tracepoint): Rename
init_registers_i386_avx_mpx_avx512_linux.
* linux-x86-low.c (x86_64_regmap[]): Add PKRU register.
(x86_linux_read_description): Rename X86_XSTATE_AVX_MPX_AVX512_MASK,
rename tdesc_amd64_avx_mpx_avx512_linux, rename
tdesc_i386_avx_mpx_avx512_linux.
(x86_get_ipa_tdesc_idx): Rename tdesc_amd64_avx_mpx_avx512_linux,
rename tdesc_i386_avx_mpx_avx512_linux.
(initialize_low_arch): Rename init_registers_amd64_avx_mpx_avx512_linux,
rename init_registers_i386_avx_mpx_avx512_linux.
* linux-x86-tdesc.h (init_registers_amd64_avx_mpx_avx512_linux): Renamed
prototype.
(tdesc_amd64_avx_mpx_avx512_linux): Likewise.
(init_registers_i386_avx_mpx_avx512_linux): Likewise.
(tdesc_i386_avx_mpx_avx512_linux): Likewise.
doc/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* gdb.texinfo (i386 Features): Add description of PKRU register.
Change-Id: If75ce5aba7dfd33fdbe3d8b47f04ef3f550c52be
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Michael Sturm [Tue, 22 Mar 2016 15:26:09 +0000 (16:26 +0100)]
Add target description for avx-avx512.
Add a dedicated target description for the feature combination
avx-avx512 as implemented by certain IA CPU models.
The corresponding X86_XSTATE_AVX_AVX512_MASK already exists, but shared
the tdesc with X86_XSTATE_AVX_MPX_AVX512_MASK. This caused MPX registers
displayed as undefined on CPUs that only implemented
X86_XSTATE_AVX_AVX512_MASK, which is undesired. This patch solves this issue.
This patch also corrects the wrong usage of x32-avx-mpx-avx512, which is
replaced by x32-avx-avx512. The MPX feature is not implemented in x32 mode.
gdb/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* amd64-linux-tdep.c (features/i386/amd64-avx-avx512-linux.c):
New include.
(features/i386/x32-avx-mpx-avx512-linux.c): Rename to...
(features/i386/x32-avx-avx512-linux.c): ...this.
(amd64_linux_core_read_description): Add dedicated cases for
X86_XSTATE_AVX_AVX512_MASK and return appropriate tdesc.
(_initialize_amd64_linux_tdep): Add calls to
initialize_tdesc_amd64_avx_avx512_linux and
initialize_tdesc_x32_avx_avx512_linux.
* amd64-linux.tdep.h (tdesc_amd64_avx_avx512_linux): New prototype.
(tdesc_x32_avx_mpx_avx512_linux): Rename to...
(tdesc_x32_avx_avx512_linu): ...this.
* amd64-tdep.c (features/i386/amd64-avx-avx512.c): New include.
(features/i386/x32-avx-mpx-avx512.c): Rename to...
(features/i386/x32-avx-avx512.c): ...this.
(amd64_target_description): Add dedicated case for
X86_XSTATE_AVX_AVX512_MASK and return appropriate tdesc.
(_initialize_amd64_tdep): Add call to
initialize_tdesc_amd64_avx_avx512.
(initialize_tdesc_x32_avx_mpx_avx512): Rename to...
(initialize_tdesc_x32_avx_avx512): ...this.
* features/Makefile (WHICH): New tdescs i386/i386-avx-avx512,
i386/i386-avx-avx512-linux, i386/amd64-avx-avx512,
i386/amd64-avx-avx512-linux.
(i386/x32-avx-mpx-avx512): Rename to...
(i386/x32-avx-avx512): ...this.
(i386/x32-avx-mpx-avx512-linux): Rename to...
(i386/x32-avx-avx512-linux): ...this.
(i386/i386-avx-avx512-expedite, i386/i386-avx-avx512-linux-expedite,
i386/amd64-avx-avx512-expedite, i386/amd64-avx-avx512-linux-expedite):
New expedites.
(i386/x32-avx-mpx-avx512-expedite): Rename to...
(i386/x32-avx-avx512-expedite): ...this.
(i386/x32-avx-mpx-avx512-linux-expedite): Rename to...
(i386/x32-avx-avx512-linux-expedite): ...this.
(XMLTOC): New XML files i386/amd64-avx-avx512-linux.xml,
i386/amd64-avx-avx512.xml, i386/i386-avx-avx512-linux.xml,
i386/i386-avx-avx512.xml.
(i386/x32-avx-mpx-avx512-linux.xml): Rename to...
(i386/x32-avx-avx512-linux.xml): ...this.
(i386/x32-avx-mpx-avx512.xml): Rename to...
(i386/x32-avx-avx512.xml): ...this.
($(outdir)/i386/i386-avx-avx512.dat): New rule.
($(outdir)/i386/i386-avx-avx512-linux.dat): Likewise.
($(outdir)/i386/amd64-avx-avx512.dat): Likewise.
($(outdir)/i386/amd64-avx-avx512-linux.dat): Likewise.
($(outdir)/i386/x32-avx-mpx-avx512.dat): Rename to...
($(outdir)/i386/x32-avx-avx512.dat): ...this.
($(outdir)/i386/x32-avx-mpx-avx512-linux.dat): Rename to...
($(outdir)/i386/x32-avx-avx512-linux.dat): ...this.
* features/i386/amd64-avx-avx512-linux.c: New file.
* features/i386/amd64-avx-avx512-linux.xml: Likewise.
* features/i386/amd64-avx-avx512.c: Likewise.
* features/i386/amd64-avx-avx512.xml: Likewise.
* features/i386/i386-avx-avx512-linux.c: Likewise.
* features/i386/i386-avx-avx512-linux.xml: Likewise.
* features/i386/i386-avx-avx512.c: Likewise.
* features/i386/i386-avx-avx512.xml: Likewise.
* features/i386/x32-avx-mpx-avx512-linux.c: Deleted.
* features/i386/x32-avx-avx512-linux.c: New file.
* features/i386/x32-avx-mpx-avx512-linux.xml: Deleted.
* features/i386/x32-avx-avx512-linux.xml: New file.
* features/i386/x32-avx-mpx-avx512.c: Deleted.
* features/i386/x32-avx-avx512.c: New file.
* features/i386/x32-avx-mpx-avx512.xml: Deleted.
* features/i386/x32-avx-avx512.xml: New file.
* i386-linux-tdep.c (features/i386/i386-avx-avx512-linux.c): New include.
(i386_linux_core_read_description): Add dedicated case for
X86_XSTATE_AVX_AVX512_MASK and return appropriate tdesc.
(_initialize_i386_linux_tdep): Add call to
initialize_tdesc_i386_avx_avx512_linux.
* i386-linux-tdep.h (tdesc_i386_avx_avx512_linux): New prototype.
* i386-tdep.c (features/i386/i386-avx-avx512.c): New include.
(i386_validate_tdesc_p): Correct XSTATE mask used for feature_avx512.
(i386_target_description): Add dedicated case for
X86_XSTATE_AVX_AVX512_MASK and return appropriate tdesc.
(_initialize_i386_tdep): Add call to initialize_tdesc_i386_avx_avx512.
* regformats/i386/amd64-avx-avx512-linux.dat: New file
* regformats/i386/amd64-avx-avx512.dat: Likewise.
* regformats/i386/i386-avx-avx512-linux.dat: Likewise.
* regformats/i386/i386-avx-avx512.dat: Likewise.
* regformats/i386/x32-avx-mpx-avx512-linux.dat: Deleted.
* regformats/i386/x32-avx-avx512-linux.dat: New file.
* regformats/i386/x32-avx-mpx-avx512.dat: Deleted.
* regformats/i386/x32-avx-avx512.dat: New file.
* x86-linux-nat.c (x86_linux_read_description): Add dedidated case for
X86_XSTATE_AVX_AVX512_MASK and return appropriate description.
gdbserver/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* Makefile.in (clean): Add handling of new source files
i386-avx-avx512.c, i386-avx-avx512-linux.c, amd64-avx-avx512.c,
amd64-avx-avx512-linux.c.
(x32-avx-mpx-avx512.c): Rename to...
(x32-avx-avx512.c): ...this.
(x32-avx-mpx-avx512-linux.c): Rename to...
(x32-avx-avx512-linux.c): ...this.
(i386-avx-avx512-linux-ipa.o): New rule.
(amd64-avx-avx512-linux-ipa.o): Likewise.
(i386-avx-avx512.c): Likewise.
(i386-avx-avx512-linux.c): Likewise.
(amd64-avx-avx512.c): Likewise.
(amd64-avx-avx512-linux.c): Likewise.
(x32-avx-avx512.c): Rename rule, source files, dat files from
x32-avx-mpx-avx512.*) to this.
(x32-avx-avx512-linux.c): Rename rule, source files, dat files from
x32-avx-mpx-avx512-linux.*) to this.
* configure.srv (srv_i386_regobj): Add i386-avx-avx512.o.
(srv_i386_linux_regobj): Add i386-avx-avx512-linux.o.
(srv_amd64_regobj): Add amd64-avx-avx512.o, rename
x32-avx-mpx-avx512.o to x32-avx-avx512.o.
(srv_amd64_linux_regobj): Add amd64-avx-avx512-linux.o, rename
x32-avx-mpx-avx512-linux.o to x32-avx-avx512-linux.o.
(ipa_i386_linux_regobj): Add i386-avx-avx512-linux-ipa.o.
(ipa_amd64_linux_regobj): Add amd64-avx-avx512-linux-ipa.o.
(srv_i386_xmlfiles): Add i386/i386-avx-avx512.xml.
(srv_amd64_xmlfiles): Add i386/amd64-avx-avx512.xml, rename
x32-avx-mpx-avx512.xml to x32-avx-avx512.xml.
(srv_i386_linux_xmlfiles): Add i386/i386-avx-avx512-linux.xml.
(srv_amd64_linux_xmlfiles): Add i386/amd64-avx-avx512-linux.xml,
rename x32-avx-mpx-avx512-linux.xml to x32-avx-avx512-linux.xml.
* linux-amd64-ipa.c (get_ipa_tdesc): Add dedicated case for
X86_TDESC_AVX_AVX512 and return appropriate tdesc.
(initialize_low_tracepoint): Add init_registers_amd64_avx_avx512_linux.
* linux-i386-ipa.c (get_ipa_tdesc): Add dedicated case for
X86_TDESC_AVX_AVX512 and return appropriate tdesc.
(initialize_low_tracepoint): Add init_registers_i386_avx_avx512_linux.
* linux-x86-low.c (x86_linux_read_description): Add dedicated cases for
X86_XSTATE_AVX_AVX512_MASK and return appropriate tdesc.
(x86_get_ipa_tdesc_idx): Rename tdesc_x32_avx_mpx_avx512_linux to
tdesc_x32_avx_avx512_linux, add dedicated if-clause for
tdesc_amd64_avx_avx512_linux and return appropriate mask.
Add dedicated clause for tdesc_i386_avx_avx512_linux
and return appropriate mask.
(initialize_low_arch): Add init_registers_amd64_avx_avx512_linux,
rename init_registers_x32_avx_mpx_avx512_linux, add
init_registers_i386_avx_avx512_linux.
* linux-x86-tdesc.h (enum x86_linux_tdesc): Add new value for
X86_TDESC_AVX_AVX512.
(init_registers_amd64_avx_avx512_linux): New prototype.
(tdesc_amd64_avx_avx512_linux): Likewise.
(init_registers_x32_avx_mpx_avx512_linux): Rename to...
(init_registers_x32_avx_avx512_linux): ...this.
(tdesc_x32_avx_mpx_avx512_linux): Rename to...
(tdesc_x32_avx_avx512_linux): ...this.
(init_registers_i386_avx_avx512_linux): New prototype.
(tdesc_i386_avx_avx512_linux): Likewise.
Change-Id: I01359fab56c961a39568df50af39714ec7b31706
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Michael Sturm [Fri, 27 Jan 2017 15:14:28 +0000 (16:14 +0100)]
Rename target descriptions to reflect actual content of description.
To better reflect the actual feature set covered by the IA target
descriptions, the existing descriptions are renamed. Each feature of
the extended state is added to the name of a description or xstate mask
starting from AVX.
For example, amd64-mpx-avx512-linux becomes amd64-avx-mpx-avx512-linux,
while amd64-avx-linux remains unchanged.
Likewise, the corresponding xstate masks are changed, e.g. from
X86_XSTATE_MPX_AVX512_MASK to X86_XSTATE_AVX_MPX_AVX512_MASK.
gdb/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* amd64-linux-tdep.c (features/i386/amd64-avx512-linux.c): Rename
include to...
(features/i386/amd64-avx-mpx-avx512-linux.c): ...this.
(features/i386/x32-avx512-linux.c): Rename include to...
(features/i386/x32-avx-mpx-avx512-linux.c): ...this.
(amd64_linux_core_read_description): Rename X86_XSTATE_MPX_AVX512_MASK,
X86_XSTATE_AVX512_MASK, desc_x32_avx512_linux, tdesc_amd64_avx512_linux.
(_initialize_amd64_linux_tdep): Rename
initialize_tdesc_amd64_avx512_linux, initialize_tdesc_x32_avx512_linux.
* amd64-linux-tdep.h (tdesc_amd64_avx512_linux): Rename to...
(tdesc_amd64_avx_mpx_avx512_linux): ...this.
(tdesc_x32_avx512_linux): Rename to...
(tdesc_x32_avx_mpx_avx512_linux): ...this.
* amd64-tdep.c (features/i386/amd64-avx512.c): Rename include to...
(features/i386/amd64-avx-mpx-avx512.c): ...this.
(features/i386/x32-avx512.c): Rename include to...
(features/i386/x32-avx-mpx-avx512.c): ...this.
(amd64_target_description): Rename X86_XSTATE_MPX_AVX512_MASK,
X86_XSTATE_AVX512_MASK, tdesc_amd64_avx512.
(_initialize_amd64_tdep): Rename initialize_tdesc_amd64_avx512. Rename
initialize_tdesc_x32_avx512.
* common/x86-xstate.h (X86_XSTATE_AVX512_MASK): Rename to...
(X86_XSTATE_AVX_AVX512_MASK): ...this.
(86_XSTATE_MPX_AVX512_MASK): Rename to...
(X86_XSTATE_AVX_MPX_AVX512_MASK): ...this.
(X86_XSTATE_ALL_MASK): Rename X86_XSTATE_MPX_AVX512_MASK to
X86_XSTATE_AVX_MPX_AVX512_MASK.
* features/Makefile (WHICH): Rename i386/i386-avx512,
i386/i386-avx512-linux, i386/amd64-avx512, i386/amd64-avx512-linux,
i386/x32-avx512, i386/x32-avx512-linux.
(i386/i386-avx512-expedite, i386/i386-avx512-linux-expedite,
i386/amd64-avx512-expedite, i386/amd64-avx512-linux-expedite,
i386/x32-avx512-expedite, i386/x32-avx512-linux-expedite): Rename
expedites.
(XMLTOC): Rename i386/amd64-avx512-linux.xml, i386/amd64-avx512.xml,
i386/i386-avx512-linux.xml, i386/i386-avx512.xml,
i386/x32-avx512-linux.xml, i386/x32-avx512.xml.
($(outdir)/i386/i386-avx512.dat): Rename dat file in rule.
($(outdir)/i386/i386-avx512-linux.dat): Likewise.
($(outdir)/i386/amd64-avx512.dat): Likewise.
($(outdir)/i386/amd64-avx512-linux.dat): Likewise.
($(outdir)/i386/x32-avx512.dat): Likewise.
($(outdir)/i386/x32-avx512-linux.dat): Likewise.
* features/i386/amd64-avx512-linux.c: Regenerate from renamed XML file.
* features/i386/amd64-avx512-linux.xml: Rename XML file.
* features/i386/amd64-avx512.c: Regenerate from renamed XML file.
* features/i386/amd64-avx512.xml: Rename XML file.
* features/i386/i386-avx512-linux.c: Regenerate from renamed XML file.
* features/i386/i386-avx512-linux.xml: Rename XML file.
* features/i386/i386-avx512.c: Regenerate from renamed XML file.
* features/i386/i386-avx512.xml: Rename XML file.
* features/i386/x32-avx512-linux.c: Regenerate from renamed XML file.
* features/i386/x32-avx512-linux.xml: Rename XML file.
* features/i386/x32-avx512.c: Regenerate from renamed XML file.
* features/i386/x32-avx512.xml: Rename XML file.
* i386-linux-tdep.c (features/i386/i386-avx512-linux.c): Rename to...
(features/i386/i386-avx-mpx-avx512-linux.c): ...this.
(i386_linux_core_read_description): Rename X86_XSTATE_MPX_AVX512_MASK,
X86_XSTATE_AVX512_MASK, tdesc_i386_avx512_linux.
(_initialize_i386_linux_tdep): Rename initialize_tdesc_i386_avx512_linux.
* i386-linux-tdep.h (tdesc_i386_avx512_linux): Rename to...
(tdesc_i386_avx_mpx_avx512_linux): ...this.
* i386-tdep.c (features/i386/i386-avx512.c): Rename to...
(features/i386/i386-avx-mpx-avx512.c): ...this.
(i386_register_reggroup_p): Rename X86_XSTATE_AVX512_MASK.
(i386_validate_tdesc_p): Likewise.
(i386_target_description): Rename X86_XSTATE_MPX_AVX512_MASK,
tdesc_i386_avx512.
(_initialize_i386_tdep): Rename initialize_tdesc_i386_avx512.
* regformats/i386/amd64-avx512-linux.dat: Regenerate from renamed XML
file.
* regformats/i386/amd64-avx512.dat: Likewise.
* regformats/i386/i386-avx512-linux.dat: Likewise.
* regformats/i386/i386-avx512.dat: Likewise.
* regformats/i386/x32-avx512-linux.dat: Likewise.
* regformats/i386/x32-avx512.dat: Likewise.
* x86-Linux-nat.c (x86_linux_read_description): Rename
X86_XSTATE_MPX_AVX512_MASK, X86_XSTATE_AVX512_MASK,
tdesc_x32_avx512_linux, tdesc_amd64_avx512_linux, tdesc_i386_avx512_linux.
gdbserver/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* Makefile.in (clean): Rename i386-avx512.c, i386-avx512-linux.c,
amd64-avx512.c, amd64-avx512-linux.c, x32-avx512.c, x32-avx512-linux.c.
(i386-avx512-linux-ipa.o): Rename rule and source files.
(amd64-avx512-linux-ipa.o): Likewise.
(i386-avx512.c): Rename rule, source fils and dat files.
(i386-avx512-linux.c): Likewise.
(amd64-avx512.c): Likewise.
(amd64-avx512-linux.c): Likewise.
(x32-avx512.c): Likewise.
(x32-avx512-linux.c): Likewise.
* configfure.srv (srv_i386_regobj): Rename i386-avx512.o.
(i386_linux_regobj): Rename i386-avx512-linux.o.
(srv_amd64_regobj): Rename amd64-avx512.o, x32-avx512.o.
(srv_amd64_linux_regobj): Rename amd64-avx512-linux.o,
x32-avx512-linux.o.
(ipa_i386_linux_regobj): Rename i386-avx512-linux-ipa.o.
(ipa_amd64_linux_regobj): Rename amd64-avx512-linux-ipa.o.
(srv_i386_xmlfiles): Rename i386/i386-avx512.xml.
(srv_amd64_xmlfiles): Rename i386/amd64-avx512.xml, i386/x32-avx512.xml.
(srv_i386_linux_xmlfiles): Rename i386/i386-avx512-linux.xml.
(srv_amd64_linux_xmlfiles): Rename i386/amd64-avx512-linux.xml,
i386/x32-avx512-linux.xml).
* linux-amd64-ipa.c (get_ipa_tdesc): Rename X86_TDESC_AVX512 and returned
tdesc for that case.
(initialize_low_tracepoint): Rename init_registers_amd64_avx512_linux.
* linux-i386-ipa.c (get_ipa_tdesc): Rename X86_TDESC_AVX512 and tdesc
returned for that case.
(initialize_low_tracepoint): Rename init_registers_i386_avx512_linux.
* linux-x86-low.c (x86_linux_read_description): Rename
X86_XSTATE_AVX512_MASK and tdesc returned for that case.
(x86_get_ipa_tdesc_idx): Rename tdesc_amd64_avx512_linux,
tdesc_x32_avx512_linux and mask returned for these descriptions.
Rename tdesc_i386_avx512_linux and mask returned for that description.
(initialize_low_arch): Rename init_registers_amd64_avx512_linux,
init_registers_x32_avx512_linux, init_registers_i386_avx512_linux.
* linux-x86-tdesc.h (enum x86_linux_tdesc): Rename X86_TDESC_AVX512.
(init_registers_amd64_avx512_linux): Rename to...
(init_registers_amd64_avx_mpx_avx512_linux): ...this.
(tdesc_amd64_avx512_linux): Rename to...
(tdesc_amd64_avx_mpx_avx512_linux): ...this.
(init_registers_x32_avx512_linux): Rename to...
(init_registers_x32_avx_mpx_avx512_linux): ...this.
(tdesc_x32_avx512_linux): Rename to...
(tdesc_x32_avx_mpx_avx512_linux): ...this.
(init_registers_i386_avx512_linux): Rename to...
(init_registers_i386_avx_mpx_avx512_linux): ...this.
(tdesc_i386_avx512_linux): Rename to...
(tdesc_i386_avx_mpx_avx512_linux): ...this.
Change-Id: Idb83be3b3b72d5487542d4b568193df2777a3d9d
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Michael Sturm [Wed, 3 Feb 2016 16:55:20 +0000 (17:55 +0100)]
Change xstate_bv handling to use 8 bytes of data.
The size of the state-component bitmap as specified in
Intel(R) 64 and IA-32 Architectures Software Developer's Manual,
Chapter 13.4.2 is 8 bytes.
So far, the data types used for xstate_bv_p (gdb_byte*),
clear_bv (unsigned int) and tdep->xcr0 (uint64_t) were
inconsistent. But, since the xstate components were still
fitting into a single byte, the code still worked
as expected.
However, with the addition of the PKU feature (bit 9),
using one byte for the bitmap will no longer be sufficient.
This patch changes related code to use 64 bit data types
consistently and changes read/write acces of the XSAVE
header in the xsave buffer to use the endianess-aware
functions extract_unsigned_integer and store_unsigned_integer.
This is required to make sure that eventual differences
in endianess between host and target are taken care off.
gdb/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* i387-tdep.c (i387_supply_xsave): Change type
of clear_bv to ULONGEST. Replace gdb_byte *xstate_bv_p
with ULONGEST xstate_bv and use extract_unsigned_integer
and store_unsigned_integer to read/write its value from
the xsave buffer.
(i387_collect_xsave): Replace gdb_byte *xstate_bv_p
with ULONGEST initial_xstate_bv and use
extract_unsigned_integer/store_unsigned_integer to
read/write its value from the xsave buffer.
Change type of clear_bv to ULONGEST.
gdbserver/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* i387-fp.c (i387_cache_to_xsave): Change type of clear_bv to
unsigned long long.
(i387_fxsave_to_cache): Likewise.
Change-Id: I0de254158960b4f7bcbc9fe2fb857034fa1f7ca5
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Michael Sturm [Mon, 5 Dec 2016 14:03:06 +0000 (15:03 +0100)]
Sync up x86-gcc-cpuid.h with cpuid.h from gcc-6 branch.
Pedro suggested a separate patch synching with GCCs cpuid.h
instead of just adding new bits for PKU feature.
gdb/Changelog:
2016-11-14 Michael Sturm <michael.sturm@intel.com>
* nat/x86-gcc-cpuid.h: Replace with copy of cpuid.h
from gcc-6 branch.
Change-Id: I16f8f7f2d0aa7c2e815701d15ed831a6c6b33d21
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Alan Modra [Fri, 17 Feb 2017 07:28:17 +0000 (17:58 +1030)]
Relax dwarf2 expected error match
* testsuite/ld-elf/dwarf2.err: Accept other errors between the
multiple definition errors.
Alan Modra [Fri, 17 Feb 2017 06:54:02 +0000 (17:24 +1030)]
Relax dwarf3 expected error match
* testsuite/ld-elf/dwarf2.err: Add missing newline at end.
* testsuite/ld-elf/dwarf3.err: Likewise. Allow match without filename.
Pedro Alves [Fri, 17 Feb 2017 01:26:12 +0000 (01:26 +0000)]
bfd: Rename Chunk and S3Forced
The direct references in objcopy kind of look like a hack to me, so
I'm calling these symbols internal too. Certainly they aren't named
and documented as a public BFD symbol today anyway.
So ... give these bfd-internal symbols with external linkage a _bfd_
prefix to avoid collisions in the global symbol namespace.
While at it, give them names that more closely match the corresponding
option name that toggles them.
Also while at it, fix a few related comment typos.
gdb/ChangeLog:
2017-02-17 Pedro Alves <palves@redhat.com>
* srec.c (Chunk): Rename to ...
(_bfd_srec_len): ... this.
(S3Forced): Rename to ...
(_bfd_srec_forceS3): ... this.
* objcopy.c: Adjust all references.
Pedro Alves [Fri, 17 Feb 2017 01:26:12 +0000 (01:26 +0000)]
bfd: Rename bsd_write_armap and coff_write_armap
Give these bfd-internal symbols with external linkage a _bfd_ prefix
to avoid collisions in the global symbol namespace.
bfd/ChangeLog:
2017-02-17 Pedro Alves <palves@redhat.com>
* archive.c (bsd_write_armap): Rename to ...
(_bfd_bsd_write_armap): ... this.
(coff_write_armap): Rename to ...
(_bfd_coff_write_armap): ... this.
* libbfd-in.h (bsd_write_armap): Rename to ...
(_bfd_bsd_write_armap): ... this.
(coff_write_armap): Rename to ...
(_bfd_coff_write_armap): ... this.
* aout-target.h, aout-tic30.c: Adjust all users.
* libbfd.h: Regenerate.
Pedro Alves [Fri, 17 Feb 2017 01:26:12 +0000 (01:26 +0000)]
bfd: Rename warn_deprecated
Give this bfd-internal symbol with external linkage a _bfd_ prefix to
avoid collisions in the global symbol namespace.
bfd/ChangeLog:
2017-02-17 Pedro Alves <palves@redhat.com>
* bfd-in.h (bfd_read, bfd_write): Adjust to rename.
(warn_deprecated): Rename to ...
(_bfd_warn_deprecated): ... this.
* libbfd.c (warn_deprecated): Rename to ...
(_bfd_warn_deprecated): ... this.
* bfd-in2.h: Regenerate.
Pedro Alves [Fri, 17 Feb 2017 01:26:12 +0000 (01:26 +0000)]
bfd: Rename real_{ftell, fseek, fopen}
Give these bfd-internal symbols with external linkage a _bfd_ prefix
to avoid collisions in the global symbol namespace.
bfd/ChangeLog:
2017-02-17 Pedro Alves <palves@redhat.com>
* bfdio.c (real_ftell): Rename to ...
(_bfd_real_ftell): ... this.
(real_fseek): Rename to ...
(_bfd_real_fseek): ... this.
(real_fopen): Rename to ...
(_bfd_real_fopen): ... this.
* libbfd-in.h (real_ftell): Rename to ...
(_bfd_real_ftell): ... this.
(real_fseek): Rename to ...
(_bfd_real_fseek): ... this.
(real_fopen): Rename to ...
(_bfd_real_fopen): ... this.
* cache.c, dwarf2.c, opncls.c: Adjust all callers.
* libbfd.h: Regenerate.
Pedro Alves [Fri, 17 Feb 2017 01:26:11 +0000 (01:26 +0000)]
bfd: Rename read_{signed,unsigned}_leb128, safe_read_leb128
Give these bfd-internal symbols with external linkage a _bfd_ prefix
to avoid collisions in the global symbol namespace.
bfd/ChangeLog:
2017-02-17 Pedro Alves <palves@redhat.com>
* dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
* libbfd.c (read_unsigned_leb128): Rename to ...
(_bfd_read_unsigned_leb128): ... this.
(read_signed_leb128): Rename to ...
(_bfd_read_signed_leb128): ... this.
(safe_read_leb128): Rename to ...
(_bfd_safe_read_leb128): ... this.
* libbfd-in.h (read_unsigned_leb128): Rename to ...
(_bfd_read_unsigned_leb128): ... this.
(read_signed_leb128): Rename to ...
(_bfd_read_signed_leb128): ... this.
(safe_read_leb128): Rename to ...
(_bfd_safe_read_leb128): ... this.
* libbfd.h: Renegerate.
GDB Administrator [Fri, 17 Feb 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Mon, 19 Dec 2016 15:27:59 +0000 (15:27 +0000)]
bfd: Improve lookup of file / line information for errors
When looking up file and line information (used from the linker to
report error messages) if no symbol is passed in, then use the symbol
list to look for a matching symbol.
If a matching symbol is found then use this to look up the file / line
information.
This should improve errors when looking up file / line information for
data sections. Hopefully we should find a matching data symbol, which
should, in turn (we hope) match a DW_TAG_variable in the DWARF, this
should allow us to give accurate file / line errors for data symbols.
As the hope is to find a matching DW_TAG_variable in the DWARF then we
ignore section symbols, and prefer global symbols to locals.
bfd/ChangeLog:
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
before trying to fine matching file and line information.
ld/ChangeLog:
* testsuite/ld-elf/shared.exp: Update expected results.
* testsuite/ld-elf/dwarf2.err: Likewise
Andrew Burgess [Thu, 15 Dec 2016 15:22:49 +0000 (15:22 +0000)]
bfd/dwarf: Improve use of previously loaded dwarf information
When parsing DWARF data in order to report file/line type error messages
we perform section placement to make section addresses unique within
relocatable object files.
Currently, if we reuse previously loaded (and cached) dwarf data then we
neglect to perform section placement, the result is that the section
addresses will not be unique, and we might, incorrectly associate an
address with the wrong debug information, and so report an incorrect
file and line number.
Further we neglect to check that that bfd for which we are looking up
debug information is actually the bfd for which the previous debug
information was loaded, it is possible that we will reuse previously
loaded debug information for a different bfd.
And finally, due to following of gnu_debuglink links in one bfd to
another, the process of checking that the cached debug information is
valid requires us to track the original bfd in the cached debug
information. The original debug information here is either the bfd that
we're interested in, not the bfd we finally load the debug information
from.
bfd/ChangeLog:
* dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
(_bfd_dwarf2_slurp_debug_info): If stashed debug information does
not match current bfd, then reload debug information. Record bfd
we're loading debug info for in the stash. If we have debug
informatin in the cache then perform section placement before
returning.
ld/ChangeLog:
* testsuite/ld-elf/dwarf.exp (build_tests): Add new tests.
* testsuite/ld-elf/dwarf2.err: New file.
* testsuite/ld-elf/dwarf2a.c: New file.
* testsuite/ld-elf/dwarf2b.c: New file.
* testsuite/ld-elf/dwarf3.c: New file.
* testsuite/ld-elf/dwarf3.err: New file.
Andrew Burgess [Tue, 7 Feb 2017 22:31:46 +0000 (22:31 +0000)]
ld: Add additional checking for warnings/errors in testsuite
This commit adds new actions to the run_cc_link_tests mechanism in the
linker testsuite.
Previously this procedure could take a parameter containing a regular
expression that would be matched against warnings from the linker.
After this commit the warnings parameter is removed, instead, the
actions list can contain the actions 'warning', 'error',
'warning_output', or 'error_output'. The action names are chosen to
match the actions already present in the run_dump_test procedure.
These new actions allow for the current warning checking, but also allow
for checking of errors using a regular expression. More interestingly,
the *_output actions allow for the warning/error patterns to be placed
in a separate file.
The small number of tests that make use of the warning parameter have
been updated to the new mechanism. Later commits will make use of the
new features added in this commit.
ld/ChangeLog:
* testsuite/lib/ld-lib.exp (run_cc_link_tests): Add warning,
error, warning_output, and error_output actions. Remove separate
warnings parameter.
* testsuite/ld-elf/shared.exp (build_tests): Updated to use
'warning' action.
* testsuite/ld-plugin/lto.exp (lto_link_tests): Likewise.
Alan Modra [Thu, 16 Feb 2017 11:49:10 +0000 (22:19 +1030)]
ld testsuite function pointer comparisons vs. hppa
ld/testsuite/ld-elf/check-ptr-eq.c fails for hppa, since function
pointers may point at plabels. It isn't valid to cast two function
pointers to void* and then compare the void pointers.
* testsuite/ld-elf/check-ptr-eq.c (check_ptr_eq): Change params
from void pointers to function pointers.
* testsuite/ld-elf/pr18718.c: Update to suit.
* testsuite/ld-elf/pr18720a.c: Update to suit.
Alan Modra [Tue, 14 Feb 2017 00:15:51 +0000 (10:45 +1030)]
hppa -z relro again
I misunderstood the hppa alias problem. File offsets of segments need
to be such that no page is mapped twice with different permissions.
(Which still seems to me like something the kernel could fix, but
anyhow, this is not so difficult to achieve in ld.)
PR 21000
bfd/
* elf-bfd.h (struct elf_backend_data): Add no_page_alias.
* elfxx-target.h (elf_backend_no_page_alias): Define.
(elfNN_bed): Init new field.
* elf.c (assign_file_positions_for_load_sections): If no_page_alias
ensure PT_LOAD segment starts on a new page.
* elf32-hppa.c (elf_backend_no_page_alias): Define.
ld/
* testsuite/ld-elf/loadaddr1.d: Adjust for hppa file offsets.
* testsuite/ld-elf/loadaddr2.d: Likewise.
* testsuite/ld-elf/loadaddr3a.d: Likewise.
* testsuite/ld-scripts/rgn-at5.d: Likewise.
Alan Modra [Thu, 16 Feb 2017 01:53:12 +0000 (12:23 +1030)]
PR21132, hppa-linux pie support doesn't work
This fixes a long-standing hppa bug seen when generating PIEs, and I
think possible to trigger with forced local symbols in shared
libraries. Not allocating enough space for PLT relocs results in ld
writing outside of the buffer.
PR 21132
* elf32-hppa.c (allocate_plt_static): Allocate space for relocs
if pic.
Alan Modra [Thu, 16 Feb 2017 04:43:56 +0000 (15:13 +1030)]
Fix more powerpc testsuite source errors
* testsuite/ld-powerpc/vxworks1-lib.s: Correct addi to addic.
* testsuite/ld-powerpc/vxworks1-lib.dd: Adjust to suit.
Jiong Wang [Thu, 16 Feb 2017 09:40:03 +0000 (09:40 +0000)]
[Patch] Add BFD_LINKER_CREATED to BFD_FLAGS_SAVED
bfd/
* bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
* bfd-in2.h: Regenerated.
Bug exposed by https://sourceware.org/ml/binutils/2017-02/msg00128.html
Sergio Durigan Junior [Wed, 15 Feb 2017 20:08:19 +0000 (15:08 -0500)]
PR gdb/21164: maint print {symbols,msymbols,psymbols} without args crash
This is a fix for PR gdb/21164. The problem started to happen after:
commit
34c41c681f4a0a0dfe0405c7d2aecf458520557a
Author: Doug Evans <xdje42@gmail.com>
AuthorDate: Mon Dec 19 08:33:46 2016 -0800
New syntax for mt print symbols,msymbols,psymbols.
This change introduced new syntax for the mentioned commands, and
improved the parsing of arguments by using 'gdb_buildargv'. However,
it is necessary to check if the argv being built is not NULL, which
can happen if the user doesn't provide any arguments to these
commands.
gdb/ChangeLog:
2017-02-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21164
* psymtab.c (maintenance_print_psymbols): Verify if 'argv' is not
NULL before using it.
* symmisc.c (maintenance_print_symbols): Likewise.
(maintenance_print_msymbols): Likewise.
gdb/testsuite/ChangeLog:
gdb/ChangeLog:
2017-02-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21164
* gdb.base/maint.exp: Add testcases for when the commands do
not have arguments.
GDB Administrator [Thu, 16 Feb 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 15 Feb 2017 19:39:30 +0000 (11:39 -0800)]
i386: Allow "lea foo@GOT, %reg" in PIC
"lea foo@GOT, %reg" is OK in PIC since it only loads the GOT offset
into register, which can be used later with a GOT base register to
get the value in the GOT entry.
bfd/
PR ld/21168
* elf32-i386.c (elf_i386_relocate_section): Allow
"lea foo@GOT, %reg" in PIC.
ld/
PR ld/21168
* testsuite/ld-i386/i386.exp: Run pr21168.
* testsuite/ld-i386/pr21168a.c: New file.
* testsuite/ld-i386/pr21168b.S: Likewise.
H.J. Lu [Wed, 15 Feb 2017 18:55:51 +0000 (10:55 -0800)]
Add a test for R_386_GOT32/R_386_GOT32X IFUNC reloc error
bfd/
PR ld/20244
* elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
error against local IFUNC symbol without a base register for
PIC.
ld/
PR ld/20244
* testsuite/ld-i386/i386.exp: Run pr20244-4a, pr20244-4b and
pr20244-4c.
* testsuite/ld-i386/pr20244-4.s: New file.
* testsuite/ld-i386/pr20244-4a.d: Likewise.
* testsuite/ld-i386/pr20244-4b.d: Likewise.
* testsuite/ld-i386/pr20244-4c.d: Likewise.
Andrew Waterman [Tue, 14 Feb 2017 23:37:04 +0000 (15:37 -0800)]
Add SFENCE.VMA instruction
include/ChangeLog:
2017-02-14 Andrew Waterman <andrew@sifive.com>
* opcode/riscv-opc.h (MATCH_SFENCE_VMA): New define.
(MASK_SFENCE_VMA): Likewise.
(sfence_vma): Declare instruction.
opcodes/ChangeLog:
2017-02-14 Andrew Waterman <andrew@sifive.com>
* riscv-opc.c (riscv_opcodes): Add sfence.vma instruction and
pseudoinstructions.
Richard Sandiford [Wed, 15 Feb 2017 16:54:21 +0000 (16:54 +0000)]
[AArch64] Add SVE system registers
This patch adds the SVE-specific system registers.
opcodes/
* aarch64-opc.c (aarch64_sys_regs): Add SVE registers.
(aarch64_sys_reg_supported_p): Handle them.
gas/
* testsuite/gas/aarch64/sve-sysreg.s,
testsuite/gas/aarch64/sve-sysreg.d,
testsuite/gas/aarch64/sve-sysreg-invalid.d,
testsuite/gas/aarch64/sve-sysreg-invalid.l: New tests.
Richard Sandiford [Wed, 15 Feb 2017 16:51:17 +0000 (16:51 +0000)]
[AArch64] Fix +sve documentation
The documentation entry for the SVE feature incorrectly said that
it was enabled by default for ARMv8-A or later. This patch fixes
that and also mentions that +sve implies +simd. (It also implies
+fp, but that follows by transitivity.)
gas/
* doc/c-aarch64.texi: Fix sve entry.
Maciej W. Rozycki [Tue, 7 Feb 2017 02:08:23 +0000 (02:08 +0000)]
LD: vfinfo: Make clever formatters consistent WRT function name reporting
Remove an inconsistency in linker error message processing causing that
it depends on the ability to infer the name of the originating source
file whether or not the name of the offending function is repeated by
clever formatters for each issue reported within the function.
Taking the `ld/testsuite/ld-powerpc/tocopt7.s' test case source as an
example and the `powerpc-linux' target we have:
$ as -gdwarf2 -o tocopt.o -a64 tocopt.s
$ ld -o tocopt -melf64ppc tocopt.o
tocopt.o: In function `_start':
tocopt.s:35:(.text+0x14): toc optimization is not supported for 0x3fa00000 instruction.
tocopt.s:49:(.text+0x34): toc optimization is not supported for 0x3fa00000 instruction.
$
vs:
$ as -o tocopt.o -a64 tocopt.s
$ ld -o tocopt -melf64ppc tocopt.o
tocopt.o: In function `_start':
(.text+0x14): toc optimization is not supported for 0x3fa00000 instruction.
tocopt.o: In function `_start':
(.text+0x34): toc optimization is not supported for 0x3fa00000 instruction.
$
Similarly with the `mips-linux' target and this source:
$ cat jal-global-multi-overflow.s
.text
.set noreorder
.space 0x2000
.align 4
.globl foo
.ent foo
foo:
jal bar
nor $0, $0
jal bar
nor $0, $0
.end foo
.space 0x1ff0
.align 4
.globl bar
.ent bar
bar:
jal foo
nor $0, $0
jal foo
nor $0, $0
.end bar
$ as -o jal-global-multi-overflow.o jal-global-multi-overflow.s
$ ld -Ttext 0x1fffd000 -e foo -o jal-global-multi-overflow jal-global-multi-overflow.o
jal-global-multi-overflow.o: In function `foo':
(.text+0x2000): relocation truncated to fit: R_MIPS_26 against `bar'
jal-global-multi-overflow.o: In function `foo':
(.text+0x2008): relocation truncated to fit: R_MIPS_26 against `bar'
jal-global-multi-overflow.o: In function `bar':
(.text+0x4000): relocation truncated to fit: R_MIPS_26 against `foo'
jal-global-multi-overflow.o: In function `bar':
(.text+0x4008): relocation truncated to fit: R_MIPS_26 against `foo'
$
Not only this is inconsistent, but it causes output clutter as well with
redundant information.
The cause for this is a check in `vfinfo' the intent of which is to
print the function heading whenever (among others) the name of the
source file has changed, which however does not take into account a
situation where the name couldn't have been established both now and
previously.
Adjust the check then for this situation, yielding:
$ as -o tocopt.o -a64 tocopt.s
$ ld -o tocopt -melf64ppc tocopt.o
tocopt.o: In function `_start':
(.text+0x14): toc optimization is not supported for 0x3fa00000 instruction.
(.text+0x34): toc optimization is not supported for 0x3fa00000 instruction.
$
and:
$ as -o jal-global-multi-overflow.o jal-global-multi-overflow.s
$ ld -Ttext 0x1fffd000 -e foo -o jal-global-multi-overflow jal-global-multi-overflow.o
jal-global-multi-overflow.o: In function `foo':
(.text+0x2000): relocation truncated to fit: R_MIPS_26 against `bar'
(.text+0x2008): relocation truncated to fit: R_MIPS_26 against `bar'
jal-global-multi-overflow.o: In function `bar':
(.text+0x4000): relocation truncated to fit: R_MIPS_26 against `foo'
(.text+0x4008): relocation truncated to fit: R_MIPS_26 against `foo'
$
respectively instead. Adjust the test suite accordingly.
ld/
* ldmisc.c (vfinfo): Don't print the function name again either
if no source file name has been found both now and previously.
* testsuite/ld-cris/tls-err-20x.d: Adjust accordingly.
* testsuite/ld-mips-elf/mode-change-error-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-mips16.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-micromips.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jump.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jump-mips16.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jump-micromips.d: Likewise.
* testsuite/ld-mips-elf/unaligned-lwpc-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-ldpc-1.d: Likewise.
* testsuite/ld-powerpc/tocopt.out: Likewise.
* testsuite/ld-powerpc/tocopt7.out: Likewise.
Maciej W. Rozycki [Tue, 7 Feb 2017 02:07:21 +0000 (02:07 +0000)]
PowerPC/BFD: Convert `%P: %H:' to `%H:' in error messages
Remove an inconsistency in BFD linker error messages across the PowerPC
backends, where in the presence of line information the `%P: %H:' format
sequence makes the first error message produced for any given function
different from subsequent ones.
Taking the `ld/testsuite/ld-powerpc/tocopt7.s' test case source as an
example and the `powerpc-linux' target we have:
$ as -gdwarf2 -o tocopt.o -a64 tocopt.s
$ ld -o tocopt -melf64ppc tocopt.o
ld: tocopt.o: In function `_start':
tocopt.s:35:(.text+0x14): toc optimization is not supported for 0x3fa00000 instruction.
ld: tocopt.s:49:(.text+0x34): toc optimization is not supported for 0x3fa00000 instruction.
$
where the first error message does not have the source file name
prefixed with the linker program executable's name, i.e. `ld:', whereas
the second error message does, as would any subsequent.
This is because with a multiple-line error message such as `%H' produces
`%P' only prints the program executable's name on the first line and not
any later ones. Also the PowerPC backend is the only part of BFD which
uses `%P' along with one of the clever `%C', `%D', `%G', `%H' format
specifiers. And last but not least this breaks a GNU Coding Standard's
requirement that error messages from compilers should look like this:
source-file-name:lineno: message
also quoted in `vfinfo' code handling these specifiers.
Convert `%P: %H:' to `%H:' in error messages across the PowerPC backends
then, yielding:
$ as -gdwarf2 -o tocopt.o -a64 tocopt.s
$ ld -o tocopt -melf64ppc tocopt.o
tocopt.o: In function `_start':
tocopt.s:35:(.text+0x14): toc optimization is not supported for 0x3fa00000 instruction.
tocopt.s:49:(.text+0x34): toc optimization is not supported for 0x3fa00000 instruction.
$
instead, making it consistent and matching the GNU Coding Standard's
requirement.
bfd/
* elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
`%P: %H:' with `info->callbacks->einfo'.
(ppc_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
(ppc64_elf_edit_toc): Likewise.
(ppc64_elf_relocate_section): Likewise.
Maciej W. Rozycki [Tue, 7 Feb 2017 02:06:20 +0000 (02:06 +0000)]
LD: vfinfo: Remove static NULL initializers
Remove static NULL initializers, moving the respective variables from
data to BSS and saving some storage space.
ld/
* ldmisc.c (vfinfo) <'H'>: Remove static NULL initializers.
Thomas Preud'homme [Wed, 15 Feb 2017 11:24:27 +0000 (11:24 +0000)]
Fix illegal upper case gdb cmd in chained-calls.exp
3d7b173c29900879c9a5958dd6029fd36666e57c made upper case commands now
illegal. However gdb.cp/chained-calls.exp still contains one test using
P to print an expression. This patch fixes the testcase to use p
instead.
2017-02-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
gdb/
* gdb.cp/chained-calls.exp: Use p instead of P.
Claudiu Zissulescu [Wed, 15 Feb 2017 10:57:51 +0000 (11:57 +0100)]
[ARC] Fix assembler relaxation.
Fix assembler relaxation step for add, ld, mov, mpy and sub
instructions. Add tests to it.
gas/
2017-02-15 Claudiu Zissulescu <claziss@synopsys.com>
* config/tc-arc.c (md_convert_frag): Remove @pcl relocation
information from input expression.
(assemble_insn): Make sure pcrel is correctly set.
(arc_pcrel_adjust): Compensate for PCL rounding.
* testsuite/gas/arc/relax-add01.d: New file.
* testsuite/gas/arc/relax-add01.s: Likewise.
* testsuite/gas/arc/relax-add02.d: Likewise.
* testsuite/gas/arc/relax-add02.s: Likewise.
* testsuite/gas/arc/relax-add03.d: Likewise.
* testsuite/gas/arc/relax-add03.s: Likewise.
* testsuite/gas/arc/relax-add04.d: Likewise.
* testsuite/gas/arc/relax-add04.s: Likewise.
* testsuite/gas/arc/relax-ld01.d: Likewise.
* testsuite/gas/arc/relax-ld01.s: Likewise.
* testsuite/gas/arc/relax-ld02.d: Likewise.
* testsuite/gas/arc/relax-ld02.s: Likewise.
* testsuite/gas/arc/relax-mov01.d: Likewise.
* testsuite/gas/arc/relax-mov01.s: Likewise.
* testsuite/gas/arc/relax-mov02.d: Likewise.
* testsuite/gas/arc/relax-mov02.s: Likewise.
* testsuite/gas/arc/relax-mpy01.d: Likewise.
* testsuite/gas/arc/relax-mpy01.s: Likewise.
* testsuite/gas/arc/relax-sub01.d: Likewise.
* testsuite/gas/arc/relax-sub01.s: Likewise.
* testsuite/gas/arc/relax-sub02.d: Likewise.
* testsuite/gas/arc/relax-sub02.s: Likewise.
* testsuite/gas/arc/relax-sub03.d: Likewise.
* testsuite/gas/arc/relax-sub03.s: Likewise.
* testsuite/gas/arc/relax-sub04.d: Likewise.
* testsuite/gas/arc/relax-sub04.s: Likewise.
opcodes/
2017-02-15 Claudiu Zissulescu <claziss@synopsys.com>
* arc-opc.c (UIMM6_20R): Define.
(SIMM12_20): Use above.
(SIMM12_20R): Define.
(SIMM3_5_S): Use above.
(UIMM7_A32_11R_S): Define.
(UIMM7_9_S): Use above.
(UIMM3_13R_S): Define.
(SIMM11_A32_7_S): Use above.
(SIMM9_8R): Define.
(UIMM10_A32_8_S): Use above.
(UIMM8_8R_S): Define.
(W6): Use above.
(arc_relax_opcodes): Use all above defines.
Nick Clifton [Wed, 15 Feb 2017 09:42:38 +0000 (09:42 +0000)]
Move Eric Christopher to Past Maintainers list.
* MAINTAINERS: (MIPS, MN10300): Move Eric Christopher to Past
Maintainers section.
Igor Kudrin [Wed, 15 Feb 2017 09:13:56 +0000 (09:13 +0000)]
Use Windows style directory separators when running sysroot tests under MinGW and Cygwin.
* testsuite/ld-scripts/sysroot-prefix.exp
(get_base_dir_for_scripts): New function.
(run_sysroot_prefix_test): Use get_base_dir_for_scripts.
Vladimir Radosavljevic [Wed, 15 Feb 2017 08:55:04 +0000 (00:55 -0800)]
Don't give an internal error for unsupported relocations.
gold/
* mips.cc (Target_mips::Scan::get_reference_flags): Remove
gold_unreachable from default case.
Vladimir Radosavljevic [Wed, 15 Feb 2017 08:47:36 +0000 (00:47 -0800)]
Add support for R_MIPS_HIGHER/HIGHEST, R_MICROMIPS_HIGHER/HIGHEST relocations.
2017-02-15 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
PR gold/21111
* mips.cc (Mips_relocate_functions::relhigher): New method.
(Mips_relocate_functions::relhighest): Likewise.
(mips_get_size_for_reloc): Add support for relocs: R_MIPS_HIGHER and
R_MIPS_HIGHEST.
(Target_mips::Scan::local): Add support for relocs: R_MIPS_HIGHER,
R_MIPS_HIGHEST, R_MICROMIPS_HIGHER and R_MICROMIPS_HIGHEST.
(Target_mips::Scan::global): Likewise.
(Target_mips::Scan::get_reference_flags): Likewise.
(Target_mips::Relocate::relocate): Call static methods for resolving
HIGHER and HIGHEST relocations.
Vineet Gupta [Wed, 15 Feb 2017 08:52:53 +0000 (08:52 +0000)]
Distinguish some of the registers different on ARC700 and HS38 cpus
opcodes * arc-regs.h: Distinguish some of the registers different on
ARC700 and HS38 cpus.
gas * testsuite/gas/arc/st.d: Update for 0xe having a name now
Rahul Chaudhry [Wed, 15 Feb 2017 08:37:10 +0000 (00:37 -0800)]
Improved support for --icf=safe when used with -pie.
gold/
* x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
Return true even when building pie binaries.
(Target_x86_64::possible_function_pointer_reloc): Check opcode
for R_X86_64_PC32 relocations.
(Target_x86_64::local_reloc_may_be_function_pointer): Pass
extra arguments to local_reloc_may_be_function_pointer.
(Target_x86_64::global_reloc_may_be_function_pointer): Likewise.
* gc.h (gc_process_relocs): Add check for STT_FUNC.
* testsuite/Makefile.am (icf_safe_pie_test): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/icf_safe_pie_test.sh: New shell script.
Tim Wiederhake [Wed, 15 Feb 2017 07:08:17 +0000 (08:08 +0100)]
Add missing ChangeLog entries.
This adds the missing ChangeLog entries for the "Python bindings" patch series.
GDB Administrator [Wed, 15 Feb 2017 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Tue, 14 Feb 2017 23:23:12 +0000 (15:23 -0800)]
Add self to aarch64 maintainers. Fix mla instruction.
sim/
* MAINTAINTERS (aarch64): Add myself.
sim/aarch64/
* simulator.c (do_vec_MLA): Rewrite switch body.
sim/testsuite/sim/aarch64/
* mla.s: New.
Jim Wilson [Tue, 14 Feb 2017 22:35:57 +0000 (14:35 -0800)]
Fix bit/bif instructions.
sim/aarch64/
* simulator.c (do_vec_bit): Change loop limits from 16 and 8 to 4 and
2. Move test_false if inside loop. Fix logic for computing result
stored to vd.
sim/testsuite/sim/aarch64
* bit.s: New.
Jim Wilson [Tue, 14 Feb 2017 22:31:03 +0000 (14:31 -0800)]
Add ldn/stn single support, fix ldnr support.
sim/aarch64/
* simulator.c: (LDn_STn_SINGLE_LANE_AND_SIZE): New.
(do_vec_LDn_single, do_vec_STn_single): New.
(do_vec_LDnR): Add and set new nregs var. Replace switch on nregs with
loop over nregs using new var n. Add n times size to address in loop.
Add n to vd in loop.
(do_vec_load_store): Add comment for instruction bit 24. New var
single to hold instruction bit 24. Add new code to use single. Move
ldnr support inside single if statements. Fix ldnr register counts
inside post if statement. Change HALT_NYI calls to HALT_UNALLOC.
sim/testsuite/sim/aarch64/
* ldn_single.s: New.
* ldnr.s: New.
* stn_single.s: New.
Tom Tromey [Wed, 29 Apr 2015 15:44:24 +0000 (09:44 -0600)]
PR python/13598 - add before_prompt event
This adds an event that is emitted just before GDB presents a prompt
to the user. This provides Python code a way to react to whatever
changes might have been made by the previous command. For example, in
my GUI I use this to track changes to the selected frame and reflect
them in the UI.
Built and regtested on x86-64 Fedora 23.
gdb/ChangeLog
2017-02-14 Tom Tromey <tom@tromey.com>
PR python/13598:
* python/python.c (gdbpy_before_prompt_hook): Emit before_prompt
event.
* python/py-evts.c (gdbpy_initialize_py_events): Add
before_prompt registry.
* python/py-events.h (events_object) <before_prompt>: New field.
gdb/doc/ChangeLog
2017-02-14 Tom Tromey <tom@tromey.com>
PR python/13598:
* python.texi (Events In Python): Document events.before_prompt.
gdb/testsuite/ChangeLog
2017-02-14 Tom Tromey <tom@tromey.com>
PR python/13598:
* gdb.python/py-events.exp: Add before_prompt event tests.
Andreas Arnez [Tue, 14 Feb 2017 17:17:19 +0000 (18:17 +0100)]
Big-endian targets: Fix implptrpiece.exp
The test case implptrpiece.exp accesses the second byte of the short
integer number 1 and expects it to be zero. This is valid for
little-endian targets, but fails on big-endian targets.
This is fixed by distinguishing the expected value by endianness.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/implptrpiece.exp: Fix check for big-endian targets.
Nick Clifton [Tue, 14 Feb 2017 15:10:34 +0000 (15:10 +0000)]
Fix invalid memory access displayiing contents of sections.
PR binutils/21159
* readelf.c (dump_section_as_strings): Reset the start address if
no decompression is perfromed.
(dump_section_as_bytes): Likewise.
Nick Clifton [Tue, 14 Feb 2017 14:17:09 +0000 (14:17 +0000)]
Fix an illegal memory access parsing corrupt STABD debug information.
PR binutils/21158
* rddbg.c (read_symbol_stabs_debugging_info): Check for a null or
empty symbol name.
Nick Clifton [Tue, 14 Feb 2017 14:07:29 +0000 (14:07 +0000)]
Fix handling of corrupt STABS enum type strings.
PR binutils/21157
* stabs.c (parse_stab_enum_type): Check for corrupt NAME:VALUE
pairs.
(parse_number): Exit early if passed an empty string.
Nick Clifton [Tue, 14 Feb 2017 13:24:09 +0000 (13:24 +0000)]
Fix illegal memory access problems with readelf processing corrupt RL78 binaries.
PR binutils/21155
* readelf.c (IN_RANGE): New macro. Tests for an address + offset
being within a given range.
(target_specific_reloc_handling): Use macro to test for underflow
as well as overflow of reloc offset.
Alan Modra [Tue, 14 Feb 2017 10:08:21 +0000 (20:38 +1030)]
PowerPC register expression checks
This stops powerpc gas blithely accepting such nonsense as
"addi %f4,%cr3,%r31".
PR 21118
gas/
* NEWS: Mention powerpc register checks.
* config/tc-ppc.c (struct pd_reg): Make value a short. Add flags.
(pre_defined_registers): Delete fpscr and pmr entries. Set
register type in flags.
(cr_names): Set type in flags.
(reg_name_search): Return pointer to struct pd_reg rather than value.
(register_name): Adjust to suit. Set X_md from flags.
(ppc_parse_name): Likewise.
(ppc_optimize_expr): New function.
(md_assemble): Verify expresion reg flags match operand.
* config/tc-ppc.h (md_optimize_expr): Define.
(ppc_optimize_expr): Declare.
include/
* opcode/ppc.h (PPC_OPERAND_*): Reassign values, regs first.
(PPC_OPERAND_SPR, PPC_OPERAND_GQR): Define.
opcodes/
* ppc-opc.c (powerpc_operands): Flag SPR, SPRG and TBR entries
with PPC_OPERAND_SPR. Flag PSQ and PSQM with PPC_OPERAND_GQR.
Alan Modra [Tue, 14 Feb 2017 10:00:27 +0000 (20:30 +1030)]
Fix powerpc testsuite source errors
PR 21118 work exposed these errors in the testsuite.
* testsuite/gas/ppc/cell.s: Correct invalid registers.
* testsuite/gas/ppc/vle-simple-1.s: Likewise.
* testsuite/gas/ppc/vle-simple-2.s: Likewise.
Alan Modra [Tue, 14 Feb 2017 05:29:13 +0000 (15:59 +1030)]
Update ppc64_elf_gc_mark_dynamic_ref
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
--gc-keep-exported, and test versioned field of sym rather than
looking for @ in name.
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
Add documentation for new record Python bindings.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* NEWS: Add record Python bindings entry.
gdb/doc/ChangeLog:
* python.texi (Recordings In Python): New section.
Change-Id: Ibacb5930085bff36b0003fde30db9a8178cb280b
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
python: Add tests for record Python bindings
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/testsuite/ChangeLog:
* gdb.python/py-record-btrace.c, gdb.python/py-record-btrace.exp,
gdb.python/py-record-full.c, gdb.python/py-record-full.exp: New file.
Change-Id: Icd919b4e1d5642f5cbc097a6aede1416eba402e5
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
python: Implement btrace Python bindings for record history.
This patch implements the gdb.Record Python object methods and fields for
record target btrace. Also, implement a stub for record target full.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-record-btrace.o,
py-record-full.o.
(SUBDIR_PYTHON_SRCS): Add py-record-btrace.c, py-record-full.c.
* python/py-record-btrace.c, python/py-record-btrace.h,
python/py-record-full.c, python/py-record-full.h: New file.
* python/py-record.c: Add include for py-record-btrace.h and
py-record-full.h.
(recpy_method, recpy_format, recpy_goto, recpy_replay_position,
recpy_instruction_history, recpy_function_call_history, recpy_begin,
recpy_end): Use functions from py-record-btrace.c and py-record-full.c.
* python/python-internal.h (PyInt_FromSsize_t, PyInt_AsSsize_t):
New definition.
(gdbpy_initialize_btrace): New export.
* python/python.c (_initialize_python): Add gdbpy_initialize_btrace.
Change-Id: I8bd893672ffc7e619cc1386767897249e125973a
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
python: Create Python bindings for record history.
This patch adds three new functions to the gdb module in Python:
- start_recording
- stop_recording
- current_recording
start_recording and current_recording return an object of the new type
gdb.Record, which can be used to access the recorded data.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog
* Makefile.in (SUBDIR_PYTHON_OBS): Add python/py-record.o.
(SUBDIR_PYTHON_SRCS): Add python/py-record.c.
* python/py-record.c: New file.
* python/python-internal.h (gdbpy_start_recording,
gdbpy_current_recording, gdpy_stop_recording,
gdbpy_initialize_record): New export.
* python/python.c (_initialize_python): Add gdbpy_initialize_record.
(python_GdbMethods): Add gdbpy_start_recording,
gdbpy_current_recording and gdbpy_stop_recording.
Change-Id: I772aa9aa068621443f10a330b11dc7dc9a63face
Tim Wiederhake [Tue, 13 Dec 2016 10:24:56 +0000 (11:24 +0100)]
Add method to query current recording method to target_ops.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog
* record-btrace.c (record_btrace_record_method): New function.
(init_record_btrace_ops): Initialize to_record_method.
* record-full.c (record_full_record_method): New function.
(init_record_full_ops, init_record_full_core_ops): Add
record_full_record_method.
* record.h (enum record_method): New enum.
* target-debug.h (target_debug_print_enum_record_method: New define.
* target-delegates.c: Regenerate.
* target.c (target_record_method): New function.
* target.h: Include record.h.
(struct target_ops) <to_record_method>: New field.
(target_record_method): New export.
Change-Id: I05daa70e4e08a19901e848c731bb7d60cd87cc5a
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
Add record_start and record_stop functions.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog
* record.h (record_start, record_stop): New export.
* record.c (record_start, record_stop): New function.
Change-Id: If235d4bde8ec61dab6dbd23e087430e66d2e91a7
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
btrace: Use binary search to find instruction.
Currently, btrace_find_insn_by_number will iterate over all function call
segments to find the one that contains the needed instruction. This linear
search is too slow for the upcoming Python bindings that will use this
function to access instructions. This patch introduces a vector in struct
btrace_thread_info that holds pointers to all recorded function segments and
allows to use binary search.
The proper solution is to turn the underlying tree into a vector of objects
and use indices for access. This requires more work. A patch set is
currently being worked on and will be published later.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* btrace.c (btrace_fetch): Copy function call segments pointer
into a vector.
(btrace_clear): Clear the vector.
(btrace_find_insn_by_number): Use binary search to find the correct
function call segment.
* btrace.h (brace_fun_p): New typedef.
(struct btrace_thread_info) <functions>: New field.
Change-Id: I8a7f67e80bfe4ff62c4192f74a2153a70bf2a035
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
btrace: Export btrace_decode_error function.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* record-btrace.c (btrace_ui_out_decode_error): Move most of it ...
* btrace.c (btrace_decode_error): ... here. New function.
* btrace.h (btrace_decode_error): New export.
Change-Id: I2b4b43a55dbfd9f526a540d2ad52a6708f31feba
Tim Wiederhake [Mon, 21 Nov 2016 15:39:57 +0000 (16:39 +0100)]
btrace: Count gaps as one instruction explicitly.
This gives all instructions, including gaps, a unique number. Add a function
to retrieve the error code if a btrace instruction iterator points to an
invalid instruction.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog:
* btrace.c (ftrace_call_num_insn, btrace_insn_get_error): New function.
(ftrace_new_function, btrace_insn_number, btrace_insn_cmp,
btrace_find_insn_by_number): Remove special case for gaps.
* btrace.h (btrace_insn_get_error): New export.
(btrace_insn_number, btrace_find_insn_by_number): Adjust comment.
* record-btrace.c (btrace_insn_history): Print number for gaps.
(record_btrace_info, record_btrace_goto): Handle gaps.
Change-Id: I8eb0e48a95f4278522fea74ea13526bfe6898ecc
Markus Metzger [Mon, 30 Jan 2017 08:16:27 +0000 (09:16 +0100)]
btrace: preserve call stack on function switch
On 64-bit FC25, the _dl_runtime_resolve function uses a conditional branch to
'call' a particular variant optimized for that system:
(gdb) disas _dl_runtime_resolve_avx_opt
Dump of assembler code for function _dl_runtime_resolve_avx_opt:
0x00007ffff7deeb60 <+0>: push %rax
0x00007ffff7deeb61 <+1>: push %rcx
0x00007ffff7deeb62 <+2>: push %rdx
0x00007ffff7deeb63 <+3>: mov $0x1,%ecx
0x00007ffff7deeb68 <+8>: xgetbv
0x00007ffff7deeb6b <+11>: mov %eax,%r11d
0x00007ffff7deeb6e <+14>: pop %rdx
0x00007ffff7deeb6f <+15>: pop %rcx
0x00007ffff7deeb70 <+16>: pop %rax
0x00007ffff7deeb71 <+17>: and $0x4,%r11d
0x00007ffff7deeb75 <+21>: bnd je 0x7ffff7def4a0 <_dl_runtime_resolve_sse_vex>
End of assembler dump.
When computing the function-level trace, btrace treats this as a switch from
_dl_runtime_resolve_avx_opt to _dl_runtime_resolve_sse_vex. We know that we
switched functions but we can't really say in which caller/callee relationship
those two functions are.
In addition to preserving the indentaion level, also preserve the caller
information. This is a heuristic since we don't really know. But at least in
this case, this seems to be the right thing to do.
This fixes a fail in gdb.btrace/rn-dl-bind.exp on 64-bit FC25.
gdb/
* btrace.c (ftrace_new_switch): Preserve up link and flags.
GDB Administrator [Tue, 14 Feb 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Palmer Dabbelt [Wed, 8 Feb 2017 19:26:07 +0000 (11:26 -0800)]
Don't use "_gp" on RISC-V, use "_global_pointer$" instead
"_gp" could conflict with ABI-complient code. While it's probably OK
because MIPS uses this name, we figured it'd be good to clean this up
before a release with RISC-V in it.
ld/ChangeLog:
2017-02-13 Palmer Dabbelt <palmer@dabbelt.com>
* emulparams/elf32lriscv-defs.sh (SDATA_START_SYMBOLS): Change
_gp to __global_pointer$.
bfd/ChangeLog:
2017-02-13 Palmer Dabbelt <palmer@dabbelt.com>
* elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
__global_pointer$.
Nick Clifton [Mon, 13 Feb 2017 17:51:27 +0000 (17:51 +0000)]
Fix invalid memory access in the BFD library's DWARF parser.
PR binutils/21151
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
unit length field.
Thomas Preud'homme [Mon, 13 Feb 2017 17:46:59 +0000 (17:46 +0000)]
[ARM] Allow immediate without prefix in unified syntax for VCMP
2017-02-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (parse_ifimm_zero): Make prefix optional in unified
syntax.
* testsuite/gas/arm/vcmp-noprefix-imm.d: New file.
* testsuite/gas/arm/vcmp-noprefix-imm.s: New file.
Nick Clifton [Mon, 13 Feb 2017 17:23:10 +0000 (17:23 +0000)]
Fix illegal memory access bug in nm when run on a corrupt binary.
PR binutils/21150
* nm.c (file_symbol): Add test of string length before testing
string characters.
Nick Clifton [Mon, 13 Feb 2017 15:19:48 +0000 (15:19 +0000)]
Extend previous patch to cover uncompress_section_contents returning FALSE to other callers.
PR binutils/21135
(dump_section_as_bytes, load_specific_debug_section): Likewise.
Nick Clifton [Mon, 13 Feb 2017 15:04:37 +0000 (15:04 +0000)]
Fix invalid read of section contents whilst processing a corrupt binary.
PR binutils/21135
* readelf.c (dump_section_as_bytes): Handle the case where
uncompress_section_contents returns false.
Nick Clifton [Mon, 13 Feb 2017 14:52:48 +0000 (14:52 +0000)]
Fix invalid memory access attempting to read the compression header of a too-small compressed section.
PR binutils/21149
* readelf.c (get_compression_header): Add size parameter. Check
size against sizeof compression header before attempting to
extract the header.
(process_section_headers): Pass size to get_compression_header.
(dump_section_as_strings): Likewise.
(dump_section_as_bytes): Likewise.
(load_specific_debug_section): Likewise.
Nick Clifton [Mon, 13 Feb 2017 14:35:24 +0000 (14:35 +0000)]
Fix check for buffer overflow when processing version information.
PR binutils/21148
* readelf.c (process_version_sections): Include size of auxillary
version information when checking for buffer overflow.
Nick Clifton [Mon, 13 Feb 2017 14:17:07 +0000 (14:17 +0000)]
Fix access violation when reporting sections that could not be dumped.
PR binutils/21147
* readelf.c (process_section_contents): Fix off by one error
reporting un-dumped sections.
Nick Clifton [Mon, 13 Feb 2017 14:03:22 +0000 (14:03 +0000)]
Fix read-after-free error in readelf when processing multiple, relocated sections in an MSP430 binary.
PR binutils/21139
* readelf.c (target_specific_reloc_handling): Add num_syms
parameter. Check for symbol table overflow before accessing
symbol value. If reloc pointer is NULL, discard all saved state.
(apply_relocations): Pass num_syms to target_specific_reloc_handling.
Call target_specific_reloc_handling with a NULL reloc pointer
after processing all of the relocs.
Luis Machado [Mon, 13 Feb 2017 13:29:30 +0000 (07:29 -0600)]
Improve load command's help text
This fairly obvious patch adds usage text to the load command's help text.
Originally it did not have usage and mentioned things like FILE and OFFSET
without explaining how those should be passed in the command.
gdb/ChangeLog:
2017-02-13 Luis Machado <lgustavo@codesourcery.com>
* symfile (_initialize_symfile): Add usage text to the load command's
help text.
gdb/doc/ChangeLog:
2017-02-13 Luis Machado <lgustavo@codesourcery.com>
* gdb.texinfo (Target Commands): Document the optional offset
argument for the load command.
Luis Machado [Mon, 13 Feb 2017 13:16:34 +0000 (07:16 -0600)]
Fix gdb.linespec/explicit.exp
This patch addresses timeout failures i noticed while testing aarch64-elf.
FAIL: gdb.linespec/explicit.exp: complete unique function name (timeout)
FAIL: gdb.linespec/explicit.exp: complete non-unique function name (timeout)
FAIL: gdb.linespec/explicit.exp: complete non-existant function name (timeout)
FAIL: gdb.linespec/explicit.exp: complete unique file name (timeout)
FAIL: gdb.linespec/explicit.exp: complete non-unique file name (timeout)
The timeouts were caused by an attempt to match a bell character (x07) that
doesn't show up on my particular test setup.
The bell character is output whenever one tries to complete a pattern and there
are multiple possible matches. When there is only one possible match, GDB will
complete the input pattern without outputting the bell character.
The reason for the discrepancy in this test's behavior is due to the use of
"main" for a unique name test.
On glibc-based systems, GDB may notice the "main_arena" symbol, which is
a data global part of glibc's malloc implementation. Therefore a bell character
will be output because we have a couple possible completion matches.
GDB should not be outputting such a data symbol as a possible match, but this
problem may/will be addressed in a future change and is besides the point of
this particular change.
On systems that are not based on glibc, GDB will not see any other possible
matches for completing "main", so there will be no bell characters.
The use of main is a bit fragile though, so the patch adds a new local function
with a name that has a greater chance of being unique and adjusts the test to
iuse it.
I've also added the regular expression switch (-re) to all the
gdb_test_multiple calls that were missing it. Hopefully this will reduce the
chances of someone wasting time trying to match a regular expression (a much
more common use case) when, in reality, the pattern is supposed to be matched
literally.
gdb/testsuite/ChangeLog
2017-02-13 Luis Machado <lgustavo@codesourcery.com>
* gdb.linespec/explicit.c (my_unique_function_name): New function.
(main): Call my_unique_function_name.
* gdb.linespec/explicit.exp: Use my_unique_function_name to test
completion of patterns with a single match.
Add missing -re switches to gdb_test_multiple calls.