]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
4 years agoPower10 stub selection
Alan Modra [Fri, 17 Jul 2020 07:17:28 +0000 (16:47 +0930)] 
Power10 stub selection

This patch better supports mixing of power10 and non-power10 code,
as might be seen in a cpu-optimized library using ifuncs to select
functions optimized for a given cpu.  Using -Wl,--no-power10-stubs
isn't that good in this situation since non-power10 notoc stubs are
slower and larger than the power10 variants, which you'd like to use
on power10 code paths.

With this change, power10 pc-relative code that makes calls marked
@notoc uses power10 stubs if stubs are necessary, and other calls use
non-power10 instructions in stubs.  This will mean that if gcc is
generating code for -mcpu=power10 but with pc-rel disabled then you'll
get the older stubs even on power10 (unless you force with
-Wl,--power10-stubs).  That shouldn't be too big a problem: stubs that
use r2 are reasonable.  It's just the ones that set up addressing
using "mflr 12; bcl 20,31,.+4; mflr 11; mtlr 12" that should be
avoided if possible.

bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
(select_alt_stub): New function.
(ppc_get_stub_entry): Use it here.
(ppc64_elf_check_relocs): Set had_power10_relocs rather than
power10_stubs.
(ppc64_elf_size_stubs): Clear power10_stubs here instead.  Don't
merge notoc stubs with other varieties when power10_stubs is "auto".
Instead dup the stub hash table entry.
(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
tests of power10_stubs.
ld/
* emultempl/ppc64elf.em (power10-stubs): Accept optional "auto" arg.
* ld.texi (power10-stubs): Update.
* testsuite/ld-powerpc/callstub-1.d: Force --power10-stubs.
* testsuite/ld-powerpc/callstub-2.d: Relax branch offset comparison.
* testsuite/ld-powerpc/callstub-4.d: New test.
* testsuite/ld-powerpc/notoc.d: Force --no-power10-stubs.
* testsuite/ld-powerpc/notoc3.d,
* testsuite/ld-powerpc/notoc3.s,
* testsuite/ld-powerpc/notoc3.wf: New test.
* testsuite/ld-powerpc/powerpc.exp: Run new tests.  Pass
--no-power10-stubs for notoc link.

(cherry picked from commit e10a07b32dc1faed25b5bbcbbc47d68e2ff537b9)

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 19 Jul 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 18 Jul 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 17 Jul 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 16 Jul 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agommix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol
Hans-Peter Nilsson [Wed, 15 Jul 2020 04:22:28 +0000 (06:22 +0200)] 
mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol

Spotted when inspecting gcc testsuite logs, but this already is
covered by the ld-mmix testsuite, it's just that the assert is ignored
since the regexp match is for a substring and not anchored.

With the anchors added but not the bugfix, the ld.log shows that the
asserts cause a non-match as intended:

Executing on host: sh -c {./ld-new   -LX/src/ld/testsuite/ld-mmix  -m elf64mmix -o tmpdir/dump tmpdir/undef-2.o tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'
failed with: <./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'>, expected: <\A[^\n\r]*undefined reference to `undefd'\Z>
FAIL: ld-mmix/undef-2

Gone with the fix of course, leaving just the intended "undefined
reference" line.

I'm not going to add anchors manually for all the "error:" strings in
the test-suite, not even in the mmix parts.  Sorry, but I'll just do
it for *these* specific undefined-reference tests.

Just a thought: maybe the run_dump_test "error:" string should
*automatically* get anchor marks prepended and appended for a single
line match as in the patch, "\A[^\n\r]*" prepended and \Z appended
unless either anchor mark or \r or \n is present in the regexp?

Committed.

bfd:
* elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.

ld/testsuite:
* testsuite/ld-mmix/undef-1.d, testsuite/ld-mmix/undef-1m.d,
testsuite/ld-mmix/undef-2.d, testsuite/ld-mmix/undef-2m.d: Add
start- and end-anchors to error-string to match just a
single-line error-message.

(cherry picked from commit a8a48c756c0da3a49008662e14ae582764ddd0bb)

4 years agox86: Don't display eiz with no scale
H.J. Lu [Wed, 15 Jul 2020 13:49:45 +0000 (06:49 -0700)] 
x86: Don't display eiz with no scale

Change

67 48 8b 1c 25 ef cd ab 89  mov    0x89abcdef(,%eiz,1),%rbx

to

67 48 8b 1c 25 ef cd ab 89  mov    0x89abcdef,%rbx

in AT&T syntax and

67 48 8b 1c 25 ef cd ab 89  mov    rbx,QWORD PTR [eiz*1+0x89abcdef]

to

67 48 8b 1c 25 ef cd ab 89  mov    rbx,QWORD PTR ds:0x89abcdef

in Intel syntax.

gas/

PR gas/26237
* testsuite/gas/i386/evex-no-scale-64.d: Updated.
* testsuite/gas/i386/addr32.d: Likewise.
* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
* testsuite/gas/i386/x86-64-addr32.d: Likewise.

opcodes/

PR gas/26237
* i386-dis.c (OP_E_memory): Don't display eiz with no scale
without base nor index registers.

(cherry picked from commit 04c662e2b66bedd050f97adec19afe0fcfce9ea7)

4 years agox86-64: Zero-extend lower 32 bits displacement to 64 bits
H.J. Lu [Tue, 14 Jul 2020 16:57:52 +0000 (09:57 -0700)] 
x86-64: Zero-extend lower 32 bits displacement to 64 bits

Since the addr32 (0x67) prefix zero-extends the lower 32 bits address to
64 bits, change disassembler to zero-extend the lower 32 bits displacement
to 64 bits when there is no base nor index registers.

gas/

PR gas/26237
* testsuite/gas/i386/addr32.s: Add tests for 32-bit wrapped around
address.
* testsuite/gas/i386/x86-64-addr32.s: Likewise.
* testsuite/gas/i386/addr32.d: Updated.
* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
* testsuite/gas/i386/x86-64-addr32.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-addr32-intel.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-addr32.d: Likewise.

opcodes/

PR gas/26237
* i386-dis.c (OP_E_memory): Without base nor index registers,
32-bit displacement to 64 bits.

(cherry picked from commit 8e58ef803cf752cbde547a5064540f05470ea714)

4 years agox86: Remove 32-bit sign extension in offset_in_range
H.J. Lu [Mon, 13 Jul 2020 17:18:39 +0000 (10:18 -0700)] 
x86: Remove 32-bit sign extension in offset_in_range

When encoding a 32-bit offset, there is no need to sign-extend it to 64
bits since only the lower 32 bits are used.

PR gas/26237
* config/tc-i386.c (offset_in_range): Remove 32-bit sign
extension.

(cherry picked from commit 7a705315596cf5effe01de8c3ac2535687c5663d)

4 years agoFix the generation of REL relocs for missing build notes.
Nick Clifton [Wed, 15 Jul 2020 11:53:59 +0000 (12:53 +0100)] 
Fix the generation of REL relocs for missing build notes.

* write.c (create_note_reloc): Add desc2_size parameter.  Zero out
the addend field of REL relocations.  Store the full addend into
the note for REL relocations.

4 years agoFix an illegal memory access in the BFD library which can be triggered by an attempt...
Nick Clifton [Wed, 15 Jul 2020 10:15:16 +0000 (11:15 +0100)] 
Fix an illegal memory access in the BFD library which can be triggered by an attempt to parse a corrupt PE format file.

PR26240
* coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
check for aux entries that overflow the buufer.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 15 Jul 2020 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 14 Jul 2020 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agopowerpc garbage collect test
Alan Modra [Thu, 9 Jul 2020 13:18:10 +0000 (22:48 +0930)] 
powerpc garbage collect test

ld's garbage collection test on powerpc64 catered for old compilers
(pre -mcmodel=medium support), setting options that caused the test to
fail.  Which meant the test wasn't really testing anything.  Get rid
of that old compiler support, and avoid -fPIE fails on ppc32.

* testsuite/ld-gc/gc.exp: Don't set -mminimal-toc for powerpc64,
and remove powerpc64 xfail.  Use -fno-PIE for ppc32.

(cherry picked from commit c560184eb2074570988c498aaae494d0c4b00328)

4 years agopr18841 tests on powerpc64
Alan Modra [Thu, 9 Jul 2020 07:05:27 +0000 (16:35 +0930)] 
pr18841 tests on powerpc64

The PR18841 test does cross-module calls from within an ifunc
resolver, which is nasty, and not supported in general since the
called function may not be relocated.  In this case the called
function (zoo) is just a stub so doesn't need relocating, but on ppc64
the function descriptor for zoo in the executable won't be relocated
at the time the shared library ifunc resolver runs.  That means the
test will fail if your compiler generates PIEs by default.

PR 18841
* testsuite/ld-ifunc/ifunc.exp: Run pr18841 tests non-pie.

(cherry picked from commit 470cd0faa7f433b47944683eee4fc3dad6ef7cdf)

4 years agoUpdated French translation for the gas/ and binutils/ sub-directories
Nick Clifton [Mon, 13 Jul 2020 13:48:15 +0000 (14:48 +0100)] 
Updated French translation for the gas/ and binutils/ sub-directories

4 years agoChange fatal errors about linking in executable files to simple warnings.
Nick Clifton [Mon, 13 Jul 2020 13:36:50 +0000 (14:36 +0100)] 
Change fatal errors about linking in executable files to simple warnings.

* ldelf.c (ldelf_after_open): Change fatal errors about linking in
executable files to simple warnings.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 13 Jul 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 12 Jul 2020 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 11 Jul 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoDocument powerpc64 ld options
Alan Modra [Fri, 10 Jul 2020 07:28:49 +0000 (16:58 +0930)] 
Document powerpc64 ld options

* ld.texi (PowerPC64 ELF64): Document --no-inline-optimize,
--power10-stubs and --no-power10-stubs.

(cherry picked from commit d882c9889312591a8bfdbc1740938780cd4032bd)

4 years agoPowerPC64 ld --no-power10-stubs
Alan Modra [Fri, 10 Jul 2020 01:18:45 +0000 (10:48 +0930)] 
PowerPC64 ld --no-power10-stubs

Needed for libraries that use ifuncs or other means to support
cpu-optimized versions of functions, some power10, some not, and those
functions make calls using linkage stubs.

bfd/
* elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
* elf64-ppc.c (struct ppc_link_hash_table): Delete
power10_stubs.
(ppc64_elf_check_relocs): Adjust setting of power10_stubs.
(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
uses of power10_stubs.
ld/
* emultempl/ppc64elf.em (params): Init new field.
(enum ppc64_opt): Add OPTION_POWER10_STUBS and OPTION_NO_POWER10_STUBS.
(PARSE_AND_LIST_LONGOPTS): Support --power10-stubs and
--no-power10-stubs.
(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Likewise.
* testsuite/ld-powerpc/callstub-3.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.

(cherry picked from commit d3b10ee787216d304a858246656ed2fdaecdfd93)

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 10 Jul 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoUpdate Turkish translation in the gprof sub-directory
Nick Clifton [Thu, 9 Jul 2020 13:24:42 +0000 (14:24 +0100)] 
Update Turkish translation in the gprof sub-directory

4 years agoUpdate French translation in the bfd sub-directory
Nick Clifton [Thu, 9 Jul 2020 13:21:42 +0000 (14:21 +0100)] 
Update French translation in the bfd sub-directory

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 9 Jul 2020 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 8 Jul 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agox86: Remove an incorrect AVX2 entry
H.J. Lu [Tue, 7 Jul 2020 12:06:38 +0000 (05:06 -0700)] 
x86: Remove an incorrect AVX2 entry

The upper 16 vector registers were added by AVX512.

PR gas/26212
* doc/c-i386.texi: Remove an incorrect AVX2 entry.

(cherry picked from commit dbdba9b04d4b91121357ac9a0402d67cb53ce7ce)

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Jul 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoReplacwe string length constant with "sizeof()-1" in previous delta to target-reloc.h.
Nick Clifton [Mon, 6 Jul 2020 12:56:34 +0000 (13:56 +0100)] 
Replacwe string length constant with "sizeof()-1" in previous delta to target-reloc.h.

4 years agoFix failures in the GOLD testsuite when run on systems that have been built with...
Nick Clifton [Mon, 6 Jul 2020 10:22:39 +0000 (11:22 +0100)] 
Fix failures in the GOLD testsuite when run on systems that have been built with annobin.

* target-reloc.h (Default_comdat_behaviour:get): Ignore discarded
relocs that refer to the .gnu.build.attributes section.
* testsuite/script_test_7.sh: Adjust expected address of the .bss
section.
* testsuite/script_test_9.sh: Do not expect the .init section to
immediately follow the .text section in the mapping of sections to
segments.

4 years agoUpdated translations for various binutils sub-directories
Nick Clifton [Mon, 6 Jul 2020 09:40:44 +0000 (10:40 +0100)] 
Updated translations for various binutils sub-directories

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Jul 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Jul 2020 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoSet version to 2.34.90 and regenerate files
Nick Clifton [Sat, 4 Jul 2020 09:41:03 +0000 (10:41 +0100)] 
Set version to 2.34.90 and regenerate files

4 years agoAdd markers for binutils 2.35 branch
Nick Clifton [Sat, 4 Jul 2020 09:16:22 +0000 (10:16 +0100)] 
Add markers for binutils 2.35 branch

4 years agogdb: make macro_stringify return a gdb::unique_xmalloc_ptr<char>
Simon Marchi [Fri, 3 Jul 2020 00:38:53 +0000 (20:38 -0400)] 
gdb: make macro_stringify return a gdb::unique_xmalloc_ptr<char>

The change to macro_stringify is straightforward.  This allows removing
the manual memory management in fixup_definition.

gdb/ChangeLog:

* macroexp.h (macro_stringify): Return
gdb::unique_xmalloc_ptr<char>.
* macroexp.c (macro_stringify): Likewise.
* macrotab.c (fixup_definition): Update.

Change-Id: Id7db8988bdbd569dd51c4f4655b00eb26db277cb

4 years agogdb: make macro_expand_next return a gdb::unique_xmalloc_ptr<char>
Simon Marchi [Fri, 3 Jul 2020 00:38:47 +0000 (20:38 -0400)] 
gdb: make macro_expand_next return a gdb::unique_xmalloc_ptr<char>

For some reason, macro_expand_next does not return a
gdb::unique_xmalloc_ptr<char>, like its counterparts macro_expand and
macro_expand_once.  This patch fixes that.

macro_buffer::release now returns a gdb::unique_xmalloc_ptr<char> too,
which required updating the other callers.  The `.release (). release
()` in macro_stringify looks a bit funny, but it's because one release
is for the macro_buffer, and the other is for the unique ptr.

I removed the ATTRIBUTE_UNUSED_RESULT on macro_buffer::release, I don't
really understand why it's there.  I don't see how this method could be
called without using the result, that would be an obvious memory leak.
The commit that introduced it (4e4a8b932b7 "Add ATTRIBUTE_UNUSED_RESULT
to macro_buffer") doesn't give any details.

gdb/ChangeLog:

* c-exp.y (scan_macro_expansion): Don't free `expansion`.
(lex_one_token): Update.
* macroexp.c (struct macro_buffer) <release>: Return
gdb::unique_xmalloc_ptr<char>.
(macro_stringify): Update.
(macro_expand): Update.
(macro_expand_next): Return gdb::unique_xmalloc_ptr<char>.
* macroexp.h (macro_expand_next): Likewise.

Change-Id: I67a74d0d479d2c20cdc82161ead7c54cea034f56

4 years agogdb: remove callback in macro expand functions
Simon Marchi [Fri, 3 Jul 2020 00:38:25 +0000 (20:38 -0400)] 
gdb: remove callback in macro expand functions

I started to look into changing the callbacks in macroexp.h to use
gdb::function_view.  However, I noticed that the passed lookup function
was always `standard_macro_lookup`, which looks up a macro in a
`macro_scope` object.  Since that doesn't look like a very useful
abstraction, it would be simpler to just pass the scope around and have
the various functions call standard_macro_lookup themselves.  This is
what this patch does.

gdb/ChangeLog:

* macroexp.h (macro_lookup_ftype): Remove.
(macro_expand, macro_expand_once, macro_expand_next): Remove
lookup function parameters, add scope parameter.
* macroexp.c (scan, substitute_args, expand, maybe_expand,
macro_expand, macro_expand_once, macro_expand_next): Likewise.
* macroscope.h (standard_macro_lookup): Change parameter type
to macro_scope.
* macroscope.c (standard_macro_lookup): Likewise.
* c-exp.y (lex_one_token): Update.
* macrocmd.c (macro_expand_command): Likewise.
(macro_expand_once_command): Likewise.

Change-Id: Id2431b1489359e1b0274dc2b81e5ea5d225d730c

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Jul 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agosim/igen: Fix linker error with -fno-common
Sebastian Huber [Thu, 2 Jul 2020 16:10:49 +0000 (18:10 +0200)] 
sim/igen: Fix linker error with -fno-common

GCC 10 enables -fno-common by default.  This resulted in multiple
definition linker errors since a global variable was declared and
defined in a header file:

  ld: libsim.a(idecode.o):sim/v850/idecode.h:71: multiple definition of
  `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
  here

  ld: libsim.a(engine.o):sim/v850/idecode.h:71: multiple definition of
  `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
  here

  ld: libsim.a(support.o):sim/v850/idecode.h:71: multiple definition of
  `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
  here

  ld: libsim.a(semantics.o):sim/v850/idecode.h:71: multiple definition
  of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first
  defined here

sim/igen

PR sim/26194

* lf.h (lf_get_file_type): Declare.
* lf.c (lf_get_file_type): Define.
* gen-idecode.c (print_idecode_issue_function_header): Use
lf_get_file_type() to issue an extern variable declaration in
case of header files.

4 years agosim/ppc: Fix linker error with -fno-common
Sebastian Huber [Wed, 1 Jul 2020 17:29:55 +0000 (19:29 +0200)] 
sim/ppc: Fix linker error with -fno-common

GCC 10 enables -fno-common by default.  This resulted in a multiple
definition linker error since global variables were declared and defined
in a header file:

  ld: ld-insn.o:sim/ppc/ld-insn.h:221: multiple definition of
  `max_model_fields_len'; igen.o:sim/ppc/ld-insn.h:221: first defined here

sim/ppc

* ld-insn.h (last_model, last_model_data, last_model_function,
last_model_internal, last_model_macro, last_model_static):
Delete.
(max_model_fields_len, model_data, model_functions,
model_internal, model_macros, model_static, models): Declare, but do not
define.
* ld-insn.c (last_model, last_model_data, last_model_function,
last_model_internal, last_model_macro, last_model_static,
max_model_fields_len, model_data, model_functions,
model_internal, model_macros, model_static, models): Define.

4 years agoFix gdb.base/structs2.exp with Clang
Pedro Alves [Thu, 2 Jul 2020 18:32:40 +0000 (19:32 +0100)] 
Fix gdb.base/structs2.exp with Clang

gdb.base/structs2.exp fails to run with Clang, because of:

 gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:14: warning:
       implicit conversion from 'int' to 'signed char' changes value from 130 to
       -126 [-Wconstant-conversion]
   param_reg (130, 120, 33000, 32000);
   ~~~~~~~~~  ^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:24: warning:
       implicit conversion from 'int' to 'short' changes value from 33000 to
       -32536 [-Wconstant-conversion]
   param_reg (130, 120, 33000, 32000);
   ~~~~~~~~~            ^~~~~
 2 warnings generated.

 === gdb Summary ===

 # of untested testcases         1

Fix it by passing actual negative numbers.

gdb/testsuite/ChangeLog:

* gdb.base/structs2.c (main): Adjust second parem_reg call to
explicitly write negative numbers.
* gdb.base/structs2.exp: Adjust expected output.

4 years agoFix gdb.base/charset.exp with Clang
Pedro Alves [Thu, 2 Jul 2020 14:54:36 +0000 (15:54 +0100)] 
Fix gdb.base/charset.exp with Clang

gdb.base/charset.exp fails to run with Clang, because of:

 gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:144:20: warning:
       implicit conversion from 'int' to 'char' changes value from 162 to -94
       [-Wconstant-conversion]
11, 162, 17);
    ^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:151:16: warning:
       implicit conversion from 'int' to 'char' changes value from 167 to -89
       [-Wconstant-conversion]
167,
^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:168:16: warning:
       implicit conversion from 'int' to 'char' changes value from 167 to -89
       [-Wconstant-conversion]
167,
^~~
 3 warnings generated.

 === gdb Summary ===

 # of untested testcases         1

Fix it by changing init_string to take unsigned char parameters.

gdb/testsuite/ChangeLog:

* gdb.base/charset.c (init_string): Change all char parameters to
unsigned char parameters.

4 years agoRemove stale -DNO_PROTOTYPES bits from gdb testsuite
Pedro Alves [Fri, 3 Jul 2020 12:34:22 +0000 (13:34 +0100)] 
Remove stale -DNO_PROTOTYPES bits from gdb testsuite

The gdb.base/call-sc.exp, gdb.base/structs.exp and
gdb.base/structs2.exp testcases still try compiling the sources with
-DNO_PROTOTYPES, but the corresponding sources don't have any #ifdef
NO_PROTOTYPES any longer.  Those were removed throughout years ago.

OTOH, gdb.base/ovlymgr.h does check for NO_PROTOTYPES, but no .exp
file compiles it with -DNO_PROTOTYPES.

gdb.base/reread.exp and gdb.base/varargs.exp set a 'prototypes'
global, which is a stale bit left behind when the "try-compiling
without and then with -DNO_PROTOTYPES" logic was around.

gdb/testsuite/ChangeLog:

* gdb.base/call-sc.exp (start_scalars_test): Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
* gdb.base/overlays.c: Remove references to PARAMS.
* gdb.base/ovlymgr.h (PARAMS): Delete, and remove all references.
* gdb.base/reread.exp: Don't set 'prototypes' global.
* gdb.base/structs.exp (start_structs_test): Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
* gdb.base/structs2.exp: Don't set 'prototypes' global.  Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
Don't issue "set width 0".  Remove gdb_stop_suppressing_tests
call.
* gdb.base/varargs.exp: Don't set 'prototypes' global.

4 years agoRemove stale overlay testcase bits
Pedro Alves [Fri, 3 Jul 2020 12:34:21 +0000 (13:34 +0100)] 
Remove stale overlay testcase bits

D10V support was removed years ago, but the gdb.base/d10vovly.c file
stayed behind.  Looking a bit closer, I can't find anywhere that
references gdb.base/m32rovly.c either.

Both gdb.base/m32rovly.c and gdb.base/d10vovly.c seem to be older
copies of gdb.base/ovlymgr.c, that are exactly the same, except for
some cosmetic differences, and for missing _ovly_debug_event.  Note
that gdb.base/ovlymgr.c has the #ifdef __M32R__ bits too.  Note also
that gdb.base/overlays.exp is currently only supported on m32r, and
that uses ovlymgr.c not gdb.base/m32rovly.c.

gdb/testsuite/ChangeLog:

* gdb.base/d10vovly.c: Delete.
* gdb.base/m32rovly.c: Delete.
* gdb.base/ovlymgr.c: Remove all code guarded by __D10V__.

4 years agoRe: Change readelf's display of symbol names
Alan Modra [Fri, 3 Jul 2020 05:59:13 +0000 (15:29 +0930)] 
Re: Change readelf's display of symbol names

Fixes some fallout from git commit 0942c7ab94e5.

PR 26028
gas/
* testsuite/gas/ia64/unwind-ilp32.d: Add -T to readelf options.
gold/
* testsuite/Makefile.am (file_in_many_sections.stdout): Add -W
to readelf options.
* testsuite/Makefile.in: Regenerate.
ld/
* testsuite/ld-arm/arm-elf.exp (vxworks1): Pass --wide to readelf
when dumping relocs.
* testsuite/ld-i386/i386.exp (vxworks1): Likewise.
* testsuite/ld-sh/sh-vxworks.exp (vxworks1): Likewise.
* testsuite/ld-sparc/sparc.exp (vxworks1): Likewise.
* testsuite/ld-arm/vxworks1.rd: Adjust to suit.
* testsuite/ld-i386/vxworks1.rd: Adjust.
* testsuite/ld-sh/vxworks1.rd: Adjust.
* testsuite/ld-sparc/vxworks1.rd: Adjust.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Jul 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agox86: Add SwapSources
H.J. Lu [Thu, 2 Jul 2020 13:30:00 +0000 (06:30 -0700)] 
x86: Add SwapSources

We check register-only source operand to decide if two source operands of
VEX encoded instructions should be swapped.  But source operands in AMX
instructions with two source operands swapped are all register-only
operand.  Add SwapSources to indicate two source operands should be
swapped.

gas/

* config/tc-i386.c (build_modrm_byte): Check vexswapsources to
swap two source operands.

opcodes/

* i386-gen.c (opcode_modifiers): Add VexSwapSources.
* i386-opc.h (VexSwapSources): New.
(i386_opcode_modifier): Add vexswapsources.
* i386-opc.tbl: Add VexSwapSources to BMI2 and BMI instructions
with two source operands swapped.
* i386-tbl.h: Regenerated.

4 years agoSkip fill-1 gas test for MeP targets.
Nick Clifton [Thu, 2 Jul 2020 13:08:16 +0000 (14:08 +0100)] 
Skip fill-1 gas test for MeP targets.

* testsuite/gas/all/fill-1.d: Skip for MeP targets.

4 years agoaarch64: Fix segfault on unicode symbols
Alex Coplan [Thu, 2 Jul 2020 12:53:07 +0000 (13:53 +0100)] 
aarch64: Fix segfault on unicode symbols

This patch fixes a segfault which occurs when the AArch64 backend parses
a symbol operand that begins with a register name and ends with a
unicode byte (byte value > 127).

For example, the following input causes the crash:

x0é: udf x0é

gas/ChangeLog:

2020-07-02  Alex Coplan  <alex.coplan@arm.com>

* config/tc-aarch64.c (reg_name_p): Fix cast so that we don't
segfault on negative chars.
* testsuite/gas/aarch64/reglike-label-unicode-segv.d: New test.
* testsuite/gas/aarch64/reglike-label-unicode-segv.s: Input.

4 years agogdb: remove unused fetch_inferior_event and inferior_event_handler parameters
Simon Marchi [Thu, 2 Jul 2020 12:37:26 +0000 (08:37 -0400)] 
gdb: remove unused fetch_inferior_event and inferior_event_handler parameters

I noticed that fetch_inferior_event receives the client_data parameter
from its caller, inferior_event_handler, but doesn't actually need it.
This patch removes it.  In turn, inferior_event_handler doesn't use its
parameter, so remove it too.

The `data` argument used when registering
remote_async_inferior_event_handler is changed to NULL, to avoid
confusion.  It could make people think that the value passed is used
somewhere, when in fact it's not.

gdb/ChangeLog:

* inf-loop.c (inferior_event_handler): Remove client_data param.
* inf-loop.h (inferior_event_handler): Likewise.
* infcmd.c (step_1): Adjust.
* infrun.c (proceed): Adjust.
(fetch_inferior_event): Remove client_data param.
(infrun_async_inferior_event_handler): Adjust.
* infrun.h (fetch_inferior_event): Remove `void *` param.
* linux-nat.c (handle_target_event): Adjust.
* record-btrace.c (record_btrace_handle_async_inferior_event):
Adjust.
* record-full.c (record_full_async_inferior_event_handler):
Adjust.
* remote.c (remote_async_inferior_event_handler): Adjust.

Change-Id: I3c2aa1eb0ea3e0985df096660d2dcd794674f2ea

4 years agoChange readelf's display of symbol names (when not in --wide mode) so that if they...
Nick Clifton [Thu, 2 Jul 2020 10:30:52 +0000 (11:30 +0100)] 
Change readelf's display of symbol names (when not in --wide mode) so that if they are going to be truncated then "[...]" is displayed at the end.  Add a comment line option to disable this enhancement and restore the old behaviour.

PR 26028
binutils* readelf.c (print_symbol): Handle truncation of symbol names.
(options): Add -T/--silent-truncation option.
(parse_args): Handle the option.
(print_dynamic_symbol): Correct calculation of width available to
display symbol name.
* doc/binutils.texi: Document the -T option to readelf.
* NEWS: Mention the new feature.

gas * testsuite/gas/ia64/group-2.d: Add -T option to readelf
command line.
* testsuite/gas/ia64/unwind.d: Likewise.
* testsuite/gas/mmix/bspec-1.d: Likewise.
* testsuite/gas/mmix/bspec-2.d: Likewise.
* testsuite/gas/mmix/comment-1.d: Likewise.
* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.

ld * testsuite/ld-powerpc/powerpc.exp: Add -T option to readelf
command line when running some tests.
* testsuite/ld-arm/arm-elf.exp: Likewise.
* testsuite/ld-mips-elf/mips-elf.exp: Likewise.
* testsuite/ld-mmix/local1.d: Likewise.
* testsuite/ld-mmix/local3.d: Likewise.
* testsuite/ld-mmix/local5.d: Likewise.
* testsuite/ld-mmix/local7.d: Likewise.
* testsuite/ld-powerpc/powerpc.exp: Likewise.

4 years agoMake tui_win_info::name pure virtual
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Make tui_win_info::name pure virtual

It seemed cleaner to me for tui_win_info::name to be pure virtual.
This meant adding a name method to the locator window; but this too
seems like an improvement.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_win_info) <name>: Now pure virtual.
* tui/tui-stack.h (struct tui_locator_window) <name>: New method.

4 years agoRemove tui_gen_win_info
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Remove tui_gen_win_info

This merges the tui_gen_win_info base class with tui_win_info;
renaming the resulting class to tui_win_info.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_win_info::refresh_window): Move from
tui_gen_win_info.
(tui_win_info::make_window): Merge with
tui_gen_win_info::make_window.
(tui_win_info::make_visible): Move from tui_gen_win_info.
* tui/tui-win.c (tui_win_info::max_width): Move from
tui_gen_win_info.
* tui/tui-layout.h (class tui_layout_window) <m_window>: Change
type.
<window_factory>: Likewise.
* tui/tui-layout.c (tui_win_info::resize): Move from
tui_gen_win_info.
(make_standard_window): Change return type.
(get_locator_window, tui_get_window_by_name): Likewise.
(tui_layout_window::apply): Remove a cast.
* tui/tui-data.h (MIN_WIN_HEIGHT): Move earlier.
(struct tui_win_info): Merge with tui_gen_win_info.
(struct tui_gen_win_info): Remove.

4 years agoDerive tui_locator_window from tui_win_info
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Derive tui_locator_window from tui_win_info

tui_locator_window is the last remaining concrete child class of
tui_gen_win_info.  It seems a bit cleaner to me to flatten the
hierarchy a bit; this patch prepares for that by changing
tui_locator_window to derive from tui_win_info.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.h (struct tui_locator_window): Derive from
tui_win_info.
<do_scroll_horizontal, do_scroll_vertical>: New methods.
<can_box>: New method.

4 years agoRemove body of tui_locator_window constructor
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Remove body of tui_locator_window constructor

The tui_locator_window constructor initializes the first character of
two of its members.  However, this is actually an error, since these
were changed to be std::string.  This removes the erroneous code.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.h (struct tui_locator_window): Remove body.

4 years agoDon't derive tui_data_item_window from tui_gen_win_info
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Don't derive tui_data_item_window from tui_gen_win_info

There's no deep reason that tui_data_item_window should derive from
tui_gen_win_info -- it currently uses a curses window to render, but
that isn't truly needed, and it adds some hacks to other parts of the
TUI.

This patch changes tui_data_item_window so that it doesn't have a base
class, and updates the register window.  This simplifies the code and
enables a subsequent cleanup.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::display_registers_from)
(tui_data_window::display_registers_from)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows): Update.
(tui_data_window::refresh_window, tui_data_window::no_refresh):
Remove.
(tui_data_window::check_register_values): Update.
(tui_data_item_window::rerender): Add parameters.  Update.
(tui_data_item_window::refresh_window): Remove.
* tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: No longer
virtual.
* tui/tui-regs.h (struct tui_data_item_window): Don't derive from
tui_gen_win_info.
<refresh_window, max_height, min_height>: Remove.
<rerender>: Add parameters.
<x, y, visible>: New members.
(struct tui_data_window) <refresh_window, no_refresh>: Remove.
<m_item_width>: New member.

4 years agoRename tui_data_item_window::item_no
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Rename tui_data_item_window::item_no

tui_data_item_window::item_no is misnamed -- it only can be used for a
register, but it references a "display" number as well.  (Based on
other comments I've seen in the past -- most since deleted -- I think
there were plans at one point to display variables in this window as
well.  However, this was never implemented.)

This patch renames this member to be more correct.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::show_register_group)
(tui_data_window::check_register_values): Update.
* tui/tui-regs.h (struct tui_data_item_window) <regno>: Rename
from item_no.

4 years agoRemove useless "if' from tui-regs.c
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Remove useless "if' from tui-regs.c

tui_data_window::show_register_group had a useless "if" -- the
condition could never be false.  This patch removes it.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::show_register_group): Remove
useless "if".

4 years agoRemove tui_data_window::name
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Remove tui_data_window::name

The "name" member of tui_data_window was set, but never used.  This
removes it.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::show_register_group): Update.
* tui/tui-regs.h (struct tui_data_item_window) <name>: Remove.

4 years agoMove some code out of tui-data.h
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Move some code out of tui-data.h

This moves some code out of tui-data.h, to more closely related
places.  Some unused forward declarations are also removed.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.c (SINGLE_KEY): Move from tui-data.h
* tui/tui-winsource.h (enum tui_line_or_address_kind)
(struct tui_line_or_address): Move from tui-data.h.
* tui/tui-win.c (DEFAULT_TAB_LEN): Move from tui-data.h.
* tui/tui-data.h (DEFAULT_TAB_LEN): Move to tui-win.c.
(tui_cmd_window, tui_source_window_base, tui_source_window)
(tui_disasm_window): Don't declare.
(enum tui_line_or_address_kind, struct tui_line_or_address): Move
to tui-winsource.h.
(SINGLE_KEY): Move to tui-stack.c.

4 years agoRemove tui_expand_tabs
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Remove tui_expand_tabs

tui_expand_tabs only has a single caller.  This patch removes this
function, in favor of a tab-expanding variant of string_file.  This
simplifies the code somewhat.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_item_window) <content>: Now a
std::string.
* tui/tui-regs.c (class tab_expansion_file): New.
(tab_expansion_file::write): New method.
(tui_register_format): Change return type.  Use
tab_expansion_file.
(tui_get_register, tui_data_window::display_registers_from)
(tui_data_item_window::rerender): Update.
* tui/tui-io.h (tui_expand_tabs): Don't declare.
* tui/tui-io.c (tui_expand_tabs): Remove.

4 years agoUse complete_on_enum in tui_reggroup_completer
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)] 
Use complete_on_enum in tui_reggroup_completer

tui_reggroup_completer has an "XXXX" comment suggesting the use of
complete_on_enum.  This patch implements this suggestion.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Jul 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoRecognize -1 as a tombstone value in .debug_line
Fangrui Song [Wed, 1 Jul 2020 19:31:44 +0000 (12:31 -0700)] 
Recognize -1 as a tombstone value in .debug_line

LLD from 11 onwards (https://reviews.llvm.org/D81784) uses -1 to
represent a relocation in .debug_line referencing a discarded symbol.
Recognize -1 to fix gdb.base/break-on-linker-gcd-function.exp when the
linker is a newer LLD.

gdb/ChangeLog:

* dwarf2/read.c (lnp_state_machine::check_line_address): Test -1.

4 years agoPR26188, buff overflow in coff_find_nearest_line_with_names
Alan Modra [Wed, 1 Jul 2020 07:24:50 +0000 (16:54 +0930)] 
PR26188, buff overflow in coff_find_nearest_line_with_names

PR 26188
* coffgen.c (coff_find_nearest_line_with_names): Sanity check
raw syment index before dereferencing.

4 years agoAllow reference form for DW_AT_associated and DW_AT_allocated attributes
Alok Kumar Sharma [Wed, 1 Jul 2020 06:23:09 +0000 (11:53 +0530)] 
Allow reference form for DW_AT_associated and DW_AT_allocated attributes

Currently, GDB rejects the (die) reference form while it accepts exprloc
form. It is allowed in DWARF standard. "Table 7.5: Attribute encodings"
in DWARF5 standard. Flang compiler assigns (die) reference to
DW_AT_associated and DW_AT_allocated for some cases.

gdb/ChangeLog

* dwarf2/read.c (set_die_type): Removed conditions to restrict
forms for DW_AT_associated and DW_AT_allocated attributes,
which is already checked in function attr_to_dynamic_prop.

4 years agoRe: Remove x86 NaCl target support
Alan Modra [Wed, 1 Jul 2020 07:22:02 +0000 (16:52 +0930)] 
Re: Remove x86 NaCl target support

Fixes accidental breakage of vxworks by commit bbd19b19e4.

* elf32-i386.c (elf_backend_object_p): Undef for vxworks.

4 years agoobsolete xc16x
Alan Modra [Tue, 30 Jun 2020 23:45:34 +0000 (09:15 +0930)] 
obsolete xc16x

The xc16x md_apply_fix code is just so broken that in my opinion the
target should never have been accepted, and from a quick look at
commit logs for the target it appears that no one has ever contributed
fixes for anything.  This target has just been a 14 year burden on
global binutils and cgen maintainers.  That's not how free software is
supposed to work.

bfd/
* config.bfd: Obsolete xc16x.
gas/
* config/tc-xc16x.c (md_apply_fix): Add FIXME.

4 years agogas eqv-dot test fails
Alan Modra [Tue, 30 Jun 2020 23:44:45 +0000 (09:14 +0930)] 
gas eqv-dot test fails

* testsuite/gas/all/eqv-dot.d: xfail targets that set linkrelax
in data sections, and mep.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Jul 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoUpdate readline/README to mention patchlevel
Tom Tromey [Tue, 30 Jun 2020 21:17:07 +0000 (15:17 -0600)] 
Update readline/README to mention patchlevel

This updates readline/README to mention the current patchlevel, and
the "git am" approach to importing new upstream patches.

readline/ChangeLog
2020-06-30  Tom Tromey  <tom@tromey.com>

* README: Update instructions.

4 years agoproblems restoring the history file are not signaled correctly to the calling application
Chet Ramey [Fri, 7 Feb 2020 19:58:55 +0000 (14:58 -0500)] 
problems restoring the history file are not signaled correctly to the calling application

4 years agoreading history entries with timestamps can result in joined entries
Chet Ramey [Fri, 7 Feb 2020 19:57:47 +0000 (14:57 -0500)] 
reading history entries with timestamps can result in joined entries

4 years agofix problems moving back beyond start of history
Chet Ramey [Fri, 7 Feb 2020 19:56:45 +0000 (14:56 -0500)] 
fix problems moving back beyond start of history

4 years agoReadline-8.0 patch 1: fix file descriptor leak with zero-length history file
Chet Ramey [Wed, 14 Aug 2019 15:28:48 +0000 (11:28 -0400)] 
Readline-8.0 patch 1: fix file descriptor leak with zero-length history file

4 years agoFix test breakages caused by removal of gdb_py_test_multiple.
Philippe Waroquiers [Tue, 30 Jun 2020 16:40:21 +0000 (18:40 +0200)] 
Fix test breakages caused by removal of gdb_py_test_multiple.

Tom de Vries detected that some python tests were broken as
they were still using gdb_py_test_multiple that was replaced
by gdb_test_multiline.  Repair these tests by using the new function.

gdb/testsuite/ChangeLog
2020-06-30  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.python/py-breakpoint.exp: use gdb_test_multiline instead
of gdb_py_test_multiple.
* gdb.python/py-cmd.exp: Likewise.
* gdb.python/py-events.exp: Likewise.
* gdb.python/py-function.exp: Likewise.
* gdb.python/py-inferior.exp: Likewise.
* gdb.python/py-infthread.exp: Likewise.
* gdb.python/py-linetable.exp: Likewise.
* gdb.python/py-parameter.exp: Likewise.
* gdb.python/py-value.exp: Likewise.

4 years agoRemove x86 NaCl target support
H.J. Lu [Tue, 30 Jun 2020 15:47:02 +0000 (08:47 -0700)] 
Remove x86 NaCl target support

NaCl has been deprecated:

https://developer.chrome.com/native-client/migration

and NaCl will completely disappear in 2021:

https://lists.llvm.org/pipermail/llvm-dev/2020-April/141107.html

Remove x86 NaCl target support from bfd, binutils, gas and ld.

bfd/

* archures.c (bfd_mach_i386_nacl): Removed.
(bfd_mach_i386_i386_nacl): Likewise.
(bfd_mach_x86_64_nacl): Likewise.
(bfd_mach_x64_32_nacl): Likewise.
* config.bfd: Remove *-*-nacl* targets.
* configure.ac: Remove x86 NaCl target vectors.
* cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
(bfd_x64_32_nacl_arch): Likewise.
(bfd_x86_64_nacl_arch): Likewise.
(bfd_i386_nacl_arch): Likewise.
(bfd_x64_32_arch_intel_syntax): Updated.
* elf32-i386.c: Don't include "elf-nacl.h".
(elf_i386_nacl_plt): Removed.
(elf_i386_nacl_plt0_entry): Likewise.
(elf_i386_nacl_plt_entry): Likewise.
(elf_i386_nacl_pic_plt0_entry): Likewise.
(elf_i386_nacl_pic_plt_entry): Likewise.
(elf_i386_nacl_eh_frame_plt): Likewise.
(elf_i386_nacl_plt): Likewise.
(elf32_i386_nacl_elf_object_p): Likewise.
(elf_i386_get_synthetic_symtab): Updated.
(elf_i386_link_setup_gnu_properties): Likewise.
* elf64-x86-64.c: Don't include "elf-nacl.h".
(elf_x86_64_nacl_plt): Removed.
(elf64_x86_64_nacl_elf_object_p): Likewise.
(elf_x86_64_nacl_plt0_entry): Likewise.
(elf_x86_64_nacl_plt_entry): Likewise.
(elf_x86_64_nacl_eh_frame_plt): Likewise.
(elf_x86_64_nacl_plt): Likewise.
(elf32_x86_64_nacl_elf_object_p): Likewise.
(elf_x86_64_get_synthetic_symtab): Updated.
(elf_x86_64_link_setup_gnu_properties): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
* targets.c: Remove x86 NaCl target vectors.
* bfd-in2.h: Regenerated.
* configure: Likewise.

binutils/

* NEWS: Mention x86 NaCl target support removal.
* dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): Remove
x86 NaCl target support.
* testsuite/binutils-all/elfedit-1.d: Likewise.
* testsuite/binutils-all/i386/i386.exp: Likewise.
* testsuite/binutils-all/x86-64/objects.exp: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/x86-64.exp: Likewise.

gas/

* NEWS: Mention x86 NaCl target support removal.
* config/tc-i386.c: Remove x86 NaCl target support.
* config/tc-i386.h: Likewise.
* configure.tgt: Likewise.
* testsuite/gas/i386/i386.exp: Likewise.
* testsuite/gas/i386/iamcu-1.d: Likewise.
* testsuite/gas/i386/iamcu-2.d: Likewise.
* testsuite/gas/i386/iamcu-3.d: Likewise.
* testsuite/gas/i386/iamcu-4.d: Likewise.
* testsuite/gas/i386/iamcu-5.d: Likewise.
* testsuite/gas/i386/k1om.d: Likewise.
* testsuite/gas/i386/l1om.d: Likewise.

ld/

* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_nacl.c,
eelf32_x86_64_nacl.c, eelf_x86_64_nacl.c.
Remove x86 NaCl dep files.
* NEWS: Mention x86 NaCl target support removal.
* configure.tgt: Remove x86 NaCl target support.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/elf.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-i386/align-branch-1.d: Likewise.
* testsuite/ld-i386/export-class.exp: Likewise.
* testsuite/ld-i386/i386.exp: Likewise.
* testsuite/ld-i386/load1.d: Likewise.
* testsuite/ld-i386/pie1.d: Likewise.
* testsuite/ld-i386/pr12570a.d: Likewise.
* testsuite/ld-i386/pr12570b.d: Likewise.
* testsuite/ld-i386/pr19636-1d.d: Likewise.
* testsuite/ld-i386/pr19636-1l.d: Likewise.
* testsuite/ld-i386/pr19636-2c.d: Likewise.
* testsuite/ld-i386/pr19636-2d.d: Likewise.
* testsuite/ld-i386/pr19636-2e.d: Likewise.
* testsuite/ld-i386/pr20244-1a.d: Likewise.
* testsuite/ld-i386/pr20244-1b.d: Likewise.
* testsuite/ld-i386/pr20244-2a.d: Likewise.
* testsuite/ld-i386/pr20244-2b.d: Likewise.
* testsuite/ld-i386/pr20244-2c.d: Likewise.
* testsuite/ld-i386/pr20244-4a.d: Likewise.
* testsuite/ld-i386/pr20244-4b.d: Likewise.
* testsuite/ld-i386/pr21884.d: Likewise.
* testsuite/ld-ifunc/binutils.exp: Likewise.
* testsuite/ld-ifunc/ifunc-10-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-x86-64/align-branch-1.d: Likewise.
* testsuite/ld-x86-64/dwarfreloc.exp: Likewise.
* testsuite/ld-x86-64/line.exp: Likewise.
* testsuite/ld-x86-64/load1a.d: Likewise.
* testsuite/ld-x86-64/load1b.d: Likewise.
* testsuite/ld-x86-64/load1c.d: Likewise.
* testsuite/ld-x86-64/load1d.d: Likewise.
* testsuite/ld-x86-64/pie3.d: Likewise.
* testsuite/ld-x86-64/pr18160.d: Likewise.
* testsuite/ld-x86-64/pr19013-x32.d: Likewise.
* testsuite/ld-x86-64/pr19013.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr20253-1b.d: Likewise.
* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
* testsuite/ld-x86-64/pr20253-1f.d: Likewise.
* testsuite/ld-x86-64/pr20253-1h.d: Likewise.
* testsuite/ld-x86-64/pr20253-1j.d: Likewise.
* testsuite/ld-x86-64/pr20253-1l.d: Likewise.
* testsuite/ld-x86-64/pr21884.d: Likewise.
* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
* testsuite/ld-x86-64/tlsgd10.dd: Likewise.
* testsuite/ld-x86-64/tlsgd5.dd: Likewise.
* testsuite/ld-x86-64/tlsgd8.dd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* emulparams/elf32_x86_64_nacl.sh: Removed.
* emulparams/elf_i386_nacl.sh: Likewise.
* emulparams/elf_x86_64_nacl.sh: Likewise.
* testsuite/ld-i386/emit-relocs-nacl.rd: Likewise.
* testsuite/ld-i386/load1-nacl.d: Likewise.
* testsuite/ld-i386/pie1-nacl.d: Likewise.
* testsuite/ld-i386/plt-nacl.pd: Likewise.
* testsuite/ld-i386/plt-pic-nacl.pd: Likewise.
* testsuite/ld-i386/pr17709-nacl.rd: Likewise.
* testsuite/ld-i386/pr19636-1d-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2c-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2d-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2e-nacl.d: Likewise.
* testsuite/ld-i386/pr19827-nacl.rd: Likewise.
* testsuite/ld-i386/pr21884-nacl.d: Likewise.
* testsuite/ld-i386/pr21884-nacl.t: Likewise.
* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic2-nacl.rd: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/load1a-nacl.d: Likewise.
* testsuite/ld-x86-64/load1b-nacl.d: Likewise.
* testsuite/ld-x86-64/load1c-nacl.d: Likewise.
* testsuite/ld-x86-64/load1d-nacl.d: Likewise.
* testsuite/ld-x86-64/pie3-nacl.d: Likewise.
* testsuite/ld-x86-64/plt-nacl.pd: Likewise.
* testsuite/ld-x86-64/pr17709-nacl.rd: Likewise.
* testsuite/ld-x86-64/pr19013-nacl.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise.
* testsuite/ld-x86-64/pr19827-nacl.rd: Likewise.
* testsuite/ld-x86-64/pr21884-nacl.d: Likewise.
* testsuite/ld-x86-64/pr21884-nacl.t: Likewise.
* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.pd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise.
* Makefile.in: Regenerated.
* po/BLD-POTFILES.in: Likewise.

4 years agoFix bug in quirk_rust_enum
Tom Tromey [Tue, 30 Jun 2020 13:57:35 +0000 (07:57 -0600)] 
Fix bug in quirk_rust_enum

Tom de Vries pointed out that some Rust tests were failing after the
variant part rewrite.  He sent an executable, which helped track down
this bug.

quirk_rust_enum was passing 1 to alloc_rust_variant in one case.
However, a comment earlier says:

      /* We don't need a range entry for the discriminant, but we do
 need one for every other field, as there is no default
 variant.  */

In this case, we must pass -1 for this parameter.  That is what this
patch implements.

gdb/ChangeLog
2020-06-30  Tom Tromey  <tromey@adacore.com>

* dwarf2/read.c (quirk_rust_enum): Correctly call
alloc_rust_variant for default-less enum.

4 years agoDo not define basic_string_view::to_string
Tom Tromey [Tue, 30 Jun 2020 13:53:03 +0000 (07:53 -0600)] 
Do not define basic_string_view::to_string

gdb's copy of basic_string_view includes a to_string method.  However,
according to cppreference, this is not a method on the real
std::basic_string_view:

https://en.cppreference.com/w/cpp/string/basic_string_view

This difference matters because gdb_string_view.h will use the
standard implementation when built with a C++17 or later.  This caused
PR build/26183.

This patch fixes the problem by changing the method to be a standalone
helper function, and then rewriting the uses.  Tested by rebuilding
with a version of GCC that defaults to C++17.

(Note that the build still is not clean; and also I noticed that the
libstdc++ string_view forbids the use of nullptr ... I wonder if gdb
violates that.)

gdb/ChangeLog
2020-06-30  Tom Tromey  <tromey@adacore.com>

PR build/26183:
* ada-lang.c (ada_lookup_name_info::ada_lookup_name_info): Use
gdb::to_string.

gdbsupport/ChangeLog
2020-06-30  Tom Tromey  <tromey@adacore.com>

PR build/26183:
* gdb_string_view.h (basic_string_view::to_string): Remove.
(gdb::to_string): New function.

4 years agoAdd support for attributes using DW_FORM_GNU_strp_alt
Nick Clifton [Tue, 30 Jun 2020 12:05:18 +0000 (13:05 +0100)] 
Add support for attributes using DW_FORM_GNU_strp_alt

* dwarf.c (read_and_display_attr_value): Support
DW_FORM_GNU_strp_alt when used with DW_AT_dwo_name and
DW_AT_comp_dir.

4 years ago[gdb/testsuite] Handle early_flags in gdb_default_target_compile
Tom de Vries [Tue, 30 Jun 2020 07:23:09 +0000 (09:23 +0200)] 
[gdb/testsuite] Handle early_flags in gdb_default_target_compile

In gdb_default_target_compile, we use dejagnu's default_target_compile, unless
we need support for languages that are not yet support in the used dejagnu
version, in which case we use a local default_target_compile:
gdb_default_target_compile_1.

However, there's another reason to use the local default_target_compile: when
early_flags is used, because there's no dejagnu release available yet
supporting this.

Fix this by detecting and handling early_flags in gdb_default_target_compile.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-30  Tom de Vries  <tdevries@suse.de>

PR testsuite/26175
* lib/future.exp (gdb_default_target_compile): Detect and handle
early_flags.

4 years agosolaris XPASS ld-elf/group1
Alan Modra [Tue, 30 Jun 2020 04:42:49 +0000 (14:12 +0930)] 
solaris XPASS ld-elf/group1

* testsuite/ld-elf/group1.d: Don't xfail all solaris targets, just
ix86 and x86_64.

4 years agoDon't xfail nds32 for ld-elf/reloc-discard test
Alan Modra [Tue, 30 Jun 2020 04:17:32 +0000 (13:47 +0930)] 
Don't xfail nds32 for ld-elf/reloc-discard test

* testsuite/ld-elf/reloc-discard.d: Don't xfail nds32.

4 years agoFix nds32*-elf XPASS readelf -wiaoRlL dw5
Alan Modra [Tue, 30 Jun 2020 03:45:29 +0000 (13:15 +0930)] 
Fix nds32*-elf XPASS readelf -wiaoRlL dw5

The underlying fail was probably fixed with git commit fbaf61ad5.

* testsuite/binutils-all/readelf.exp (readelf_dump_test): Remove
xfail for nds32.

4 years agomicroblaze-linux XPASS ld-elf/var1
Alan Modra [Tue, 30 Jun 2020 03:52:52 +0000 (13:22 +0930)] 
microblaze-linux XPASS ld-elf/var1

microblaze-linux uses the standard ELF script, microblaze-elf its own
script lacking an input section pattern needed to make this test pass.
Add the missing pattern for .data, in line with most other sections
that do have .* patterns.

* scripttempl/elfmicroblaze.sc (.data): Add .data.* entry.
* testsuite/ld-elf/var1.d: Don't xfail microblaze.

4 years agoRISC-V: Support debug and float CSR as the unprivileged ones.
Nelson Chu [Mon, 8 Jun 2020 02:54:53 +0000 (10:54 +0800)] 
RISC-V: Support debug and float CSR as the unprivileged ones.

The unprivileged CSR should be controlled by other specific specs rather
than the privileged spec.  For example, the debug CSR should be controlled
by the debug spec, and the float CSR should be controlled by the float
spec.  User may use assembler options to choose what the debug and other
specs they want, or may encode the versions of specs into the architecture
string directly.  Since we haven't decided which one is better, we set the
defined and aborted versions of unprivileged CSR to PRIV_SPEC_CLASS_NONE
in the include/opcode/riscv-opc.h, to tell assembler don't check priv spec
versions for them.  However, these PRIV_SPEC_CLASS_NONE will be changed
to FLOAT_SPEC_CLASS_* and DEBUG_SPEC_CLASS_* in the future.

gas/
* config/tc-riscv.c (riscv_csr_class_check): Removed.  Move the
checking into riscv_csr_address.
(riscv_csr_version_check): Likewise.
(riscv_csr_address): New function.  Return the suitable CSR address
after checking the ISA dependency and versions.  Issue warnings if
we find any conflict and -mcsr-check is set.  CSR_CLASS_F and
CSR_CLASS_DEBUG are unprivileged CSR for now, so don't check the
priv spec versions for them.
(reg_csr_lookup_internal): Call riscv_csr_address to find the
suitable CSR address.

* testsuite/gas/riscv/priv-reg-fail-fext.d: Remove -mpriv-spec=1.11.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise.
* testsuite/gas/riscv/priv-reg-fail-fext.l:  We don't care the
priv spec warnings here.  These warnings are added by accident.
Remove them and only focus on the ISA dependency warnings.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-version-1p9.l: Updated since
dscratch0 and dscratch1 are regarded as the unprivileged CSR rather
than the privileged ones.
* testsuite/gas/riscv/priv-reg-fail-version-1p9p1.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise.
* testsuite/gas/riscv/priv-reg.s: Likewise.  Add missing debug CSR.
* testsuite/gas/riscv/priv-reg-version-1p9.d: Likewise.
* testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise.
* testsuite/gas/riscv/priv-reg-version-1p10.d: Likewise.
* testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise.
* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.

include/
* opcode/riscv-opc.h: Support the unprivileged CSR.  The versions
of the unprivileged CSR should be PRIV_SPEC_CLASS_NONE for now.
* opcode/riscv.h (enum riscv_csr_class): Add CSR_CLASS_DEBUG.

opcodes/
* riscv-dis.c (print_insn_args, case 'E'): Updated.  Let the
unprivileged CSR can also be initialized.

4 years agoRISC-V: Cleanup the include/opcode/riscv-opc.h.
Nelson Chu [Tue, 23 Jun 2020 06:23:51 +0000 (14:23 +0800)] 
RISC-V: Cleanup the include/opcode/riscv-opc.h.

The include/opcode/riscv-opc.h file is no longer automatically generated,
so we remove the misleading comments and add new ones.  Besides, the CAUSE_*
macros and DECLARE_CAUSE are unused for binutils and gdb.  Therefore, remove
them, too.

include/
* opcode/riscv-opc.h: Cleanup and remove the unused macros.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Jun 2020 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: fix documentation of gdbarch_displaced_step_copy_insn
Simon Marchi [Mon, 29 Jun 2020 15:27:40 +0000 (11:27 -0400)] 
gdb: fix documentation of gdbarch_displaced_step_copy_insn

I spotted something that looks wrong in the doc of
gdbarch_displaced_step_copy_insn.

It says that if the function returns NULL, it means that it has emulated
the behavior of the instruction and written the result to REGS.
However, it says below that the function may return NULL to indicate
that the instruction can't be single-stepped out-of-line, in which case
the core steps the instruction in-line.  The two are contradictory.

The right one is the latter, if the function returns NULL, the core
falls back to in-line stepping. I checked all the implementations of
this function and they all agree with this.

gdb/ChangeLog:

* gdbarch.sh (displaced_step_copy_insn): Update doc.
* gdbarch.h: Re-generate.

Change-Id: I98163cdd38970cde4c77680e249b10f5d2d5bf9b

4 years agogdb/testsuite: better handle failures in simavr board, reap simavr process
Simon Marchi [Mon, 29 Jun 2020 14:19:43 +0000 (10:19 -0400)] 
gdb/testsuite: better handle failures in simavr board, reap simavr process

This patch makes a few adjustments to the simavr.exp to handle tests
that error out more gracefully.  I put all the changes in the same patch
because right now it's in a very bad shape, so it's very painful to do
small incremental adjustements.  I found that with these changes, it
becomes reasonably stable.

For example, the gdb.base/step-over-syscall.exp test is a bit buggy
(stuff for another patch...), in that it calls gdb_load (through
clean_restart) with a file that doesn't exist.  The gdb_load
implementation in simavr.exp gets called with a file that doesn't exist,
and simavr (expectedly) fails to start.

When this happens, we currently leave the $simavr_spawn_id variable set.
However, because the simavr process has terminated, its spawn id is
closed.  When the next test tries to close the previous connection to
simavr, it fails to, and this error is thrown:

    ERROR: close: spawn id exp86 not open
        while executing
    "close -i $simavr_spawn_id"
        (procedure "gdb_load" line 18)
        invoked from within

In other words, any test ran after step-over-syscall.exp will have
simavr.exp's gdb_load fail on it.

This patch tries to make sure that simavr.exp's gdb_load only leaves
simavr_spawn_id set if everything went fine.  If we couldn't start
simavr, don't see the expected output, or fail to connect to it, we
close the spawn id (if needed) and unset simavr_spawn_id.

As an additional precaution, I added a catch around the "close the
previous connection" code.  Ideally, this shouldn't be necessary, but I
bet there are other similar scenarios where we might try to close an
already close spawn id.  So I think displaying a warning is better than
messing up all following tests.

Also, the board never wait'ed for the simavr process, resulting in tons
of zombie simavr processes hanging around.  This patch adds some calls
to "wait" whenever we close the connection (or realize it is already
closed), which seems to fix the problem.

Finally I switched a `gdb_expect` to bare `expect`, where we wait for
the "listening" message from simavr.  I found it necessary because
gdb_expect (through remote_expect) adds a `-i <gdb spawn id> -timeout
10`.  So if for some reason the GDB process has crashed in the mean
time, this expect will unexpectedly error out with a `spawn id <gdb
spawn id> not open`.  Therefore, change `gdb_expect` to `expect` so that
we only deal with simavr's spawn id here.

Here are the results on TESTS="gdb.base/*.exp" before:

    # of expected passes 4816
    # of unexpected failures 4433
    # of known failures 2
    # of unresolved testcases 300
    # of untested testcases 143
    # of unsupported tests 7
    # of paths in test names 2
    # of duplicate test names 10

and after:

    # of expected passes 21957
    # of unexpected failures 1564
    # of expected failures 8
    # of unknown successes 1
    # of known failures 31
    # of unresolved testcases 532
    # of untested testcases 153
    # of unsupported tests 28
    # of paths in test names 2
    # of duplicate test names 32

I tested using simavr's current master (7c254e2081b5).

gdb/testsuite/ChangeLog:

* boards/simavr.exp (gdb_load): Catch errors when closing
previous connection.  Close connection, wait for process and
unset simavr_spawn_id on failure.

Change-Id: I695fc765e1c22e1d1dc0b08e0f5141244986b868

4 years agox86: Support VEX base opcode length > 1
H.J. Lu [Mon, 29 Jun 2020 13:28:31 +0000 (06:28 -0700)] 
x86: Support VEX base opcode length > 1

Intel AMX instructions with 8-bit immediate opcode extension without
operands:

tilerelease, 0, 0x49c0, None, 2, CpuAMX_TILE|Cpu64, Vex|VexOpcode=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }

Update build_vex_prefix to support VEX base opcode length > 1.

* tc-i386.c (build_vex_prefix): Support VEX base opcode length > 1.
(md_assemble): Don't process ImmExt without operands.

4 years agotic6x: Call _bfd_elf_add_dynamic_tags
H.J. Lu [Mon, 29 Jun 2020 12:52:22 +0000 (05:52 -0700)] 
tic6x: Call _bfd_elf_add_dynamic_tags

Update tic6x linker tests to expect C6000_DSBT_BASE, C6000_DSBT_SIZE and
C6000_DSBT_INDEX dynamic tags immediately before NULL dynamic tag.

bfd/

* elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.

ld/

* testsuite/ld-tic6x/shlib-1.rd: Move C6000_DSBT_BASE,
C6000_DSBT_SIZE and C6000_DSBT_INDEX dynamic tags to the last.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.

4 years ago[gdb/testsuite] Emit unresolved for unknown proc
Tom de Vries [Mon, 29 Jun 2020 11:59:19 +0000 (13:59 +0200)] 
[gdb/testsuite] Emit unresolved for unknown proc

Since commit 26783bce15 "[gdb/testsuite] Don't abort testrun for invalid
command in test-case" we don't abort the testrun when encountering an invalid
command.  However, since we don't report errors in the summary, there's a
chance that the error goes unnoticed.

Make the invalid command error more visible by marking the test-case
unresolved, such that we have f.i.:
...
PASS: gdb.python/py-breakpoint.exp: test_bkpt_internal: Test watchpoint write
UNRESOLVED: gdb.python/py-breakpoint.exp: test_bkpt_eval_funcs: \
  testcase aborted due to invalid command name: gdb_py_test_multiple
ERROR: tcl error sourcing py-breakpoint.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
  ...
                === gdb Summary ===

nr of expected passes            56
nr of unresolved testcases       1
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-29  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (unknown): Make test-case unresolved.

4 years ago[gdbserver] Add missing include of gdbsupport/agent.h
Tom de Vries [Mon, 29 Jun 2020 10:14:10 +0000 (12:14 +0200)] 
[gdbserver] Add missing include of gdbsupport/agent.h

The file gdbserver/ax.h contains:
...
 #ifdef IN_PROCESS_AGENT
 #define debug_threads debug_agent
 #endif
...
but does not declare debug_agent.

Fix this by adding an include of gdbsupport/agent.h.

[ If this fix would have been in place before commit 8118159c69 "[gdbserver] Fix
Wlto-type-mismatch for debug_agent", we would have simply run into this build
breaker with a regular, non-lto build:
...
src/gdbserver/ax.cc:28:5: error: conflicting declaration 'int debug_agent'
 int debug_agent = 0;
     ^~~~~~~~~~~
In file included from src/gdbserver/ax.h:25:0,
                 from src/gdbserver/ax.cc:20:
src/gdbsupport/agent.h:47:13: note: previous declaration as 'bool debug_agent'
 extern bool debug_agent;
             ^~~~~~~~~~~
... ]

Tested on x86_64-linux.

gdbserver/ChangeLog:

2020-06-29  Tom de Vries  <tdevries@suse.de>

* ax.h: Include gdbsupport/debug_agent.h.

4 years ago[gdb/testsuite] Expect conformation question in gdb.server/solib-list.exp
Tom de Vries [Mon, 29 Jun 2020 09:02:06 +0000 (11:02 +0200)] 
[gdb/testsuite] Expect conformation question in gdb.server/solib-list.exp

Before commit a8654e7d78 'Fixes PR 25475: ensure exec-file-mismatch "ask"
always asks in case of mismatch', there was a difference in behaviour in
test-case gdb.server/solib-list.exp.

If the executable did not contain debug info (as is usually the case), gdb
would detect a mismatch but not ask for confirmation:
...
(gdb) target remote localhost:2346^M
Remote debugging using localhost:2346^M
warning: Mismatch between current exec-file solib-list^M
and automatically determined exec-file /lib64/ld-2.26.so^M
exec-file-mismatch handling is currently "ask"^M
Reading symbols from /lib64/ld-2.26.so...^M
Reading symbols from /usr/lib/debug/lib64/ld-2.26.so.debug...^M
0x00007ffff7dd7ea0 in _start () at rtld.c:745^M
745     }^M
(gdb) PASS: gdb.server/solib-list.exp: non-stop 0: target remote
...

If the executable did contain debug info (as happens to be the case for
openSUSE), gdb would detect a mismatch and ask for confirmation:
...
(gdb) PASS: gdb.server/solib-list.exp: non-stop 0: file binfile
target remote localhost:2346^M
Remote debugging using localhost:2346^M
warning: Mismatch between current exec-file solib-list^M
and automatically determined exec-file /lib64/ld-2.26.so^M
exec-file-mismatch handling is currently "ask"^M
Load new symbol table from "/lib64/ld-2.26.so"? (y or n) y^M
Reading symbols from /lib64/ld-2.26.so...^M
Reading symbols from /usr/lib/debug/lib64/ld-2.26.so.debug...^M
0x00007ffff7dd7ea0 in _start () at rtld.c:745^M
745     }^M
(gdb) PASS: gdb.server/solib-list.exp: non-stop 0: target remote
...

After commit a8654e7d78, the confirmation is now also asked in case there's
no debug info.

Tighten the test-case by verifying that the confirmation question is asked, as
suggested in the log message of commit a8654e7d78:
...
we can remove the bypass introduced by Tom in 6b9374f1, in order to always
answer to the 'load' question.
...

gdb/testsuite/ChangeLog:

2020-06-29  Tom de Vries  <tdevries@suse.de>

PR gdb/25475
* gdb.server/solib-list.exp: Verify that the symbol reload
confirmation question is asked.

4 years agogas/testsuite: test-case for PR25331 (mmix reloc fixup bug)
Hans-Peter Nilsson [Mon, 29 Jun 2020 03:38:26 +0000 (05:38 +0200)] 
gas/testsuite: test-case for PR25331 (mmix reloc fixup bug)

The bug manifested "only" for a 64-bit host:

pr25331.c: Assembler messages:
pr25331.c:430: Error: internal error: fixup not contained within frag
failed with: <pr25331.c: Assembler messages:
pr25331.c:430: Error: internal error: fixup not contained within frag>, no expected output
FAIL: gas/mmix/pr25331

gas:
PR gas/25331
* testsuite/gas/mmix/pr25331.d, testsuite/gas/mmix/pr25331.s: New test.

4 years agogas: Fix mmix fixups and TC_FX_SIZE_SLACK, PR25331
Hans-Peter Nilsson [Mon, 29 Jun 2020 03:32:02 +0000 (05:32 +0200)] 
gas: Fix mmix fixups and TC_FX_SIZE_SLACK, PR25331

Finally; sorry for the delay.  There were a few false starts, where I
misinterpreted the error-messages and the comment that Alan added:
it's not the fix size that's too large (and the frag too small), it's
stating the wrong size of what will be "fixed up" - that of the actual
target value, not the size of the field that needs to be adjusted.
Comments added for clarity.

Test-suite committed separately.

gas:
PR gas/25331
* config/tc-mmix.c (md_assemble) <fixup for
BFD_RELOC_MMIX_BASE_PLUS_OFFSET>: This fixup affects 1 byte, not 8.
Also, set its fx_no_overflow.
(md_convert_frag) <case ENCODE_RELAX (STATE_PUSHJSTUB, STATE_ZERO)>:
Similarly this fixup affects 4 bytes, not 8 and needs its
fx_no_overflow set.
* config/tc-mmix.h (TC_FX_SIZE_SLACK): Don't define.

4 years agobinutils/dwarf.c: Correct an `index' global shadowing error for pre-4.8 GCC
Hans-Peter Nilsson [Mon, 29 Jun 2020 01:50:45 +0000 (03:50 +0200)] 
binutils/dwarf.c: Correct an `index' global shadowing error for pre-4.8 GCC

In older gcc, shadowing a function name with a local variable name is
flagged as an error, certainly a bug but which is usually worked
around in binutils:

gcc -DHAVE_CONFIG_H -I. -I$SRC/binutils  -I. -I$SRC/binutils -I../bfd -I$SRC/binutils/../bfd -I$SRC/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I$SRC/binutils/../zlib -g -O2 -MT dwarf.o -MD -MP -MF $depbase.Tpo -c -o dwarf.o $SRC/binutils/dwarf.c &&\
mv -f $depbase.Tpo $depbase.Po
cc1: warnings being treated as errors
$SRC/binutils/dwarf.c: In function 'display_debug_str_offsets':
$SRC/binutils/dwarf.c:6913: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: error: shadowed declaration is here
make[4]: *** [dwarf.o] Error 1

See also GCC PR c/53066.  This is just another one that crept in since
I and others last had to use an old version.  The name "idx" was used
in the preceding function, display_debug_addr.  Also, it was declared
c99 style (after a statement in the block).  Committed as obvious.

binutils:
* dwarf.c (display_debug_str_offsets): Rename local variable
index to idx.  Move to top of function.