Commit Graph

102066 Commits

Author SHA1 Message Date
Simon Marchi 84b300de36 gdbserver: remove support for ARM/WinCE
This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove win32-arm-low.cc, wincecompat.cc.
	* configure.srv: Remove mingw32ce cases.
	* server.h, win32-low.cc: Remove __MINGW32CE__-guarded code.
	* win32-low.h (to_back_slashes): Remove.
	* win32-arm-low.cc, wincecompat.cc, wincecompat.h: Remove.

Change-Id: Ib75c0b55b0ab7caca38bbeff5f2fa9397a8e7e8d
2020-06-12 16:06:45 -04:00
Simon Marchi 96c16e2b7f gdbserver: remove support for Tile
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): linux-tile-low.cc.
	* configure.srv: Remove tilegx case.
	* linux-tile-low.cc: Remove.

Change-Id: I1c2910d04ddbd6013e5d228047106b41d80f9477
2020-06-12 16:06:45 -04:00
Simon Marchi bd1467aee8 gdbserver: remove support for M32R
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove linux-m32r-low.cc.
	* configure.srv: Remove m32r case.
	* linux-m32r-low.cc: Remove.

Change-Id: I5617b2b1fd92aeec19b38e0e3c0b78adaafdb35b
2020-06-12 16:06:44 -04:00
Simon Marchi 7b46bf6f83 gdbserver: remove support for CRIS
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove linux-cris-low.c.
	* configure.srv: Remove cris cases.
	* linux-cris-low.cc, linux-crisv32-low.cc: Remove.

Change-Id: Ib3ff436b03373548215f15540a47f39cbec5f512
2020-06-12 16:06:43 -04:00
Simon Marchi 1fa29f56ba gdbserver: remove support for Blackfin
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove linux-bfin-low.c.
	* configure.srv: Remove bfin case.
	* linux-bfin-low.cc: Remove.
	* linux-low.cc: Remove BFIN-conditional code.

Change-Id: I846310d15e6386118ec7eabb1b87e647174560fb
2020-06-12 16:06:42 -04:00
Simon Marchi 613f149a90 gdbserver: remove support for Neutrino
This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

	* configure: Re-generate.
	* configure.ac: Remove srv_qnx test.
	* configure.srv: Remove nto case.
	* nto-low.cc, nto-low.h, nto-x86-low.cc: Remove.
	* remote-utils.c: Remove __QNX__-guarded code.

Change-Id: I8a1ad9c740a69352da1f6993778dbf951eebb22f
2020-06-12 16:06:41 -04:00
Simon Marchi fdb95bf546 gdbserver: remove support for LynxOS
This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

	* configure: Re-generate.
	* configure.ac: Remove srv_lynxos test.
	* configure.srv: Remove lynxos cases.
	* lynx-i386-low.cc, lynx-low.cc, lynx-low.h, lynx-ppc-low.c:
	Remove.

Change-Id: I239d1cf1fc7b4c7a174251bc7981707eaba7d972
2020-06-12 16:06:41 -04:00
Simon Marchi c00094dc7a gdbserver: small cleanup of README file
Fix a few outdated or incoherent things in the README:

- Don't mention remote.c nor *-stub.c files as references for the remote
  protocol.  remote.c is in GDB, not GDBserver, and *-stub.c files don't
  exist today.  Add a link to the documentation instead.

- In the "server (target) side" section, use `:2345` instead of
  `host:2345`.  It currently says that using `host:2345` means we would
  expect a connection from `host`.  That's not what I would expect by
  passing a host part here.  If I passed `11.22.33.44:2345` as the listen
  address, I would expect it to instruct gdbserver to listen only on that
  (11.22.33.44) network interface, not to expect a connection from host
  `11.22.33.44`.  So, remove that part of the sentence.

- Remove the list of supported target, refer to configure.srv instead.
  Keeping a list here is bound to lose sync with reality.

- In the cross-compile instructions, I don't think it's necessary to mention
  "In a Bourne shell".

- In the cross-compile instructions, I don't know what passing
  `your-target-name` to configure does, I don't think it's valid.  Use
  `make all-gdbserver` as in the instructions just above.

gdbserver/ChangeLog:

	* README: Fix a few outdated or incoherent things.

Change-Id: I79349e25bc1bc53447855e0dea6cc7b9630f4553
2020-06-12 16:01:35 -04:00
Tom de Vries 8118159c69 [gdbserver] Fix Wlto-type-mismatch for debug_agent
When building gdb including gdbserver with CFLAGS/CXXFLAGS -O2 -g -flto=auto,
I run into:
...
src/gdbserver/../gdbsupport/agent.h:47:13: error: type of 'debug_agent' \
  does not match original declaration [-Werror=lto-type-mismatch]
 extern bool debug_agent;
             ^
src/gdbserver/ax.cc:28:5: note: type 'int' should match type 'bool'
 int debug_agent = 0;
     ^
src/gdbserver/ax.cc:28:5: note: 'debug_agent' was previously declared here
src/gdbserver/ax.cc:28:5: note: code may be misoptimized unless \
  -fno-strict-aliasing is used
...

Fix this by changing the type of debug_agent in ax.cc from int to bool.

Tested on x86_64-linux.
2020-06-12 18:36:56 +02:00
Andrew Burgess a29d511281 gdb/testsuite: Prevent globals leaking between test scripts
Many of the test scripts create variables in the global namespace,
these variables will then be present for the following test scripts.
In most cases this is harmless, but in some cases this can cause
problems.

For example, if a variable is created as an array in one script, but
then assigned as a scalar in a different script, this will cause a TCL
error.

The solution proposed in this patch is to have the GDB test harness
record a list of all known global variables at the point just before
we source the test script.  Then, after the test script has run, we
again iterate over all global variables.  Any variable that was not in
the original list is deleted, unless it was marked as a persistent global
variable using gdb_persistent_global.

The assumption here is that no test script should need to create a
global variable that will outlive the lifetime of the test script
itself.  With this patch in place all tests currently seem to pass, so
the assumption seems to hold.

gdb/testsuite/ChangeLog:

2020-06-12  Andrew Burgess  <andrew.burgess@embecosm.com>
	    Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (gdb_known_globals, gdb_persistent_globals): New global.
	(gdb_persistent_global, gdb_persistent_global_no_decl): New proc.
	(gdb_setup_known_globals): New proc.
	(gdb_cleanup_globals): New proc.
	* lib/gdb.exp (load_lib): New override proc.
	(gdb_stdin_log_init): Set var in_file as persistent global.
	* lib/pascal.exp (gdb_stdin_log_init): Set vars
	pascal_compiler_is_gpc, pascal_compiler_is_fpc, gpc_compiler and
	fpc_compiler as persistent global.
2020-06-12 15:09:33 +02:00
Tom de Vries 8c74a764f2 [gdb/testsuite] Don't leak tuiterm.exp spawn override
In lib/tuiterm.exp the builtin spawn is overridden by a tui-specific version.

After running the first test-case that imports tuiterm.exp, the override
remains active, so it can cause trouble in subsequent test-cases, even if they
do not import tuiterm.exp.  See f.i. commit c8d4f6dfd9 "[gdb/testsuite] Fix
spawn in tuiterm.exp".

Fix this by:
- adding a variable gdb_finish_hooks which is a list of procs to run during
  gdb_finish
- adding a proc tuiterm_env that is used in test-cases instead of
  "load_lib tuiterm.exp".
- letting tuiterm_env:
  - install the tui-specific spawn version, and
  - use the gdb_finish_hooks to schedule restoring the builtin spawn
    version.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/tuiterm.exp (spawn): Rename to ...
	(tui_spawn): ... this.
	(toplevel): Move rename of spawn ...
	(gdb_init_tuiterm): ... here.  New proc.
	(gdb_finish_tuiterm): New proc.
	* lib/gdb.exp (gdb_finish_hooks): New global var.
	(gdb_finish): Handle gdb_finish_hooks.
	(tuiterm_env): New proc.
	* gdb.python/tui-window.exp: Replace load_lib tuiterm.exp with
	tuiterm_env.
	* gdb.tui/basic.exp: Same.
	* gdb.tui/corefile-run.exp: Same.
	* gdb.tui/empty.exp: Same.
	* gdb.tui/list-before.exp: Same.
	* gdb.tui/list.exp: Same.
	* gdb.tui/main.exp: Same.
	* gdb.tui/new-layout.exp: Same.
	* gdb.tui/regs.exp: Same.
	* gdb.tui/resize.exp: Same.
	* gdb.tui/tui-layout-asm-short-prog.exp: Same.
	* gdb.tui/tui-layout-asm.exp: Same.
	* gdb.tui/tui-missing-src.exp: Same.
	* gdb.tui/winheight.exp: Same.
2020-06-12 13:29:43 +02:00
Tom de Vries 26783bce15 [gdb/testsuite] Don't abort testrun for invalid command in test-case
Say we add a call to foobar at the end of a test-case, and run the
test-suite.  We'll run into a dejagnu error:
...
ERROR: (DejaGnu) proc "foobar" does not exist.
...
and the test-suite run is aborted.

It's reasonable that the test-case is aborted, but it's not reasonable that
the testsuite run is aborted.

Problems in one test-case should not leak into other test-cases, and they
generally don't.  The exception is the "invalid command name" problem due to
an override of ::unknown in dejagnu's framework.exp.

Fix this by reverting dejagnu's ::unknown override for the duration of each
test-case, using the gdb_init/gdb_finish hooks.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	PR testsuite/26110
	* lib/gdb.exp (gdb_init): Revert dejagnu's override of ::unknown.
	(gdb_finish): Reinstall dejagnu's override of ::unknown.
2020-06-12 09:13:17 +02:00
Nelson Chu 453c733fcf RISC-V: Update the rebuild-csr-xml.sh.
We add new arguments defined and aborted verisons for DECLARE_CSR to
support privileged versions controling in binutils.  Therefore, the
rebuild-csr-xml.sh should be updated, too.

	gdb/
	* features/riscv/rebuild-csr-xml.sh: Updated.
2020-06-12 09:44:02 +08:00
Nelson Chu d8af286fff RISC-V: Drop the privileged spec v1.9 support.
There is a conflict between v1.9 and v1.9.1 - CSR MISA address.  MISA is
0xf10 in v1.9, but change to 0x301 in v1.9.1.  The change made MISA writable,
but may also cause risk of compatibility.  Binutils already support the
-mpriv-spec options and ELF priv attributes, which can used to choose what
privileged spec you want, and then give a correponding CSR name and address
to use.  But Gdb and other tools don't have the simialr mechanism for now.
However, there are two things can be confirmed,

1. If we don't have a way to control the priv specs, then the changes, like
MISA, will cause risk and hard to maintain.

2. We get the guarantee that the CSR address won't be reused in the future
specs, even if it is dropped.

I'm not sure if Gdb needs to care about the priv spec versions, it is still
discussing.  But drop the priv spec v1.9, and make sure that we won't reuse
the CSR address is a useful solution for now.  Also, we might drop the v1.9.1
in a year or two.  After that, specs above v1.10 should be compatible anyway.

	gas/
	* testsuite/gas/riscv/priv-reg-fail-version-1p9.d: Removed.
	* testsuite/gas/riscv/priv-reg-fail-version-1p9.l: Likewise.
	* testsuite/gas/riscv/priv-reg-version-1p9.d: Likewise.

	include/
	* opcode/riscv-opc.h: Update the defined versions of CSR from
	PRIV_SPEC_CLASS_1P9 to PRIV_SPEC_CLASS_1P9P1.  Also, drop the
	MISA DECLARE_CSR_ALIAS since it's aborted version is v1.9.
	* opcode/riscv.h (enum riscv_priv_spec_class): Remove
	PRIV_SPEC_CLASS_1P9.

	opcodes/
	* riscv-opc.c (priv_specs): Remove v1.9 and PRIV_SPEC_CLASS_1P9.
2020-06-12 09:41:20 +08:00
GDB Administrator e9576b7d68 Automatic date update in version.in 2020-06-12 00:00:20 +00:00
Tom Tromey 914592f9ff Update documentation for Ada .gdb_index
.gdb_index now supports Ada, so update the documentation to reflect
this.

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

	* gdb.texinfo (Index Files): Reword.  Remove Ada limitation.
2020-06-11 11:24:48 -06:00
Tom Tromey 2b4e6a3f4b Fix hex floating point lexing
PR gdb/18318 notes that gdb will sometimes incorrectly handle hex
floating point input.  This turns out to be a bug in the C lexer; the
'p' was not being correctly recognized, and so the exponent was not
always passed to the floating point "from_string" method.

Tested by the buildbot "Fedora-x86_64-m64" builder.

gdb/ChangeLog
2020-06-11  Tom Tromey  <tom@tromey.com>

	PR gdb/18318:
	* c-exp.y (lex_one_token): Handle 'p' like 'e'.

gdb/testsuite/ChangeLog
2020-06-11  Tom Tromey  <tom@tromey.com>

	PR gdb/18318:
	* gdb.base/printcmds.exp (test_float_accepted): Add more hex
	floating point tests.
2020-06-11 10:34:31 -06:00
Jonny Grant 4412332f4b gdb: add mailing list and IRC information to --help
A few user-vibisble changes to the --help output:

 * Remove unnecessary quotes around bug url.
 * Mention the mailing list and IRC channel as places where users can
   ask GDB-related questions.
 * Add empty lines between items in the footer, to improve readability.
 * Remove unnecessary new line at the end of output.

2020-06-09  Jonny Grant  <jg@jguk.org>
2020-06-09  Simon Marchi  <simon.marchi@polymtl.ca>

	* main.c (captured_main_1): Don't print new line after help.
	(print_gdb_help): add mailing list and IRC channel information
	to --help.  Add new lines between items in the footer.  Remove
	quotes around bug url.

Signed-off-by: Jonathan Grant <jg@jguk.org>
Change-Id: Ibd0746a348d558fb35b5cd7e366f107742806565
2020-06-11 10:30:36 -04:00
Keith Seitz 2f33032a93 Compute proper length for dynamic types of TYPE_CODE_TYPEDEF
This patch fixes gdb/21356 in which we hit an assertion in
value_contents_bits_eq:

(gdb) p container_object2
(gdb) p container_object2
$1 = {_container_member2 = 15, _vla_struct_object2 = {_some_member = 0,
    _vla_field = {
../../src/gdb/value.c:829: internal-error: \
  int value_contents_bits_eq(const value*, int, const value*, int, int): \
  Assertion `offset1 + length \
             <= TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT' failed.

This is happening because TYPE_LENGTH (val1->enclosing_type) is erroneously
based on enclosing_type, which is a typedef, instead of the actual underlying
type.

This can be traced back to resolve_dynamic_struct, where the size of the
type is computed:
...
        TYPE_FIELD_TYPE (resolved_type, i)
          = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
                                           &pinfo, 0);
        gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
                    == FIELD_LOC_KIND_BITPOS);

        new_bit_length = TYPE_FIELD_BITPOS (resolved_type, i);
        if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
          new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
        else
          new_bit_length += (TYPE_LENGTH (TYPE_FIELD_TYPE (resolved_type, i))
                             * TARGET_CHAR_BIT);
...

In this function, resolved_type is TYPE_CODE_TYPEDEF which is not what we
want to use to calculate the size of the actual field.

This patch fixes this and the similar problem in resolve_dynamic_union.

gdb/ChangeLog:
2020-06-11  Keith Seitz  <keiths@redhat.com>

	PR gdb/21356
	* gdbtypes.c (resolve_dynamic_union, resolve_dynamic_struct):
	Resolve typedefs for type length calculations.

gdb/testsuite/ChangeLog:
2020-06-11  Keith Seitz  <keiths@redhat.com>

	PR gdb/21356
	* gdb.base/vla-datatypes.c (vla_factory): Add typedef for struct
	vla_struct.
	Add new struct vla_typedef and union vla_typedef_union and
	corresponding instantiation objects.
	Initialize new objects.
	* gdb.base/vla-datatypes.exp: Add tests for vla_typedef_struct_object
	and vla_typedef_union_object.
	Fixup type for vla_struct_object.
2020-06-11 14:34:44 +02:00
Tom de Vries a8baf0a32b [gdb/testsuite] Make gdb.base/dbx.exp more robust
Test-case gdb.base/dbx.exp overrides:
- the GDBFLAGS variable
- the gdb_file_cmd proc

There's code at the end of the test-case to restore both, but that's not
guaranteed to be executed.

Fix this by:
- using save_vars to restore GDBFLAGS
- using a new proc with_override to restore gdb_file_cmd

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/gdb.exp (with_override): New proc, factored out of ...
	* gdb.base/dbx.exp: ... here.  Use with_override and save_vars.
2020-06-11 14:10:05 +02:00
Alex Coplan 14962256b3 [PATCH]: aarch64: Refactor representation of system registers
Prior to this patch, the information describing the AArch64 system
registers was separate from the information describing which system
registers are available depending on the CPU feature set. Indeed, the
latter was implemented as a separate function from the main table with
the system register information.

This patch remedies this situation and puts the feature information into
the system register table itself.

This has several advantages:

 * Having all the information described in one place is easier to
   maintain.
 * The logic to check whether a system register is supported now becomes
   trivial (and much more efficient).

Since this patch ended up touching every line of the system register
table, I took the opportunity to make the formatting more consistent and
remove some redundant comments.

Note that there is still more refactoring that could be done along the
same lines here (e.g. with the TLB instructions) but this seemed like a
reasonable first pass.

Testing:

 * Regression tested an x64 -> aarch64-none-elf cross binutils.
 * Built aarch64-none-elf cross toolchain, checked newlib startup
   code still works.
 * Bootstrapped binutils on aarch64-linux-gnu, regression tested.
 * Built aarch64 kernel using new binutils with allyesconfig.

OK for master? If so, I'll need a maintainer to commit on my behalf
since I don't have write access.

Thanks,
Alex

---

include/ChangeLog:

2020-06-11  Alex Coplan  <alex.coplan@arm.com>

	* opcode/aarch64.h (aarch64_sys_reg): Add required features to struct
	describing system registers.

opcodes/ChangeLog:

2020-06-11  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-opc.c (SYSREG): New macro for describing system registers.
	(SR_CORE): Likewise.
	(SR_FEAT): Likewise.
	(SR_RNG): Likewise.
	(SR_V8_1): Likewise.
	(SR_V8_2): Likewise.
	(SR_V8_3): Likewise.
	(SR_V8_4): Likewise.
	(SR_PAN): Likewise.
	(SR_RAS): Likewise.
	(SR_SSBS): Likewise.
	(SR_SVE): Likewise.
	(SR_ID_PFR2): Likewise.
	(SR_PROFILE): Likewise.
	(SR_MEMTAG): Likewise.
	(SR_SCXTNUM): Likewise.
	(aarch64_sys_regs): Refactor to store feature information in the table.
	(aarch64_sys_reg_supported_p): Collapse logic for system registers
	that now describe their own features.
	(aarch64_pstatefield_supported_p): Likewise.
2020-06-11 12:34:37 +01:00
Alan Modra 382264181d Run certain ld-plugun lto tests only for ELF
lto-6.c refers to _etext, pr12760b.c has a .gnu.warning section,
the pr23818 test uses readelf, and pr23958.c has a .symver directive.

	* testsuite/ld-plugin/lto.exp (lto_link_tests): Move lto-6,
	pr12760, pr23818 and pr23958 tests to..
	(lto_link_elf_tests): ..here.
2020-06-11 18:22:42 +09:30
Nick Clifton 928055a369 Fix a compile time warning in the linker testsuite when compiling using clang.
* testsuite/ld-elf/pr26094-1b.c (main): Change return type to
	int.
2020-06-11 09:27:41 +01:00
Alan Modra f0aa30258a PR26107, Compilation failure in pdp11.c
PR 26107
	* pdp11.c (is_stab): Replace legacy "index" function with "strchr".
2020-06-11 15:50:33 +09:30
Alan Modra fd17d1e695 Re: asan: readelf: process_mips_specific buffer overflow
Let's do without that unnecessary internal option buffer.  This also
fixes another bug in that the REGINFO data was being taken from the
calloc'd internal option buffer, so was all zeros.

	* readelf.c (process_mips_specific): Don't alloc memory for
	Elf_Internal_Options.
2020-06-11 14:50:48 +09:30
Alan Modra d0c4e7802d asan: readelf: process_mips_specific buffer overflow
DT_MIPS_OPTIONS is not a regular array as assumed by readelf.  This
patch corrects that assumption, and to do so easily, makes various
internal (host byte order) structs the same size as external (target
byte order) structs.

include/
	* elf/mips.h (Elf32_RegInfo): Use fixed width integer types.
	(Elf64_Internal_RegInfo, Elf_Internal_Options): Likewise.
binutils/
	* readelf.c (process_mips_specific): Assert size of internal
	types match size of external types, and simplify allocation of
	internal buffer.  Catch possible integer overflow when sanity
	checking option size.  Don't assume options are a regular array.
	Sanity check reginfo option against option size.  Use PRI macros
	when printing.
2020-06-11 13:54:46 +09:30
Simon Marchi ec16513e31 gdb: fix whitespaces in ChangeLog
Replace 8 spaces with tabs.

Change-Id: I60f2df3a2866f75f0307077bf6cb1fa3918f8180
2020-06-10 23:00:20 -04:00
Jonny Grant c5a6a07f2a gdb/doc: remove broken links Previous and Up from contents
gdb/doc/ChangeLog:

	* gdb.texinfo: Remove broken links Previous and Up from
	contents.

Signed-off-by: Jonny Grant <jg@jguk.org>
Change-Id: Iad7323580a3c0c7f00eab1264d66f39e8d156e38
2020-06-10 22:56:31 -04:00
H.J. Lu 447f6d8627 ia64: Set DF_TEXTREL instead of reltext
Update ia64 ELF backend to set DF_TEXTREL for dynamic relocs against
readonly sections like other backends.

	* elfnn-ia64.c (elfNN_ia64_link_hash_table): Remove reltext.
	(allocate_dynrel_entries): Set DF_TEXTREL instead of reltext.
	(elfNN_ia64_size_dynamic_sections): Check DF_TEXTREL instead
	of reltext.
2020-06-10 18:20:36 -07:00
GDB Administrator 6cff1eab4d Automatic date update in version.in 2020-06-11 00:00:16 +00:00
Alan Modra 84df1f9dcb Fix x86 ld testsuite fails with glibc < 2.28
* testsuite/ld-elf/linux-x86.exp: Build tests when non-native.
	(check_pr25749b): Add optional args.  Set expected pass file
	from args.  Run -1b and -2a tests with passall.out.
	* testsuite/ld-elf/passall.out: New file.
	* testsuite/ld-elf/pr25749-1.c: Adjust to pass with older glibc.
	* testsuite/ld-elf/pr25749-2.c: Likewise.
	* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use
	regexp_diff to compare expected output from running binary.
2020-06-10 22:19:07 +09:30
Tom de Vries 7ab9679411 [gdb/symtab] Enable ada .gdb_index
Currently the .gdb_index is not enabled for ada executables (PR24713).

Fix this by adding the required support in write_psymbols, similar to how that
is done for .debug_names in debug_names::insert.

Tested on x86_64-linux, with native and target board cc-with-gdb-index.

gdb/ChangeLog:

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

	PR ada/24713
	* dwarf2/index-write.c (struct mapped_symtab): Add m_string_obstack.
	(write_psymbols): Enable .gdb_index for ada.
	* dwarf2/read.c: Remove comment stating .gdb_index is unsupported for
	ada.

gdb/testsuite/ChangeLog:

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

	* gdb.ada/ptype_union.exp: Remove PR24713 workaround.
2020-06-10 14:46:53 +02:00
Tom de Vries e5f3ece2ab [gdb/symtab] Fix name lookup in dw2_map_matching_symbols
In commit 9a0bacfb08 "[gdb/symtab] Handle .gdb_index in ada language mode", a
missing part of dw2_map_matching_symbols was added, containing a call to
dw2_expand_symtabs_matching_symbol.

However, the callback passed to that call has one problem: the callback has an
argument "offset_type namei", which is ignored.  Instead, match_name is passed
as argument to dw2_symtab_iter_init, where a name lookup is done, which may or
may not yield the same value as namei.

Fix this by creating a new version of dw2_symtab_iter_init that takes a
"offset_type namei" argument instead of "const char *name", and passing namei.

Tested on x86_64-linux, with native and target board cc-with-gdb-index.

gdb/ChangeLog:

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

	* dwarf2/read.c (dw2_symtab_iter_init_common): Factor out of ...
	(dw2_symtab_iter_init): ... here.  Add variant with "offset_type
	namei" instead of "const char *name" argument.
	(dw2_map_matching_symbols): Use "offset_type namei" variant of
	dw2_symtab_iter_init.
2020-06-10 14:46:53 +02:00
H.J. Lu e1b5d517d1 ELF: Properly handle section symbols
When defining the section symbol, __start_FOO, for the section FOO:

1. Treat the common symbol, __start_FOO, in input object file as
definition.
2. Clear verinfo.verdef.

bfd/

	PR ld/26094
	* elflink.c (bfd_elf_define_start_stop): Handle common symbols.
	Clear verinfo.verdef.

ld/

	PR ld/26094
	* testsuite/ld-elf/pr26094-1.ver: New fike.
	* testsuite/ld-elf/pr26094-1a.c: Likewise.
	* testsuite/ld-elf/pr26094-1a.rd: Likewise.
	* testsuite/ld-elf/pr26094-1b.c: Likewise.
	* testsuite/ld-elf/pr26094-1b.rd: Likewise.
	* testsuite/ld-elf/pr26094-1c.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run ld/26094 tests.
2020-06-10 05:31:31 -07:00
Ralf Habacker 25065fcd19 Fix the windmc program to conform to the behaviour of mc.exe by rejecting lines that reach end-of-file without a terminating newline character.
PR 26082
	* mclex.c (yylex): Reject lines that reach end-of-file without a
	terminating newline character.
2020-06-10 10:07:26 +01:00
Simon Marchi cab5c3b707 gdb/testsuite: fix duplicate test names in gdb.base/index-cache.exp
Fix:

    DUPLICATE: gdb.base/index-cache.exp: test_cache_disabled: no files were created
    DUPLICATE: gdb.base/index-cache.exp: test_cache_disabled: check index-cache stats

We use `proc_with_prefix` for test_cache_disabled, but we call it twice.  So we
need an additional prefix to identify the specific call.  This patch adds that.

gdb/testsuite/ChangeLog:

	* gdb.base/index-cache.exp (test_cache_disabled): Add test_prefix
	parameter, update callers.

Change-Id: Idf382fd380c77a654e8a7aa236af50b65c96b1d2
2020-06-09 23:14:46 -04:00
GDB Administrator f5163fdc3c Automatic date update in version.in 2020-06-10 00:00:16 +00:00
H.J. Lu cebd6b8ac1 IFUNC: Update IFUNC resolver check with DT_TEXTREL
Add ifunc_resolvers to elf_link_hash_table and use it for both x86 and
ppc64.  Before glibc commit b5c45e837, DT_TEXTREL is incompatible with
IFUNC resolvers.  Set ifunc_resolvers if there are IFUNC resolvers and
issue a warning for IFUNC resolvers with DT_TEXTREL.

bfd/

	PR ld/18801
	* elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
	(_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
	bfd_boolean * argument.  Set ifunc_resolvers if there are IFUNC
	resolvers.
	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
	Set ifunc_resolvers if there are FUNC resolvers.
	* elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
	(build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
	with elf.ifunc_resolvers.
	(write_plt_relocs_for_local_syms): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	(ppc64_elf_finish_dynamic_sections): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
	Updated.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
	(_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
	instead of readonly_dynrelocs_against_ifunc.
	* elfxx-x86.h (elf_x86_link_hash_table): Remove
	readonly_dynrelocs_against_ifunc.

ld/

	PR ld/18801
	* testsuite/ld-i386/i386.exp: Run ifunc-textrel-1a,
	ifunc-textrel-1b, ifunc-textrel-2a and ifunc-textrel-2b.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/ifunc-textrel-1a.d: Likewise.
	* testsuite/ld-i386/ifunc-textrel-1b.d: Likewise.
	* testsuite/ld-i386/ifunc-textrel-2a.d: Likewise.
	* testsuite/ld-i386/ifunc-textrel-2b.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-1.s: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-1a.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-1b.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-2.s: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-2a.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-2b.d: Likewise.
	* testsuite/ld-i386/pr18801a.d: Expect warning for IFUNC
	resolvers.
	* testsuite/ld-i386/pr18801b.d: Likewise.
	* estsuite/ld-x86-64/pr18801a.d: Likewise.
	* estsuite/ld-x86-64/pr18801b.d: Likewise.
2020-06-09 06:57:25 -07:00
H.J. Lu f9630fa654 i386-dis.c: Fix a typo in comments
* i386-dis.c (prefix_table): Fix a typo in comments.
2020-06-09 06:29:33 -07:00
Seth Girvan 18ca16bec8 [PATCH] gas/doc: improve AVR modifiers wording.
* doc/c-avr.texi: Improve wording.
2020-06-09 11:13:39 +01:00
Jan Beulich 6778f1c485 x86: add missing 64-bit tests for "don't ignore mandatory pseudo prefixes"
Commit da4977e00b added the 32-bit test files, but failed to add the
64-bit ones.
2020-06-09 11:28:15 +02:00
Alan Modra a61e306070 PR26065, ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail
PR 26065
	* testsuite/ld-elf/shared.exp: Compile dl4main.c -fPIC.
	(dl4e, dl4f): Expect dl4a.out.
	* testsuite/ld-elf/dl4e.out: Delete.
2020-06-09 17:34:52 +09:30
Jan Beulich 73239888b3 x86: consistently print prefixes explicitly which are invalid with VEX etc
All of data size, rep, lock, and rex prefixes are invalid with VEX- and
alike encoded insns. Make sure they get printed explicitly in all cases,
to signal the anomaly. With this, do away with "rex_ignored" - if there
is a rex prefix, we want to print it anyway for VEX etc (and there's
nothing "ignored" about it in the first place - such an instruction will
raise #UD).
2020-06-09 08:59:04 +02:00
Jan Beulich 18897deb53 x86: fix {,V}MOV{L,H}PD disassembly
Neither the legacy nor the VEX-encoded forms are permitted with register
operands, just like is already the case for their store forms as well as
{,V}MOV{L,H}PS.

At the same time, besides folding respective vex_len_table[] entries,
adjust adjacent related legacy mod_table[] entries:
- when the prefix was already decoded, PREFIX_OPCODE is pointless,
- limit the amount of string literals by using X consistently on all
  {,V}MOV{L,H}P{S,D} forms.
2020-06-09 08:57:55 +02:00
Jan Beulich 97e6786a6e x86: utilize X macro in EVEX decoding
For major opcodes allowing only packed FP kinds of operands, i.e. the
ones where legacy and AVX decoding uses the X macro, we can do so for
AVX512 as well, by attaching to the checking logic the "EVEX.W must
match presence of embedded 66 prefix" rule. (Encodings not following
this general pattern simply may not gain the PREFIX_OPCODE attribute.)

Note that testing of the thus altered decoding has already been put in
place by "x86: correct decoding of packed-FP-only AVX encodings".

This can also be at least partly applied to scalar-FP-only insns (i.e.
V{,U}COMIS{S,D}) as well as the vector-FP forms of insns also allowing
scalar encodings (e.g. VADDP{S,D}).

Take the opportunity and also fix EVEX-encoded VMOVNTP{S,D} as well as
to-memory forms of VMOV{L,H}PS and both forms of VMOV{L,H}PD to wrongly
disassemble with only register operands.
2020-06-09 08:57:22 +02:00
Jan Beulich bf926894b6 x86: correct decoding of packed-FP-only AVX encodings
Various AVX insns utilizing the X macro fail to reject F3/F2 embedded
prefix encodings. As the PREFIX_OPCODE attribute wasn't used by any
non-legacy-encoded insns so far, re-use it to achieve the intended
effect.
2020-06-09 08:56:39 +02:00
Jan Beulich a5aaedb9db x86: correct mis-named MOD_0F51 enumerator
This is for extension major opcode 50, so name it accordingly.
2020-06-09 08:55:50 +02:00
Jan Beulich 828c2a2580 x86-64: adjust far indirect branch handling
An unwanted side effect of 5990e377e5 ("x86-64: Intel64 adjustments
for insns dealing with far pointers") was that with -mintel64 LCALL and
LJMP would now default to 64-bit operand size. Since 64-bit far branches
aren't portable, the default operand size should still be 32-bit.
However, since the 64-bit variant is permitted, an ambiguous operand
warning should be issued.

As to the actual code change, please note that the conditional
surrounding the switch() that gets adjusted covers several cases which
are of no interest to or benign in 64-bit mode, hence the new
conditional added can be quite a bit less involved.
2020-06-09 08:47:31 +02:00
Jan Beulich da4977e00b x86: don't ignore mandatory pseudo prefixes
{vex}, {vex3}, and {evex} are mandatory prefixes, and hence should not
be randomly ignored. Fix this for insns without operands as well as for
insns referencing the high 16 [XYZ]MM registers. To achieve the former,
re-purpose VEX_check_operands(), renaming it to VEX_check_encoding() and
moving its only operand check to check_VecOperands().

This involves fixing a testcase relying on {vex2} to get ignored.
2020-06-09 08:46:22 +02:00
Alan Modra efb2a7b412 PowerPC64: Downgrade ifunc with textrel error to a warning
For ppc64 I set flags when recording the dynamic relocation rather
than when allocating space.  That allows you to distinguish three
cases:
1) The dynamic ifunc relocation is in an executable and will always be
   to an ifunc resolver in the executable.
2) The dynamic ifunc relocation is in a shared library which provides
   an ifunc resolver, but that may be overridden at runtime to use a
   resolver in another binary.
3) The dynamic ifunc relocation is not to a locally defined ifunc
   resolver.

Case (3) won't cause a segfault trying to run resolver code that is
non-exec on older glibc.

I made case (1) an error for ppc64, but since newer glibc ld.so does
allow running ifunc resolvers when segments are writable I suppose I
should downgrade that to a warning like case (2).

	* elf64-ppc.c (struct ppc_link_hash_table): Delete
	maybe_local_ifunc_resolver field.
	(build_global_entry_stubs_and_plt): Set local_ifunc_resolver in
	cases where maybe_local_ifunc_resolver was set.
	(ppc64_elf_relocate_section): Likewise.
	(ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel
	error to a warning.
2020-06-09 09:37:23 +09:30