Andrew Burgess [Tue, 16 Apr 2019 23:31:43 +0000 (00:31 +0100)]
gdb/riscv: Allow breakpoints to be created at invalid addresses
Some testsuite cases (gdb.cp/nsalias.exp for example) construct dwarf2
debug info for fake functions to test that this debug info is handled
correctly.
We currently get an error trying to read from an invalid address while
creating breakpoints for these fake functions.
Other targets allow creating breakpoints on invalid addresses, and
only error when GDB actually tries to insert the breakpoints.
In order to make RISC-V behave in the same way as other targets, this
commit makes the failure to read memory during breakpoint creation
non-fatal, we then expect to see a failure when GDB tries to insert
the breakpoint, just like other targets.
Tested with a riscv64-linux native testsuite run.
gdb/ChangeLog:
* riscv-tdep.c (riscv_breakpoint_kind_from_pc): Hanndle case where
code read might fail, assume 4-byte breakpoint in that case.
Alan Modra [Tue, 16 Apr 2019 12:04:22 +0000 (21:34 +0930)]
xfail gas weakref1 test for nds32
Oops, I removed the wrong xfail from gas.exp in last commit, fix it
here.
* testsuite/gas/all/weakref1.d: xfail nds32.
Alan Modra [Tue, 16 Apr 2019 08:38:11 +0000 (18:08 +0930)]
ns32k testsuite tidy
Some of these tests were excluded for ns32k-netbsd, exclude for all
ns32k instead.
binutils/
* testsuite/binutils-all/copy-2.d: Don't run for ns32k-*-*.
* testsuite/binutils-all/copy-3.d: Likewise.
gas/
* testsuite/gas/all/gas.exp: Remove ns32k xfails.
* testsuite/gas/all/weakref1u.d: Don't run for ns32k-*-*.
ld/
* testsuite/ld-scripts/pr20302.d: Don't run for ns32k-*-*.
* testsuite/ld-scripts/section-match-1.d: Likewise.
* testsuite/ld-undefined/require-defined.exp: Likewise.
Alan Modra [Tue, 16 Apr 2019 06:17:02 +0000 (15:47 +0930)]
Move fixup fx_bit_fixP and fx_im_disp fields to TC_FIX_TYPE
These are only used by dlx and ns32k.
* write.h: Don't include bit_fix.h.
(struct fix): Rearrange some fields. Delete fx_im_disp and
fx_bit_fixP. Use bitfields for fx_size and fx_pcrel_adjust.
* write.c (fix_new_internal): Don't init fx_im_disp and fx_bit_fixP.
(fixup_segment): Don't exclude overflow checks on fx_bit_fixP.
(print_fixup): Don't print im_disp.
* config/tc-cris.c (md_apply_fix): Remove tests of fx_bit_fixP
and fx_im_disp.
* config/tc-dlx.c (md_apply_fix): Remove wrong debug code. Set
fx_no_overflow when fx_bit_fixP.
* config/tc-dlx.h: Include bit_fix.h.
(TC_FIX_TYPE, tc_fix_data, TC_INIT_FIX_DATA): Define.
* config/tc-ns32k.c (fix_new_ns32k, fix_new_ns32k_exp): Set
fx_no_overflow when bit_fixP.
* config/tc-ns32k.h (TC_FIX_TYPE): Add fx_bit_fixP and fx_im_disp.
(fix_im_disp, fix_bit_fixP): Adjust to suit.
(TC_INIT_FIX_DATA, TC_FIX_DATA_PRINT): Likewise.
Alan Modra [Tue, 16 Apr 2019 01:40:44 +0000 (11:10 +0930)]
Make fixup fx_where unsigned
Another field that only stores unsigned values.
* write.h (struct fix <fx_where>): Make unsigned.
(fix_new, fix_at_start, fix_new_exp): Adjust prototypes.
* write.c (fix_new, fix_new_exp, fix_at_start): Make "where" and
"size" parameters unsigned long.
(fix_new_internal): Likewise. Adjust error format string to suit.
* config/tc-mips.c (md_convert_frag): Remove cast of fx_where.
* config/tc-sparc.c (md_apply_fix): Likewise.
* config/tc-score.c (s3_convert_frag): Adjust for unsigned fx_where.
* config/tc-score7.c (s7_convert_frag): Likewise.
Alan Modra [Mon, 15 Apr 2019 12:21:44 +0000 (21:51 +0930)]
Make frag fr_fix unsigned
The field only stores unsigned values, so let's make it unsigned to
stop people worrying about the possibility of negative values.
* frags.h (struct frag <fr_fix>): Use unsigned type.
* frags.c (frag_new): Assert that current size exceeds
old_frags_var_max_size.
* ehopt.c (get_cie_info): Adjust for unsigned fr_fix.
* listing.c (calc_hex): Likewise.
* write.c (cvt_frag_to_fill, write_relocs): Likewise.
* config/tc-arc.c (md_convert_frag): Likewise.
* config/tc-avr.c (avr_patch_gccisr_frag): Likewise.
* config/tc-mips.c (md_convert_frag): Likewise.
* config/tc-rl78.c (md_convert_frag): Likewise.
* config/tc-rx.c (md_convert_frag): Likewise.
* config/tc-sparc.c (md_apply_fix): Likewise.
* config/tc-xtensa.c (next_instrs_are_b_retw): Likewise.
(unrelaxed_frag_min_insn_count, unrelaxed_frag_has_b_j): Likewise.
GDB Administrator [Tue, 16 Apr 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Leszek Swirski [Mon, 15 Apr 2019 15:56:43 +0000 (11:56 -0400)]
Fix AMD64 return value ABI in expression evaluation
The AMD64 System V ABI specifies that when a function has a return type
classified as MEMORY, the caller provides space for the value and passes
the address to this space as the first argument to the function (before
even the "this" pointer). The classification of MEMORY is applied to
struct that are sufficiently large, or ones with unaligned fields.
The expression evaluator uses call_function_by_hand to call functions,
and the hand-built frame has to push arguments in a way that matches the
ABI of the called function. call_function_by_hand supports ABI-based
struct returns, based on the value of gdbarch_return_value, however on
AMD64 the implementation of the classifier incorrectly assumed that all
non-POD types (implemented as "all types with a base class") should be
classified as MEMORY and use the struct return.
This ABI mismatch resulted in issues when calling a function that returns
a class of size <16 bytes which has a base class, including issues such
as the "this" pointer being incorrect (as it was passed as the second
argument rather than the first).
This is now fixed by checking for field alignment rather than POD-ness,
and a testsuite is added to test expression evaluation for AMD64.
gdb/ChangeLog:
* amd64-tdep.c (amd64_classify_aggregate): Use cp_pass_by_reference
rather than a hand-rolled POD check when checking for forced MEMORY
classification.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-eval.cc: New file.
* gdb.arch/amd64-eval.exp: New file.
Faraz Shahbazker [Mon, 15 Apr 2019 15:48:42 +0000 (08:48 -0700)]
Skip print-map-discarded test for non-ELF targets
ld/
* testsuite/ld-gc/gc.exp: Skip print-map-discarded test
for non-ELF targets.
Alan Hayward [Mon, 15 Apr 2019 11:31:21 +0000 (12:31 +0100)]
AArch64 SVE: Support changing vector lengths for ptrace
When writing registers to the kernel, check if regcache VG has been changed. If
so then update the thread's vector length, then write back the registers.
When reading registers from the kernel, ensure regcache VG register is updated.
The regcache registers should already be of the correct length.
Remove all the checks that error if the vector length has changed.
gdb/ChangeLog:
* aarch64-linux-nat.c (store_sveregs_to_thread): Set vector length.
* nat/aarch64-sve-linux-ptrace.c (aarch64_sve_set_vq): New function.
(aarch64_sve_regs_copy_to_reg_buf): Remove VG checks.
(aarch64_sve_regs_copy_from_reg_buf): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_set_vq): New declaration.
Alan Hayward [Mon, 15 Apr 2019 11:29:40 +0000 (12:29 +0100)]
AArch64 SVE: Check for vector length change when getting gdbarch
Override the thread_architecture method, similar to SPU. If the vector
length has changed, then find the arch using info, making sure the vector
length is passed down to the init routine.
In the init routine, ensure the arch has the correct vector length.
Example output. Program is stopped in thread 2, just before it calls prctl
to change the vector length
(gdb) info threads
Id Target Id Frame
1 Thread 0xffffbf6f4000 (LWP 3188) "sve_change" 0x0000ffffbf6ae130 in pthread_join ()
* 2 Thread 0xffffbf55e200 (LWP 3189) "sve_change" thread1 (arg=0xfeedface) at sve_change_size.c:28
(gdb) print $vg
$1 = 8
(gdb) print $z0.s.u
$2 = {
623191333,
623191333,
623191333,
623191333, 0 <repeats 12 times>}
(gdb) n
29 int ret = prctl(PR_SVE_SET_VL, vl/2);
(gdb) n
30 printf ("Changed: ret\n", ret);
(gdb) print $vg
$4 = 4
(gdb) print $z0.s.u
$5 = {
623191333,
623191333,
623191333,
623191333, 0, 0, 0, 0}
(gdb) thr 1
[Switching to thread 1 (Thread 0xffffbf6f4000 (LWP 3181))]
(gdb) print $vg
$6 = 8
(gdb) print $z0.s.u
$7 = {
623191333,
623191333,
623191333,
623191333, 0 <repeats 12 times>}
gdb/ChangeLog:
* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Add override.
* aarch64-tdep.c (aarch64_gdbarch_init): Ensure different tdesc for
each VQ.
Alan Hayward [Mon, 15 Apr 2019 11:27:31 +0000 (12:27 +0100)]
AArch64: Tidy up aarch64_gdbarch_init
Move the lookup_by_info to the top of the function to avoid unnecessarily
creating a new feature when the gdbarch already exists.
Add some additional cleanups that have no functional effect.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_gdbarch_init): Move gdbarch lookup.
Andre Vieira [Mon, 15 Apr 2019 11:23:24 +0000 (12:23 +0100)]
[binutils, ARM, 16/16] Add support to VLDR and VSTR of system registers
GNU as' Arm backend assumes each mnemonic has a single entry in the instruction table but VLDR (system register) and VSTR (system register) are different instructions than VLDR and VSTR. It is thus necessary to add some form of demultiplexing in the parser. It starts by creating a new operand type OP_VLDR which indicate that the operand is either the existing OP_RVSD operand or a system register. The function parse_operands () then tries these two cases in order, calling the new parse_sys_vldr_vstr for the second case.
Since the encoding function is specified in the instruction table entry, it also need to have some sort of demultiplexing. This is done in do_vldr_vstr which either calls the existing do_neon_ldr_str () or calls the new do_t_vldr_vstr_sysreg ().
A new internal relocation is needed as well since the offset has a shorter range than in other Thumb coprocessor instructions. Disassembly also requires special care since VSTR (system register) reuse the STC encoding with the coprocessor number 15. Armv8.1-M Mainline ARM manual states that coprocessor 8, 14 and 15 are reserved for floating-point and MVE instructions a feature bit check is added if the coprocessor number is one of this value and we are trying to match a coprocessor instruction (eg. STC) to forbid the match.
ChangeLog entries are as follows:
*** bfd/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* reloc.c (BFD_RELOC_ARM_T32_VLDR_VSTR_OFF_IMM): New internal
relocation.
* bfd-in2.h: Regenerate.
* libbfd.h: Likewise.
*** gas/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (parse_sys_vldr_vstr): New function.
(OP_VLDR): New enum operand_parse_code enumerator.
(parse_operands): Add logic for OP_VLDR.
(do_t_vldr_vstr_sysreg): New function.
(do_vldr_vstr): Likewise.
(insns): Guard VLDR and VSTR by arm_ext_v4t for Thumb mode.
(md_apply_fix): Add bound check for VLDR and VSTR co-processor offset.
Add masking logic for BFD_RELOC_ARM_T32_VLDR_VSTR_OFF_IMM relocation.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.s: Add examples of bad
uses of VLDR and VSTR.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.l: Add error messages for
above bad uses.
* testsuite/gas/arm/archv8m_1m-cmse-main.s: Add examples of VLDR and
VSTR valid uses.
* testsuite/gas/arm/archv8m_1m-cmse-main.d: Add disassembly for the
above examples.
*** opcodes/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* arm-dis.c (coprocessor_opcodes): Document new %J and %K format
specifier. Add entries for VLDR and VSTR of system registers.
(print_insn_coprocessor): Forbid coprocessor numbers 8, 14 and 15 in
coprocessor instructions on Armv8.1-M Mainline targets. Add handling
of %J and %K format specifier.
Andre Vieira [Mon, 15 Apr 2019 11:18:16 +0000 (12:18 +0100)]
[binutils, ARM, 15/16] Add support for VSCCLRM
Like for CLRM, this patch aims to share as much logic with the similar looking VLDM/VSTM. This is achieved by adding 2 new enumerator values in enum reg_list_els for the single-precision and double-precision variants of VSCCLRM and extending parse_vfp_reg_list () to deal with these types.
These behave like the existing REGLIST_VFP_S and REGLIST_VFP_D types with extra logic to expect VPR as the last element in the register list.
The function is algo augmented with a new partial_match parameter to indicate if any register other than VPR had already been parsed in the register list so as to not try parsing the second variant if that's the case and return the right error message.
The rest of the patch is the usual encoding function, new disassembler table entries and format specifier and parsing, encoding and disassembling tests.
It is worth mentioning that the new entry in the disassembler table was added in the coprocessor-related table despite VSCCLRM always being available even in FPU-less configurations. The main reason for this is that VSCCLRM also match VLDMIA entry and must thus be tried first but coprocessor entries are tried before T32 entries. It also makes sense because it is in the same encoding space as coprocessor and VFP instructions and is thus the natural place for someone to look for this instruction.
Note: Both variants of VSCCLRM support D16-D31 registers but Armv8.1-M Mainline overall does not. I have thus decided not to implement support for these registers in order to keep the code simpler. It can always be added later if needed.
ChangeLog entries are as follows:
*** gas/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (arm_typed_reg_parse): Fix typo in comment.
(enum reg_list_els): New REGLIST_VFP_S_VPR and REGLIST_VFP_D_VPR
enumerators.
(parse_vfp_reg_list): Add new partial_match parameter. Set
*partial_match to TRUE if at least one element in the register list has
matched. Add support for REGLIST_VFP_S_VPR and REGLIST_VFP_D_VPR
register lists which expect VPR as last element in the list.
(s_arm_unwind_save_vfp_armv6): Adapt call to parse_vfp_reg_list to new
prototype.
(s_arm_unwind_save_vfp): Likewise.
(enum operand_parse_code): New OP_VRSDVLST enumerator.
(parse_operands): Adapt call to parse_vfp_reg_list to new prototype.
Handle new OP_VRSDVLST case.
(do_t_vscclrm): New function.
(insns): New entry for VSCCLRM instruction.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.s: Add invalid VSCCLRM
instructions.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.l: Add error expectations
for above instructions.
* testsuite/gas/arm/archv8m_1m-cmse-main.s: Add tests for VSCCLRM
instruction.
* testsuite/gas/arm/archv8m_1m-cmse-main.d: Add expected disassembly
for above instructions.
*** opcodes/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* arm-dis.c (coprocessor_opcodes): Document new %C format control code.
Add new entries for VSCCLRM instruction.
(print_insn_coprocessor): Handle new %C format control code.
Andre Vieira [Mon, 15 Apr 2019 11:14:38 +0000 (12:14 +0100)]
[opcodes, ARM, 14/16] Add mode availability to coprocessor table entries
The coprocessor_opcodes table is used both to share commonalities in coprocessor-related instructions and to avoid duplication between Arm and Thumb mode. However, some instructions do have differences between Arm and Thumb. For instance, vldmia allows PC as base register in Arm mode but not in Thumb mode.
In that very case the distinction becomes necessary because the encoding with PC as base register is used in Thumb mode to denote a VSCCLRM. It is thus necessary to distinguish what is Arm or Thumb only from what is shared. This patch adds an extra field to the coprocessor_opcodes table entries to indicate what mode is a given instruction available in. The print_insn_coprocessor then uses that field to determine if an entry that matched the mark and value checked should be allowed to match or not given the current mode.
ChangeLog entry is as follows:
*** opcodes/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* arm-dis.c (enum isa): New enum.
(struct sopcode32): New structure.
(coprocessor_opcodes): change type of entries to struct sopcode32 and
set isa field of all current entries to ANY.
(print_insn_coprocessor): Change type of insn to struct sopcode32.
Only match an entry if its isa field allows the current mode.
Andre Vieira [Mon, 15 Apr 2019 11:07:20 +0000 (12:07 +0100)]
[binutils, ARM, 13/16] Add support for CLRM
Given the similarity between LDM/STM and CLRM register lists, most of the changes in this patch aim at sharing code between those two sets of instruction. Sharing is achieved both in parsing and encoding of those instructions.
In terms of parsing, parse_reg_list () is extended to take a type that describe what type of instruction is being parsed. The reg_list_els used for parse_vfp_reg_list () is reused for the type and that function is added an assert for the new REGLIST_CLRM and REGLIST_RN enumerators.
parse_reg_list () is then taught to accept APSR and reject SP and PC when parsing for a CLRM instruction. At last, caller of parse_reg_list () is updated accordingly and logic is added for the new OP_CLRMLST operand.
Encoding-wise, encode_thumb2_ldmstm () is reused to encode the variable bits of CLRM and is thus renamed encode_thumb2_multi (). A new do_io parameter is added to distinguish between LDM/STM and CLRM which guard all the LDM/STM specific code of the function.
Finally objdump is told how to disassemble CLRM, again reusing the logic to print the LDM/STM register list (format specifier 'm'). Tests are also added in the form of negative tests to check parsing and encoding/disassembling tests.
ChangeLog entries are as follows:
*** gas/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (enum reg_list_els): Define earlier and add
REGLIST_RN and REGLIST_CLRM enumerators.
(parse_reg_list): Add etype parameter to distinguish between regular
core register list and CLRM register list. Add logic to
recognize CLRM register list.
(parse_vfp_reg_list): Assert type is not for core register list.
(s_arm_unwind_save_core): Update call to parse_reg_list to new
prototype.
(enum operand_parse_code): Declare OP_CLRMLST enumerator.
(parse_operands): Update call to parse_reg_list to new prototype. Add
logic for OP_CLRMLST.
(encode_thumb2_ldmstm): Rename into ...
(encode_thumb2_multi): This. Add do_io parameter. Add logic to
encode CLRM and guard LDM/STM only code by do_io.
(do_t_ldmstm): Adapt to use encode_thumb2_multi.
(do_t_push_pop): Likewise.
(do_t_clrm): New function.
(insns): Define CLRM.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.d: New file.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.l: Likewise.
* testsuite/gas/arm/archv8m_1m-cmse-main-bad.s: Likewise.
* testsuite/gas/arm/archv8m_1m-cmse-main.d: Likewise.
* testsuite/gas/arm/archv8m_1m-cmse-main.s: Likewise.
*** opcodes/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* arm-dis.c (thumb_opcodes): Document %n control code. Add entry for
CLRM.
(print_insn_thumb32): Add logic to print %n CLRM register list.
Andre Vieira [Mon, 15 Apr 2019 10:58:47 +0000 (11:58 +0100)]
[binutils, ARM, 12/16] Scalar Low Overhead loop instructions for Armv8.1-M Mainline
s patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils.
This patch adds support to the Scalar low overhead loop instructions:
LE
WLS
DLS
We also add a new assembler resolvable relocation bfd_reloc_code_real enum for the 12-bit branch offset used in these instructions.
ChangeLog entries are as follows:
*** bfd/ChnageLog ***
2019-04-12 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_LOOP12): New.
* bfd-in2.h: Regenerated.
* libbfd.h: Regenerated.
*** gas/ChangeLog ***
2019-04-12 Sudakshina Das <sudi.das@arm.com>
Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/tc-arm.c (operand_parse_code): Add OP_LR and OP_oLR
for the LR operand and optional LR operand.
(parse_operands): Add switch cases for OP_LR and OP_oLR for
both type checking and value checking.
(encode_thumb32_addr_mode): New entries for DLS, WLS and LE.
(v8_1_loop_reloc): New helper function for handling labels
for the low overhead loop instructions.
(do_t_loloop): New function to encode DLS, WLS and LE.
(insns): New entries for WLS, DLS and LE.
(md_pcrel_from_section): New switch case
for BFD_RELOC_ARM_THUMB_LOOP12.
(md_appdy_fix): Likewise.
(tc_gen_reloc): Likewise.
* testsuite/gas/arm/armv8_1-m-tloop.s: New.
* testsuite/gas/arm/armv8_1-m-tloop.d: New.
* testsuite/gas/arm/armv8_1-m-tloop-bad.s: New.
* testsuite/gas/arm/armv8_1-m-tloop-bad.d: New.
* testsuite/gas/arm/armv8_1-m-tloop-bad.l: New.
*** opcodes/ChangeLog ***
2019-04-12 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (print_insn_thumb32): Updated to accept new %P
and %Q patterns.
Andre Vieira [Mon, 15 Apr 2019 10:53:25 +0000 (11:53 +0100)]
[binutils, ARM, 11/16] New BFCSEL instruction for Armv8.1-M Mainline
s patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils.
This patch adds the BFCSEL instruction. It also adds a local relocation with a new bfd_reloc_code_real enum.
ChangeLog entries are as follows:
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_THUMB_PCREL_BFCSEL): New relocation.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/tc-arm.c (T16_32_TAB): New entriy for bfcsel.
(do_t_v8_1_branch): New switch case for bfcsel.
(toU): Define.
(insns): New instruction for bfcsel.
(md_pcrel_from_section): New switch case
for BFD_RELOC_THUMB_PCREL_BFCSEL.
(md_appdy_fix): Likewise
(tc_gen_reloc): Likewise.
* testsuite/gas/arm/armv8_1-m-bfcsel.d: New.
* testsuite/gas/arm/armv8_1-m-bfcsel.s: New.
*** ld/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* testsuite/ld-arm/bfcsel.s: New.
* testsuite/ld-arm/bfcsel.d: New.
* testsuite/ld-arm/arm-elf.exp: Add above test.
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (thumb32_opcodes): New instruction bfcsel.
(print_insn_thumb32): Edit the switch case for %Z.
Andre Vieira [Mon, 15 Apr 2019 10:46:54 +0000 (11:46 +0100)]
[binutils, ARM, 10/16] BFCSEL infrastructure with new global reloc R_ARM_THM_BF12
This patch is part of a series of patches to add support for Armv8.1-M Mainline
instructions to binutils.
This adds infrastructure for the BFCSEL instructions which is one of the first
instructions in Arm that have more than one relocations in them.
This adds a new relocation R_ARM_THM_BF12.
The inconsistency between external R_ARM_THM_BF12 and internal
BFD_RELOC_ARM_THUMB_BF13 is because internally we count the static bit-0 of the
immediate and we don't externally.
ChangeLog entries are as follows :
ChangeLog entries are as follows :
*** bfd/ChnageLog ***
2019-04-04 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_BF13): New.
* bfd-in2.h: Regenerated.
* libbfd.h: Regenerated.
* elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF13.
(elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF13
and R_ARM_THM_BF12 together.
(elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF13.
*** elfcpp/ChangeLog ***
2019-04-04 Sudakshina Das <sudi.das@arm.com>
* arm.h (R_ARM_THM_BF12): New relocation code.
*** gas/ChangeLog ***
2019-04-04 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (md_pcrel_from_section): New switch case for
BFD_RELOC_ARM_THUMB_BF13.
(md_appdy_fix): Likewise.
(tc_gen_reloc): Likewise.
*** include/ChangeLog ***
2019-04-04 Sudakshina Das <sudi.das@arm.com>
* elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF12.
*** opcodes/ChangeLog ***
2019-04-04 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (print_insn_thumb32): Updated to accept new %Z pattern.
Andre Vieira [Mon, 15 Apr 2019 10:42:10 +0000 (11:42 +0100)]
[binutils, ARM, 9/16] New BFL instruction for Armv8.1-M Mainline
This patch is part of a series of patches to add support for Armv8.1-M Mainline
instructions to binutils.
This patch adds the BFL instruction.
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/tc-arm.c (T16_32_TAB): New entrie for bfl.
(do_t_v8_1_branch): New switch case for bfl.
(insns): New instruction for bfl.
* testsuite/gas/arm/armv8_1-m-bfl.d: New.
* testsuite/gas/arm/armv8_1-m-bfl.s: New.
* testsuite/gas/arm/armv8_1-m-bfl-bad.s: New.
* testsuite/gas/arm/armv8_1-m-bfl-bad.d: New.
* testsuite/gas/arm/armv8_1-m-bfl-bad.l: New.
* testsuite/gas/arm/armv8_1-m-bfl-rel.d: New.
* testsuite/gas/arm/armv8_1-m-bfl-rel.s: New.
*** ld/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* testsuite/ld-arm/bfl.s: New.
* testsuite/ld-arm/bfl.d: New.
* testsuite/ld-arm/arm-elf.exp: Add above test.
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (thumb32_opcodes): New instruction bfl.
Andre Vieira [Mon, 15 Apr 2019 10:37:51 +0000 (11:37 +0100)]
[binutils, ARM, 8/16] BFL infrastructure with new global reloc R_ARM_THM_BF18
This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils.
This adds infrastructure for the BFL instructions which is one of the first instructions in Arm that have more than one relocations in them.
This adds a new relocation R_ARM_THM_BF18.
The inconsistency between external R_ARM_THM_BF18 and internal
BFD_RELOC_ARM_THUMB_BF19 is because internally we count the static bit-0 of the immediate and we don't externally.
ChangeLog entries are as follows :
*** bfd/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_BF19): New
* libbfd.h: Regenerated.
* bfd-in2.h: Regenerated.
* bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF18.
(elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF19
and R_ARM_THM_BF18 together.
(elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF19.
*** elfcpp/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm.h (R_ARM_THM_BF18): New relocation code.
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (md_pcrel_from_section): New switch case for
BFD_RELOC_ARM_THUMB_BF19.
(md_appdy_fix): Likewise.
(tc_gen_reloc): Likewise.
*** include/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF18.
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (print_insn_thumb32): Updated to accept new %Y pattern.
Andre Vieira [Mon, 15 Apr 2019 10:29:14 +0000 (11:29 +0100)]
[binutils, ARM, 7/16] New BFX and BFLX instruction for Armv8.1-M Mainline
This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils.
This patch adds the BFX and BFLX instructions.
ChangeLog entries are as follows :
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (T16_32_TAB): New entries for bfx and bflx.
(do_t_v8_1_branch): New switch cases for bfx and bflx.
(insns): New instruction for bfx and bflx.
* testsuite/gas/arm/armv8_1-m-bf-exchange.d: New.
* testsuite/gas/arm/armv8_1-m-bf-exchange.s: New.
* testsuite/gas/arm/armv8_1-m-bf-exchange-bad.s: New
* testsuite/gas/arm/armv8_1-m-bf-exchange-bad.l: New
* testsuite/gas/arm/armv8_1-m-bf-exchange-bad.d: New
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (print_insn_thumb32): Add '%<bitfield>S' to print an
Arm register with r13 and r15 unpredictable.
(thumb32_opcodes): New instructions for bfx and bflx.
Andre Vieira [Mon, 15 Apr 2019 10:25:12 +0000 (11:25 +0100)]
[binutils, ARM, 6/16] New BF instruction for Armv8.1-M Mainline
This patch is part of a series of patches to add support for Armv8.1-M Mainline
instructions to binutils.
This patch adds the BF instruction.
ChangeLog entries are as follows:
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/tc-arm.c (T16_32_TAB): New entries for bf.
(do_t_branch_future): New.
(insns): New instruction for bf.
* testsuite/gas/arm/armv8_1-m-bf.d: New.
* testsuite/gas/arm/armv8_1-m-bf.s: New.
* testsuite/gas/arm/armv8_1-m-bf-bad.s: New.
* testsuite/gas/arm/armv8_1-m-bf-bad.l: New.
* testsuite/gas/arm/armv8_1-m-bf-bad.d: New.
* testsuite/gas/arm/armv8_1-m-bf-rel.d: New.
* testsuite/gas/arm/armv8_1-m-bf-rel.s: New.
*** ld/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* testsuite/ld-arm/bf.s: New.
* testsuite/ld-arm/bf.d: New.
* testsuite/ld-arm/arm-elf.exp: Add above test.
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (thumb32_opcodes): New instructions for bf.
Andre Vieira [Mon, 15 Apr 2019 10:18:57 +0000 (11:18 +0100)]
[binutils, ARM, 5/16] BF insns infrastructure with new global reloc R_ARM_THM_BF16
This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils.
This adds infrastructure for the BF instructions which is one of the first instructions in Arm that have more than one relocations in them.
This is the third infrastructure patch that adds a new relocation R_ARM_THM_BF16.
The inconsistency between external R_ARM_THM_BF16 and internal
BFD_RELOC_ARM_THUMB_BF17 is because internally we count the static bit-0 of the immediate and we don't externally.
ChangeLog entries are as follows :
*** bfd/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_BF17): New enum.
* bfd-in2.h: Regenerated.
* libbfd.h: Regenerated.
* bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF16.
(elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF17
and R_ARM_THM_BF16 together.
(get_value_helper): New reloc helper.
(elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF16.
*** elfcpp/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm.h (R_ARM_THM_BF16): New relocation code.
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (md_pcrel_from_section): New switch case for
BFD_RELOC_ARM_THUMB_BF17.
(md_appdy_fix): Likewise.
(tc_gen_reloc): Likewise.
*** include/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF16.
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (print_insn_thumb32): Updated to accept new %W pattern.
Andre Vieira [Mon, 15 Apr 2019 10:12:57 +0000 (11:12 +0100)]
[binutils, ARM, 4/16] BF insns infrastructure with array of relocs in struct arm_it
This patch is part of a series of patches to add support for ARMv8.1-M Mainline
instructions to binutils.
This adds infrastructure for the Branch Future instructions (BF, BFX, BFL,
BFLX, BFCSEL).
These are the first instructions in ARM that have more than one relocations in
them. Their external relocations can be found in the 'ELF for the Arm
Architecture - ABI 2019Q1' document on developer.arm.com
This is the second infrastructure patch that adds support to allow up to
3 relocations in an instruction. This is done by changing the reloc member of
struct arm_it to an array instead (relocs[3]). All the previous occurrences of
reloc can now to referring to relocs[0].
ChangeLog entries are as follows :
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (ARM_IT_MAX_RELOCS): New macro.
(arm_it): Member reloc renamed relocs and updated to an array.
Rest: Replace all occurrences of reloc to relocs[0].
Andre Vieira [Mon, 15 Apr 2019 10:06:30 +0000 (11:06 +0100)]
[binutils, ARM, 3/16] BF insns infrastructure with new bfd_reloc_code_real for fallback branch
This patch is part of a series of patches to add support for Armv8.1-M Mainline
instructions to binutils.
This adds infrastructure for the Branch Future instructions (BF, BFX, BFL, BFLX,
BFCSEL). These are the first instructions in ARM that have more than one
relocations in them.
This is the first infrastructure patch that adds a new bfd_reloc_code_real enum
for the fallback branch offset.
This is common for all such instructions and needs to be resolvable by the
assembler.
ChangeLog entries are as follows :
*** bfd/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_THUMB_PCREL_BRANCH5): New enum.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
*** gas/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* config/tc-arm.c (md_pcrel_from_section): New switch case
for BFD_RELOC_THUMB_PCREL_BRANCH5.
(v8_1_branch_value_check): New function to check branch
offsets.
(md_appdy_fix): New switch case for
BFD_RELOC_THUMB_PCREL_BRANCH5.
(tc_gen_reloc): Likewise.
*** opcodes/ChangeLog ***
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* arm-dis.c (print_insn_thumb32): Updated to accept new %G pattern.
Andre Vieira [Mon, 15 Apr 2019 10:00:21 +0000 (11:00 +0100)]
[GAS, ARM, 2/16] Add CLI extension support for Armv8.1-M Mainline
This patch implements the dsp, fp and fp.dp extensions for Armv8.1-M Mainline.
This patch also removes the fp-armv8 check from the half-precision move
instructions 'do_neon_movhf', as checking that the FP16 instructions extension
feature bit is enabled 'ARM_EXT2_FP16_INST' is enough.
gas/ChangeLog:
2019-04-15 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/tc-arm.c (do_neon_movhf): Remove fp-armv8 check.
(armv8_1m_main_ext_table): New extension table.
(arm_archs): Use the new extension table.
* doc/c-arm.texi: Add missing arch and document new extensions.
* testsuite/gas/arm/armv8.1-m.main-fp.d: New.
* testsuite/gas/arm/armv8.1-m.main-fp-dp.d: New.
* testsuite/gas/arm/armv8.1-m.main-hp.d: New.
Andre Vieira [Mon, 15 Apr 2019 09:54:42 +0000 (10:54 +0100)]
[binutils, ARM, 1/16] Add support for Armv8.1-M Mainline CLI
The patch is straightforward, it does the following:
- support the new Tag_CPU_arch build attribute value, ie.:
+ declare the new value
+ update all the asserts forcing logic to be reviewed for new
architectures
+ create a corresponding bfd_mach_arm_8_1M_MAIN enumerator in bfd and
add mapping from Tag_CPU_arch to it
+ teach readelf about new Tag_CPU_arch value
- declare armv8.1-m.main as a supported architecture value
- define Armv8.1-M Mainline in terms of feature bits available
- tell objdump mapping from bfd_mach_arm_8_1M_MAIN enumerator to feature
bits available
- update architecture-specific logic in gas and bfd guarded by the
asserts mentioned above.
- tests for all the above
ChangeLog entries are as follows:
*** bfd/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* archures.c (bfd_mach_arm_8_1M_MAIN): Define.
* bfd-in2.h: Regenerate.
* cpu-arm.c (arch_info_struct): Add entry for Armv8.1-M Mainline.
* elf32-arm.c (using_thumb_only): Return true for Armv8.1-M Mainline
and update assert.
(using_thumb2): Likewise.
(using_thumb2_bl): Update assert.
(arch_has_arm_nop): Likewise.
(bfd_arm_get_mach_from_attributes): Add case for Armv8.1-M Mainline.
(tag_cpu_arch_combine): Add logic for Armv8.1-M Mainline merging.
*** binutils/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* readelf.c (arm_attr_tag_CPU_arch): Add entry for Armv8.1-M Mainline.
*** gas/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (cpu_arch_ver): Add entry for Armv8.1-M Mainline
Tag_CPU_arch build attribute value. Reindent.
(get_aeabi_cpu_arch_from_fset): Update assert.
(aeabi_set_public_attributes): Update assert for Tag_DIV_use logic.
* testsuite/gas/arm/attr-march-armv8_1-m.main.d: New test.
*** include/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* elf/arm.h (TAG_CPU_ARCH_V8_1M_MAIN): new macro.
(MAX_TAG_CPU_ARCH): Set value to above macro.
* opcode/arm.h (ARM_EXT2_V8_1M_MAIN): New macro.
(ARM_AEXT_V8_1M_MAIN): Likewise.
(ARM_AEXT2_V8_1M_MAIN): Likewise.
(ARM_ARCH_V8_1M_MAIN): Likewise.
*** ld/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* testsuite/ld-arm/attr-merge-13.attr: New test.
* testsuite/ld-arm/attr-merge-13a.s: New test.
* testsuite/ld-arm/attr-merge-13b.s: New test.
*** opcodes/ChangeLog ***
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* arm-dis.c (select_arm_features): Add logic for Armv8.1-M Mainline.
GDB Administrator [Mon, 15 Apr 2019 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 14 Apr 2019 00:01:01 +0000 (00:01 +0000)]
Automatic date update in version.in
Andrew Burgess [Thu, 11 Apr 2019 22:17:31 +0000 (23:17 +0100)]
sim: Use host not target byte order for merging and splitting values
When using writes to memory through a struct to merge and extract
multi-word value, it is the endianness of the host, not the target
that affects which order the component words need to be written into
the structure.
Of the 5 functions adjusted here 4 of them are unused. The 5th,
JOINSIDF will soon be used by the or1k target.
For or1k, simulated on x86-64, this change fixes this function so that
the correct bytes are now returned.
sim/common/ChangeLog:
* cgen-ops.h (SUBWORDXFSI): Compare HOST_BYTE_ORDER not
CURRENT_TARGET_BYTE_ORDER.
(SUBWORDTFSI): Likewise.
(JOINSIDF): Likewise.
(JOINSIXF): Likewise.
(JOINSITF): Likewise.
Matthew Fortune [Tue, 9 Apr 2019 20:40:00 +0000 (20:40 +0000)]
[MIPS] Add i6500 CPU and fix i6400 default ASEs
gas/
* config/tc-mips.c (mips_cpu_info_table): Add i6500. Update
default ASEs for i6400.
* doc/c-mips.texi (-march): Document i6500.
* testsuite/gas/mips/elf_mach_i6400.d: New test.
* testsuite/gas/mips/elf_mach_i6500.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
Matthew Fortune [Tue, 9 Apr 2019 17:34:48 +0000 (10:34 -0700)]
[MIPS] Apply ASE information for the selected processor
GAS does not enable implicit ASEs for most MIPS processors.
The rework of option handling done as part of .module implementation
left the implicit ASE logic broken and default enabled ASEs for
most processors did not get applied. This patch ensures the ASE
information is carried forward to the point where it is required.
gas/
* config/tc-mips.c (mips_set_options) <init_ase>: New field.
(file_mips_opts, mips_opts) <init_ase>: Initialize new field.
(file_mips_check_options): Propagate initial ASE settings.
(mips_after_parse_args, parse_code_option): Track the initial
ASE settings for a CPU.
(s_mipsset): Restore the initial ASE settings when reverting
to the default arch.
* testsuite/gas/mips/elf_mach_p6600.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.
Alan Modra [Fri, 12 Apr 2019 11:02:57 +0000 (20:32 +0930)]
makefile dependencies for generated ld/e*.c
This patch modifies genscripts.sh to emit dependency info along with
the generated emulation e*.c files. This is done by a new source_sh
function that records its arg to a file (.deps/e*.Tc), using the
function whenever a shell script is sourced. Entries in the file are
made unique and written to .deps/e*.Pc. These files are then
included by the Makefile.
* Makefile.am (GENSCRIPTS): Pass LIB_PATH as a parameter. Add
DEPDIR parameter.
(ELF_DEPS, ELF_GEN_DEPS, ELF_X86_DEPS): Delete.
(ALL_EMULATION_SOURCES, ALL_64_EMULATION_SOURCES): Depend on
$GEN_DEPENDS.
(e*.c): Delete all dependencies, instead include dependencies
from $DEPDIR/*.Pc.
* Makefile.in: Regenerate.
* configure.ac (source_sh): Define and use function.
* configure: Regenerate.
* emulparams/aarch64cloudabib.sh, * emulparams/aarch64elf32b.sh,
* emulparams/aarch64elfb.sh, * emulparams/aarch64fbsdb.sh,
* emulparams/aarch64linux32b.sh, * emulparams/aarch64linuxb.sh,
* emulparams/arcelf.sh, * emulparams/arcelf_prof.sh,
* emulparams/arclinux.sh, * emulparams/arclinux_nps.sh,
* emulparams/arclinux_prof.sh, * emulparams/arcv2elf.sh,
* emulparams/arcv2elfx.sh, * emulparams/armelf_fbsd.sh,
* emulparams/armelf_linux_eabi.sh,
* emulparams/armelf_linux_fdpiceabi.sh,
* emulparams/armelf_nacl.sh, * emulparams/armelf_nbsd.sh,
* emulparams/armelf_vxworks.sh, * emulparams/armelfb.sh,
* emulparams/armelfb_fbsd.sh, * emulparams/armelfb_fuchsia.sh,
* emulparams/armelfb_linux.sh, * emulparams/armelfb_linux_eabi.sh,
* emulparams/armelfb_linux_fdpiceabi.sh,
* emulparams/armelfb_nacl.sh, * emulparams/armelfb_nbsd.sh,
* emulparams/armsymbian.sh, * emulparams/cskyelf_linux.sh,
* emulparams/elf32_sparc_sol2.sh,
* emulparams/elf32_sparc_vxworks.sh, * emulparams/elf32_tic6x_be.sh,
* emulparams/elf32_tic6x_elf_be.sh,
* emulparams/elf32_tic6x_elf_le.sh,
* emulparams/elf32_tic6x_linux_be.sh,
* emulparams/elf32_tic6x_linux_le.sh,
* emulparams/elf32_x86_64.sh, * emulparams/elf32_x86_64_nacl.sh,
* emulparams/elf32b4300.sh, * emulparams/elf32bfinfd.sh,
* emulparams/elf32bmipn32.sh, * emulparams/elf32bsmip.sh,
* emulparams/elf32btsmip.sh, * emulparams/elf32btsmip_fbsd.sh,
* emulparams/elf32btsmipn32.sh, * emulparams/elf32btsmipn32_fbsd.sh,
* emulparams/elf32ebmip.sh, * emulparams/elf32ebmipvxworks.sh,
* emulparams/elf32elmip.sh, * emulparams/elf32elmipvxworks.sh,
* emulparams/elf32frvfd.sh, * emulparams/elf32l4300.sh,
* emulparams/elf32lm32fd.sh, * emulparams/elf32lmip.sh,
* emulparams/elf32lppc.sh, * emulparams/elf32lppclinux.sh,
* emulparams/elf32lppcnto.sh, * emulparams/elf32lppcsim.sh,
* emulparams/elf32lr5900.sh, * emulparams/elf32lr5900n32.sh,
* emulparams/elf32lriscv.sh, * emulparams/elf32lriscv_ilp32.sh,
* emulparams/elf32lriscv_ilp32f.sh, * emulparams/elf32lsmip.sh,
* emulparams/elf32ltsmip.sh, * emulparams/elf32ltsmip_fbsd.sh,
* emulparams/elf32ltsmipn32.sh, * emulparams/elf32ltsmipn32_fbsd.sh,
* emulparams/elf32microblazeel.sh, * emulparams/elf32or1k_linux.sh,
* emulparams/elf32ppc.sh, * emulparams/elf32ppc_fbsd.sh,
* emulparams/elf32ppccommon.sh, * emulparams/elf32ppclinux.sh,
* emulparams/elf32ppcnto.sh, * emulparams/elf32ppcsim.sh,
* emulparams/elf32ppcvxworks.sh, * emulparams/elf32ppcwindiss.sh,
* emulparams/elf32tilegx_be.sh, * emulparams/elf64_ia64_fbsd.sh,
* emulparams/elf64_sparc_fbsd.sh, * emulparams/elf64_sparc_sol2.sh,
* emulparams/elf64alpha_fbsd.sh, * emulparams/elf64alpha_nbsd.sh,
* emulparams/elf64bmip-defs.sh, * emulparams/elf64bmip.sh,
* emulparams/elf64btsmip.sh, * emulparams/elf64btsmip_fbsd.sh,
* emulparams/elf64lppc.sh, * emulparams/elf64lriscv-defs.sh,
* emulparams/elf64lriscv.sh, * emulparams/elf64lriscv_lp64.sh,
* emulparams/elf64lriscv_lp64f.sh, * emulparams/elf64ltsmip.sh,
* emulparams/elf64ltsmip_fbsd.sh, * emulparams/elf64ppc.sh,
* emulparams/elf64ppc_fbsd.sh, * emulparams/elf64rdos.sh,
* emulparams/elf64tilegx_be.sh, * emulparams/elf_i386.sh,
* emulparams/elf_i386_be.sh, * emulparams/elf_i386_fbsd.sh,
* emulparams/elf_i386_ldso.sh, * emulparams/elf_i386_nacl.sh,
* emulparams/elf_i386_sol2.sh, * emulparams/elf_i386_vxworks.sh,
* emulparams/elf_iamcu.sh, * emulparams/elf_k1om.sh,
* emulparams/elf_k1om_fbsd.sh, * emulparams/elf_l1om.sh,
* emulparams/elf_l1om_fbsd.sh, * emulparams/elf_x86_64.sh,
* emulparams/elf_x86_64_cloudabi.sh,
* emulparams/elf_x86_64_fbsd.sh, * emulparams/elf_x86_64_nacl.sh,
* emulparams/elf_x86_64_sol2.sh, * emulparams/h8300helf.sh,
* emulparams/h8300helf_linux.sh, * emulparams/h8300hnelf.sh,
* emulparams/h8300self.sh, * emulparams/h8300self_linux.sh,
* emulparams/h8300snelf.sh, * emulparams/h8300sxelf.sh,
* emulparams/h8300sxelf_linux.sh, * emulparams/h8300sxnelf.sh,
* emulparams/hppanbsd.sh, * emulparams/hppaobsd.sh,
* emulparams/m32rlelf.sh, * emulparams/m32rlelf_linux.sh,
* emulparams/m68kelfnbsd.sh, * emulparams/mn10300.sh,
* emulparams/msp430X.sh, * emulparams/nds32belf.sh,
* emulparams/nds32belf16m.sh, * emulparams/nds32belf_linux.sh,
* emulparams/pjlelf.sh, * emulparams/ppclynx.sh,
* emulparams/score7_elf.sh, * emulparams/shelf_fd.sh,
* emulparams/shelf_linux.sh, * emulparams/shelf_nbsd.sh,
* emulparams/shelf_uclinux.sh, * emulparams/shelf_vxworks.sh,
* emulparams/shl.sh, * emulparams/shlelf.sh,
* emulparams/shlelf_fd.sh, * emulparams/shlelf_nbsd.sh,
* emulparams/shlelf_vxworks.sh: Use source_sh.
* genscripts.sh: Adjust for changed parameters. Emit dependencies
for e*.c to .deps/*.Pc.
(source_sh): New function, use it throughout to source scripts.
* genscrba.sh (source_em): Use source_sh.
Alan Modra [Fri, 12 Apr 2019 09:32:44 +0000 (19:02 +0930)]
ld TDIRS substitution
It is no longer true that autoconf/automake cannot substitute vars
with embedded new-lines.
* configure.ac (TDIRS): Build up tdirs in this variable and
AC_SUBST, also using AM_SUBST_NOTMAKE.
* configure: Regenerate.
* Makefile.am (DISTCLEANFILES): Remove tdirs.
* Makefile.in: Regenerate.
Andrew Burgess [Fri, 12 Apr 2019 23:54:16 +0000 (00:54 +0100)]
gdb: Fix failure in gdb.base/complex-parts.exp for x86-32
The x86-32 ABI specifies 96-bit long double, this was causing a
failure on the test gdb.base/complex-parts.exp.
The problem is that GDB tries to find a builtin floating point type of
the correct size in order to reuse the name of that type as the name
for the components of the complex type being built.
Previously GDB was only aware of floating point types sized 32, 64, or
128 bits. This patch teaches GDB how to handle 96 bit floating point
type.
gdb/ChangeLog:
* dwarf2read.c (dwarf2_init_complex_target_type): Handle complex
target types of size 96-bits, add some additional comments, and
check that the builtin type we found was the correct size.
GDB Administrator [Sat, 13 Apr 2019 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
John Darrington [Fri, 12 Apr 2019 16:39:01 +0000 (18:39 +0200)]
GAS: S12Z: Remove definition of macro TC_M68K.
gas/config:
* tc-s12z.h: Remove inappropriate macro definition.
John Darrington [Fri, 12 Apr 2019 16:39:01 +0000 (18:39 +0200)]
S12Z: opcodes: Replace "operator" with "optr".
opcodes/
* s12z-dis.c, s12z-opc.c, s12z-opc.h: Replace operator with optr.
John Darrington [Fri, 12 Apr 2019 16:39:01 +0000 (18:39 +0200)]
GAS: tc-s12z.c: int -> bfd_boolean
Use bfd_boolean where appropriate.
Eli Zaretskii [Fri, 12 Apr 2019 12:35:57 +0000 (15:35 +0300)]
Another fix for GDB styling
gdb/ChangeLog:
2019-04-12 Eli Zaretskii <eliz@gnu.org>
* utils.c (prompt_for_continue): Don't restore the styling at the
end, as applied_style has the wrong value. This fixes styling in
long lists of file names that are interrupted by the "Continue?"
prompt.
Nick Clifton [Fri, 12 Apr 2019 12:15:21 +0000 (13:15 +0100)]
Fix thinko in linker documentation.
PR 24450
* ld.texi (Output Section Attributes): Add ALIGN_WITH_INPUT to
example of section attributes.
Alan Hayward [Mon, 8 Apr 2019 15:02:55 +0000 (16:02 +0100)]
Testsuite: Add gdbserver sysroot test
The local board file ensures that the sysroot is always set to load
files from the local filesystem.
Add a gdbserver test to explicitly test the sysroot set to both the
remote target and the local filesystem.
gdb/testsuite/ChangeLog:
* gdb.server/sysroot.c: New test.
* gdb.server/sysroot.exp: New file.
* lib/gdbserver-support.exp (gdb_target_cmd): Add additional text
matching param.
Andrew Burgess [Thu, 11 Apr 2019 22:51:48 +0000 (23:51 +0100)]
gdb: Remove LANG_MAGIC
The language_defn structure has an la_magic field, this used to be
used as a basic check that the language_defn structure had the
expected layout - at least the end of the structure was where we
expected it to be.
This feature only really makes sense if we imagine GDB dynamically
loading language support from dynamic libraries, where a version
mismatch might cause problems.
However, in current GDB language support is statically built into GDB,
and since this commit:
commit
47e77640be31fc1a4eb3718f594ed5fd0faff065
Date: Thu Jul 20 18:28:01 2017 +0100
Make language_def O(1)
the existing (if pointless) check of the la_magic field was removed.
There now appears to be no use of the la_magic field, and I propose
that we delete it.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* ada-lang.c (ada_language_defn): Remove use of LANG_MAGIC.
* c-lang.c (c_language_defn): Likewise.
(cplus_language_defn): Likewise.
(asm_language_defn): Likewise.
(minimal_language_defn): Likewise.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Likewise.
* go-lang.c (go_language_defn): Likewise.
* language.c (unknown_language_defn): Likewise.
(auto_language_defn): Likewise.
* language.h (struct language_defn): Remove la_magic field.
(LANG_MAGIC): Delete.
* m2-lang.c (m2_language_defn): Remove use of LANG_MAGIC.
* objc-lang.c (objc_language_defn): Likewise.
* opencl-lang.c (opencl_language_defn): Likewise.
* p-lang.c (pascal_language_defn): Likewise.
* rust-lang.c (rust_language_defn): Likewise.
GDB Administrator [Fri, 12 Apr 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Sun, 7 Apr 2019 21:30:37 +0000 (22:30 +0100)]
gdb/riscv: Remove riscv_type_alignment function
Make use of the type_align function and remove riscv_type_alignment as
it is no longer needed. I tested this against a number of RV32 and
RV64 targets, and I also ran the tests with an assertion in place
checking that the old riscv_type_alignment function gives the same
answer as the common type_align function - it does, and all the tests
still pass.
gdb/ChangeLog:
* riscv-tdep.c (riscv_type_align): New function.
(riscv_type_alignment): Delete.
(riscv_arg_location): Use 'type_align'.
(riscv_gdbarch_init): Register riscv_type_align gdbarch function.
Andrew Burgess [Sat, 6 Apr 2019 10:02:04 +0000 (11:02 +0100)]
gdb: Fix alignment computation for structs with only static fields
The current code in gdbtypes.c:type_align incorrectly returns 0 as the
alignment for a structure containing only static fields. After this
patch the correct value of 1 is returned. The gdb.base/align.exp test
is extended to cover this case.
gdb/ChangeLog:
* gdbtypes.c (type_align): A struct with no non-static fields also
has alignment of 1.
gdb/testsuite/ChangeLog:
* gdb.base/align.exp: Extend test to cover structures containing
only static fields.
Andrew Burgess [Fri, 5 Apr 2019 12:50:19 +0000 (13:50 +0100)]
gdb/riscv: Handle empty C++ structs during argument passing
This commit resolves a large number of failures in the test script
gdb.base/infcall-nested-structs.exp which were caused by GDB (for
RISC-V) incorrectly handling empty C++ structures when preparing
arguments for a dummy call, or collecting a return value.
The issue is further complicated in that there was a bug in GCC, such
that in some cases GCC would generate incorrect code when passing a
small structure that contained empty sub-structures. This was fixed
in GCC trunk on 5-March-2019, so in order to see the best results with
this patch you'll need a recent version of GCC.
Anything that used to work should continue to work after this patch,
regardless of GCC version being used.
The fix in this commit is that GDB now pays more attention to the
offset of fields within a structure when preparing arguments as in C++
an empty structure has a non-zero size, this is an example:
struct s1 { struct s2 { } empty; int f; };
We previously assumed that 'f' was at offset 0 inside type 's1',
however this is not the case in C++ as 's2' has size 1, and with
alignment 'f' is likely at some even bigger offset inside 's1'.
gdb/ChangeLog:
* riscv-tdep.c (riscv_call_arg_complex_float): Fix offset of first
component to 0.
(riscv_struct_info::riscv_struct_info): Initialise m_offsets
member.
(riscv_struct_info::analyse): New implementation using new
analyse_inner member function.
(riscv_struct_info::field_offset): New member function.
(riscv_struct_info::m_offsets): New member variable.
(riscv_struct_info::analyse_inner): New private member function,
takes the old implementation of riscv_struct_info::analyse but
extended to track field offsets.
(riscv_call_arg_struct): Update the struct folding special cases
to handle cases where empty C++ structs, which are non-zero
length, are found.
(riscv_arg_location): Initialise the length of each location, a
non-zero length now indicates the location is in use.
(riscv_push_dummy_call): Allow for the first location having a
non-zero offset when setting up arguments.
(riscv_return_value): Likewise, but for return values.
Tom Tromey [Thu, 11 Apr 2019 19:00:48 +0000 (13:00 -0600)]
Make "msg" const in internal_vproblem
I noticed that the "msg" variable in internal_vproblem could be
"const". This seems like an improvement because it can wind up in
rodata.
Tested by rebuilding.
gdb/ChangeLog
2019-04-11 Tom Tromey <tromey@adacore.com>
* utils.c (internal_vproblem): Make "msg" const.
Max Filippov [Fri, 5 Apr 2019 00:06:57 +0000 (17:06 -0700)]
xtensa: gas: add relaxations tests
gas/
2019-04-11 Max Filippov <jcmvbkbc@gmail.com>
* testsuite/gas/xtensa/loop-relax-2.d: New test definition.
* testsuite/gas/xtensa/loop-relax.d: New test definition.
* testsuite/gas/xtensa/loop-relax.s: New test source.
* testsuite/gas/xtensa/text-section-literals-1a.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-2.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-2.s: New test
source.
* testsuite/gas/xtensa/text-section-literals-2a.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-3.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-3.s: New test
source.
* testsuite/gas/xtensa/text-section-literals-4.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-4.s: New test
source.
* testsuite/gas/xtensa/text-section-literals-4a.d: New test
definition.
Max Filippov [Fri, 5 Apr 2019 00:51:00 +0000 (17:51 -0700)]
xtensa: gas: convert tests to run_dump_tests
gas/
2019-04-11 Max Filippov <jcmvbkbc@gmail.com>
* testsuite/gas/xtensa/all.exp: Remove all expect-based
tests and all explicit run_dump_test / run_list_test
invocations. Add run_dump_tests for all .d files in the
test subdirectory.
* testsuite/gas/xtensa/entry_align.d: New test definition.
* testsuite/gas/xtensa/entry_align.l: New test output.
* testsuite/gas/xtensa/entry_misalign.d: New test definition.
* testsuite/gas/xtensa/entry_misalign2.d: New test definition.
* testsuite/gas/xtensa/j_too_far.d: New test definition.
* testsuite/gas/xtensa/j_too_far.l: New test output.
* testsuite/gas/xtensa/loop_align.d: New test definition.
* testsuite/gas/xtensa/loop_misalign.d: New test definition.
* testsuite/gas/xtensa/trampoline-2.d: New test definition.
* testsuite/gas/xtensa/trampoline-2.l: Remove empty output.
* testsuite/gas/xtensa/xtensa-err.exp: Use positive logic.
Max Filippov [Wed, 10 Apr 2019 08:18:01 +0000 (01:18 -0700)]
xtensa: gas: clean up literal management code
gas/
2019-04-11 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (xtensa_literal_pseudo): Drop code that has
no effect.
(get_literal_pool_location): Only search for the literal pool
when auto litpools is used, otherwise take one recorded in the
tc_segment_info_data.
(xtensa_assign_litpool_addresses): New function.
(xtensa_move_literals): Don't duplicate 'literal pool location
required...' error message. Call xtensa_assign_litpool_addresses.
Max Filippov [Mon, 8 Apr 2019 20:47:18 +0000 (13:47 -0700)]
xtensa: gas: put .literal_position at section start
Provide literal position at the beginning of each section for literal
space reserved by relaxations when text-section-literals or
auto-litpools options are used. Remove code that adds fill frag to the
literal section for every .literal_position directive to avoid creation
of empty literal sections.
Fix auto-litpools tests that got literal pool address changes.
gas/
2019-04-11 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (xtensa_is_init_fini): Add declaration.
(xtensa_mark_literal_pool_location): Don't add fill frag to literal
section that records literal pool location.
(md_begin): Call xtensa_mark_literal_pool_location when text
section literals or auto litpools are used.
(xtensa_elf_section_change_hook): Call
xtensa_mark_literal_pool_location when text section literals or
auto litpools are used, there's no literal pool location defined
for the current section and it's not .init or .fini.
* testsuite/gas/xtensa/auto-litpools-first1.d: Fix up addresses.
* testsuite/gas/xtensa/auto-litpools-first2.d: Likewise.
* testsuite/gas/xtensa/auto-litpools.d: Likewise.
Faraz Shahbazker [Tue, 2 Apr 2019 20:17:16 +0000 (20:17 +0000)]
ld: Add --no-print-map-discarded option
Add a new option to disable the listing of discarded sections
in map file output. The use case stems from a large application
built with -ffunction-sections --gc-sections where the list of
discarded sections blows up the map file output. The default
behaviour remains to print discarded sections, but the new option
allows us to disable it.
ld/
* NEWS: Mention new option --no-print-map-discarded.
* ld.h (ld_config_type) <print_map_discarded>: New field.
* ldlang.c (lang_map): Conditionally output discarded sections
in map files based on configuration option.
* ldlex.h (option_values) <OPTION_PRINT_MAP_DISCARDED,
OPTION_NO_PRINT_MAP_DISCARDED>: New.
* ldmain.c (main): Enabled print_map_discarded by default.
* lexsup.c (ld_options): Add new command-line options.
(parse_args) <OPTION_NO_PRINT_MAP_DISCARDED,
OPTION_PRINT_MAP_DISCARDED>: New cases.
* ld.texi: Document new options.
* testsuite/ld-gc/gc.exp: Add new test.
* testsuite/ld-gc/skip-map-discarded.s: New file.
* testsuite/ld-gc/skip-map-discarded.d: New file.
* testsuite/ld-gc/skip-map-discarded.map: New file.
Tom de Vries [Thu, 11 Apr 2019 17:13:05 +0000 (19:13 +0200)]
[gdb/testsuite] Add cc-with-dwz.exp and cc-with-dwz-m.exp
We can use CC_WITH_TWEAKS_FLAGS when cd-ing into the gdb build subdir and
invoking make check:
...
$ cd $objdir/gdb
$ make check \
RUNTESTFLAGS='--target_board=cc-with-tweaks' \
CC_WITH_TWEAKS_FLAGS='-z'
...
But when cd-ing into the top-level build dir and invoking make check-gdb
instead:
...
$ cd $objdir
$ make check-gdb \
RUNTESTFLAGS='--target_board=cc-with-tweaks' \
CC_WITH_TWEAKS_FLAGS='-z'
...
using CC_WITH_TWEAKS_FLAGS has no effect, because CC_WITH_TWEAKS_FLAGS is not
passed down from the top level Makefile.
Add cc-with-dwz.exp and cc-with-dwz-m.exp, that don't require
CC_WITH_TWEAKS_FLAGS to be set in the make invocation, allowing us to run these
test configurations from the toplevel build dir:
...
$ cd $objdir
$ make check-gdb \
RUNTESTFLAGS='--target_board=cc-with-dwz'
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-04-11 Tom de Vries <tdevries@suse.de>
* boards/cc-with-dwz-m.exp: New file.
* boards/cc-with-dwz.exp: New file.
* boards/cc-with-tweaks.exp: Note that check-gdb doesn't work.
H.J. Lu [Thu, 11 Apr 2019 15:18:51 +0000 (08:18 -0700)]
x86: Add -z cet-report=[none|warning|error]
Add -z cet-report=[none|warning|error] to report the missing Intel
Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK) properties
in input .note.gnu.property section. -z cet-report=none, which is
the default, will make the linker not report missing properties in
input files. -z cet-report=warning will make the linker issue a
warning for missing properties in input files. -z cet-report=error
will make the linker issue an error for missing properties in input
files. Note that -z ibt will turn off the missing IBT property report
and -z shstk will turn off the missing SHSTK property report.
Supported for Linux/i386 and Linux/x86_64.
bfd/
* elf-linker-x86.h (elf_x86_cet_report): New.
(elf_linker_x86_params): Add cet_report.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
missing IBT and SHSTK properties if needed.
ld/
* ld.texi: Document -z cet-report=[none|warning|error].
* emulparams/cet.sh: Add -z cet-report=[none|warning|error].
* testsuite/ld-i386/i386.exp: Run -z cet-report=[warning|error]
tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/property-x86-cet1.d: New file.
* testsuite/ld-i386/property-x86-cet2a.d: Likewise.
* testsuite/ld-i386/property-x86-cet2b.d: Likewise.
* testsuite/ld-i386/property-x86-cet3a.d: Likewise.
* testsuite/ld-i386/property-x86-cet3b.d: Likewise.
* testsuite/ld-i386/property-x86-cet4a.d: Likewise.
* testsuite/ld-i386/property-x86-cet4b.d: Likewise.
* testsuite/ld-i386/property-x86-cet5a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5b.d: Likewise.
* testsuite/ld-i386/property-x86-cet6.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet.s: Likewise.
* testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet6-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet6.d: Likewise.
H.J. Lu [Thu, 11 Apr 2019 14:53:55 +0000 (07:53 -0700)]
Add PR ld/24436 to ChangeLog entry
H.J. Lu [Thu, 11 Apr 2019 13:52:03 +0000 (06:52 -0700)]
ld: Add -static-pie tests
Add -static-pie tests for DT_INIT_ARRAY, DT_FINI_ARRAY, DT_PREINIT_ARRAY
and IFUNC.
* testsuite/config/default.exp (STATIC_PIE_LDFLAGS): New. Set
to "-static-pie" if target compiler supports it.
* testsuite/ld-elf/elf.exp: Run -static-pie tests if
$STATIC_PIE_LDFLAGS isn't empty.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
H.J. Lu [Thu, 11 Apr 2019 13:44:53 +0000 (06:44 -0700)]
Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry
Instead of BFD_ASSERT (h != NULL) with
ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562
ld: bad.o: invalid string offset
50331648 >= 371 for section `nterp'
check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with
ld: bad.o: section 'g': corrupt VTENTRY entry
* elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of
"h != NULL". Don't check "h != NULL" before calling.
bfd_elf_gc_record_vtentry.
* elf32-arm.c (elf32_arm_check_relocs): Likewise.
* elf32-bfin.c (bfin_check_relocs): Likewise.
* elf32-cris.c (cris_elf_check_relocs): Likewise.
* elf32-csky.c (csky_elf_check_relocs): Likewise.
* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
* elf32-frv.c (elf32_frv_check_relocs): Likewise.
* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
* elf32-metag.c (elf_metag_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
* elf32-s390.c (elf_s390_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Likewise.
* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_s390_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt
VTENTRY entry.
Alan Modra [Thu, 11 Apr 2019 10:12:31 +0000 (19:42 +0930)]
PR24435, buffer overflow reading dynamic entries
PR 24435
* elflink.c (elf_link_add_object_symbols): Don't read partial
dynamic entries from fuzzed objects.
Tamar Christina [Thu, 11 Apr 2019 10:27:28 +0000 (11:27 +0100)]
AArch64: When DF_BIND_NOW don't use TLSDESC GOT value.
When using DF_BIND_NOW on AArch64 we don't reserve the GOT slot for a TLSDESC,
but we still emitted DT_TLSDESC_GOT and DT_TLSDESC_PLT. This caused random
memory corruption as the "special" value of (bfd_vma)-1 would be set for
dt_tlsdesc_got.
Since we don't have a value of dt_tlsdesc_got I also don't emit DT_TLSDESC_PLT
now becuase it would point to an incomplete PLT. To be able to write the PLT
entry DT_TLSDESC_GOT is needed and since we don't have one we can't write the
PLT entry either.
It is my understanding that GLIBC doesn't need these two entries when not lazy
loading. Conversely AArch32 does not reserve neither the GOT not the PLT slot
when doing DF_BIND_NOW.
AArch32 does not need these checks because these values are initialized to 0
and so the if (...) checks don't pass, but on AArch64 these are initialized
to (bfd_vma)-1 and thus we need some extra checks.
bfd/ChangeLog:
PR ld/24302
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Don't emit
DT_TLSDESC_GOT and DT_TLSDESC_PLT when DF_BIND_NOW.
(elfNN_aarch64_finish_dynamic_sections): Don't write PLT if DF_BIND_NOW.
ld/ChangeLog:
PR ld/24302
* testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
* testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: New test.
Sudakshina Das [Thu, 11 Apr 2019 09:19:37 +0000 (10:19 +0100)]
[BINUTILS, AArch64, 2/2] Update Store Allocation Tag instructions
This patch updates the Store allocation tags instructions in
Armv8.5-A Memory Tagging Extension. This is part of the changes
that have been introduced recently in the 00bet10 release
All of these instructions have an updated register operand (Xt -> <Xt|SP>)
- STG <Xt|SP>, [<Xn|SP>, #<simm>]
- STG <Xt|SP>, [<Xn|SP>, #<simm>]!
- STG <Xt|SP>, [<Xn|SP>], #<simm>
- STZG <Xt|SP>, [<Xn|SP>, #<simm>]
- STZG <Xt|SP>, [<Xn|SP>, #<simm>]!
- STZG <Xt|SP>, [<Xn|SP>], #<simm>
- ST2G <Xt|SP>, [<Xn|SP>, #<simm>]
- ST2G <Xt|SP>, [<Xn|SP>, #<simm>]!
- ST2G <Xt|SP>, [<Xn|SP>], #<simm>
- STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]
- STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]!
- STZ2G <Xt|SP>, [<Xn|SP>], #<simm>
In order to accept <Rt|SP> a new operand type Rt_SP is introduced which has
the same field as FLD_Rt but follows other semantics of Rn_SP.
*** gas/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* config/tc-aarch64.c (process_omitted_operand): Add case for
AARCH64_OPND_Rt_SP.
(parse_operands): Likewise.
* testsuite/gas/aarch64/armv8_5-a-memtag.d: Update tests.
* testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise.
* testsuite/gas/aarch64/illegal-memtag.l: Likewise.
* testsuite/gas/aarch64/illegal-memtag.s: Likewise.
*** include/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_Rt_SP.
*** opcodes/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* aarch64-opc.c (aarch64_print_operand): Add case for
AARCH64_OPND_Rt_SP.
(verify_constraints): Likewise.
* aarch64-tbl.h (QL_LDST_AT): Update to add SP qualifier.
(struct aarch64_opcode): Update stg, stzg, st2g, stz2g instructions
to accept Rt|SP as first operand.
(AARCH64_OPERANDS): Add new Rt_SP.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
Sudakshina Das [Thu, 11 Apr 2019 09:13:23 +0000 (10:13 +0100)]
[BINUTILS, AArch64, 1/2] Add new LDGM/STGM instruction
This patch adds the new LDGM/STGM instructions of the
Armv8.5-A Memory Tagging Extension. This is part of the changes
that have been introduced recently in the 00bet10 release
The instructions are as follows:
LDGM Xt, [<Xn|SP>]
STGM Xt, [<Xn|SP>]
*** gas/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* testsuite/gas/aarch64/armv8_5-a-memtag.d: New tests for ldgm and stgm.
* testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise.
* testsuite/gas/aarch64/illegal-memtag.l: Likewise.
* testsuite/gas/aarch64/illegal-memtag.s: Likewise.
*** opcodes/ChangeLog ***
2019-04-11 Sudakshina Das <sudi.das@arm.com>
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-tbl.h (aarch64_opcode): Add new ldgm and stgm.
Alan Hayward [Wed, 10 Apr 2019 14:58:27 +0000 (15:58 +0100)]
AArch64: Ensure regcache is reset between tests
A recent change made the AArch64 self tests resuse the saved regs
cache, rather than creating a new one. Ensure it is reset to default
values between tests.
Do this by splitting the reset functionality from trad_frame_alloc_saved_regs
into a new function.
Fixes selftest on AArch64.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_analyze_prologue_test): Reset saved regs.
* trad-frame.c (trad_frame_reset_saved_regs): New function.
(trad_frame_alloc_saved_regs): Call trad_frame_reset_saved_regs.
* trad-frame.h (trad_frame_reset_saved_regs): New declaration.
H.J. Lu [Thu, 11 Apr 2019 01:36:05 +0000 (18:36 -0700)]
ld: Don't define __rel[a]_iplt_start/__rel[a]_iplt_end in PIE
__rel[a]_iplt_start and __rel[a]_iplt_end are defined to handle IFUNC in
static executables. For PIE, since IFUNC is handled as the part of the
normal dynamic relocation processing, there is no need to define these
symbols in PIE.
* scripttempl/elf.sc (CREATE_PIC): New. Set for CREATE_SHLIB or
CREATE_PIE.
(__rel_iplt_start): Don't define for CREATE_PIC.
(__rel_iplt_end): Likewise.
(__rela_iplt_start): Likewise.
(__rela_iplt_end): Likewise.
Kevin Buettner [Sat, 16 Mar 2019 19:40:01 +0000 (12:40 -0700)]
Fix amd64->i386 linux syscall restart problem
This commit fixes some failures in gdb.base/interrupt.exp
when debugging a 32-bit i386 linux inferior from an amd64 host.
When running the following test...
make check RUNTESTFLAGS="--target_board unix/-m32 interrupt.exp"
... without this commit, I see the following output:
FAIL: gdb.base/interrupt.exp: continue (the program exited)
FAIL: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: Send Control-C, second time
FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running)
ERROR: Undefined command "".
ERROR: GDB process no longer exists
=== gdb Summary ===
When the test is run with this commit in place, we see 12 passes
instead. This is the desired behavior.
Analysis:
On Linux, when a syscall is interrupted by a signal, the syscall
may return -ERESTARTSYS when a signal occurs. Doing so indicates that
the syscall is restartable. Then, depending on settings associated
with the signal handler, and after the signal handler is called, the
kernel can then either return -EINTR or can cause the syscall to be
restarted. In this discussion, we are concerned with the latter
case.
On i386, the kernel returns this status via the EAX register.
When debugging a 32-bit (i386) process from a 64-bit (amd64)
GDB, the debugger fetches 64-bit registers even though the
process being debugged is 32-bit. Since we're debugging a 32-bit
target, only 32 bits are being saved in the register cache.
Now, ideally, GDB would save all 64-bits in the regcache and
then would be able to restore those same values when it comes
time to continue the target. I've looked into doing this, but
it's not easy and I don't see many benefits to doing so. One
benefit, however, would be that EAX would appear as a negative
value for doing syscall restarts.
At the moment, GDB is setting the high 32 bits of RAX (and other
registers too) to 0. So, when GDB restores EAX just prior to
a syscall restart, the high 32 bits of RAX are zeroed, thus making
it look like a positive value. For this particular purpose, we
need to sign extend EAX so that RAX will appear as a negative
value when EAX is set to -ERESTARTSYS. This in turn will cause
the signal handling code in the kernel to recognize -ERESTARTSYS
which will in turn cause the syscall to be restarted.
This commit is based on work by Jan Kratochvil from 2009:
https://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
Jan's patch had the sign extension code in amd64-nat.c. Several
other native targets make use of this code, so it seemed better
to move the sign extension code to a linux specific file. I
also added similar code to gdbserver.
Another approach is to fix the problem in the kernel. Hui Zhu
tried to get a fix into the kernel back in 2014, but it was not
accepted. Discussion regarding this approach may be found here:
https://lore.kernel.org/patchwork/patch/457841/
Even if a fix were to be put into the kernel, we'd still need
some kind of fix in GDB in order to support older kernels.
Finally, I'll note that Fedora has been carrying a similar patch for
at least nine years. Other distributions, including RHEL and CentOS
have picked up this change and have been using it too.
gdb/ChangeLog:
* amd64-linux-nat.c (amd64_linux_collect_native_gregset): New
function.
(fill_gregset): Call amd64_linux_collect_native_gregset instead
of amd64_collect_native_gregset.
(amd64_linux_nat_target::store_registers): Likewise.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
when using a 64-bit gdbserver.
GDB Administrator [Thu, 11 Apr 2019 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Wed, 10 Apr 2019 14:49:36 +0000 (15:49 +0100)]
Pull in patch for libiberty that fixes a stack exhaustion bug when demangling a pathalogically constructed mangled name.
PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter. Adjust
body of the function accordingly. Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.
Tom Tromey [Sun, 10 Mar 2019 21:37:20 +0000 (15:37 -0600)]
Introduce a separate debug objfile iterator
This introduces a new iterator and range adapter for iteration over
the separate debug files of a given objfile. As in the current
approach, the requested objfile is returned first, followed by the
separate debug objfiles.
gdb/ChangeLog
2019-04-10 Tom Tromey <tom@tromey.com>
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_in_objfile_from_linkage_name): Use the iterator.
* objfiles.h (class separate_debug_iterator): New.
(class separate_debug_range): New.
(struct objfile) <separate_debug_objfiles>: New method.
(objfile_separate_debug_iterate): Don't declare.
* objfiles.c (separate_debug_iterator::operator++): Rename from
objfile_separate_debug_iterate.
(objfile_relocate, objfile_rebase, objfile_has_symbols): Use the
iterator.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Use the
iterator.
Tom Tromey [Sun, 10 Mar 2019 21:01:26 +0000 (15:01 -0600)]
Fix a couple of comments
While working on objfiles I noticed a typo in one comment, and another
comment that, as far as I can tell, has been obsolete for a very long
time.
gdb/ChangeLog
2019-04-10 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Remove old comment.
* objfiles.c (free_all_objfiles): Fix a typo.
Tom Tromey [Sun, 20 Jan 2019 04:30:36 +0000 (21:30 -0700)]
Remove some uses of "object_files"
The "object_files" macro is sometimes used when iterating over
objfiles. This patch removes a few such uses in favor of the new
range adapter.
gdb/ChangeLog
2019-04-10 Tom Tromey <tom@tromey.com>
* ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
* minsyms.c (lookup_minimal_symbol): Use foreach.
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline): Likewise.
* symfile.c (reread_symbols): Use foreach.
Michael Forney [Wed, 10 Apr 2019 08:47:37 +0000 (18:17 +0930)]
PR24427, bfd/doc/chew.c reads uninitialized memory and subtracts from function pointer
PR 24427
* doc/chew.c (free_words): Correctly free "push_text" strings.
Rainer Orth [Wed, 10 Apr 2019 07:48:43 +0000 (09:48 +0200)]
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86
The fix H.J. implemented for PR gas/22791 in the thread starting at
[PATCH] x86-64: Treat PC32 relocation with branch as PLT32
https://sourceware.org/ml/binutils/2018-02/msg00065.html
is causing problems on Solaris/x86. The native linker is strongly
preferred there, and there's no intention of implementing the linker
optimization he plans there. Besides, the kernel runtime linker,
otherwise has no need to deal with that reloc at all, and instead of
adding (possibly even more) workarounds with no benefit, it seems
appropriate to disable the R_X86_64_PLT32 generation as branch marker on
Solaris/x86 in the first place.
The patch itself is trivial, the only complication is adapting the
testsuite. Since I've found no way to have conditional sections in the
.d files, I've instead used the solution already found elsewhere of
having separate .d files for the affected tests in an i386/solaris
subdirectory and skipping the original ones.
Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without
regressions.
* config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.
* testsuite/gas/i386/solaris/solaris.exp: New driver.
* testsuite/gas/i386/solaris/reloc64.d,
testsuite/gas/i386/solaris/x86-64-jump.d,
testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d,
testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d,
testsuite/gas/i386/solaris/x86-64-nop-3.d,
testsuite/gas/i386/solaris/x86-64-nop-4.d,
testsuite/gas/i386/solaris/x86-64-nop-5.d,
testsuite/gas/i386/solaris/x86-64-relax-2.d,
testsuite/gas/i386/solaris/x86-64-relax-3.d: New tests.
* testsuite/gas/i386/reloc64.d,
testsuite/gas/i386/x86-64-jump.d,
testsuite/gas/i386/x86-64-mpx-branch-1.d,
testsuite/gas/i386/x86-64-mpx-branch-2.d,
testsuite/gas/i386/x86-64-nop-3.d,
testsuite/gas/i386/x86-64-nop-4.d,
testsuite/gas/i386/x86-64-nop-5.d,
testsuite/gas/i386/x86-64-relax-2.d,
testsuite/gas/i386/x86-64-relax-3.d: Skip on *-*-solaris*.
Alan Modra [Wed, 10 Apr 2019 06:00:37 +0000 (15:30 +0930)]
Re: XFAIL PR ld/20995 tests for lynxos and nto targets
* testsuite/ld-elf/shared.exp: Don't xfail PR ld/20995 for
powerpc-nto.
Alan Modra [Wed, 10 Apr 2019 02:28:15 +0000 (11:58 +0930)]
cskyelf.em branch stub handling
This fixes the csky-elf ld-elf/pr21884 and ld-unique/pr21529 failures,
by disabling branch stubs for binary (and other non-csky) output.
The csky-linux target gets branch stubs off by default because
presumably there are reasons why branch stubs were disabled, but
rather than killing the support completely it can be enabled by
--branch-stub.
* emultempl/cskyelf.em (csk_elf_before_parse): New function,
setting use_branch_stub false for linux.
(csky_elf_create_output_section_statements): Do emit this
function and all others in the file for linux, plus the branch
option control. Disable branch stubs when non-ELF.
Alan Modra [Wed, 10 Apr 2019 02:05:48 +0000 (11:35 +0930)]
Fix some ld dependencies
In looking at the csky-elf vs. csky-linux differences, the first thing
I compared was csky_elf.sh and cskyelf_linux.sh. Those files are
mostly the same but besides the real differences, annoyingly have some
lines ordered differently. It's better in such cases to have one file
source the other, making differences plain. This patch does that for
csky and microblaze, removes an unused variable defined in a few
places, and fixes ld makefile dependencies.
* Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em.
(ecskyelf_linux.c): Depend on cskyelf.sh.
(eelf32microblazeel.c): Depend on elf32microblaze.sh.
* Makefile.in: Regenerate.
* emulparams/cskyelf.sh: Comment regarding cskelf_linux.sh.
(PAGE_SIZE): Don't define.
* emulparams/cskyelf_linux.sh: Source sckyelf.sh, leaving just
the differing variable defs/undefs.
* emulparams/elf32mcore.sh (PAGE_SIZE): Don't define.
* emulparams/elf32microblaze.sh: Comment re. elf32microblazeel.sh.
(OUTPUT_FORMAT): Use BIG_OUTPUT_FORMAT.
(PAGE_SIZE): Don't define.
* emulparams/elf32microblazeel.sh: Source elf32microblaze.sh,
leaving just the differing OUTPUT_FORMAT.
Alan Modra [Wed, 10 Apr 2019 02:27:00 +0000 (11:57 +0930)]
Regen BLD-POTFILES.in
* po/BLD-POTFILES.in: Regenerate.
Alan Modra [Mon, 8 Apr 2019 07:27:51 +0000 (16:57 +0930)]
te-cloudabi.h
This patch is aimed a fixing large numbers of x86_64-cloudabi failures
caused by gas selecting the wrong target name.
* config/te-cloudabi.h: New file.
* config/tc-aarch64.c (aarch64_after_parse_args): Use TE_CLOUDABI
rather than TARGET_OS to select cloudabi.
* config/tc-i386.h (ELF_TARGET_FORMAT64): Define for TE_CLOUDABI.
* configure.tgt (*-*-cloudabi*): Set em=cloudabi.
GDB Administrator [Wed, 10 Apr 2019 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 9 Apr 2019 19:19:28 +0000 (13:19 -0600)]
Fix Rust lexer buglet
PR rust/24414 points out that the Rust lexer uses strtoul when lexing
an integer, and that this can give the wrong results in some
situations.
This patch changes it to use strtoulst, like most of the rest of gdb.
It also adds a self test.
Tested on x86-64 Fedora 29 using an i686 build.
gdb/ChangeLog
2019-04-09 Ivan Begert <ivanbegert@gmail.com>
Tom Tromey <tromey@adacore.com>
PR rust/24414:
* rust-exp.y (rust_parser::lex_number): Use strtoulst.
(rust_lex_int_test): Change "value" to be LONGEST.
(rust_lex_tests): Add test for long integer literal.
Tom Tromey [Thu, 4 Apr 2019 22:57:11 +0000 (16:57 -0600)]
Use find_thread_in_random in select_event_lwp
I noticed that find_thread_in_random duplicates the code in
find_thread_in_random, so this patch changes the latter to use the
former.
There are two other spots in gdb that do this, but to unify all of
them would require switching some code from using the "iterate over"
idiom to using iterators.
Another possible improvement is that find_thread_in_random could be
made single-pass using reservoir sampling.
Tested by the buildbot.
gdb/gdbserver/ChangeLog
2019-04-09 Tom Tromey <tromey@adacore.com>
* linux-low.c (select_event_lwp): Use find_thread_in_random.
Tom Tromey [Thu, 4 Apr 2019 23:03:27 +0000 (17:03 -0600)]
Consistently use bool for fake_pid_p
I noticed a few spots where fake_pid_p is handled as an int, whereas
the field in struct inferior has type bool. This patch changes the
remaining places to use bool as well.
Tested by the buildbot.
gdb/ChangeLog
2019-04-09 Tom Tromey <tromey@adacore.com>
* remote.c (remote_target::remote_add_inferior): Change fake_pid_p
to bool.
(extended_remote_target::attach): Update.
(remote_target::remote_notice_new_inferior): Update.
(remote_target::add_current_inferior_and_thread): Update.
* inferior.c (exit_inferior_1): Use "false".
* corelow.c (add_to_thread_list): Make fake_pid_p bool.
Simon Marchi [Tue, 9 Apr 2019 16:35:29 +0000 (12:35 -0400)]
Fix typo in latest ChangeLog entry
Simon Marchi [Tue, 9 Apr 2019 16:32:26 +0000 (12:32 -0400)]
Use -qualified flag when setting temporary breakpoint in start command
When using the "start" command, GDB puts a temporary breakpoint on the
"main" symbol (we literally invoke the tbreak command). However, since
it does wild matching by default, it also puts a breakpoint on any C++
method or "main" function in a namespace. For example, when debugging
GDB, it creates a total of 24 locations:
(gdb) start
Temporary breakpoint 1 at 0x198c1e9: main. (24 locations)
as there are a bunch of methods called main in the selftests, such as
selftests::string_view::capacity_1::main()
If such method was called in the constructor of a global object, or a
function marked with the attribute "constructor", then we would stop at
the wrong place. Also, this causes a few extra symtabs (those that
contain the "wrong" mains) to be expanded for nothing.
The dummiest, most straightforward solution is to add -qualified when
invoking tbreak. With this patch, "start" creates a single-location
breakpoint, as expected.
I copied the start.exp test to start-cpp.exp and made it use a C++ test
file, which contains two main functions. The new test verifies that the
output of "start" is the output we get when we set a single-location
breakpoint.
gdb/ChangeLog:
* infcmd.c (run_command_1): Pass -qualified to tbreak when usind
the "start" command.
gdb/testsuite/ChangeLog:
* gdb.base/start-cpp.exp: New file.
* gdb.base/start-cpp.cc: New file.
Robert Suchanek [Tue, 9 Apr 2019 09:30:26 +0000 (17:30 +0800)]
[MIPS] Add RDHWR with the SEL field for MIPS R6.
In Release 6 of the MIPS architecture [1], instruction RDHWR supports
a 3rd operand to serve as the 3-bit select field for the hardware
register.
[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 332-334
opcodes/
* mips-opc.c (mips_builtin_opcodes): Add RDHWR rt rd sel.
gas/
* testsuite/gas/mips/mips.exp: Run hwr-names test.
* testsuite/gas/mips/hwr-names.s: Add test cases for RDHWR with
the SEL field.
* testsuite/gas/mips/mipsr6@hwr-names.d: New file.
Kevin Buettner [Thu, 21 Mar 2019 03:38:33 +0000 (20:38 -0700)]
Rename python function thread_from_thread_handle to thread_from_handle
This renaming was done to stay consistent with the naming of the new
gdb.InferiorThread.handle method. I had initially named it "thread_handle"
but Tom Tromey suggested just "handle".
The old name (thread_from_thread_handle) still works, but is marked as
deprecated in comments in the code as well as in the documentation.
I have some code which uses these functions. I very much like the
brevity of the new names.
gdb/doc/ChangeLog:
* python.texi (Inferiors In Python): Rename
Inferior.thread_from_thread_handle to Inferior.thread_from_handle.
Add note about the former being deprecated.
gdb/ChangeLog:
* python/py-inferior.c (infpy_thread_from_thread_handle):
Adjust comments to reflect renaming of thread_from_thread_handle
to thread_from_handle. Adjust keywords. Fix type error message.
(inferior_object_methods): Add thread_from_handle. Retain
thread_from_thread_handle, but mark it as deprecated.
testsuite/ChangeLog:
* gdb.python/py-thrhandle.exp: Adjust tests to call
thread_from_handle instead of thread_from_thread_handle.
Kevin Buettner [Sun, 16 Sep 2018 04:53:38 +0000 (21:53 -0700)]
Documentation for python method InferiorThread.handle
gdb/doc/ChangeLog:
* python.texi (Threads In Python): Add description for method
InferiorThread.handle.
Kevin Buettner [Sun, 16 Sep 2018 04:15:49 +0000 (21:15 -0700)]
Tests for gdb.InferiorThread.handle
gdb/testsuite/ChangeLog:
* gdb.python/py-thrhandle.exp: Add tests for
gdb.InferiorThread.handle.
Kevin Buettner [Wed, 27 Feb 2019 22:06:28 +0000 (15:06 -0700)]
Support buffer objects as handles in Inferior.thread_from_thread_handle()
InferiorThread.handle() returns a python bytes object. We'd like to
be able to pass the output of this function, a thread handle, to
Inferior.thread_from_thread_handle(). Up to now,
thread_from_thread_handle() expects to receive a gdb.Value input.
This commit adds support to also allow a python buffer object to be
passed as the handle.
infpy_thread_from_thread_handle() calls find_thread_by_handle() which
has the obvious functionality. It used to pass the thread handle via
a struct value pointer. I've revised this interface to instead pass a
gdb::array_view<const gdb_byte> object. (Thanks to Tom Tromey for
suggesting this data structure over an earlier version which passed a
gdb_byte pointer and length.)
gdb/ChangeLog:
* gdbthread.h (find_thread_by_handle): Revise declaration.
* thread.c (find_thread_by_handle): Likewise. Adjust
implementation too.
* python/py-inferior.c (infpy_thread_from_thread_handle): Add
support for buffer objects as handles.
Kevin Buettner [Wed, 27 Feb 2019 21:59:02 +0000 (14:59 -0700)]
Add python method InferiorThread.handle
gdb/ChangeLog:
* python/py-infthread.c (thpy_thread_handle): New function.
(thread_object_methods): Register thpy_thread_handle.
Kevin Buettner [Fri, 8 Feb 2019 02:16:04 +0000 (19:16 -0700)]
Introduce target_ops method thread_info_to_thread_handle
This patch adds a thread_info_to_thread_handle method to the target_ops
struct. It also implements this functionality for remote targets and
linux native threads.
gdb/ChangeLog:
* gdbthread.h (thread_to_thread_handle): Declare.
* thread.c (gdbtypes.h): Include.
(thread_to_thread_handle): New function.
* target.h (struct target_ops): Add thread_info_to_thread_handle.
(target_thread_info_to_thread_handle): Declare.
* target.c (target_thread_info_to_thread_handle): New function.
* target-debug.h (target_debug_print_gdb_byte_vector): Define.
* target-delegates.c: Regenerate.
* linux-thread-db.c (class thread_db_target): Add method
thread_info_to_thread_handle.
(thread_db_target::thread_info_to_thread_handle): Define.
* remote.c (class remote_target): Add new method
thread_info_to_thread_handle.
(remote_target::thread_info_to_thread_handle): Define.
H.J. Lu [Tue, 9 Apr 2019 00:04:01 +0000 (17:04 -0700)]
x86: Define GNU_PROPERTY_X86_ISA_1_AVX512_BF16
Update assembler and readelf to support
#define GNU_PROPERTY_X86_ISA_1_AVX512_BF16 (1U << 24)
for AVX512_BF16.
binutils/
* readelf.c (decode_x86_isa): Handle
GNU_PROPERTY_X86_ISA_1_AVX512_BF16.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
gas/
* config/tc-i386.c (output_insn): Support
GNU_PROPERTY_X86_ISA_1_AVX512_BF16.
* testsuite/gas/i386/property-2.s: Add AVX512_BF16 test.
* testsuite/gas/i386/property-2.d: Updated.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.
include/
* elf/common.h (GNU_PROPERTY_X86_ISA_1_AVX512_BF16): New.
GDB Administrator [Tue, 9 Apr 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 8 Apr 2019 20:54:20 +0000 (13:54 -0700)]
XFAIL PR ld/20995 tests for lynxos and nto targets
lynxos and nto targets don't support RELRO.
* testsuite/ld-elf/shared.exp: XFAIL PR ld/20995 tests for
lynxos and nto targets.
Pedro Alves [Mon, 8 Apr 2019 12:03:54 +0000 (13:03 +0100)]
Some gdb_exception{,error,quit} tweaks
- Explicitly include <string> for std::string.
- Use std::make_shared to construct gdb_exception::message instead of
operator new, avoiding one heap allocation (2 instead of 3). Add
'const char *fmt, va_list ap' parameters to
gdb_exception{,error,quit}'s ctors, and do the std::make_shared in
the gdb_exception ctor.
- gdb_exception_error's constructor does not need to have an 'enum
return_reason' parameter, since it is always RETURN_ERROR, by
definition.
- Similarly, gdb_exception_quit's contructor does not need to have
'enum return_reason'/'enum errors' parameters.
- In the gdb_exception_{quit,_error} ctors that take a gdb_exception
as argument, assert that they're being passed a gdb_exception object
of the right 'reason'.
gdb/ChangeLog:
2019-04-08 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (throw_exception): Don't create
named object to throw; throw directly.
(throw_it): Likewise. Don't initialize gdb_exception::message
here, with new; pass FMT and AP to the ctor instead.
* common/common-exceptions.h: Include <string>.
(gdb_exception::gdb_exception(enum return_reason, enum errors,
const char *, va_list)): New ctor. Use std::make_shared.
(gdb_exception_error::gdb_exception_error(enum return_reason, enum
errors)): Delete.
(gdb_exception_error::gdb_exception_error(enum errors, const char
*, va_list)): New.
(gdb_exception_error::gdb_exception_error(const gdb_exception &)):
Add assertion.
(gdb_exception_quit::gdb_exception_quit(enum return_reason, enum
errors)): Delete.
(gdb_exception_quit::gdb_exception_quit(const char *, va_list)): New.
(gdb_exception_quit::gdb_exception_quit(const gdb_exception &)):
Add assertion.
H.J. Lu [Mon, 8 Apr 2019 18:58:51 +0000 (11:58 -0700)]
x86: Remove i386-*-kaos* and i386-*-chaos targets
Remove i386-*-kaos* and i386-*-chaos targets since they are no longer
supported by config.sub:
$ .../config.sub i386-kaos
Invalid configuration `i386-kaos': system `kaos' not recognized
$ .../config.sub i386-chaos
Invalid configuration `i386-chaos': system `chaos' not recognized
$
bfd/
* config.bfd: Remove i[3-7]86-*-kaos* and i[3-7]86-*-chaos targets.
gas/
* configure.tgt: Remove i386-*-kaos* and i386-*-chaos targets.
* testsuite/gas/i386/i386.exp: Remove *-*-caos* and "*-*-kaos*
check.
ld/
* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_chaos.c.
(eelf_i386_chaos.c): Removed.
* Makefile.in: Regenerated.
* configure.tgt: Remove i[3-7]86-*-kaos*.
* emulparams/elf_i386_chaos.sh: Removed.
H.J. Lu [Mon, 8 Apr 2019 18:34:32 +0000 (11:34 -0700)]
Count i386-moss as ELF
* testsuite/binutils-all/nm.exp: Count i386-moss as ELF.
H.J. Lu [Mon, 8 Apr 2019 18:27:57 +0000 (11:27 -0700)]
Use elf-x86.em for i386-moss and i386-beos
* emulparams/elf_i386_be.sh (EXTRA_EM_FILE): New.
* emulparams/i386moss.sh (EXTRA_EM_FILE): Likewise.
H.J. Lu [Mon, 8 Apr 2019 18:06:04 +0000 (11:06 -0700)]
x86: Consolidate AVX512 BF16 entries in i386-opc.tbl
1. Use single entry for vcvtne2ps2bf16 and vdpbf16ps with Disp8ShiftVL.
2. Use 5 entries, instead of 8, for vcvtneps2bf16.
* i386-opc.tbl: Consolidate AVX512 BF16 entries.
* i386-init.h: Regenerated.
Tom Tromey [Mon, 28 Jan 2019 17:45:45 +0000 (10:45 -0700)]
Replace throw_exception with throw in some cases
This replaces throw_exception with "throw;" when possible. This was
written by script. The rule that is followed is that uses of the
form:
catch (... &name)
{
...
throw_exception (name);
}
... can be rewritten. This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* valops.c (value_rtti_indirect_type): Replace throw_exception
with throw.
* tracefile-tfile.c (tfile_target_open): Replace throw_exception
with throw.
* thread.c (thr_try_catch_cmd): Replace throw_exception with
throw.
* target.c (target_translate_tls_address): Replace throw_exception
with throw.
* stack.c (frame_apply_command_count): Replace throw_exception
with throw.
* solib-spu.c (append_ocl_sos): Replace throw_exception with
throw.
* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
with throw.
* rs6000-tdep.c (rs6000_frame_cache)
(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
* remote.c: Replace throw_exception with throw.
* record-full.c (record_full_message, record_full_wait_1)
(record_full_restore): Replace throw_exception with throw.
* record-btrace.c:
(get_thread_current_frame_id, record_btrace_start_replaying)
(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
(cmd_record_btrace_start): Replace throw_exception with throw.
* parse.c (parse_exp_in_context_1): Replace throw_exception with
throw.
* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
(resume_stopped_resumed_lwps): Replace throw_exception with throw.
* linespec.c:
(find_linespec_symbols): Replace throw_exception with throw.
* infrun.c (displaced_step_prepare, resume): Replace
throw_exception with throw.
* infcmd.c (post_create_inferior): Replace throw_exception with
throw.
* inf-loop.c (inferior_event_handler): Replace throw_exception
with throw.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Replace throw_exception with throw.
* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
(get_prev_frame_always, get_frame_pc_if_available)
(get_frame_address_in_block_if_available, get_frame_language):
Replace throw_exception with throw.
* frame-unwind.c (frame_unwind_try_unwinder): Replace
throw_exception with throw.
* eval.c (fetch_subexp_value, evaluate_var_value)
(evaluate_funcall, evaluate_subexp_standard): Replace
throw_exception with throw.
* dwarf2loc.c (call_site_find_chain)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
Replace throw_exception with throw.
* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
with throw.
* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
throw.
* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
* completer.c (complete_line_internal): Replace throw_exception
with throw.
* compile/compile-object-run.c (compile_object_run): Replace
throw_exception with throw.
* cli/cli-script.c (process_next_line): Replace throw_exception
with throw.
* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
(btrace_enable, btrace_maint_update_pt_packets): Replace
throw_exception with throw.
* breakpoint.c (create_breakpoint, save_breakpoints): Replace
throw_exception with throw.
* break-catch-throw.c (re_set_exception_catchpoint): Replace
throw_exception with throw.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Replace throw_exception with throw.
* aarch64-tdep.c (aarch64_make_prologue_cache)
(aarch64_make_stub_cache): Replace throw_exception with throw.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
throw.
(linux_resume_one_lwp): Likewise.