Commit Graph

102505 Commits

Author SHA1 Message Date
Nick Clifton
56c1b507aa Fix the generation of 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.
2020-07-15 12:52:53 +01:00
Alan Modra
28b80303a2 PR26239, memory leak in _bfd_dwarf2_slurp_debug_info
PR 26239
	* coffgen.c (_bfd_coff_close_and_cleanup): Free dwarf2 info.
2020-07-15 19:47:57 +09:30
Nick Clifton
4fd8d58564 Fix an illegal memory access in the BFD library which can be triggered by attempting 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.
2020-07-15 11:09:59 +01:00
Tom de Vries
52781cce79 [gdb/testsuite] Handle callq -> call disassembly change
We're currently running into:
...
FAIL: gdb.trace/entry-values.exp: disassemble bar
...

Since commit 36938cabf0 "x86: avoid attaching suffixes to unambiguous insns",
"callq" is disassembled as "call", and the test-case expects "callq".

Fix this by expecting "call" instead.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-07-15  Tom de Vries  <tdevries@suse.de>

	* gdb.trace/entry-values.exp: Expect "call" instead of "callq" if
	is_amd64_regs_target.
2020-07-15 11:17:41 +02:00
Andrew Burgess
3dcc261cf8 gdb/fortran: Handle dynamic string types when printing types
After commit:

  commit 8c2e4e0689
  Date:   Sun Jul 12 22:58:51 2020 -0400

      gdb: add accessors to struct dynamic_prop

An existing bug was exposed in the Fortran type printing code.  When
GDB is asked to print the type of a function that takes a dynamic
string argument GDB will try to read the upper bound of the string.

The read of the upper bound is written as:

    if (type->bounds ()->high.kind () == PROP_UNDEFINED)
      // Treat the upper bound as unknown.
    else
      // Treat the upper bound as known and constant.

However, this is not good enough.  When printing a function type the
dynamic argument types will not have been resolved.  As a result the
dynamic property is not PROP_UNDEFINED, but nor is it constant.

By rewriting this code to specifically check for the PROP_CONST case,
and treating all other cases as the upper bound being unknown we avoid
incorrectly treating the dynamic property as being constant.

gdb/ChangeLog:

	* f-typeprint.c (f_type_print_base): Allow for dynamic types not
	being resolved.

gdb/testsuite/ChangeLog:

	* gdb.fortran/ptype-on-functions.exp: Add more tests.
	* gdb.fortran/ptype-on-functions.f90: Likewise.
2020-07-15 08:56:25 +01:00
Jan Beulich
f0e8d0bae4 x86: move putop() case labels to restore alphabetic sorting
... as far as non-fall-through behavior permits.
2020-07-15 08:55:53 +02:00
Jan Beulich
c3f5525ff1 x86: make PUSH/POP disassembly uniform
Irrespective of their encoding the resulting output should look the
same. Therefore wire the handling of PUSH/POP with GPR operands
encoded in the main opcode byte to the same logic used for other
operands. This frees up yet another macro character.
2020-07-15 08:55:20 +02:00
Jan Beulich
e2e018c340 x86-64: adjust stack insn test case
The value chosen for the 16-/32-bit immediate cases didn't work well
with the subsequent insn's REX prefix - we ought to pick a value the
upper two bytes of which evaluate to a 2-byte insn. Bump the values
accordingly, allowing the subsequent insn to actually have the intended
REX.W.
2020-07-15 08:54:40 +02:00
Jan Beulich
36938cabf0 x86: avoid attaching suffixes to unambiguous insns
"Unambiguous" is is in particular taking as reference the assembler,
which also accepts certain insns - despite them allowing for varying
operand size, and hence in principle being ambiguous - without any
suffix. For example, from the very beginning of the life of x86-64 I had
trouble understanding why a plain and simple RET had to be printed as
RETQ. In case someone really used the 16-bit form, RETW disambiguates
the two quite fine.
2020-07-15 08:53:55 +02:00
Hans-Peter Nilsson
a8a48c756c 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" like.

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.
2020-07-15 06:22:28 +02:00
Simon Marchi
054a095926 gdb/testsuite/lib/dwarf.exp: fix addr_size parameter comments
The comments modified in this patch claim that the addr_size parameters
can take the value 32 or 64 (suggesting the value is in bits).  In fact,
the expected value is in bytes, either 4 or 8.

The actual value in the DWARF info is in bytes.  And we can see that the
default values used (if addr_size == "default") are:

	if {$_cu_addr_size == "default"} {
	    if {[is_64_target]} {
		set _cu_addr_size 8
	    } else {
		set _cu_addr_size 4
	    }
	}

gdb/testsuite/ChangeLog:

	* lib/dwarf.exp (Dwarf::cu, Dwarf::tu, Dwarf::lines): Change valid
	values in documentation for addr_size to 4 and 8.

Change-Id: I4a02dca2bb7992198864e545ef099f020f54ff2f
2020-07-14 23:18:30 -04:00
GDB Administrator
360f1cd72d Automatic date update in version.in 2020-07-15 00:00:06 +00:00
Markus Böck
e8a83e931e PR26198 MinGW failure to link regular object file and LTO object file
PR 26198
	* coffgen.c (_bfd_coff_section_already_linked): Allow for plugin
	objects both before and after normal object files.
	* elflink.c (_bfd_elf_section_already_linked): Likewise.
2020-07-15 08:31:30 +09:30
H.J. Lu
8e58ef803c 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.
2020-07-14 09:58:07 -07:00
Andrew Burgess
f63dcaf808 gdb: Improve formatting of 'show endian' messages
This commit changes the output of 'show endian'.  Here is a
session before this commit:

    (gdb) show endian
    The target endianness is set automatically (currently little endian)
    (gdb) set endian big
    The target is assumed to be big endian
    (gdb) show endian
    The target is assumed to be big endian
    (gdb)

After this commit the session now looks like this:

    (gdb) show endian
    The target endianness is set automatically (currently little endian).
    (gdb) set endian big
    The target is set to big endian.
    (gdb) show endian
    The target is set to big endian.
    (gdb)

The changes are:

  1. Each line ends with '.', and
  2. After setting the endianness GDB is now a little more assertive;
  'target is set to' not 'target is assumed to be', the user did just
  tell us after all!
2020-07-14 13:21:42 +01:00
Andrew Burgess
ccb9eba6a2 gdb: Improve formatting of 'show architecture' messages
This commit changes the output of 'show architecture'.  Here is a
session before this commit:

  (gdb) show architecture
  The target architecture is set automatically (currently i386)
  (gdb) set architecture mips
  The target architecture is assumed to be mips
  (gdb) show architecture
  The target architecture is assumed to be mips
  (gdb)

After this commit the session now looks like this:

  (gdb) show architecture
  The target architecture is set to "auto" (currently "i386").
  (gdb) set architecture mips
  The target architecture is set to "mips".
  (gdb) show architecture
  The target architecture is set to "mips".
  (gdb)

The changes are:

  1. The value is now enclosed in quotes,
  2. Each line ends with '.', and
  3. After setting the architecture GDB is now a little more
  assertive; 'architecture is set to' not 'is assumed to be', the user
  did just tell us after all!

gdb/ChangeLog:

	* arch-utils.c (show_architecture): Update formatting of messages.

gdb/testsuite/ChangeLog:

	* gdb.arch/amd64-osabi.exp: Update.
	* gdb.arch/arm-disassembler-options.exp: Update.
	* gdb.arch/powerpc-disassembler-options.exp: Update.
	* gdb.arch/ppc64-symtab-cordic.exp: Update.
	* gdb.arch/s390-disassembler-options.exp: Update.
	* gdb.base/all-architectures.exp.tcl: Update.
	* gdb.base/attach-pie-noexec.exp: Update.
	* gdb.base/catch-syscall.exp: Update.
	* gdb.xml/tdesc-arch.exp: Update.
2020-07-14 13:21:42 +01:00
Claudiu Zissulescu
570b0ed6d5 arc: Detect usage of illegal double register pairs
ARC can use odd-even double register pairs in some selected
instructions. Although the GNU assembler doesn't allow even-odd
registers to be used, there may be cases when the disassembler is
presented with such situation.  This patch add a test and detects such
cases.

opcodes/
2020-07-14  Claudiu Zissulescu  <claziss@gmail.com>

	* arc-dis.c (print_insn_arc): Detect and emit a warning when a
	faulty double register pair is detected.

binutils/
2020-07-14  Claudiu Zissulescu  <claziss@gmail.com>

	* testsuite/binutils-all/arc/double_regs.s: New test.
	* testsuite/binutils-all/arc/objdump.exp: Add the above test.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2020-07-14 14:51:15 +03:00
Jan Beulich
bfbd943845 x86/Intel: debug registers are named DRn
%db<n> is an AT&T invention; the Intel documentation and MASM have only
ever specified DRn (in line with CRn and TRn). (In principle gas also
shouldn't accept the names in Intel mode, but at least for now I've kept
things as they are. Perhaps as a first step this should just be warned
about.)
2020-07-14 10:43:38 +02:00
Jan Beulich
78467458dd x86: drop Rm and the 'L' macro
Rm (and hence OP_R()) can be dropped by making 'Z' force modrm.mod to 3
(for OP_E()) instead of ignoring it. While at it move 'Z' handling to
its designated place (after 'Y'; 'W' handling will be moved by a later
change).

Moves to/from TRn are illegal in 64-bit mode and thus get converted to
honor this at the same time (also getting them in line with moves
to/from CRn/DRn ModRM.mod handling wise). This then also frees up the L
macro.
2020-07-14 10:43:03 +02:00
Jan Beulich
464d2b6568 x86: drop Rdq, Rd, and MaskR
Rdq, Rd, and MaskR can be replaced by Edq, Ed / Rm, and MaskE
respectively, as OP_R() doesn't enforce ModRM.mod == 3, and hence where
MOD matters but hasn't been decoded yet it needs to be anyway. (The case
of converting to Rm is temporary until a subsequent change.)
2020-07-14 10:42:33 +02:00
Jan Beulich
035e7389dd x86: simplify decode of opcodes valid only without any (embedded) prefix
In this case there's no need to go through prefix_table[] at all - the
.prefix_requirement == PREFIX_OPCODE machinery takes care of this case
already.

A couple of further adjustments are needed though:
- Gv / Ev and alike then can't be used (needs to be Gdq / Edq instead),
- dq_mode and friends shouldn't lead to PREFIX_DATA getting set in
  used_prefixes.
2020-07-14 10:42:03 +02:00
Jan Beulich
bb5b3501b3 x86: also use %BW / %DQ for kshift* 2020-07-14 10:41:30 +02:00
Tom de Vries
025a39a7c2 [gdb/testsuite] Fix clone-new-thread-event.c with glibc 2.30
Starting glibc 2.30, unistd.h declares gettid (for _GNU_SOURCE).

This clashes with a static gettid in test source
clone-new-thread-event.c:
...
gdb compile failed, gdb.threads/clone-new-thread-event.c:46:1: error: \
  static declaration of 'gettid' follows non-static declaration
   46 | gettid (void)
      | ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from gdb.threads/clone-new-thread-event.c:27:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of 'gettid' \
  was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
...

Fix this by renaming the static gettid to local_gettid.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-07-14  Tom de Vries  <tdevries@suse.de>

	* gdb.threads/clone-new-thread-event.c (gettid): Rename to ...
	(local_gettid): ... this.
	(fn): Update.
2020-07-14 10:36:17 +02:00
Jan Beulich
7531c61332 x86: simplify decode of opcodes valid with (embedded) 66 prefix only
The only valid (embedded or explicit) prefix being the data size one
(which is a fairly common pattern), avoid going through prefix_table[].
Instead extend the "required prefix" logic to also handle PREFIX_DATA
alone in a table entry, now used to identify this case. This requires
moving the (adjusted) ->prefix_requirement logic ahead of the printing
of stray prefixes, as the latter needs to observe the new setting of
PREFIX_DATA in used_prefixes.

Also add PREFIX_OPCODE on related entries when previously there was
mistakenly no decode step through prefix_table[].
2020-07-14 10:33:40 +02:00
Jan Beulich
17d3c7eccd x86: drop further EVEX table entries that can be served by VEX ones
A few cases were missed by 6df22cf64c ("x86: drop EVEX table entries
that can be served by VEX ones").
2020-07-14 10:32:51 +02:00
Jan Beulich
41f5efc685 x86: drop need_vex_reg
It was quite odd for the prior operand handling to have to clear this
flag for the actual operand handling to print nothing. Have the actual
operand handling determine whether the operand is actually present.
With this {d,q}_scalar_swap_mode become unused and hence also get dropped.
2020-07-14 10:32:19 +02:00
Jan Beulich
89e65d17e3 x86: drop Vex128 and Vex256
These are only used when VEX.L or EVEX.L'L have already been decoded,
and hence the "normal" length dependent name determination is quite
fine. Adjust a few enumerators to make clear that vex_len_table[] has
been consulted; be consistent and do so for all *f128 and *i128 insns
in one go.
2020-07-14 10:31:49 +02:00
Jan Beulich
492a76aab5 x86: replace %LW by %DQ
This makes more visible what the two alternatives will be that result
from this macro.
2020-07-14 10:30:26 +02:00
Jan Beulich
059edf8b97 x86: merge/move logic determining the EVEX disp8 shift
Fold redundant case blocks and move the extra adjustments logic into
the single case block that actually needs it - there's no need to go
through the extra logic for all the other cases. Also utilize there that
vex.b cannot be set at this point, due to earlier logic. Reduce the
comment there, which was partly stale anyway.
2020-07-14 10:29:55 +02:00
Jan Beulich
4726e9a479 x86: extend %BW use to VP{COMPRESS,EXPAND}{B,W}
Unlike the earlier ones these also need their operands adjusted. Replace
the (mis-described: there's nothing "scalar" here) {b,w}_scalar_mode by
a single new mode, with the actual unit width controlled by EVEX.W.
2020-07-14 10:29:25 +02:00
Jan Beulich
b24d668c07 x86-64: fix {,V}PCMPESTR{I,M} disassembly in Intel mode
The operands don't allow disambiguating the insn in 64-bit mode, and
hence suffixes need to be emitted not just in AT&T mode. Achieve this
by re-using %LQ while dropping PCMPESTR_Fixup().
2020-07-14 10:28:12 +02:00
Jan Beulich
c4de76066e x86: fold VCMP_Fixup() into CMP_Fixup()
There's no reason to have two functions and two tables, when the AVX
functionality here is a proper superset of the SSE one.
2020-07-14 10:27:32 +02:00
Jan Beulich
9ab00b61a9 x86: don't disassemble MOVBE with two suffixes
MOVBE_Fixup() is entirely redundant with the S macro already used on the
mnemonics, leading to double suffixes in suffix-always mode. Drop the
function.
2020-07-14 10:26:51 +02:00
Jan Beulich
2875b28aa8 x86: avoid attaching suffix to register-only CRC32
Just like other insns with GPR operands, CRC32 with only register
operands should not get a suffix added unless in suffix-always mode.
Do away with CRC32_Fixup() altogether, using other more generic logic
instead.
2020-07-14 10:25:43 +02:00
Jan Beulich
e184e6110e x86-64: don't hide an empty but meaningless REX prefix
Unlike for non-zero values passed to USED_REX(), where rex_used gets
updated only when the respective bit was actually set in the encoding,
zero getting passed in is not further guarded, yet such a (potentially
"empty") REX prefix takes effect only when there are registers numbered
4 and up.
2020-07-14 10:24:26 +02:00
Jan Beulich
e8b5d5f971 x86: drop dead code from OP_IMREG()
There's only a very limited set of modes that this function gets invoked
with - avoid it being more generic than it needs to be. This may, down
the road, allow actually doing away with the function altogether.

This eliminates a first improperly used "USED_REX (0)".
2020-07-14 10:23:36 +02:00
Jan Beulich
38397794c9 x86-64: fold ILP32 test expectations
Various of the test expectations get adjusted later in this and a
subsequent series, so in order to avoid having to adjust more instances
than necessary fold respective test ILP32 expectations with their main
64-bit counterparts where they're identical anyway.
2020-07-14 10:22:45 +02:00
Simon Marchi
b315b67d7a gdbserver: fix memory leak when handling qsupported packet
When building gdbserver with AddressSanitizer, I get this annoying
little leak when gdbserver exits:

==307817==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 14 byte(s) in 1 object(s) allocated from:
        #0 0x7f7fd4256459 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
        #1 0x563bef981b80 in xmalloc /home/simark/src/binutils-gdb/gdbserver/../gdb/alloc.c:60
        #2 0x563befb53301 in xstrdup /home/simark/src/binutils-gdb/libiberty/xstrdup.c:34
        #3 0x563bef9d742b in handle_query /home/simark/src/binutils-gdb/gdbserver/server.cc:2286
        #4 0x563bef9ed0b7 in process_serial_event /home/simark/src/binutils-gdb/gdbserver/server.cc:4061
        #5 0x563bef9f1d9e in handle_serial_event(int, void*) /home/simark/src/binutils-gdb/gdbserver/server.cc:4402
        #6 0x563befb0ec65 in handle_file_event /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:548
        #7 0x563befb0f49f in gdb_wait_for_event /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:673
        #8 0x563befb0d4a1 in gdb_do_one_event() /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:215
        #9 0x563bef9e721a in start_event_loop /home/simark/src/binutils-gdb/gdbserver/server.cc:3484
        #10 0x563bef9eb90a in captured_main /home/simark/src/binutils-gdb/gdbserver/server.cc:3875
        #11 0x563bef9ec2c7 in main /home/simark/src/binutils-gdb/gdbserver/server.cc:3961
        #12 0x7f7fd3330001 in __libc_start_main (/usr/lib/libc.so.6+0x27001)

    SUMMARY: AddressSanitizer: 14 byte(s) leaked in 1 allocation(s).

This is due to the handling of unknown qsupported features in
handle_query.  The `qsupported` vector is built, containing all the
feature names received from GDB.  As we iterate on them, when we
encounter unknown ones, we move them at the beginning of the vector, in
preparation of passing this vector of unknown features down to the
target (which may know about them).

When moving these unknown features to other slots in the vector, we
overwrite other pointers without freeing them, which therefore leak.

An easy fix would be to add a `free` when doing the move.  However, I
think this is a good opportunity to sprinkle a bit of automatic memory
management in this code.

So, use a vector of std::string which owns all the entries.  And use a
separate vector (that doesn't own the entries) for the unknown ones,
which is then passed to target_process_qsupported.

Given that the `c_str` method of std::string returns a `const char *`,
it follows that process_stratum_target::process_qsupported must accept a
`const char **` instead of a `char **`.  And while at it, change the
pointer + size paramters to use an array_view instead.

gdbserver/ChangeLog:

	* server.cc (handle_query): Use std::vector of
	std::string for `qsupported` vector.  Use separate
	vector for unknowns.
	* target.h (class process_stratum_target) <process_qsupported>:
	Change parameters to array_view of const char *.
	(target_process_qsupported): Remove `count` parameter.
	* target.cc (process_stratum_target::process_qsupported): Change
	parameters to array_view of const char *.
	* linux-x86-low.cc (class x86_target) <process_qsupported>:
	Likewise.

Change-Id: I97f133825faa6d7abbf83a58504eb0ba77462812
2020-07-13 22:27:01 -04:00
GDB Administrator
0a3a820f6c Automatic date update in version.in 2020-07-14 00:00:12 +00:00
Paul Carroll
ed788fee02 Fix frame-apply.html collision in GDB manual.
The addition of an anchor for the "frame apply" command was causing
the HTML documentation to include files named both "frame-apply.html"
and "Frame-Apply.html", which collide on case-insensitive file
systems.  This patch removes the redundant anchor and adjusts the two
xrefs to it.

2020-07-13 Paul Carroll <pcarroll@codesourcery.com>

	PR gdb/25716

	gdb/doc/
	* gdb.texinfo (Frame Apply): Remove anchor for 'frame
	apply' and adjust xrefs to it.
2020-07-13 12:31:05 -07:00
Sandra Loosemore
74e4b667ec Skip directory tests in gdb.base/info_sources.exp on remote host
When testing on a remote host, source files from build are copied to
an arbitrary location on host.  Tests that try to pattern-match host
pathnames against directory prefixes on build don't generally work.

2020-07-13  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.base/info_sources.exp: Skip directory match tests on
	remote hosts.
2020-07-13 11:34:04 -07:00
H.J. Lu
7a70531559 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.

	* config/tc-i386.c (offset_in_range): Remove 32-bit sign
	extension.
2020-07-13 10:32:15 -07:00
Gary Benson
f413dd7439 Fix gdb.base/savedregs.exp with clang
gdb.base/savedregs.exp fails to run with clang, because of:

 gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.base/savedregs.c:36:37:
       warning: operator '<<' has lower precedence than '+'; '+' will be
       evaluated first [-Wshift-op-parentheses]
   return callee (a1 << a2 * a3 / a4 + a6 & a6 % a7 - a8) + done;
                     ~~ ~~~~~~~~~~~~~^~~~
 /gdbtest/build/gdb/testsuite/gdb.base/savedregs.c:36:37: note: place
       parentheses around the '+' expression to silence this warning
   return callee (a1 << a2 * a3 / a4 + a6 & a6 % a7 - a8) + done;
                                     ^
                        (                )
 1 warning generated.

This commit fixes it by adding the suggested parentheses.

gdb/testsuite/ChangeLog:

	* gdb.base/savedregs.exp (caller): Use parentheses to
	make expected expression evaluation ordering explicit.
2020-07-13 16:01:00 +01:00
Gary Benson
915771bb8a Fix gdb.arch/i386-sse.exp with clang
gdb.arch/i386-sse.exp fails to run with clang, because of:

 gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.arch/i386-sse.c:56:40: warning:
       passing 'int *' to parameter of type 'unsigned int *' converts between
       pointers to integer types with different sign [-Wpointer-sign]
   if (!x86_cpuid (1, NULL, NULL, NULL, &edx))
                                        ^~~~
 /gdbtest/src/gdb/testsuite/../nat/x86-cpuid.h:35:41: note: passing
       argument to parameter '__edx' here
             unsigned int *__ecx, unsigned int *__edx)
                                               ^
 1 warning generated.

Fix it by declaring edx unsigned.

gdb/testsuite/ChangeLog:

	* gdb.arch/i386-sse.c (have_sse) <edx>: Make unsigned.
2020-07-13 15:14:07 +01:00
Nick Clifton
0a5c31d1ac Updated French translation for the gas/ and binutils/ sub-directories 2020-07-13 14:49:58 +01:00
Gary Benson
2a122642b4 Use volatile pointers when attempting to trigger SIGSEGVs
Clang fails to compile a number of files with the following warning:
indirection of non-volatile null pointer will be deleted, not trap
[-Wnull-dereference].  This commit qualifies the relevant pointers
with 'volatile'.

gdb/testsuite/ChangeLog:

	* gdb.base/bigcore.c (main): Use a volatile pointer when
	attempting to trigger a SIGSEGV.
	* gdb.base/gcore-relro-pie.c (break_here): Likewise.
	* gdb.base/gcore-tls-pie.c (break_here): Likewise.
	* gdb.base/savedregs.c (thrower): Likewise.
	* gdb.mi/mi-syn-frame.c (bar): Likewise.
2020-07-13 14:47:44 +01:00
Gary Benson
3f00c730ac Skip VLA structure field tests when compiling with clang
Clang fails to compile gdb.base/vla-datatypes.c with the following
error: fields must have a constant size: 'variable length array in
structure' extension will never be supported.  This commit factors
the affected tests out into a new testcase, vla-struct-fields.{exp,c},
which is skipped when the testcase is compiled using clang,

gdb/testsuite/ChangeLog:

	* gdb.base/vla-datatypes.c (vla_factory): Factor out sections
	defining and using VLA structure fields into...
	* gdb.base/vla-struct-fields.c: New file.
	* gdb.base/vla-datatypes.exp: Factor out VLA structure field
	tests into...
	* gdb.base/vla-struct-fields.exp: New file.
2020-07-13 14:47:44 +01:00
Alan Modra
7a34d0ea4d x86_64-cygwin tests
Tests just having "xfail: x86_64-*-cygwin" aren't good, since
presumably if a test fails on x86_64-cygwin then it also fails on
x86_64-*-pe* and x86_64-*-mingw*.

binutils/
	* testsuite/lib/binutils-common.exp (is_pecoff_format): Accept
	optional machine-os arg.
ld/
	* testsuite/ld-scripts/default-script1.d: Don't skip, xfail
	using is_pecoff_format.
	* testsuite/ld-scripts/default-script2.d: Likewise.
	* testsuite/ld-scripts/default-script3.d: Likewise.
	* testsuite/ld-scripts/default-script4.d: Likewise.
	* testsuite/ld-scripts/pr20302.d: Remove x86_64-*-cygwin from notarget.
	* testsuite/ld-scripts/provide-6.d: Remove x86_64-*-cygwin from xfail.
	* testsuite/ld-scripts/provide-8.d: Likewise.
2020-07-13 22:03:59 +09:30
Alan Modra
8884c29c0f gas DWARF2 test XPASSes
git commit af2b318648 introduced a number of XPASSes.  This removes
them.  (It also introduces a FAIL on ft32-elf but the comment in the
.d file didn't adequately explain why the failure should be expected.)

	* testsuite/gas/elf/dwarf2-7.d: Remove most xfails.
	* testsuite/gas/elf/dwarf2-12.d: Likewise.
	* testsuite/gas/elf/dwarf2-13.d: Likewise.
	* testsuite/gas/elf/dwarf2-14.d: Likewise.
2020-07-13 22:03:59 +09:30
Tom de Vries
963eeee42a [gdb/testsuite] Handle missing gold linker in gdb.base/morestack.exp
When running test-case gdb.base/morestack.exp without the gold linker
installed, we run into:
...
Running src/gdb/testsuite/gdb.base/morestack.exp ...
gdb compile failed, collect2: fatal error: cannot find 'ld'
compilation terminated.
FAIL: gdb.base/morestack.exp: continue

                === gdb Summary ===

nr of expected passes            1
nr of unexpected failures        1
nr of untested testcases         1
...

The test-case needs the gold linker to run correctly (as explained in commit
b8d38ee425 "testsuite: Fix false FAIL for gdb.base/morestack.exp"), but
only prefers it, and doesn't require it.

Fix this by requiring the gold linker in the test-case.  Furthermore, silence
the compilation error by introducing a caching proc have_fuse_ld_gold and
using it in this and other test-cases that use -fuse-ld=gold.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-07-13  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (have_fuse_ld_gold): New caching proc.
	* gdb.base/gcore-tls-pie.exp: Use have_fuse_ld_gold.
	* gdb.base/gold-gdb-index.exp: Same.
	* gdb.base/morestack.exp: Same.
2020-07-13 14:14:47 +02:00