Rudy Y [Mon, 27 Feb 2017 15:02:52 +0000 (15:02 +0000)]
Add symbol called __nm_<name> to exported symbols created by dlltool.
PR 20881
* dlltool.c (secdata): Align .idata$6 on 2 byte boundary.
(make_one_lib_file): Export a symbol called __nm_<symbol> for use
with auto-importing.
Nick Clifton [Mon, 27 Feb 2017 11:33:05 +0000 (11:33 +0000)]
Fix segfault in microblaze linker when garbage collection removes a symbol scheduled for a slot in the PLT.
PR ld/21180
* elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
generating a seg-fault when encountering a symbol that has been
deleted by garbage collection.
Alan Hayward [Mon, 27 Feb 2017 09:58:35 +0000 (09:58 +0000)]
Remove MAX_REGISTER_SIZE from remote.c
gdb/
* regcache.c (regcache_raw_update): New function.
(regcache_raw_read): Move code to regcache_raw_update.
* regcache.h (regcache_raw_update): New declaration.
* remote.c (remote_prepare_to_store): Call regcache_raw_update.
GDB Administrator [Mon, 27 Feb 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Jan Kratochvil [Sun, 26 Feb 2017 15:54:51 +0000 (16:54 +0100)]
DWARF-5: Initialization due to a false compiler warning
gcc-6.3.1-1.fc25.x86_64
dwarf2read.c: In function ‘void create_debug_type_hash_table(dwo_file*, dwarf2_section_info*, htab*&, rcuh_kind)’:
dwarf2read.c:4776:32: error: ‘header.comp_unit_head::type_offset_in_tu.cu_offset::cu_off’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
dwarf2read.c:4816:21: error: ‘header.comp_unit_head::signature’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
gdb/ChangeLog
2017-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (create_debug_type_hash_table): Initialize
header.signature and header.type_offset_in_tu.
Jim Wilson [Sun, 26 Feb 2017 04:06:36 +0000 (20:06 -0800)]
Add missing smov support, and clean up existing umov support.
sim/aarch64/
* simulator.c (do_vec_SMOV_into_scalar): New.
(do_vec_UMOV_into_scalar): Renamed from do_vec_MOV_into_scalar.
Rewritten.
(do_vec_UMOV): Merged into do_vec_UMOV_into_scalar and deleted.
(do_vec_op1): Move do_vec_TRN call and do_vec_UZP call. Add
do_vec_SMOV_into_scalar call. Delete do_vec_MOV_into_scalar and
do_vec_UMOV calls. Add do_vec_UMOV_into_scalar call.
sim/testsuite/sim/aarch64/
* sumov.s: New.
Jim Wilson [Sun, 26 Feb 2017 04:04:09 +0000 (20:04 -0800)]
Add missing cnt (popcount) instruction support.
sim/aarch64/
* simulator.c (popcount): New.
(do_vec_CNT): New.
(do_vec_op1): Add do_vec_CNT call.
sim/testsuite/sim/aarch64/
* cnt.s: New.
GDB Administrator [Sun, 26 Feb 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Fri, 24 Feb 2017 13:32:27 +0000 (00:02 +1030)]
Testsuite fixes for hppa64-hpux
HPUX has a different .comm syntax, and anything in the first column
is a label.
gas/
* testsuite/gas/elf/strtab.s: Don't put directives on first
column or continuation with labels not in first column.
ld/
* testsuite/ld-elf/elf.exp: Xfail pr20995 tests on hppa64-hpux.
Set up HPUX defsym. Run pr14170 tests and build symbol3 objects,
defining HPUX where necessary. Define HPUX for implib tests.
* testsuite/ld-elf/comm-data4.d: Run for hpux.
* testsuite/ld-elf/endsym.d: Likewise.
* testsuite/ld-elf/linkoncerdiff.d: Likewise.
* testsuite/ld-elf/comm-data4.s: Add alternate .comm when HPUX.
* testsuite/ld-elf/comm-data5.s: Likewise.
* testsuite/ld-elf/endsym.s: Likewise.
* testsuite/ld-elf/pr14170c.s: Likewise.
* testsuite/ld-elf/symbol3.s: Likewise.
* testsuite/ld-elf/implib.s: Likewise. Don't start directives
in first column.
* testsuite/ld-elf/linkoncerdiff2.s: Don't use numeric labels.
* testsuite/ld-elf/warn3.d: Run for hpux.
* testsuite/ld-scripts/rgn-at10.d: Xfail for hpux.
* testsuite/ld-scripts/rgn-at11.d: Likewise.
* testsuite/ld-scripts/size-2.d: Remove xfail for hpux.
Alan Modra [Fri, 24 Feb 2017 13:28:50 +0000 (23:58 +1030)]
Fixes for new dw5 test
On some targets, .string does not add a NUL string terminator.
* testsuite/binutils-all/dw5.S: Replace .string with .asciz.
Support hpux .comm variant.
* testsuite/binutils-all/readelf.exp: Define HPUX when assembling
dw5 test for hppa64-hpux.
Alan Modra [Sat, 25 Feb 2017 05:14:29 +0000 (15:44 +1030)]
ARC naughtiness causing assertion fail at elf-strtab.c:302
This patch fixes a number of issues in the ARC backend.
- The ARC size_dynamic_sections was trashing dynamic section contents,
in particular the .gnu.version_d contents. Those versions
definitions are therefore lost so they do not drain from the strtab,
resulting in assertion failures.
- The code attempting to set DT_TEXTREL was completely bogus.
- The ARC finish_dynamic_sections would segfault on trying to set
sh_entsize for .rela.plt if that section had been discarded.
- arc_create_dynamic_sections wouldn't have ever created dynamics
sections, which was just as well since the places it was called were
way too late to create dynamic sections. Its usefulness then
devolved down to finding just one dynamic section. All the others
packaged into a struct were unused.
- .interp wasn't set for PIEs.
* elf32-arc.c (struct dynamic_sections): Delete.
(enum dyn_section_types): Delete.
(dyn_section_names): Delete.
(arc_create_dynamic_sections): Delete.
(elf_arc_finish_dynamic_sections): Don't call the above. Don't
segfault on discarded .rela.plt section.
(elf_arc_size_dynamic_sections): Formatting. Don't call
arc_create_dynamic_sections. Don't allocate memory for sections
handled by the generic linker. Correct code finding relocs in
read-only sections. Set SEC_EXCLUDE on zero size .got,
.got.plt, and .dynbss sections. Do set .interp for pies.
GDB Administrator [Sat, 25 Feb 2017 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Richard Sandiford [Fri, 24 Feb 2017 18:29:00 +0000 (18:29 +0000)]
[AArch64] Additional SVE instructions
This patch supports some additions to the SVE architecture prior to
its public release.
include/
* opcode/aarch64.h (AARCH64_OPND_SVE_ADDR_RI_S4x16)
(AARCH64_OPND_SVE_IMM_ROT1, AARCH64_OPND_SVE_IMM_ROT2)
(AARCH64_OPND_SVE_Zm3_INDEX, AARCH64_OPND_SVE_Zm3_22_INDEX)
(AARCH64_OPND_SVE_Zm4_INDEX): New aarch64_opnds.
opcodes/
* aarch64-tbl.h (OP_SVE_HMH, OP_SVE_VMU_HSD, OP_SVE_VMVU_HSD)
(OP_SVE_VMVV_HSD, OP_SVE_VMVVU_HSD, OP_SVE_VM_HSD, OP_SVE_VUVV_HSD)
(OP_SVE_VUV_HSD, OP_SVE_VU_HSD, OP_SVE_VVVU_H, OP_SVE_VVVU_S)
(OP_SVE_VVVU_HSD, OP_SVE_VVV_D, OP_SVE_VVV_D_H, OP_SVE_VVV_H)
(OP_SVE_VVV_HSD, OP_SVE_VVV_S, OP_SVE_VVV_S_B, OP_SVE_VVV_SD_BH)
(OP_SVE_VV_BHSDQ, OP_SVE_VV_HSD, OP_SVE_VZVV_HSD, OP_SVE_VZV_HSD)
(OP_SVE_V_HSD): New macros.
(OP_SVE_VMU_SD, OP_SVE_VMVU_SD, OP_SVE_VM_SD, OP_SVE_VUVV_SD)
(OP_SVE_VU_SD, OP_SVE_VVVU_SD, OP_SVE_VVV_SD, OP_SVE_VZVV_SD)
(OP_SVE_VZV_SD, OP_SVE_V_SD): Delete.
(aarch64_opcode_table): Add new SVE instructions.
(aarch64_opcode_table): Use imm_rotate{1,2} instead of imm_rotate
for rotation operands. Add new SVE operands.
* aarch64-asm.h (ins_sve_addr_ri_s4): New inserter.
(ins_sve_quad_index): Likewise.
(ins_imm_rotate): Split into...
(ins_imm_rotate1, ins_imm_rotate2): ...these two inserters.
* aarch64-asm.c (aarch64_ins_imm_rotate): Split into...
(aarch64_ins_imm_rotate1, aarch64_ins_imm_rotate2): ...these two
functions.
(aarch64_ins_sve_addr_ri_s4): New function.
(aarch64_ins_sve_quad_index): Likewise.
(do_misc_encoding): Handle "MOV Zn.Q, Qm".
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_sve_addr_ri_s4): New extractor.
(ext_sve_quad_index): Likewise.
(ext_imm_rotate): Split into...
(ext_imm_rotate1, ext_imm_rotate2): ...these two extractors.
* aarch64-dis.c (aarch64_ext_imm_rotate): Split into...
(aarch64_ext_imm_rotate1, aarch64_ext_imm_rotate2): ...these two
functions.
(aarch64_ext_sve_addr_ri_s4): New function.
(aarch64_ext_sve_quad_index): Likewise.
(aarch64_ext_sve_index): Allow quad indices.
(do_misc_decoding): Likewise.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc.h (FLD_SVE_i3h, FLD_SVE_rot1, FLD_SVE_rot2): New
aarch64_field_kinds.
(OPD_F_OD_MASK): Widen by one bit.
(OPD_F_NO_ZR): Bump accordingly.
(get_operand_field_width): New function.
* aarch64-opc.c (fields): Add new SVE fields.
(operand_general_constraint_met_p): Handle new SVE operands.
(aarch64_print_operand): Likewise.
* aarch64-opc-2.c: Regenerate.
gas/
* doc/c-aarch64.texi: Document that sve implies fp16, simd and compnum.
* config/tc-aarch64.c (parse_vector_type_for_operand): Allow .q
to be used with SVE registers.
(parse_operands): Handle new SVE operands.
(aarch64_features): Make "sve" require F16 rather than FP. Also
require COMPNUM.
* testsuite/gas/aarch64/sve.s: Add tests for new instructions.
Include compnum tests.
* testsuite/gas/aarch64/sve.d: Update accordingly.
* testsuite/gas/aarch64/sve-invalid.s: Add tests for new instructions.
* testsuite/gas/aarch64/sve-invalid.l: Update accordingly. Also
update expected output for new FMOV and MOV alternatives.
Richard Sandiford [Fri, 24 Feb 2017 18:27:26 +0000 (18:27 +0000)]
[AArch64] Add a "compnum" feature
This patch adds a named "compnum" feature for the ARMv8.3-A FCADD
and FCMLA extensions.
include/
* opcode/aarch64.h (AARCH64_FEATURE_COMPNUM): New macro.
(AARCH64_ARCH_V8_3): Include AARCH64_FEATURE_COMPNUM.
opcodes/
* aarch64-tbl.h (aarch64_feature_simd_v8_3): Replace with...
(aarch64_feature_compnum): ...this.
(SIMD_V8_3): Replace with...
(COMPNUM): ...this.
(CNUM_INSN): New macro.
(aarch64_opcode_table): Use it for the complex number instructions.
gas/
* doc/c-aarch64.texi: Add a "compnum" entry.
* config/tc-aarch64.c (aarch64_features): Likewise,
* testsuite/gas/aarch64/advsimd-compnum.s: New test.
* testsuite/gas/aarch64/advsimd-compnum.d: Likewise.
Nick Clifton [Fri, 24 Feb 2017 18:15:12 +0000 (18:15 +0000)]
Fix snafu with booleans in readelf patch - lack of a program header is not a reason for a function to return false.
(process_program_headers): Fix snafu - if the program headers are
not available then this is not a cause to fail.
(process_corefile_note_segments): Likewise.
Pedro Alves [Fri, 24 Feb 2017 17:42:51 +0000 (17:42 +0000)]
symtab.c: Small refactor
add_symtab_completions does the exact same as the code that it is
replacing.
gdb/ChangeLog:
2017-02-24 Pedro Alves <palves@redhat.com>
* symtab.c (make_file_symbol_completion_list_1): Use
add_symtab_completions.
Andrew Waterman [Wed, 22 Feb 2017 05:56:57 +0000 (21:56 -0800)]
bfd: RISC-V: relax to gp in more cases.
bfd/ChangeLog:
2017-02-24 Andrew Waterman <andrew@sifive.com>
* elfnn-riscv.c (GP_NAME): New macro.
(riscv_global_pointer_value): Use it.
(_bfd_riscv_relax_lui): If symbol and global pointer are in same
output section, consider only that section's alignment.
Andrew Waterman [Thu, 23 Feb 2017 05:23:05 +0000 (21:23 -0800)]
Add new counter-enable CSRs
include/ChangeLog:
2017-02-22 Andrew Waterman <andrew@sifive.com>
* opcode/riscv-opc.h (CSR_SCOUNTEREN): New define.
(CSR_MCOUNTEREN): Likewise.
(scounteren): Declare register.
(mcounteren): Likewise.
Alan Hayward [Fri, 24 Feb 2017 16:09:48 +0000 (16:09 +0000)]
Remove use of MAX_REGISTER_SIZE
gdb/
* stack.c (frame_info): Use frame_unwind_register_value to avoid buf.
Alan Hayward [Fri, 24 Feb 2017 16:09:43 +0000 (16:09 +0000)]
Use I386_MAX_REGISTER_SIZE and M68K_MAX_REGISTER_SIZE
gdb/
* i386-tdep.c (i386_pseudo_register_read_into_value): Use
I386_MAX_REGISTER_SIZE.
(i386_pseudo_register_write): Likewise.
(i386_process_record): Likewise.
* i387-tdep.c (i387_supply_xsave): Likewise.
* m68k-linux-nat.c (fetch_register): Use M68K_MAX_REGISTER_SIZE.
(store_register): Likewise.
Nick Clifton [Fri, 24 Feb 2017 14:48:19 +0000 (14:48 +0000)]
Tidy up readelf's use of boolean values.
* readelf.c (show_name, do_dynamic, do_syms, do_dyn_syms,
(do_reloc, do_sections, do_section_groups, do_section_details,
(do_segments, do_unwind, do_using_dynamic, do_header, do_dump,
(do_version, do_histogram, do_debugging, do_arch, do_notes,
(do_archive_index, is_32bit_elf, decompress_dumps): Use
bfd_boolean type.
(parse_args): Treat the do_* variables as booleans.
(print_vma): Return an unsigned int.
(print_symbol): Change width parameter to signed int.
(is_ia64_vms): Change return type to bfd_boolean.
(guess_is_rela): Likewise.
(slurp_rela_relocs): Likewise.
(slurp_rel_relocs): Likewise.
(dump_relocations): Likewise.
(process_file_header): Likewise.
(get_program_headers): Likewise.
(process_program_headers): Likewise.
(process_section_headers): Likewise.
(process_section_groups): Likewise.
(dump_ia64_vms_dynamic_fixups): Likewise.
(dump_ia64_vms_dynamic_relocs): Likewise.
(process_ia64_vms_dynamic_relocs): Likewise.
(process_relocs): Likewise.
(dump_ia64_unwind): Likewise.
(ia64_process_unwind): Likewise.
(dump_hppa_unwind): Likewise.
(slurp_hppa_unwind_table): Likewise.
(hppa_process_unwind): Likewise.
(decode_arm_unwind_bytecode): Likewise.
(decode_tic6x_unwind_bytecode): Likewise.
(decode_arm_unwind): Likewise.
(dump_arm_unwind): Likewise.
(arm_process_unwind): Likewise.
(process_unwind): Likewise.
(get_32bit_dynamic_section): Likewise.
(get_64bit_dynamic_section): Likewise.
(process_dynamic_section): Likewise.
(process_version_sections): Likewise.
(process_symbol_table): Likewise.
(process_syminfo): Likewise.
(apply_relocations): Likewise.
(disassemble_section): Likewise.
(dump_section_as_strings): Likewise.
(dump_section_as_bytes): Likewise.
(load_specific_debug_section): Likewise.
(load_debug_section): Likewise.
(display_debug_section): Likewise.
(process_section_contents): Likewise.
(process_attributes): Likewise.
(process_nds32_specific): Likewise.
(process_gnu_liblist): Likewise.
(print_core_note): Likewise.
(print_gnu_note): Likewise.
(print_v850_note): Likewise.
(process_netbsd_elf_note): Likewise.
(print_stapsdt_note): Likewise.
(print_ia64_vms_note): Likewise.
(process_note): Likewise.
(process_notes_at): Likewise.
(process_corefile_note_segments): Likewise.
(process_v850_notes): Likewise.
(process_note_sections): Likewise.
(process_notes): Likewise.
(process_arch_specific): Likewise.
(get_file_header): Likewise.
(process_object): Likewise.
(process_archive): Likewise.
(process_file): Likewise.
(section_subset): Make static.
(get_mips_reg_size): Return a signed integer.
(process_object): Reverse the logic of the return value.
(process_archive): Likewise.
(process_file): Likewise.
Maciej W. Rozycki [Thu, 23 Feb 2017 18:18:51 +0000 (18:18 +0000)]
readelf: Correct version flag formatting
Remove a trailing space or a leading pipe character from version flags
printed with `readelf --version-info'.
For example with the `mips-linux' target we get:
$ cat ver_def.s
.data
.globl new_foo
.type new_foo, %object
new_foo:
.symver new_foo, foo@@ver_foo
$ cat ver_def.ver
{ global: *foo*; local: *; };
$ as -o ver_def.o ver_def.s
$ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o
$ readelf -V ver_def
Version symbols section '.gnu.version' contains 4 entries:
Addr:
000000000000007e Offset: 0x01007e Link: 2 (.dynsym)
000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo)
Version definition section '.gnu.version_d' contains 2 entries:
Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr)
000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def
0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo
$
which includes an unnecessary space after `BASE'; both call sites
already provide suitable separation from output that follows. Also if
only unknown flags were present, then lone `| <unknown>' would be
printed.
binutils/
* readelf.c (get_ver_flags): Tidy the formatting of the string
returned
Maciej W. Rozycki [Thu, 23 Feb 2017 18:16:55 +0000 (18:16 +0000)]
readelf: Make version section index sum unsigned
Make `isum' unsigned like data it is calculated from.
binutils/
* readelf.c (process_version_sections) <SHT_GNU_verdef>: Make
`isum' unsigned.
<SHT_GNU_verneed>: Likewise.
Maciej W. Rozycki [Thu, 23 Feb 2017 18:16:11 +0000 (18:16 +0000)]
readelf: Fix incorrect "Version definition past end of section" message
Fix a commit
74e1a04b9787 ("More fixes for reading corrupt ELF files.")
`readelf --version-info' regression that caused "Version definition past
end of section" to be always printed at the end, even with good section
data.
For example with the `mips-linux' target we get:
$ cat ver_def.s
.data
.globl new_foo
.type new_foo, %object
new_foo:
.symver new_foo, foo@@ver_foo
$ cat ver_def.ver
{ global: *foo*; local: *; };
$ as -o ver_def.o ver_def.s
$ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o
$ readelf -V ver_def
Version symbols section '.gnu.version' contains 4 entries:
Addr:
000000000000007e Offset: 0x01007e Link: 2 (.dynsym)
000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo)
Version definition section '.gnu.version_d' contains 2 entries:
Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr)
000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def
0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo
Version definition past end of section
$
The cause is the `if (idx + ent.vd_next <= idx)' condition introduced to
ensure forward progress, which however always triggers for good version
definition section data as the last entry will have its `vd_next' value
set to 0.
Adjust the condition then, to say `if (idx + ent.vd_next < idx)' instead
and to ensure forward progress limit the number of entries processed to
the size of the version definition section, removing the problematic
message from output quoted above, while ensuring the original PR 17531
test case is still handled gracefully.
Add a suitable test case so that we have `readelf --version-info'
coverage; due to the lack of infrastructure needed to run the linker in
the `binutils' test suite and limited justification to implement it add
a new `readelf.exp' script to the `ld' test suite instead, intended to
gather any `readelf' test cases that require the linker to be run. If
ever we decide to have linker infrastructure added to the `binutils'
test suite, then the script can be moved between the test suites.
binutils/
* readelf.c (process_version_sections) <SHT_GNU_verdef>: Limit
the number of entries processed by the section size. Don't
break out of the loop if `ent.vd_next' is 0.
ld/
* testsuite/ld-elf/ver_def.d: New test.
* testsuite/ld-elf/ver_def.ld: New test linker script.
* testsuite/ld-elf/ver_def.ver: New test version script.
* testsuite/ld-elf/ver_def.s: New test source.
* testsuite/ld-elf/readelf.exp: New test script.
Jan Beulich [Fri, 24 Feb 2017 09:04:26 +0000 (10:04 +0100)]
x86: also correctly support TEST opcode aliases
Opcodes F6/1 and F7/1 are aliases of F6/0 and F7/0 in all modes. This
complements commit
8b89fe14b5 ("X86: Decode opcode 0x82 as opcode 0x80
in 32-bit mode"), just that here 64-bit mode is also covered.
Sheldon Lobo [Fri, 24 Feb 2017 08:23:50 +0000 (00:23 -0800)]
gas: test cases for the architecture level aware SPARC ASI work.
gas/ChangeLog:
Test cases for the architecture level aware SPARC ASI work.
* gas/testsuite/gas/sparc/sparc.exp: 2 new tests
* gas/testsuite/gas/sparc/asi-bump-warn.s: New test
* gas/testsuite/gas/sparc/asi-bump-warn.l: Likewise
* gas/testsuite/gas/sparc/asi-arch-error.s: Likewise
* gas/testsuite/gas/sparc/asi-arch-error.l: Likewise
GDB Administrator [Fri, 24 Feb 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 23 Feb 2017 22:27:50 +0000 (22:27 +0000)]
MIPS/BFD: Remove duplicate NewABI JALR relocation handling
Remove separate original NewABI JALR relocation handling, introduced
with commit
d06471104a83 ("relax jalr $t9 [R_MIPS_JALR symbol] to bal
symbol"), <https://sourceware.org/ml/binutils/2003-03/msg00394.html>,
and only used by LD with the `--relax' option specified, and rely solely
on `mips_elf_perform_relocation' code, which has been introduced with
commit
1367d393bb74 ("On the RM9000 convert jal to bal if in range"),
<https://www.sourceware.org/ml/binutils/2004-12/msg00088.html> and since
made more complete, across all the three ABIs.
Also remove the `--relax' option, now irrelevant, from the tests added
with the former commit.
bfd/
* elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
* elfxx-mips.c (_bfd_mips_relax_section): Remove function.
* elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
* elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
ld/
* testsuite/ld-mips-elf/relax-jalr-n32.d: Remove `--relax'
option.
* testsuite/ld-mips-elf/relax-jalr-n32-shared.d: Likewise.
* testsuite/ld-mips-elf/relax-jalr-n64.d: Likewise.
* testsuite/ld-mips-elf/relax-jalr-n64-shared.d: Likewise.
Maciej W. Rozycki [Thu, 23 Feb 2017 19:26:53 +0000 (19:26 +0000)]
MIPS/BFD: Discard ineligible JALR relocations right away
Discard R_MIPS_JALR and R_MICROMIPS_JALR relocations associated with
jumps that cannot be converted to an equivalent branch right away in
`mips_elf_calculate_relocation' rather than letting them through to
`mips_elf_perform_relocation'. This includes cross-mode jumps which
need to flip the ISA bit or jumps to a misaligned location that cannot
be encoded with a branch, in addition to preemptible symbol references
already handled.
Cross-mode jumps are actually already rejected as the conversion is made
in `mips_elf_perform_relocation', so in this case this change only saves
some processing. Jumps to a misaligned location are however converted,
with bits causing misalignment lost, making resulting code functionally
different even if the lone effect is avoiding an address error exception
with an instruction fetch at the jump destination requested.
Add test cases suitable, also including GAS verification to confirm that
the JALR relocations explicitly requested have indeed been output in the
intermediate objects used.
bfd/
* elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
<R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
or misaligned.
gas/
* testsuite/gas/mips/jalr4.d: New test.
* testsuite/gas/mips/jalr4-n32.d: New test.
* testsuite/gas/mips/jalr4-n64.d: New test.
* testsuite/gas/mips/jalr4.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* testsuite/ld-mips-elf/jalr4.dd: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
Jan Kratochvil [Thu, 23 Feb 2017 21:54:02 +0000 (22:54 +0100)]
DWARF-5: testcase
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* testsuite/binutils-all/dw5.S: New file.
* testsuite/binutils-all/dw5.W: New file.
* testsuite/binutils-all/readelf.exp (readelf -wiaoRlL): New test.
Jan Kratochvil [Thu, 23 Feb 2017 21:54:02 +0000 (22:54 +0100)]
DWARF-5: DW_FORM_data16
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (read_and_display_attr_value): Support DW_FORM_data16.
Jan Kratochvil [Thu, 23 Feb 2017 21:54:01 +0000 (22:54 +0100)]
DWARF-5: Macros
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (display_debug_macro): Support DWARF-5. Rename
DW_MACRO_GNU_*.
Jan Kratochvil [Thu, 23 Feb 2017 21:54:01 +0000 (22:54 +0100)]
DWARF-5: call sites
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (decode_location_expression): Support DW_OP_implicit_pointer,
DW_OP_const_type, DW_OP_regval_type, DW_OP_deref_type, DW_OP_convert
and DW_OP_reinterpret.
(read_and_display_attr_value): Support DW_AT_call_value,
DW_AT_call_data_value, DW_AT_call_target and
DW_AT_call_target_clobbered.
Jan Kratochvil [Thu, 23 Feb 2017 21:54:01 +0000 (22:54 +0100)]
DWARF-5 basic functionality
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (fetch_indirect_line_string): New function.
(abbrev_attr): New field implicit_const.
(add_abbrev_attr): New parameter implicit_const.
(process_abbrev_section): Support DW_FORM_implicit_const.
(decode_location_expression): Support DW_OP_entry_value.
(read_and_display_attr_value): Add parameter implicit_const. Support
DW_FORM_line_strp and DW_FORM_implicit_const.
(read_and_display_attr): Add parameter implicit_const.
(process_debug_info): Support line_str and DWARF-5.
(read_debug_line_header): Support DWARF-5.
(display_formatted_table): New function.
(display_debug_lines_raw): New parameter file. Support DWARF-5.
(display_debug_lines_decoded): New parameter fileptr. Support DWARF-5.
(display_debug_lines): Pass file parameter.
(display_debug_macro): Update read_and_display_attr_value caller.
(display_debug_abbrev): Support DW_FORM_implicit_const.
(display_loclists_list): New function.
(display_loc_list): Support .debug_loclists.
(display_debug_ranges_list): New function from display_debug_ranges.
(display_debug_rnglists_list): New function.
(display_debug_ranges): Support .debug_rnglists.
(debug_displays): Add .debug_line_str, .debug_loclists and
.debug_rnglists.
* dwarf.h: Include dwarf2.h
(DWARF2_Internal_LineInfo): Add li_offset_size.
(DWARF2_Internal_CompUnit): Add cu_unit_type.
(enum dwarf_section_display_enum): Add line_str.
* readelf.c (process_section_headers): Add rnglists and loclists.
Jan Kratochvil [Thu, 23 Feb 2017 21:54:00 +0000 (22:54 +0100)]
DWARF attrs: add delimiter
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (display_block): Add parameter delimiter.
(decode_location_expression): Update display_block callers.
(read_and_display_attr_value): Add parameter delimiter.
(read_and_display_attr, display_debug_macro): Update
read_and_display_attr_value caller.
Luis Machado [Thu, 23 Feb 2017 20:36:58 +0000 (14:36 -0600)]
PR21166: Validate rdrand/rdseed support separately in gdb.reverse/insn-reverse-x86.c
As reported in PR21166, there are Intel processors out there that support
rdrand but not rdseed. The fix is to verify both features separately and only
run rdrand/rdseed tests if supported.
gdb/testsuite/ChangeLog:
2017-02-23 Luis Machado <lgustavo@codesourcery.com>
* gdb.reverse/insn-reverse.x86.c (check_rdrand_support): Renamed to ...
(check_supported_features): ... this. Changed return type to void.
(supports_rdseed): New static global.
(rdseed): Check supports_rdseed.
(initialize): Call check_supported_features.
Jan Kratochvil [Thu, 23 Feb 2017 20:37:31 +0000 (21:37 +0100)]
dwarf.c: Use more dwarf_vma
binutils/
2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (display_loc_list): Use dwarf_vma for offset, base_address
and off.
(display_loc_list_dwo): Use dwarf_vma for offset.
(display_debug_loc): Use dwarf_vma for offset, base_address.
(struct range_entry, range_entry_compar): Use dwarf_vma for
ranges_offset.
(display_debug_ranges): Use dwarf_vma for ranges_offset, offset and
base_address.
Andreas Krebbel [Mon, 2 Jan 2017 15:40:29 +0000 (16:40 +0100)]
S/390: Add support for new cpu architecture - arch12.
This adds support of new instructions to the S/390 specific parts.
The important feature of the new instruction set is the support of
single and extended precision floating point vector operations.
Note: arch12 is NOT the official name of the new CPU. It just
continues the series of archXX options supported as alternate names.
The archXX terminology refers to the edition number of the Principle
of Operations manual. The official CPU name will be added later while
keeping support of the arch12 for backwards compatibility.
No testsuite regressions.
Committed to mainline.
Bye,
-Andreas-
opcodes/ChangeLog:
2017-02-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-mkopc.c (main): Accept arch12 as cpu string and vx2 as
facility.
* s390-opc.c: Add new operand description macros, new instruction
types, instruction masks, and new .insn instruction types.
* s390-opc.txt: Add new arch12 instructions.
include/ChangeLog:
2017-02-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* opcode/s390.h (enum s390_opcode_cpu_val): New value
S390_OPCODE_ARCH12.
(S390_INSTR_FLAG_VX2): New macro definition.
gas/ChangeLog:
2017-02-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (s390_parse_cpu): New entry for arch12.
* doc/as.texinfo: Document arch12 as cpu type.
* doc/c-s390.texi: Likewise.
* testsuite/gas/s390/s390.exp: Run arch12 specific tests.
* testsuite/gas/s390/zarch-arch12.d: New test.
* testsuite/gas/s390/zarch-arch12.s: New test.
* testsuite/gas/s390/zarch-z13.d: Rename some mnemonics in the
output patterns.
Pedro Alves [Wed, 22 Feb 2017 14:43:35 +0000 (14:43 +0000)]
Use gdb::function_view in iterate_over_symtabs & co
I wanted to pass a lambda to iterate_over_symtabs (see following
patch), so I converted it to function_view, and then the rest is
cascaded from that.
This gets rid of a bunch of single-use callback functions and
corresponding manually managed callback capture types
(add_partial_datum, search_symbols_data, etc.) in favor of letting the
compiler generate them for us by using lambdas with a capture. In a
couple cases, it was more natural to convert the existing function
callbacks to function objects (i.e., operator(), e.g.,
decode_compound_collector).
gdb/ChangeLog:
2017-02-23 Pedro Alves <palves@redhat.com>
* ada-lang.c: Include "common/function-view.h".
(ada_iterate_over_symbols): Adjust to use function_view as
callback type.
(struct add_partial_datum, ada_complete_symbol_matcher): Delete.
(ada_make_symbol_completion_list): Use a lambda.
(ada_exc_search_name_matches): Delete.
(name_matches_regex): New.
(ada_add_global_exceptions): Use a lambda and name_matches_regex.
* compile/compile-c-support.c: Include "common/function-view.h".
(print_one_macro): Change prototype to accept a ui_file pointer.
(write_macro_definitions): Use a lambda.
* dwarf2read.c: Include "common/function-view.h".
(dw2_map_expand_apply, dw2_map_symtabs_matching_filename)
(dw2_expand_symtabs_matching): Adjust to use function_view as
callback type.
* language.h: Include "common/function-view.h".
(struct language_defn) <la_iterate_over_symbols>: Adjust to use
function_view as callback type.
(LA_ITERATE_OVER_SYMBOLS): Remove DATA parameter.
* linespec.c: Include "common/function-view.h".
(collect_info::add_symbol): New method.
(struct symbol_and_data_callback, iterate_inline_only, struct
symbol_matcher_data, iterate_name_matcher): Delete.
(iterate_over_all_matching_symtabs): Adjust to use function_view
as callback type and lambdas.
(iterate_over_file_blocks): Adjust to use function_view as
callback type.
(decode_compound_collector): Now a class with private fields.
(decode_compound_collector::release_symbols): New method.
(collect_one_symbol): Rename to...
(decode_compound_collector::operator()): ... this and adjust.
(lookup_prefix_sym): decode_compound_collector construction bits
move to decode_compound_collector ctor. Pass the
decode_compound_collector object directly as callback. Remove
cleanups and use decode_compound_collector::release_symbols
instead.
(symtab_collector): Now a class with private fields.
(symtab_collector::release_symtabs): New method.
(add_symtabs_to_list): Rename to...
(symtab_collector::operator()): ... this and adjust.
(collect_symtabs_from_filename): symtab_collector construction
bits move to symtab_collector ctor. Pass the symtab_collector
object directly as callback. Remove cleanups and use
symtab_collector::release_symtabs instead.
(collect_symbols): Delete.
(add_matching_symbols_to_info): Use lambdas.
* macrocmd.c (print_macro_callback): Delete.
(info_macro_command): Use a lambda.
(info_macros_command): Pass print_macro_definition as callable
directly.
(print_one_macro): Remove 'ignore' parameter.
(macro_list_command): Adjust.
* macrotab.c (macro_for_each_data::fn): Now a function_view.
(macro_for_each_data::user_data): Delete field.
(foreach_macro): Adjust to call the function_view.
(macro_for_each): Adjust to use function_view as callback type.
(foreach_macro_in_scope): Adjust to call the function_view.
(macro_for_each_in_scope): Adjust to use function_view as callback
type.
* macrotab.h: Include "common/function-view.h".
(macro_callback_fn): Declare a prototype instead of a pointer.
Remove "user_data" parameter.
(macro_for_each, macro_for_each_in_scope): Adjust to use
function_view as callback type.
* psymtab.c (partial_map_expand_apply)
(psym_map_symtabs_matching_filename, recursively_search_psymtabs):
Adjust to use function_view as callback type and to return bool.
(psym_expand_symtabs_matching): Adjust to use function_view as
callback types.
* symfile-debug.c (debug_qf_map_symtabs_matching_filename): Adjust
to use function_view as callback type and to return bool.
(debug_qf_expand_symtabs_matching): Adjust to use function_view as
callback types.
* symfile.c (expand_symtabs_matching): Adjust to use function_view
as callback types.
* symfile.h: Include "common/function-view.h".
(expand_symtabs_file_matcher_ftype)
(expand_symtabs_symbol_matcher_ftype)
(expand_symtabs_exp_notify_ftype): Remove "data" parameter and
return bool.
(quick_symbol_functions::map_symtabs_matching_filename)
(quick_symbol_functions::expand_symtabs_matching): Adjust to use
function_view as callback type and return bool.
(expand_symtabs_matching): Adjust to use function_view as callback
type.
(maintenance_expand_name_matcher)
(maintenance_expand_file_matcher): Delete.
(maintenance_expand_symtabs): Use lambdas.
* symtab.c (iterate_over_some_symtabs): Adjust to use
function_view as callback types and return bool.
(iterate_over_symtabs): Likewise. Use unique_xmalloc_ptr instead
of a cleanup.
(lookup_symtab_callback): Delete.
(lookup_symtab): Use a lambda.
(iterate_over_symbols): Adjust to use function_view as callback
type.
(struct search_symbols_data, search_symbols_file_matches)
(search_symbols_name_matches): Delete.
(search_symbols): Use a pair of lambdas.
(struct add_name_data, add_macro_name, symbol_completion_matcher)
(symtab_expansion_callback): Delete.
(default_make_symbol_completion_list_break_on_1): Use lambdas.
* symtab.h: Include "common/function-view.h".
(iterate_over_some_symtabs): Adjust to use function_view as
callback type and return bool.
(iterate_over_symtabs): Adjust to use function_view as callback
type.
(symbol_found_callback_ftype): Remove 'data' parameter and return
bool.
(iterate_over_symbols): Adjust to use function_view as callback
type.
Pedro Alves [Thu, 23 Feb 2017 16:14:08 +0000 (16:14 +0000)]
Introduce gdb::function_view
This commit adds a new function_view type. This type holds a
non-owning reference to a callable. It is meant to be used as
callback type of functions, instead of using the C-style pair of
function pointer and 'void *data' arguments. function_view allows
passing references to stateful function objects / lambdas with
captures as callbacks efficiently, while function pointer + 'void *'
does not.
See the intro in the new function-view.h header for more.
Unit tests included, put into a new gdb/unittests/ subdir.
gdb/ChangeLog:
2017-02-23 Pedro Alves <palves@redhat.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS, SUBDIR_UNITTESTS_OBS): New.
(%.o) <unittests/%.c>: New pattern.
* configure.ac ($development): Add $(SUBDIR_UNITTESTS_OBS) to
CONFIG_OBS, and $(SUBDIR_UNITTESTS_SRCS) to CONFIG_SRCS.
* common/function-view.h: New file.
* unittests/function-view-selftests.c: New file.
* configure: Regenerate.
Sheldon Lobo [Thu, 23 Feb 2017 15:49:37 +0000 (07:49 -0800)]
opcodes,gas: associate SPARC ASIs with an architecture level.
With this change an architecture level bump due to assembly ASIs will show
up as a warning/error depending on options passed to gas.
Tested with sparc64-linux-gnu, and it does not introduce any regressions.
gas/ChangeLog:
Add support for associating SPARC ASIs with an architecture level.
* config/tc-sparc.c (parse_sparc_asi): New encode SPARC ASIs.
opcodes/ChangeLog:
Add support for associating SPARC ASIs with an architecture level.
* include/opcode/sparc.h (sparc_asi): New sparc_asi struct.
* opcodes/sparc-opc.c (asi_table): Updated asi_table and encoding/
decoding of SPARC ASIs.
Simon Marchi [Thu, 23 Feb 2017 15:36:20 +0000 (10:36 -0500)]
Fix usage of inferior_ptid in two thread_alive implementations
While inspecting some target code, I noticed that in these two
implementations of thread_alive, inferior_ptid is referenced directly
instead of using the ptid passed as parameters. I guess that it is
wrong, although I can't really test it in both cases.
gdb/ChangeLog:
* bsd-uthread.c (bsd_uthread_thread_alive): Use ptid instead of
inferior_ptid.
* go32-nat.c (go32_thread_alive): Likewise.
Nick Clifton [Thu, 23 Feb 2017 13:45:21 +0000 (13:45 +0000)]
Add support to readelf for displaying gnu attributes in architectures not known to support them.
* readelf.c (display_tag_value): Use an explicit signed type for
the tag parameter.
(display_gnu_attributes): Use an unsigned integer type for
attribute tags.
(display_power_gnu_attribute): Likewise.
(display_s390_gnu_attribute): Likewise.
(display_sparc_hwcaps): Likewise.
(display_sparc_hwcaps2): Likewise.
(display_sparc_gnu_attribute): Likewise.
(display_mips_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_raw_attribute): Likewise.
(process_attributes): Likewise.
(process_arm_specific): Delete redundant function.
(process_power_specific): Likewise.
(process_s390_specific): Likewise.
(process_sparc_specific): Likewise.
(process_tic6x_specific): Likewise.
(process_msp430x_specific): Likewise.
(display_public_gnu_attributes): New function. Displays known
information about an unknown gnu attribute.
(display_generic_attribute): New function. Calls
display_tag_value for non-nul tags.
(process_arch_specific): Call process_attributes even for
architectures not known to specifically support gnu attributes.
Yao Qi [Thu, 23 Feb 2017 11:57:46 +0000 (11:57 +0000)]
Use xfree rather than delete for varobj_iter
ASAN reports an error,
-var-create container @ c^M
=================================================================^M
^[[1m^[[31m==21639==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x6030000805c0^M
^[[1m^[[0m #0 0x7f2449b01b2a in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99b2a)^M
#1 0xbb601d in update_dynamic_varobj_children ../../binutils-gdb/gdb/varobj.c:794^M
#2 0xbb6556 in varobj_get_num_children(varobj*) ../../binutils-gdb/gdb/varobj.c:854^M
#3 0x580cb4 in print_varobj ../../binutils-gdb/gdb/mi/mi-cmd-var.c:61^M
#4 0x58138b in mi_cmd_var_create(char*, char**, int) ../../binutils-gdb/gdb/mi/mi-cmd-var.c:145^M
#5 0x5967ce in mi_cmd_execute ../../binutils-gdb/gdb/mi/mi-main.c:2301^M
#6 0x594b05 in captured_mi_execute_command ../../binutils-gdb/gdb/mi/mi-main.c:2001
....
^M
^[[1m^[[32m0x6030000805c0 is located 0 bytes inside of 32-byte region [0x6030000805c0,0x6030000805e0)^M
^[[1m^[[0m^[[1m^[[35mallocated by thread T0 here:^[[1m^[[0m^M
#0 0x7f2449b00602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)^M
#1 0x7d1596 in xmalloc ../../binutils-gdb/gdb/common/common-utils.c:43^M
#2 0x604176 in py_varobj_iter_new ../../binutils-gdb/gdb/python/py-varobj.c:159^M
#3 0x6042da in py_varobj_get_iterator(varobj*, _object*) ../../binutils-gdb/gdb/python/py-varobj.c:198^M
#4 0xbb5806 in varobj_get_iterator ../../binutils-gdb/gdb/varobj.c:720^M
#5 0xbb5b9b in update_dynamic_varobj_children ../../binutils-gdb/gdb/varobj.c:758^M
gdb:
2017-02-23 Yao Qi <yao.qi@linaro.org>
* varobj-iter.h (varobj_iter_delete): Call xfree instead of
delete.
Yao Qi [Thu, 23 Feb 2017 11:05:03 +0000 (11:05 +0000)]
Use delete instead of xfree for varobj_item
In commit 2f408ec (Use ui_file_as_string throughout more), we start to
new varobj_item,
> - vitem = XNEW (struct varobj_item);
> + vitem = new varobj_item ();
but we still use xfree. This causes some ASAN errors,
-var-update container^M
=================================================================^M
^[[1m^[[31m==20660==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x602000090c10^M
^[[1m^[[0m #0 0x2baa77d03631 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54631)^M
#1 0x80e0c8 in xfree(void*) /home/yao/SourceCode/gnu/gdb/git/gdb/common/common-utils.c:100^M
#2 0xc13670 in varobj_clear_saved_item /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:727^M
#3 0xc13957 in update_dynamic_varobj_children /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:752^M
#4 0xc1841c in varobj_update(varobj**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:1699^M
#5 0x5a2bf7 in varobj_update_one /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:712^M
#6 0x5a2a41 in mi_cmd_var_update(char*, char**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:695^
........
^M
^[[1m^[[32m0x602000090c10 is located 0 bytes inside of 16-byte region [0x602000090c10,0x602000090c20)^M
^[[1m^[[0m^[[1m^[[35mallocated by thread T0 here:^[[1m^[[0m^M
#0 0x2baa77d0415f in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5515f)^M
#1 0x63613e in py_varobj_iter_next /home/yao/SourceCode/gnu/gdb/git/gdb/python/py-varobj.c:112^M
#2 0xc13b89 in update_dynamic_varobj_children /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:776^M
#3 0xc1841c in varobj_update(varobj**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:1699^M
#4 0x5a2bf7 in varobj_update_one /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:712^M
#5 0x5a2a41 in mi_cmd_var_update(char*, char**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:695^M
gdb:
2017-02-23 Yao Qi <yao.qi@linaro.org>
* varobj.c (varobj_clear_saved_item): Use delete instead of
xfree.
(update_dynamic_varobj_children): Likewise.
Jan Beulich [Thu, 23 Feb 2017 10:21:10 +0000 (11:21 +0100)]
gas: slightly relax .startof.()/.sizeof.() testcase
Jan Beulich [Thu, 23 Feb 2017 10:03:55 +0000 (11:03 +0100)]
x86: drop stray VEX opcode 82 references
No such ModR/M-less opcode has ever existed in public documentation
afaict, so I can't see why it had been added in the first place.
Furthermore opcode 77 is special only with implied prefix 0F.
Jan Beulich [Thu, 23 Feb 2017 10:00:44 +0000 (11:00 +0100)]
x86: extend 64-bit invalid MPX insn forms testcase
Alan Modra [Thu, 23 Feb 2017 01:50:42 +0000 (12:20 +1030)]
Correct VLE 16D and SDAREL relocations
PR 20744
bfd/
* elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
16D relocations.
(ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
(ppc_elf_relocate_section): Correct calculation for VLE SDAREL
relocs.
ld/
* testsuite/ld-powerpc/vle-reloc-2.s: Use r6 for last insn of
each group.
* testsuite/ld-powerpc/vle-reloc-2.d: Update for above change
and sdarel reloc fix.
GDB Administrator [Thu, 23 Feb 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Jan Kratochvil [Wed, 22 Feb 2017 19:22:59 +0000 (20:22 +0100)]
Display user op byte
binutils/
2017-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (decode_location_expression): Display also OP.
Maciej W. Rozycki [Wed, 22 Feb 2017 18:09:41 +0000 (18:09 +0000)]
readelf: Restore a lost new line in version information
Fix a commit
74e1a04b9787 ("More fixes for reading corrupt ELF files.")
`readelf --version-info' output formatting regression where a dropped
new line caused section header information from the `.gnu.version_d'
version definition section to be printed on the same line as this
section's first entry.
For example with the `mips-linux' target we get:
$ cat ver_def.s
.data
.globl new_foo
.type new_foo, %object
new_foo:
.symver new_foo, foo@@ver_foo
$ cat ver_def.ver
{ global: *foo*; local: *; };
$ as -o ver_def.o ver_def.s
$ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o
$ readelf -V ver_def
Version symbols section '.gnu.version' contains 4 entries:
Addr:
000000000000007e Offset: 0x01007e Link: 2 (.dynsym)
000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo)
Version definition section '.gnu.version_d' contains 2 entries:
Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def
0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo
Version definition past end of section
$
Add the new line then, to get:
$ readelf -V ver_def
Version symbols section '.gnu.version' contains 4 entries:
Addr:
000000000000007e Offset: 0x01007e Link: 2 (.dynsym)
000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo)
Version definition section '.gnu.version_d' contains 2 entries:
Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr)
000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def
0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo
Version definition past end of section
$
instead.
binutils/
* readelf.c (process_version_sections) <SHT_GNU_verdef>: Print a
new line between the heading and the first version definition
entry.
Maciej W. Rozycki [Tue, 21 Feb 2017 01:46:42 +0000 (01:46 +0000)]
PR ld/20828: Move symbol version processing ahead of GC symbol sweep
Complement commit
b531344c34b0 ("PR ld/20828: Reorder the symbol sweep
stage of section GC") and commit
81ff47b3a546 ("PR ld/20828: Fix linker
script symbols wrongly forced local with section GC") and move symbol
version processing ahead of the symbol sweep stage of section GC, all in
`bfd_elf_size_dynamic_sections', so that version symbols created stay in
the global scope and are not output as local symbols to the dynamic
symbol table in the presence of corresponding symbol definitions pulled
from a DSO involved in a link.
Consolidate the whole of symbol version processing into a single block
from all parts scattered across the function and rearranging the local
variables used as necessary, however leaving the setting of dynamic
entries associated with the DT_VERDEF, DT_VERDEFNUM, DT_VERNEED and
DT_VERNEEDNUM tags and the SEC_EXCLUDE flag for unused `.gnu.version'
section in the original places.
With the rearrangement of code blocks `Elf_Internal_Verneed *t' would
shadow the previous definition of `struct bfd_elf_version_tree *t', so
rename the former variable to `vn'.
bfd/
PR ld/20828
* elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
processing ahead of the call to `elf_gc_sweep_symbol'.
ld/
PR ld/20828
* testsuite/ld-elf/pr20828-d.sd: New test.
* testsuite/ld-elf/pr20828-e.sd: New test.
* testsuite/ld-elf/pr20828-v.od: New test.
* testsuite/ld-elf/pr20828-v.ver: New test version script.
* testsuite/ld-elf/pr20828-v.ld: New test linker script.
* testsuite/ld-elf/pr20828.ld: Add `.gnu.version' and
`.gnu.version_d'.
* testsuite/ld-elf/shared.exp: Run the new tests.
Maciej W. Rozycki [Fri, 17 Feb 2017 20:30:55 +0000 (20:30 +0000)]
GAS: Consistently fix labels at the `.end' pseudo-op
Fix a functional regression with the `.end' pseudo-op, introduced with
commit
ecb4347adecd ("Last take: approval for MIPS_STABS_ELF killing"),
<https://sourceware.org/ml/binutils/2002-06/msg00443.html>, and commit
dcd410fe1544 ("GNU as 2.14 on IRIX 6: crashes with shared libs"),
<https://sourceware.org/ml/binutils/2003-07/msg00415.html>, which caused
symbol values for labels placed between the end of a function's contents
and its terminating `.end' followed by one of the alignment pseudo-ops
to be different depending on whether either `-mdebug', or `-mno-pdr', or
neither of the command-line options is in effect, be it implied or
specified.
Given debug-label-end.s as follows and the `mips-linux' target we have:
$ cat debug-label-end.s
.text
.globl foo
.globl bar
.align 4, 0
.ent foo
foo:
nop
.aent bar
bar:
.insn
.end foo
.align 4, 0
.space 16
.globl baz
.ent baz
baz:
nop
.end baz
.align 4, 0
.space 16
$ as -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
9:
00000004 0 FUNC GLOBAL DEFAULT 1 bar
$ as -mdebug -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
9:
00000010 0 FUNC GLOBAL DEFAULT 1 bar
$ as -mno-pdr -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
8:
00000010 0 FUNC GLOBAL DEFAULT 1 bar
$
The reason is the call to `md_flush_pending_output', which in the case
of `mips*-*-*' targets expands to `mips_emit_delays', which in turn
calls `mips_no_prev_insn', which calls `mips_clear_insn_labels', which
clears the list of outstanding labels. That list is in turn consulted
in `mips_align', called in the interpretation of alignment directives,
and the labels adjusted to the current location.
A call to `md_flush_pending_output' is only made from `s_mips_end' and
then only if `-mpdr' is in effect, which is the default for `*-*-linux*'
and some other `mips*-*-*' targets. A call to `md_flush_pending_output'
is never made from `ecoff_directive_end', which is used in place of
`s_mips_end' when `-mdebug' is in effect. Consequently if `-mno-pdr' or
`-mdebug' is in effect the list of outstanding labels makes it through
to any alignment directive that follows and the labels are differently
interpreted depending on the command-lines options used. And we want
code produced to be always the same.
Call `md_flush_pending_output' unconditionally then in `s_mips_end' and
add such a call from `ecoff_directive_end' as well, as long as the macro
is defined. While `ecoff_directive_end' is shared among targets, the
only one other than `mips*-*-*' actually using it is `alpha*-*-*' and it
does not define `md_flush_pending_output'. So the semantics isn't going
to change for it and neither it has to have its `s_alpha_end' updated
or have code in `ecoff_directive_end' conditionalized.
gas/
* ecoff.c (ecoff_directive_end) [md_flush_pending_output]: Call
`md_flush_pending_output'.
* config/tc-mips.c (s_mips_end) [md_flush_pending_output]: Call
`md_flush_pending_output' unconditionally.
* testsuite/gas/mips/debug-label-end-1.d: New test.
* testsuite/gas/mips/debug-label-end-2.d: New test.
* testsuite/gas/mips/debug-label-end-3.d: New test.
* testsuite/gas/mips/debug-label-end.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
Nick Clifton [Wed, 22 Feb 2017 17:28:33 +0000 (17:28 +0000)]
Align .gnu_debuglink sections on a 4-byte boundary.
PR binutils/21193
* opncls.c (bfd_create_gnu_debuglink_section): Give the newly
created section 4-byte alignment.
Hans-Peter Nilsson [Wed, 22 Feb 2017 13:17:33 +0000 (14:17 +0100)]
Fix gas/all/err-sizeof.s for cris*-*-*
Nick Clifton [Wed, 22 Feb 2017 11:57:49 +0000 (11:57 +0000)]
Skip ARM vcmp-noprefix-imm test on non-ELF targets
Jan Beulich [Wed, 22 Feb 2017 09:37:52 +0000 (10:37 +0100)]
gas: require an operand to .startof.()/.sizeof.()
Jan Beulich [Wed, 22 Feb 2017 09:36:05 +0000 (10:36 +0100)]
aarch64: actually copy first operand in convert_bfc_to_bfm()
Commit
93562a343c ("[AArch64] PR target/20666, fix wrong encoding of
new introduced BFC pseudo") changed the destination operand to 0,
making the whole function invocation a no-op. We really want to copy
operand 0 (a register) to operand 1 (an immediate before coming here),
even if right now this likely is only a latent bug.
GDB Administrator [Wed, 22 Feb 2017 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
Jan Kratochvil [Tue, 21 Feb 2017 23:13:03 +0000 (00:13 +0100)]
Fix a regression by: Code cleanup: Split dwarf2_ranges_read to a callback
On some Fedora 23 systems an internal error has been printed.
gdb/ChangeLog
2017-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (dwarf2_record_block_ranges): Add forgotten BASEADDR.
Alan Modra [Tue, 21 Feb 2017 21:40:58 +0000 (08:10 +1030)]
PowerPC ld segfault on script discarding dynamic sections
bfd/
* elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
on .got or .plt output section being discarded by script.
* elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise. Move
vxworks splt temp.
gold/
* powerpc.cc (Target_powerpc::make_iplt_section): Check that
output_section exists before attempting add_output_section_data.
(Target_powerpc::make_brlt_section): Likewise.
Simon Marchi [Tue, 21 Feb 2017 16:48:49 +0000 (11:48 -0500)]
Default initialize enum flags to 0
... so that we don't need to do it manually, and potentially forget.
For example, this allows to do:
my_flags flags;
...
flags |= some_flag;
gdb/ChangeLog:
* common/enum-flags.h (enum_flags::enum_flags): Initialize
m_enum_value to 0 in default constructor.
Edjunior Barbosa Machado [Tue, 21 Feb 2017 14:14:56 +0000 (11:14 -0300)]
[ppc64] Add POWER8/ISA 2.07 atomic sequences single-stepping support
gdb/
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK.
(STORE_CONDITIONAL_MASK): Rename from STWCX_MASK.
(LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION,
STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines.
(IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros.
(ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN.
(ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and
IS_STORE_CONDITIONAL_INSN.
gdb/testsuite/
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* gdb.arch/ppc64-isa207-atomic-inst.exp: New testcase based on
gdb.arch/ppc64-atomic-inst.exp. Add tests for lbarx/stbcx, lharx/sthcx
and lqarx/stqcx.
* gdb.arch/ppc64-isa207-atomic-inst.S: New file.
* gdb.arch/ppc64-isa207-atomic-inst.c: Likewise.
Edjunior Barbosa Machado [Tue, 21 Feb 2017 13:59:29 +0000 (10:59 -0300)]
Fix test names starting with uppercase in gdb.arch/ppc64-atomic-inst.exp
gdb/testsuite/
2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* gdb.arch/ppc64-atomic-inst.exp: Fix test names starting with
uppercase.
Nick Clifton [Tue, 21 Feb 2017 11:00:21 +0000 (11:00 +0000)]
Fix compile time warning message in linker testsuite test.
* testsuite/ld-ifunc/pr18808b.c (bar): Fix compile time warning
about non-void function returning without a result.
Jan Kratochvil [Tue, 21 Feb 2017 08:14:37 +0000 (09:14 +0100)]
Fix recent compiler warnings.
gcc-4.8.5-11.el7.x86_64
dwarf2read.c: In function ‘pc_bounds_kind dwarf2_get_pc_bounds(die_info*, CORE_ADDR*, CORE_ADDR*, dwarf2_cu*, partial_symtab*)’:
dwarf2read.c:12134:7: error: ‘range_end’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
dwarf2read.c:12133:7: error: ‘range_beginning’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
gdb/ChangeLog
2017-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2_rnglists_process: Initialize range_beginning and range_end.
Alan Modra [Mon, 20 Feb 2017 07:27:43 +0000 (17:57 +1030)]
Alpha DT_RELA
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
GDB Administrator [Tue, 21 Feb 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Jan Kratochvil [Mon, 20 Feb 2017 19:53:22 +0000 (20:53 +0100)]
DWARF-5: NEWS
a NEWS entry.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Changes since GDB 7.12): Add DWARF-5.
Jan Kratochvil [Mon, 20 Feb 2017 19:53:22 +0000 (20:53 +0100)]
DWARF-5: DW_FORM_data16
DWARF-5 has new form DW_FORM_data16. The problem is that GDB cannot pass
16-byte constant as a constant value as that would require GDB to use GCC
extension __int128.
Formerly such data was coded as DW_FORM_block* so GDB still decodes
DW_FORM_data16 like DW_FORM_block*.
gdb/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (skip_one_die, read_attribute_value)
(dwarf2_const_value_attr, dump_die_shallow)
(dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes)
(skip_form_bytes, attr_form_is_constant): Handle DW_FORM_data16.
gdb/testsuite/ChangeLog
2017-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/formdata16.c: New file.
* gdb.dwarf2/formdata16.exp: New file.
* lib/dwarf.exp (Dwarf): Add DW_FORM_data16.
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>