Luis Machado [Wed, 23 Dec 2020 19:06:11 +0000 (16:06 -0300)]
Use gdb::array_view for setting value bytes in trad-frame
This patch updates the functions setting value bytes in trad-frame to use
a gdb::array_view instead of passing a buffer and a size.
gdb/ChangeLog:
2021-01-19 Luis Machado <luis.machado@linaro.org>
* aarch64-linux-tdep.c (aarch64_linux_restore_vreg): Pass in an
array_view.
* trad-frame.c (trad_frame_set_value_bytes): Use gdb::array_view
instead of buffer and size.
(trad_frame_set_reg_value_bytes): Likewise.
* trad-frame.h (trad_frame_set_reg_value_bytes): Likewise.
(trad_frame_set_value_bytes): Likewise.
Nick Alcock [Tue, 19 Jan 2021 12:45:18 +0000 (12:45 +0000)]
libctf, create: fix ctf_type_add of structs with unnamed members
Our recent commit to support unnamed structure members better ditched
the old ctf_member_iter iterator body in favour of ctf_member_next.
However, these functions treat unnamed structure members differently:
ctf_member_iter just returned whatever the internal representation
contained, while ctf_member_next took care to always return "" rather
than sometimes returning "" and sometimes NULL depending on whether the
dict was dynamic (a product of ctf_create) or not (a product of
ctf_open). After this commit, ctf_member_iter did the same.
It was always a bug for external callers not to treat a "" return from
these functions as if it were NULL, so only buggy callers could be
affected -- but one of those buggy callers was ctf_add_type, which
assumed that it could just take whatever name was returned from
ctf_member_iter and slam it directly into the internal representation of
a dynamic dict -- which expects NULL for unnamed members, not "". The
net effect of all of this is that taking a struct containing unnamed
members and ctf_add_type'ing it into a dynamic dict produced a dict
whose unnamed members were inaccessible to ctf_member_info (though if
you wrote that dict out and then ctf_open'ed it, they would magically
reappear again).
Compensate for this by suitably transforming a "" name into NULL in the
internal representation, as should have been done all along.
libctf/ChangeLog
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* ctf-create.c (membadd): Transform ""-named members into
NULL-named ones.
* testsuite/libctf-regression/type-add-unnamed-struct*: New test.
Nick Alcock [Tue, 19 Jan 2021 12:45:18 +0000 (12:45 +0000)]
libctf: lookup_by_name: do not return success for nonexistent pointer types
The recent work allowing lookups of pointers in child dicts when the
pointed-to type is in the parent dict broke the case where a pointer
type that does not exist at all is looked up: we mistakenly return the
pointed-to type, which is likely not a pointer at all. This causes
considerable confusion.
Fixed, with a new testcase.
libctf/ChangeLog
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* ctf-lookup.c (ctf_lookup_by_name_internal): Do not return the
base type if looking up a nonexistent pointer type.
* testsuite/libctf-regression/pptrtab*: Test it.
Nick Alcock [Tue, 19 Jan 2021 12:45:18 +0000 (12:45 +0000)]
libctf, ld: fix data symbol test with newer GCC
GCC 11+ spots that the extern var_1 and var_666 declarations in this
test are unused, and removes them, thus stopping them from appearing as
conflicted data symbols and rendering the test pointless. Use them in a
function unique to this TU to prevent them from being eliminated.
ld/ChangeLog
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* testsuite/ld-ctf/data-func-2.c: Stop removal of the extern foo_t
symbols by the optimizer.
* testsuite/ld-ctf/data-func-conflicted.d: Adjust accordingly.
Tom de Vries [Tue, 19 Jan 2021 12:31:12 +0000 (13:31 +0100)]
[gdb/testsuite] Fix gdb.base/step-over-syscall.exp with -m32
When executing test-case gdb.base/step-over-syscall.exp with target board
unix/-m32, we run into:
...
(gdb) x/2i $pc^M
=> 0xf7fd5155 <__kernel_vsyscall+5>: sysenter ^M
0xf7fd5157 <__kernel_vsyscall+7>: int $0x80^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: \
pc before/after syscall instruction
stepi^M
[Detaching after fork from child process 23593]^M
0xf7fd5159 in __kernel_vsyscall ()^M
1: x/i $pc^M
=> 0xf7fd5159 <__kernel_vsyscall+9>: pop %ebp^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: stepi fork insn
print /x $pc^M
$2 = 0xf7fd5159^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: pc after stepi
FAIL: gdb.base/step-over-syscall.exp: fork: displaced=off: \
pc after stepi matches insn addr after syscall
...
The test tries to verify that after doing a stepi at a syscall insn, the $pc
is matching the insn after the syscall insn.
However, in the case that the syscall insn is "sysenter", the stepi will land
further away, so in this case:
...
0xf7fd5155 <__kernel_vsyscall+5>: sysenter ^M
0xf7fd5157 <__kernel_vsyscall+7>: int $0x80^M
0xf7fd5159 <__kernel_vsyscall+9>: pop %ebp^M
...
the stepi will land at 0xf7fd5159 instead of 0xf7fd5157.
Fix this by detecting the sysenter/int sequence and adjusting the expected
pc.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-19 Tom de Vries <tdevries@suse.de>
* gdb.base/step-over-syscall.exp: Detect and handle sysenter/int
sequence.
Tom de Vries [Tue, 19 Jan 2021 12:31:12 +0000 (13:31 +0100)]
[gdb/testsuite] Fix gdb.arch/i386-mpx.exp with -m32
When running test-case gdb.arch/i386-mpx.exp with target board unix/-m32, we
run into:
...
(gdb) print $bndstatus^M
$3 = {raw = 0xf7ca7ff2, status = {bde =
1039310844, error = 2}}^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: bndstatus formating
print $bndstatus.raw^M
$4 = (void *) 0xf7ca7ff2^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: bndstatus is zero by startup
...
The failure does not occur with -m64, there we have instead:
...
(gdb) print $bndstatus^M
$3 = {raw = 0x0, status = {bde = 0, error = 0}}^M
(gdb) PASS: gdb.arch/i386-mpx.exp: bndstatus formating
print $bndstatus.raw^M
$4 = (void *) 0x0^M
(gdb) PASS: gdb.arch/i386-mpx.exp: bndstatus is zero by startup
...
The difference is as follows. At the point of issuing the print commands, we
have run to main, so in the case of -m64 we have executed:
...
00000000004004c7 <main>:
4004c7: 55 push %rbp
4004c8: 48 89 e5 mov %rsp,%rbp
4004cb: 89 7d fc mov %edi,-0x4(%rbp)
4004ce: 48 89 75 f0 mov %rsi,-0x10(%rbp)
4004d2: 66 0f 1b 45 e0 bndmov %bnd0,-0x20(%rbp)
...
and in the case of -m32:
...
08048426 <main>:
8048426: 55 push %ebp
8048427: 89 e5 mov %esp,%ebp
8048429: 83 ec 08 sub $0x8,%esp
804842c: 8d 45 0c lea 0xc(%ebp),%eax
804842f: 8b 55 0c mov 0xc(%ebp),%edx
8048432: 0f 1a 04 10 bndldx (%eax,%edx,1),%bnd0
8048436: 66 0f 1b 45 f8 bndmov %bnd0,-0x8(%ebp)
...
In both cases, the bnd instructions attempt to save the bound for pointer
argument argv to stack. However, there's no such bound set.
In the -m64 case, that means we just save some random value to stack.
In the -m32 case, that means that when executing bndldx the corresponding
entry in the Bounds Directory is invalid, and $bndstatus is updated to reflect
that.
Fix this by dropping the unnecessary argv parameter to main, similar to all
other gdb.arch/i386-mpx*.c test-cases.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-19 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-mpx.c (main): Drop argc/argv parameter.
Alan Modra [Tue, 19 Jan 2021 08:56:11 +0000 (19:26 +1030)]
PowerPC use_local_plt
Put the logic to select local vs. usual .plt section in one place.
* elf64-ppc.c (elf_hash_entry): New inline function. Use
throughout to replace casts.
(branch_reloc_hash_match): Remove const from params.
(use_local_plt): New function.
(allocate_dynrelocs, ppc_build_one_stub, ppc_size_one_stub),
(build_global_entry_stubs_and_plt, ppc64_elf_relocate_section):
Use use_local_plt.
* elf32-ppc.c (use_local_plt): New function.
(allocate_dynrelocs, ppc_elf_relocate_section),
(write_global_sym_plt): Use use_local_plt.
Alan Modra [Tue, 19 Jan 2021 02:49:18 +0000 (13:19 +1030)]
[GOLD] powerpc assertion failure
A testcase with only ifuncs can result in no plt section (ifunc plt
entries might instead be in iplt), which means we can get to this code
without a static link.
PR 27203
* powerpc.cc (do_plt_fde_location): Remove doing_static_link
assertion.
Mike Frysinger [Tue, 19 Jan 2021 02:28:20 +0000 (21:28 -0500)]
sim: bfin: delete accidental ADI copyright
This wasn't supposed to be in here when it was first merged as we
had specifically disabled it for all the tests (and ADI has papers
in place w/the FSF). Clean up this one.
Nelson Chu [Fri, 8 Jan 2021 12:04:13 +0000 (04:04 -0800)]
ld: Just xfail riscv little endian targets for compressed1d.d test.
The sizes of compressed and uncompressed .debug_aranges are the same
for the riscv big endian targets, but different for the little endian
targets. The compress rule is fine and isn't broken by riscv, just the
original compressed1d.d fails by accident. Ideally, we should fill the
R_RISCV_ADD/SUB relocations when disabling relaxations in the assembler.
But before that, Jim already had written an alternative test compressed1d-alt
to relpace compressed1d.d for riscv, so we can only xfail the riscv little
endian targets in the short-term.
ld/
* testsuite/ld-elf/elf.exp (riscv_little_endian): Added. Return true
if target is riscv little endian. Otherwise, return false.
* testsuite/ld-elf/compressed1d.d: Only xfail the riscv little endian
targets by [riscv_little_endian].
GDB Administrator [Tue, 19 Jan 2021 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sun, 17 Jan 2021 11:16:38 +0000 (06:16 -0500)]
sim: common: simplify version script
We don't use the host & target aliases, so don't bother emitting them.
Mike Frysinger [Sun, 17 Jan 2021 10:32:12 +0000 (05:32 -0500)]
sim: common: delete configure & Makefile
This was mostly orphaned a while back, but left behind so people could
still run `make headers`. Merge that one target to the top sim dir and
delete all the build logic. This should avoid confusing people further.
Mike Frysinger [Sun, 17 Jan 2021 09:52:42 +0000 (04:52 -0500)]
sim: common: modernize gennltvals.sh
It's not 1996 anymore, so stop writing shell code like it is, and
rewrite it with modern POSIX shell standards. This makes it much
more user friendly.
Then regenerate the file with latest newlib sources to verify.
Andrew Burgess [Mon, 18 Jan 2021 17:01:11 +0000 (17:01 +0000)]
gdb/testsuite: remove actual addresses from some test names
After commit:
commit
10f92414d6d4a5f8eb8cbb2bf39ca86c1f9c1da5
Date: Fri Jan 15 12:14:45 2021 +0100
[gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32
Some test names now contain the addresses of variables from the
inferior. When running the test in different directories I'm seeing
slightly different values for the addresses. This makes comparing
test results between directories harder than it needs to be.
This commit just gives the tests a descriptive name without including
the addresses.
gdb/testsuite/ChangeLog:
* gdb.fortran/array-slices.exp (run_test): Avoid including
addresses in test names.
H.J. Lu [Mon, 18 Jan 2021 14:25:05 +0000 (06:25 -0800)]
as: Automatically enable DWARF5 support
Currently
$ as -o x.o x.s
fails when x.s contains DWARF5 ".file 0" or ".loc 0" directives. Update
assembler to automatically enable DWARF5 support so that
$ gcc -S -g -c x.c
$ gcc -c x.s
works.
PR gas/27195
* dwarf2dbg.c (dwarf2_gen_line_info): Set dwarf_level to 5 if
needed.
(dwarf2_directive_filename): Likewise.
(dwarf2_directive_loc): Likewise.
* testsuite/gas/elf/dwarf-5-file0.d: Pass --gdwarf-3.
* testsuite/gas/lns/lns-diag-1.l: Remove the
"Error: file number less than one" errors.
Andrew Burgess [Wed, 2 Dec 2020 15:10:06 +0000 (15:10 +0000)]
gdb/riscv: use a single regset supply function for riscv fbsd & linux
The RISC-V x0 register is hard-coded to zero. As such neither Linux
or FreeBSD supply the value of the register x0 in their core dump
files.
For FreeBSD we take care of this by manually supplying the value of x0
in riscv_fbsd_supply_gregset, however we don't do this for Linux. As
a result after loading a core file on Linux we see this behaviour:
(gdb) p $x0
$1 = <unavailable>
In this commit I make riscv_fbsd_supply_gregset a common function that
can be shared between RISC-V for FreeBSD and Linux, this resolves the
above issue.
There is a similar problem for the two registers `fflags` and `frm`.
These two floating point related CSRs are a little weird. They are
separate CSRs in the RISC-V specification, but are actually sub-fields
of the `fcsr` CSR.
As a result neither Linux or FreeBSD supply the `fflags` or `frm`
registers as separate fields in their core dumps, and so, after
restoring a core dump these register are similarly unavailable.
In this commit I supply `fflags` and `frm` by first asking for the
value of `fcsr`, extracting the two fields, and using these to supply
the values for `fflags` and `frm`.
gdb/ChangeLog:
* riscv-fbsd-tdep.c (riscv_fbsd_supply_gregset): Delete.
(riscv_fbsd_gregset): Use riscv_supply_regset.
(riscv_fbsd_fpregset): Likewise.
* riscv-linux-tdep.c (riscv_linux_gregset): Likewise.
(riscv_linux_fregset): Likewise.
* riscv-tdep.c (riscv_supply_regset): Define new function.
* riscv-tdep.h (riscv_supply_regset): Declare new function.
Alan Modra [Sat, 12 Sep 2020 01:19:13 +0000 (10:49 +0930)]
PR26378, sections initialised only by linker scripts are always read/write
This changes the initialisation of output sections so that it is
possible to create read-only sections fed only from linker script
BYTE, SHORT, LONG or QUAD. That currently isn't possible even for one
of the well-known ELF sections like .rodata, because once a section is
marked read/write that sticks. On the other hand if we start
read-only, well-known ELF sections end up read/write as appropriate.
For example .tdata will still be SHF_ALLOC + SHF_WRITE + SHF_TLS.
PR 26378
* ldlang.c (map_input_to_output_sections): Start with a read-only
section for data statements.
* testsuite/ld-elf/size-2.d: Adjust to suit.
Tom de Vries [Mon, 18 Jan 2021 08:32:38 +0000 (09:32 +0100)]
[gdb/tdep] Handle si_addr_bnd in compat_siginfo_from_siginfo
When running test-case gdb.arch/i386-mpx-sigsegv.exp with target board
unix/-m32, we run into:
...
(gdb) continue^M
Continuing.^M
Saw a #BR! status 1 at 0x8048c2d^M
^M
Program received signal SIGSEGV, Segmentation fault^M
Upper bound violation while accessing address 0x0804c15c^M
Bounds: [lower = 0x00000000, upper = 0x00000000].^M
0x08048a4f in lower (p=0x804c160, a=0x804c180, b=0x804c1a0, c=0x804c1c0, \
d=0x804c1e0, len=1) at i386-mpx-sigsegv.c:79^M
79 value = *(p - len);^M
(gdb) FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
...
The problem is that lower and upper in the Bounds message are 0x0, which is
caused by $_siginfo._sifields._sigfault._addr_bnd.{_lower,_upper} evaluating
to 0x0.
Fix this by copying the si_lower/si_upper fields in
compat_siginfo_from_siginfo.
Tested on x86_64-linux, with target board unix/-m32.
gdb/ChangeLog:
2021-01-18 Tom de Vries <tdevries@suse.de>
PR tdep/27172
* nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper, SEGV_BNDERR):
New macro.
(compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
for SEGV_BNDERR.
Simon Marchi [Mon, 18 Jan 2021 05:46:13 +0000 (00:46 -0500)]
gdb: const-ify hostio methods parameter in remote.c
gdb/ChangeLog:
* remote.c (class remote_target) <remote_hostio_send_command,
remote_hostio_parse_result>: Constify parameter.
(remote_hostio_parse_result): Likewise.
(remote_target::remote_hostio_send_command): Adjust.
(remote_target::remote_hostio_pread_vFile): Adjust.
(remote_target::fileio_readlink): Adjust.
(remote_target::fileio_fstat): Adjust.
Change-Id: I6b585b99937e6526a0a7e06261d2193114589912
Simon Marchi [Mon, 18 Jan 2021 05:46:13 +0000 (00:46 -0500)]
gdb: move remote_target::start_remote variable to narrower scope
The wait_status variable is only used when the target is in in all-stop
mode. We can therefore move it in the !target_is_non_stop scope. That
lets us remove the assert in the else, that checks that the wait status
is not set. If the variable doesn't exist in that scope, it pretty much
guarantees that it is not set.
gdb/ChangeLog:
* remote.c (remote_target::start_remote): Move wait_status to
narrower scope.
Change-Id: I30979135e3f4f36d04178baa67575c4e58d3b648
Simon Marchi [Mon, 18 Jan 2021 05:46:13 +0000 (00:46 -0500)]
gdb: const-ify remote_target::add_current_inferior_and_thread parameter
... and adjust callers / callees.
gdb/ChangeLog:
* remote.c (class remote_target):
<add_current_inferior_and_thread>: Constify parameter.
(stop_reply_extract_thread): Likewise.
(remote_target::get_current_thread): Likewise.
(remote_target::add_current_inferior_and_thread): Likewise.
Change-Id: Ifdc6c263104b58852b532cfda81caf836437d29c
Simon Marchi [Mon, 18 Jan 2021 05:46:13 +0000 (00:46 -0500)]
gdb: const-ify unpack_* functions in remote.c
Const-ify the unpack_* functions, and then adjust the callers
accordingly.
gdb/ChangeLog:
* remote.c (class remote_target)
<remote_unpack_thread_info_response,
parse_threadlist_response>: Constify parameter and/or return
value and or local variable.
(stub_unpack_int): Likewise.
(unpack_nibble): Likewise.
(unpack_byte): Likewise.
(unpack_int): Likewise.
(unpack_string): Likewise.
(unpack_threadid): Likewise.
(remote_target::remote_unpack_thread_info_response): Likewise.
(remote_target::parse_threadlist_response): Likewise.
Change-Id: Ibda75f664d6e3452df00f85af7134533049171b7
Alan Modra [Sun, 17 Jan 2021 23:08:22 +0000 (09:38 +1030)]
PR27198, segv in S_IS_WEAK
Fix a NULL dereference seen when assembling invalid input.
PR 27198
* config/tc-i386.c (need_plt32_p): Return FALSE for NULL symbol.
* testsuite/gas/i386/pr27198.d,
* gas/testsuite/gas/i386/pr27198.err,
* gas/testsuite/gas/i386/pr27198.s: New test.
* gas/testsuite/gas/i386/i386.exp: Run it.
H.J. Lu [Mon, 18 Jan 2021 04:01:16 +0000 (20:01 -0800)]
ld/elf: Ignore section symbols when matching linkonce with comdat
When deciding if a single member comdat group section in file FOO should
be discarded by a linkonce section in file BAR, we check if 2 sections
define the same set of local and global symbols. When only one of the
files doesn't contain the unused section symbols in the symbol table,
such as object files generated by clang or GNU assembler with
commit
d1bcae833b32f1408485ce69f844dcd7ded093a8
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Jan 7 06:42:00 2021 -0800
ELF: Don't generate unused section symbols
the check will fail since one file has the extra unused section symbols.
We should ignore both undefined and section symbols in the symbol table
when making such a decision.
bfd/
PR ld/27193
* elflink.c (elf_create_symbuf): Also ignore section symbols.
ld/
PR ld/27193
* testsuite/ld-i386/i386.exp: Run PR ld/27193 test.
* testsuite/ld-i386/pr27193.dd: New file.
* testsuite/ld-i386/pr27193a.o.bz2: Likewise.
* testsuite/ld-i386/pr27193b.s: Likewise.
H.J. Lu [Mon, 18 Jan 2021 00:43:45 +0000 (16:43 -0800)]
gold: Remove the circular IFUNC dependency in ifuncmain6pie
On Fedora 33 x86-64 with glibc 2.32-3, ifuncmain6pie failed with:
./ifuncmain6pie: IFUNC symbol 'foo' referenced in './ifuncmod6.so' is defined in the executable and creates an unsatisfiable circular dependency.
FAIL ifuncmain6pie (exit status: 127)
Remove non-JUMP_SLOT relocations against foo in ifuncmod6.so, which
trigger the circular IFUNC dependency.
* testsuite/ifuncmain6pie.c: Remove non-JUMP_SLOT relocations
against foo in ifuncmod6.so.
* testsuite/ifuncmod6.c: Likewise.
GDB Administrator [Mon, 18 Jan 2021 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 17 Jan 2021 02:36:40 +0000 (18:36 -0800)]
PR binutils/23460: Increase the max number of open files to 20
Increase the max number of open files to 20 for PR binutils/23460 test
which may have more than 16 file descriptors open:
lr-x------ 1 hjl hjl 64 Jan 16 16:49 0 -> /dev/null
l-wx------ 1 hjl hjl 64 Jan 16 16:49 1 -> pipe:[
14151430]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 10 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460c.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 11 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460d.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 12 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460e.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 13 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460f.o
lrwx------ 1 hjl hjl 64 Jan 16 16:49 14 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/stTLiXpO
lrwx------ 1 hjl hjl 64 Jan 16 16:49 15 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/stTLiXpO
l-wx------ 1 hjl hjl 64 Jan 16 16:49 2 -> pipe:[
14151430]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 3 -> pipe:[
13933216]
l-wx------ 1 hjl hjl 64 Jan 16 16:49 4 -> pipe:[
13933216]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 5 -> pipe:[
13990857]
l-wx------ 1 hjl hjl 64 Jan 16 16:49 6 -> pipe:[
13990857]
lr-x------ 1 hjl hjl 64 Jan 16 16:49 7 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/libpr23460.a
lr-x------ 1 hjl hjl 64 Jan 16 16:49 8 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460a.o
lr-x------ 1 hjl hjl 64 Jan 16 16:49 9 -> /export/build/gnu/tools-build/x86_64-linux-toolchain/build-x86_64-linux/binutils/src/binutils-build/ld/tmpdir/pr23460b.o
PR binutils/23460
* testsuite/ld-plugin/lto.exp: Increase the max number of open
files to 20 for PR binutils/23460 test.
GDB Administrator [Sun, 17 Jan 2021 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 16 Jan 2021 15:00:09 +0000 (07:00 -0800)]
ld/elf/x86: Don't compare IFUNC address in the shared object
On x86, glibc 2.33 starts to issue a fatal error message when calling
IFUNC function defined in the unrelocated executable from a shared
library.
1. Update x86 ELF linker to always convert IFUNC function defined in
position-dependent executable (PDE) to the normal function. GOT in PDE
will be updated by R_*_IRELATIVE at run-time.
2. Update PR ld/23169 tests not to compare function address of external
IFUNC function in the shared object to avoid calling the IFUNC function
defined in the unrelocated executable.
3. Remove pr23169e tests which call the IFUNC function defined in the
unrelocated position-independent executable from a shared library.
bfd/
PR ld/23169
* elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): Don't
check pointer_equality_needed.
ld/
PR ld/23169
* testsuite/ld-ifunc/ifunc.exp: Replace pr23169c.rd with
pr23169a.rd for pr23169c and pr23169f. Remove pr23169e tests.
* testsuite/ld-ifunc/pr23169a.c (foo): Don't compare function
address.
H.J. Lu [Sat, 16 Jan 2021 02:06:48 +0000 (18:06 -0800)]
ld/x86: Add -z report-relative-reloc
Linker generated relative relocations don't have symbol info:
[hjl@gnu-cfl-2 tmpdir]$ readelf -rW dump
Relocation section '.rela.dyn' at offset 0x180 contains 2 entries:
Offset Info Type Sym. Value Symbol's Name + Addend
00002f70 00000008 R_X86_64_RELATIVE 1000
00002f68 00000025 R_X86_64_IRELATIVE 1007
[hjl@gnu-cfl-2 tmpdir]$
Add -z report-relative-reloc to x86 ELF linker to report dynamic relative
relocations:
[hjl@gnu-cfl-2 tmpdir]$ ../ld-new -pie -melf32_x86_64 -z report-relative-reloc -o dump report-reloc-1.o
dump: R_X86_64_IRELATIVE (offset: 0x00002f68, info: 0x00000025, addend: 0x00001007) against 'ifunc' for section '.data.rel.ro.local' in report-reloc-1.o
dump: R_X86_64_RELATIVE (offset: 0x00002f70, info: 0x00000008, addend: 0x00001000) against '_start' for section '.data.rel.ro.local' in report-reloc-1.o
[hjl@gnu-cfl-2 tmpdir]$
It can be used to map relative relocations to corresponding symbols.
bfd/
* elf-linker-x86.h (elf_linker_x86_params): Add
report_relative_reloc.
* elf32-i386.c (elf_i386_relocate_section): Call
_bfd_x86_elf_link_report_relative_reloc to report relative
relocations for -z report-relative-reloc.
(elf_i386_finish_dynamic_symbol): Likewse.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewse.
(elf_x86_64_finish_dynamic_symbol): Likewse.
* elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): New
function.
* elfxx-x86.h (_bfd_x86_elf_link_report_relative_reloc): New
prototype.
ld/
* NEWS: Mention -z report-relative-reloc.
* ld.texi: Document -z report-relative-reloc.
* emulparams/elf32_x86_64.sh: Source x86-report-relative.sh.
* emulparams/elf_i386.sh: Likewse.
* emulparams/elf_x86_64.sh: Likewse.
* emulparams/x86-report-relative.sh: New file.
* testsuite/ld-i386/report-reloc-1.d: Likewse.
* testsuite/ld-i386/report-reloc-1.l: Likewse.
* testsuite/ld-i386/report-reloc-1.s: Likewse.
* testsuite/ld-x86-64/report-reloc-1-x32.d: Likewse.
* testsuite/ld-x86-64/report-reloc-1.d: Likewse.
* testsuite/ld-x86-64/report-reloc-1.l: Likewse.
* testsuite/ld-x86-64/report-reloc-1.s: Likewse.
* testsuite/ld-i386/i386.exp: Run report-reloc-1.
* testsuite/ld-x86-64/x86-64.exp: Run report-reloc-1 and
report-reloc-1-x32.
Alan Modra [Fri, 15 Jan 2021 23:15:09 +0000 (09:45 +1030)]
Tidy inflateEnd calls
So that no one need worry about the value of Z_OK.
bfd/
* compress.c (decompress_contents): Tidy inflateEnd result test.
binutils/
* readelf.c (uncompress_section_contents): Tidy inflateEnd result test.
Alan Modra [Fri, 15 Jan 2021 10:47:43 +0000 (21:17 +1030)]
PR26002 undefined symbol VER_NDX_GLOBAL vs. VER_NDX_LOCAL
This patch makes undefined unversioned dynamic symbols use
VER_NDX_GLOBAL (version 1) rather than VER_NDX_LOCAL (version 0).
There really isn't much use for an undefined local dynamic symbol, so
we may as well use the logically correct value in .gnu.version.
https://docs.oracle.com/cd/E26505_01/html/E26506/chapter6-54676.html
bfd/
PR 26002
* elflink.c (elf_link_output_extsym): Use version 1 in
.gnu.version for undefined unversioned symbols.
ld/
PR 26002
* testsuite/ld-elfvers/vers6.dsym: Expect "Base" for undefined
unversioned symbols.
* testsuite/ld-elfvers/vers16.dsym: Likewise.
Mike Frysinger [Wed, 6 Jan 2021 03:09:57 +0000 (22:09 -0500)]
sim: testsuite: flatten tree
Now that all port tests live under testsuite/sim/*/, and none live
in testsuite/ directly, flatten the structure by moving all of the
dirs under testsuite/sim/ to testsuite/ directly.
We need to stop passing --tool to dejagnu so that it searches all
dirs and not just ones that start with "sim". Since we have no
other dirs in this tree, and no plans to add any, should be fine.
GDB Administrator [Sat, 16 Jan 2021 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 15 Jan 2021 20:21:04 +0000 (20:21 +0000)]
gdb/tui: compare pointer to nullptr, not 0
Compare pointers to nullptr, not 0. I also fixed a trailing
whitespace in the same function.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* tui/tui.c (tui_is_window_visible): Compare to nullptr, not 0.
Tom de Vries [Fri, 15 Jan 2021 11:14:45 +0000 (12:14 +0100)]
[gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32
When running test-case gdb.fortran/array-slices.exp with target board
unix/-m32, we run into:
...
(gdb) print /x &array4d^M
$69 = 0xffffb620^M
(gdb) print /x (&array4d) + sizeof (array4d)^M
$70 = 0x95c620^M
(gdb) FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
...
The expressions calculate the start and end of an array, but the calculation
of the end expression has an unexpected result (given that it lies before the
start of the array). By printing "sizeof (array4d)" as a separate
expression:
...
(gdb) print /x sizeof (array4d)
$1 = 0xc40
...
it becomes clear we expected to get 0xffffb620 + 0xc40 == 0xffffc260 instead.
The problem is that using the '&' returns a pointer type:
...
(gdb) p &array4d
$5 = (PTR TO -> ( integer(kind=4) (-3:3,7:10,-3:3,-10:-7) )) 0xffffbe00
...
which has the consequence that the addition is done as pointer arithmetic.
Fix this by using the result of "print /x &array4d" instead of &array4d in the
addition.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-15 Tom de Vries <tdevries@suse.de>
PR testsuite/26997
* gdb.fortran/array-slices.exp (run_test): Avoid pointer arithmetic
when adding sizeof.
Nelson Chu [Fri, 15 Jan 2021 10:08:30 +0000 (18:08 +0800)]
RISC-V: Fixed the indent that caused by the previous commits accidentally.
bfd/
* elfnn-riscv.c (riscv_relax_delete_bytes): Fixed the indent that
caused by the previous commit accidentally.
Nelson Chu [Fri, 15 Jan 2021 01:36:51 +0000 (09:36 +0800)]
RISC-V: Indent and GNU coding standards tidy, also aligned the code.
bfd/
* elfnn-riscv.c: Indent, labels and GNU coding standards tidy,
also aligned the code.
gas/
* config/tc-riscv.c: Indent and GNU coding standards tidy,
also aligned the code.
* config/tc-riscv.h: Likewise.
include/
* opcode/riscv.h: Indent and GNU coding standards tidy,
also aligned the code.
opcodes/
* riscv-opc.c (riscv_gpr_names_abi): Aligned the code.
(riscv_fpr_names_abi): Likewise.
(riscv_opcodes): Likewise.
(riscv_insn_types): Likewise.
Nelson Chu [Wed, 13 Jan 2021 08:52:14 +0000 (16:52 +0800)]
RISC-V: Error and warning messages tidy.
Error and warning messages usually starting with lower case letter,
and without the period at the end. Besides, add the prefixed "internel:"
at the beginning of the messages when they are caused internally.
Also fix indents and typos.
bfd/
* elfnn-riscv.c (riscv_merge_attributes): Fix typos of messages.
gas/
* config/tc-riscv.c: Error and warning messages tidy.
* testsuite/gas/riscv/priv-reg-fail-fext.l: Updated.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.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-fail-version-1p9p1.l: Likewise.
ld/
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
opcodes/
* riscv-dis.c (parse_riscv_dis_option): Fix typos of message.
Nelson Chu [Wed, 13 Jan 2021 02:05:48 +0000 (10:05 +0800)]
RISC-V: Comments tidy and improvement.
The GNU coding standards said the comments should be complete sentences
and end with a period and two spaces. But sometimes it should be more
cleaner when the comments only include a word or codes. Therefore, I made
the following changes after referring to other target/generic codes,
* Try to write sentences in comments, must end with a period and two spaces.
* End with two spaces without a period for codes/instructions only.
* End with one space without a period for a single word/variable only.
Besids, also rewrite/remove some comments which are obsolete or too long,
and fix indents for comments.
bfd/
* elfnn-riscv.c: Comments tidy and improvement.
* elfxx-riscv.c: Likewise.
* elfxx-riscv.h: Likewise.
gas/
* config/tc-riscv.c: Comments tidy and improvement. Also update
comment "fallthru" to "Fall through" that end with a period and
two spaces.
include/
* elf/riscv.h: Comments tidy and improvement.
* opcode/riscv-opc.h: Likewise.
* opcode/riscv.h: Likewise.
opcodes/
* riscv-dis.c: Comments tidy and improvement.
* riscv-opc.c: Likewise.
Mike Frysinger [Tue, 5 Jan 2021 08:38:51 +0000 (03:38 -0500)]
sim: testsuite: delete configure script
Now that we've moved all ports to dejagnu & testsuite/sim/, the only
thing the testsuite/configure script has been doing is filling in the
sim_arch field in the testsuite/Makefile. We can simply let the top
sim/configure script do that for us now. This simplifies & speeds up
the build a bit by killing an entire configure script.
Mike Frysinger [Tue, 5 Jan 2021 08:11:32 +0000 (03:11 -0500)]
sim: d10v: relocate tests & clean up test harness
This is the only target using a dir directly under testsuite/. All
others use sim/<arch>/ instead. Relocate it so all targets look the
same, and so we can leverage the common test harness.
We drop loop.s in the process because it was never referenced and
was just 2 lines of code.
All other test files are moved & have directives added to the top so
that the test harness can invoke them correctly.
Mike Frysinger [Tue, 5 Jan 2021 07:31:54 +0000 (02:31 -0500)]
sim: mips: delete empty stub test dir
No tests were ever added in here in the ~22 years since it was first
created. Seems unlikely any tests will be added at this rate, and
the sim/mips/ testdir already has some (light) coverage for this
target. So punt the tree.
Mike Frysinger [Tue, 5 Jan 2021 07:19:02 +0000 (02:19 -0500)]
sim: frv: clean up redundant test coverage
The frv-elf subdir contained five tests:
* cache: A cache test of some sort.
* exit47: A program to test exit status of 47 from sim.
* grloop: Some basic limited loop test program.
* hello: Standard "hello world" output program.
* loop: An infinite loop program.
The loop.s test is never referenced anywhere, and is all of 2 lines.
Anyone who really needs a while(1); test case and re-implement it
themselves locally.
The cache.s code isn't referenced anywhere because it requires some
custom args to the run program, and when this testcase was added, we
didn't have any support for that. We do now, so we can add a header
to enable that. Turns out the code crashes even with those, so turn
around and mark it xfail. Maybe someone someday will care.
That leaves the small exit47, grloop, and hello tests. Now that the
sim test harness supports testing for custom exit status, we can move
them all to sim/frv/ to maintain test coverage.
The remaining differences between frv-elf & sim/frv are:
* frv-elf/ runs for frv-*-elf while sim/frv/ runs for frv*-*-*.
* frv-elf/ runs "*.s" files while sim/frv/ only has .cgs and such.
On closer inspection, these are also meaningless distinctions:
* There is nothing specific to the tests that require an *-elf
target. Normally that would mean newlib+libgloss type stuff,
but there's no such requirement in frv-elf/.
* The ".s" suffix is the standard "this is an assembly file" suffix.
Since FRV is a CGEN target, we can reuse the existing convention of
".ms" to mean "miscellaneous .s" as in "this is an assembly file,
and run/bucket its test results in the miscellaneous category".
So moving frv-elf/{cache,exit47,grloop,hello}.s to sim/frv/*.ms makes
sense and simplifies things quite a bit for the target while also
slightly increasing the coverage for some tuples.
Mike Frysinger [Tue, 5 Jan 2021 06:42:20 +0000 (01:42 -0500)]
sim: m32r: clean up redundant test coverage
The m32r-elf subdir contained three tests:
* exit47: A program to test exit status of 47 from sim.
* hello: Standard "hello world" output program.
* loop: An infinite loop program.
There's already a sim/m32r/hello.ms test that does exactly the same
thing as m32r-elf/hello.s, so we can delete that.
The loop.s test is never referenced anywhere, and is all of 2 lines.
Anyone who really needs a while(1); test case and re-implement it
themselves locally.
That leaves the single exit47 test. Now that the sim test harness
supports testing for custom exit status, we can easily move that to
sim/m32r/exit47.ms to maintain test coverage.
The remaining differences between m32r-elf & sim/m32r are:
* m32r-elf/ runs for m32r-*-elf while sim/m32r/ runs for m32r*-*-*.
* m32r-elf/ runs "*.s" files while sim/m32r/ runs "*.ms" files.
On closer inspection, these are also meaningless distinctions:
* There is nothing specific to the tests that require an *-elf
target. Normally that would mean newlib+libgloss type stuff,
but there's no such requirement in m32r-elf/.
* The ".s" suffix is the standard "this is an assembly file"
suffix. Turns out ".ms" is just how sim/m32r/ (and a few other
CGEN based targets) categorize/bucket test cases. It simply
means "miscellaneous .s" as in "this is an assembly file, and
run/bucket its test results in the miscellaneous category".
So moving m32r-elf/exit47.s to sim/m32r/exit47.ms makes sense and
simplifies things quite a bit for the target while also slightly
increasing the coverage for some tuples.
Mike Frysinger [Tue, 5 Jan 2021 06:26:21 +0000 (01:26 -0500)]
sim: testsuite: allow tests to declare expected exit status
Some tests want to verify they can control the exit status, and
allowing any non-zero value would allow tests to silently fail:
if it crashed & exited 1, or forced all non-zero to 1, then we
wouldn't be able to differentiate with a test exiting with a
status like 47.
Extend the test harness to allow tests to declare their expected
exit status that would be defined as a "pass". This requires a
small tweak to the sim_run API to return the status directly, but
that shouldn't be a big deal as it's only used by sim code.
Alan Modra [Fri, 15 Jan 2021 05:32:52 +0000 (16:02 +1030)]
PR26539, memory leak in inflate.c
Like the PR15356 fix for the same leak in bfd, but for readelf.c
PR 26539
* readelf.c (uncompress_section_contents): Always call inflateEnd.
Mike Frysinger [Thu, 14 Jan 2021 03:14:10 +0000 (22:14 -0500)]
gas: make [248]byte directives available everywhere
These aren't specific to ELF at all, and seem generally useful.
So pull them out of the ELF backend and into the common core.
GDB Administrator [Fri, 15 Jan 2021 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Lancelot SIX [Thu, 14 Jan 2021 22:52:00 +0000 (22:52 +0000)]
Add myself to gdb/MAINTAINERS
gdb/ChangeLog:
* MAINTAINERS (Wrate After Approval): Add myself.
Alexandre Oliva [Thu, 14 Jan 2021 19:36:11 +0000 (16:36 -0300)]
Update my email address (long overdue!)
for binutils/ChangeLog
* MAINTAINERS: Update my email address.
Bernd Edlinger [Mon, 4 Jan 2021 20:40:41 +0000 (21:40 +0100)]
Fix building gdb with gcc-4.x
Since is_trivially_default_constructible was not implemented before gcc-5
it cannot be used with gcc-4.x.
Fix the build by using conditional compilation around that line.
Use the equivalent is_trivially_constructible<T> instead, since
we already have HAVE_IS_TRIVIALLY_CONSTRUCTIBLE for that purpose.
Fixes: 098caef485a ("Refactor struct trad_frame_saved_regs")
gdb:
2021-01-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* trad-frame.c (trad_frame_alloc_saved_regs): Avoid compile-error
because is_trivially_default_constructible was first implemented with
gcc-5.
H.J. Lu [Thu, 14 Jan 2021 13:23:58 +0000 (05:23 -0800)]
bfin: Skip non SEC_ALLOC section for R_BFIN_FUNCDESC
Linker should never generate dynamic relocations for relocations in
non-SEC_ALLOC section which has no impact on run-time behavior. Such
relocations should be resolved to 0.
PR ld/26688
* elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
section for R_BFIN_FUNCDESC.
Nick Clifton [Thu, 14 Jan 2021 12:55:25 +0000 (12:55 +0000)]
Updated translations for some subdirectories
Tom de Vries [Thu, 14 Jan 2021 09:35:34 +0000 (10:35 +0100)]
[gdb/breakpoint] Handle .plt.sec in in_plt_section
Consider the following test-case small.c:
...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void) {
int *p = (int *)malloc (sizeof(int) * 4);
memset (p, 0, sizeof(p));
printf ("p[0] = %d; p[3] = %d\n", p[0], p[3]);
return 0;
}
...
On Ubuntu 20.04, we get:
...
$ gcc -O0 -g small.c
$ gdb -batch a.out -ex start -ex step
Temporary breakpoint 1, main () at small.c:6
6 int *p = (int *) malloc(sizeof(int) * 4);
p[0] = 0; p[3] = 0
[Inferior 1 (process $dec) exited normally]
...
but after switching off the on-by-default fcf-protection, we get the desired
behaviour:
...
$ gcc -O0 -g small.c -fcf-protection=none
$ gdb -batch a.out -ex start -ex step
Temporary breakpoint 1, main () at small.c:6
6 int *p = (int *) malloc(sizeof(int) * 4);
7 memset (p, 0, sizeof(p));
...
Using "set debug infrun 1", the first observable difference between the two
debug sessions is that with -fcf-protection=none we get:
...
[infrun] process_event_stop_test: stepped into dynsym resolve code
...
In this case, "in_solib_dynsym_resolve_code (malloc@plt)" returns true because
"in_plt_section (malloc@plt)" returns true.
With -fcf-protection=full, "in_solib_dynsym_resolve_code (malloc@plt)" returns
false because "in_plt_section (malloc@plt)" returns false, because the section
name for malloc@plt is .plt.sec instead of .plt, which is not handled in
in_plt_section:
...
static inline int
in_plt_section (CORE_ADDR pc)
{
return pc_in_section (pc, ".plt");
}
...
Fix this by handling .plt.sec in in_plt_section.
Tested on x86_64-linux.
[ Another requirement to be able to reproduce this is to have a dynamic linker
with a "malloc" minimal symbol, which causes find_solib_trampoline_target to
find it, such that skip_language_trampoline returns the address for the
dynamic linkers malloc. This causes the step machinery to set a breakpoint
there, and to continue, expecting to hit it. Obviously, we execute glibc's
malloc instead, so the breakpoint is not hit and we continue to program
completion. ]
gdb/ChangeLog:
2021-01-14 Tom de Vries <tdevries@suse.de>
PR breakpoints/27151
* objfiles.h (in_plt_section): Handle .plt.sec.
Tom de Vries [Thu, 14 Jan 2021 09:20:21 +0000 (10:20 +0100)]
[gdb/testsuite] Fix gdb.base/style.exp with -m32
When running test-case gdb.base/style.exp with target board unix/-m32, we run
into (stripped styling from output, shortened file name):
...
(gdb) frame
argv=0xffffc714) at src/gdb/testsuite/gdb.base/style.c:45
45 return some_called_function (); /* break here */
(gdb) FAIL: gdb.base/style.exp: frame when width=20
...
while with native we have instead:
...
(gdb) frame
argv=0x7fffffffd478)
at src/gdb/testsuite/gdb.base/style.c:45
45 return some_called_function (); /* break here */
(gdb) PASS: gdb.base/style.exp: frame when width=20
...
The problem is that due to argv having a different length for -m32, we get a
different layout, and the test-case doesn't accommodate for that.
Fix this by using a different regexp depending on the length of argv.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-14 Tom de Vries <tdevries@suse.de>
PR testsuite/24590
* gdb.base/style.exp: Handle shorter argv in frame command output.
Nick Clifton [Thu, 14 Jan 2021 09:15:13 +0000 (09:15 +0000)]
Fix an illegal memory access parsing a win32pstatus note with a type of 0.
* elf.c (elfcore_grok_win32pstatus): Check for a note type of 0.
Mike Frysinger [Thu, 9 Dec 2010 17:06:34 +0000 (12:06 -0500)]
ld: tests: add -msim when testing bfin targets
The Blackfin ELF compiler requires the user to explicitly select a CPU
target else it will fail:
bfin-elf-gcc: error: no processor type specified for linking
Select the sim target for these tests since we should (hopefully) have
access to the simulator. At least, it's more likely than having access
to a real development board.
This makes the pass/fail numbers increase by a lot:
-# of expected passes 398
-# of unexpected failures 6
+# of expected passes 587
+# of unexpected failures 109
It looks like the vast majority of new failures are due to our omission
of COPY relocations:
/* Bfin does not currently have a COPY reloc. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
_bfd_error_handler (_("the bfin target does not currently support the generation of copy relocations"));
return FALSE;
}
There doesn't seem to be a way to easily disable tests that cause copy
relocations though, lets just take the hit for now.
* testsuite/config/default.exp [bfin*-elf*] (gcc_B_opt): Append -msim.
Mike Frysinger [Thu, 14 Jan 2021 06:03:54 +0000 (01:03 -0500)]
gas: bfin: build lexer with -Werror
The makefile has comments about old versions of bison/yacc generating
warnings, but that doesn't apply to the lexer which comes from flex.
As far as I can tell, the warnings in the Blackfin lexer can be fixed
with defines that have been supported back through flex in 2002. So
lets turn on -Werror for it and see if anyone notices. If they do,
they can report their exact tool versions so we can record that here.
Mike Frysinger [Thu, 14 Jan 2021 05:51:59 +0000 (00:51 -0500)]
gas: bfin: fix build time warnings
Mike Frysinger [Thu, 18 Aug 2016 06:05:03 +0000 (23:05 -0700)]
sim: h8300: drop separate eightbit memory buffer
The h8300 sim has its own implementation for memory handling that I'd
like to replace with the common sim memory code. However, it's got a
weird bit of code it calls "eightbit mem" that makes this not as easy
as it would otherwise be. The code has this comment:
/* These define the size of main memory for the simulator.
Note the size of main memory for the H8/300H is only 256k. Keeping it
small makes the simulator run much faster and consume less memory.
The linker knows about the limited size of the simulator's main memory
on the H8/300H (via the h8300h.sc linker script). So if you change
H8300H_MSIZE, be sure to fix the linker script too.
Also note that there's a separate "eightbit" area aside from main
memory. For simplicity, the simulator assumes any data memory reference
outside of main memory refers to the eightbit area (in theory, this
can only happen when simulating H8/300H programs). We make no attempt
to catch overlapping addresses, wrapped addresses, etc etc. */
I've read the H8/300 Programming Manual and the H8/300H Software Manual
and can't find documentation on it. The closest I can find is the bits
about the exception vectors, but that sounds like a convention where the
first 256 bytes of memory are used for a special purpose. The sim will
actually allocate a sep memory buffer of 256 bytes and you address it by
accessing anywhere outside of main memory. e.g. I would expect code to
access it like:
uint32_t *data = (void *)0;
data[0] = reset_exception_vector;
not like the sim expects like:
uint8_t *data = (void *)0x1000000;
data[0] = ...;
The gcc manual has an "eightbit_data" attribute:
Use this attribute on the H8/300, H8/300H, and H8S to indicate that
the specified variable should be placed into the eight-bit data
section. The compiler generates more efficient code for certain
operations on data in the eight-bit data area. Note the eight-bit
data area is limited to 256 bytes of data.
And the gcc code implies that it's accessed via special addressing:
eightbit_data: This variable lives in the 8-bit data area and can
be referenced with 8-bit absolute memory addresses.
I'm fairly certain these are referring to the 8-bit addressing modes
that allow access to 0xff00 - 0xffff with only an 8-bit immediate.
They aren't completely separate address spaces which this eightbit
memory buffer occupies.
But the sim doesn't access its eightbit memory based on specific insns,
it does it purely on the addresses requested.
Unfortunately, much of this code was authored by Michael Snyder, so I
can't ask him :(. I asked Renesas support and they didn't know:
https://renesasrulz.com/the_vault/f/archive-forum/6952/question-about-eightbit-memory
So I've come to the conclusion that this was a little sim-specific hack
done for <some convenience> and has no relation to real hardware. And
as such, let's drop it until someone notices and can provide a reason
for why we need to support it.
Mike Frysinger [Wed, 13 Jan 2021 10:58:27 +0000 (05:58 -0500)]
sim: watch: add basic default handler that traps
The default watchpoint handler is NULL. That means any port that
sets the STATE_WATCHPOINTS->pc field will crash if you try to use
the --watch options but don't configure the interrupt handler. In
the past, you had to setup STATE_WATCHPOINTS->pc if you wanted to
support PC profiling, and while that was fixed a while ago, we have
a lot of ports who still configure it.
We already add a default set of interrupts (just "int") if the port
doesn't define any. Let's also add a default handler that raises a
SIGTRAP. When connected to gdb, this is a breakpoint which is what
people would expect. When running standalone, it'll abort the sim,
but it's unclear whether there's anything better to do there. This
really is just to make the watchpoint module more usable out of the
box for most ports with very little setup, at least inside of gdb.
Andrew Burgess [Thu, 14 Jan 2021 01:26:58 +0000 (20:26 -0500)]
gdb: better handling of 'S' packets
This commit builds on work started in the following two commits:
commit
24ed6739b699f329c2c45aedee5f8c7d2f54e493
Date: Thu Jan 30 14:35:40 2020 +0000
gdb/remote: Restore support for 'S' stop reply packet
commit
cada5fc921e39a1945c422eea055c8b326d8d353
Date: Wed Mar 11 12:30:13 2020 +0000
gdb: Handle W and X remote packets without giving a warning
This is related to how GDB handles remote targets that send back 'S'
packets.
In the first of the above commits we fixed GDB's ability to handle a
single process, single threaded target that sends back 'S' packets.
Although the 'T' packet would always be preferred to 'S' these days,
there's nothing really wrong with 'S' for this situation.
The second commit above fixed an oversight in the first commit, a
single-process, multi-threaded target can send back a process wide
event, for example the process exited event 'W' without including a
process-id, this also is fine as there is no ambiguity in this case.
In PR gdb/26819 we run into yet another problem with the above
commits. In this case we have a single process with two threads, GDB
hits a breakpoint in thread 2 and then performs a stepi:
(gdb) b main
Breakpoint 1 at 0x1212340830: file infinite_loop.S, line 10.
(gdb) c
Continuing.
Thread 2 hit Breakpoint 1, main () at infinite_loop.S:10
10 in infinite_loop.S
(gdb) set debug remote 1
(gdb) stepi
Sending packet: $vCont;s:2#24...Packet received: S05
../binutils-gdb/gdb/infrun.c:5807: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
What happens in this case is that on the RISC-V target displaced
stepping is not supported, so when the stepi is issued GDB steps just
thread 2. As only a single thread was set running the target decides
that is can get away with sending back an 'S' packet without a
thread-id. GDB then associates the stop with thread 1 (the first
non-exited thread), but as thread 1 was not previously set executing
the assertion seen above triggers.
As an aside I am surprised that the target sends pack 'S' in this
situation. The target is happy to send back 'T' (including thread-id)
when multiple threads are set running, so (to me) it would seem easier
to just always use the 'T' packet when multiple threads are in use.
However, the target only uses 'T' when multiple threads are actually
executing, otherwise an 'S' packet it used.
Still, when looking at the above situation we can see that GDB should
be able to understand which thread the 'S' reply is referring too.
The problem is that is that in commit
24ed6739b699 (above) when a stop
reply comes in with no thread-id we look for the first non-exited
thread and select that as the thread the stop applies too.
What we should really do is select the first non-exited, resumed thread,
and associate the stop event with this thread. In the above example
both thread 1 and 2 are non-exited, but only thread 2 is resumed, so
this is what we should use.
There's a test for this issue included which works with stock
gdbserver by disabling use of the 'T' packet, and enabling
'scheduler-locking' within GDB so only one thread is set running.
gdb/ChangeLog:
PR gdb/26819
* remote.c
(remote_target::select_thread_for_ambiguous_stop_reply): New
member function.
(remote_target::process_stop_reply): Call
select_thread_for_ambiguous_stop_reply.
gdb/testsuite/ChangeLog:
PR gdb/26819
* gdb.server/stop-reply-no-thread-multi.c: New file.
* gdb.server/stop-reply-no-thread-multi.exp: New file.
Change-Id: I9b49d76c2a99063dcc76203fa0f5270a72825d15
Simon Marchi [Thu, 14 Jan 2021 01:25:58 +0000 (20:25 -0500)]
gdb: remove target_ops::commit_resume implementation in record-{btrace, full}.c
The previous patch made the commit_resume implementations in the record
targets unnecessary, as the remote target's commit_resume implementation
won't commit-resume threads for which it didn't see a resume. This
patch removes them.
gdb/ChangeLog:
* record-btrace.c (class record_btrace_target): Remove.
(record_btrace_target::commit_resume): Remove.
* record-full.c (class record_full_target): Remove.
(record_full_target::commit_resume): Remove.
Change-Id: I3a68d3d726fb09d8b7165b4edefc330d27803b27
Simon Marchi [Thu, 14 Jan 2021 01:20:43 +0000 (20:20 -0500)]
gdb: make the remote target track its own thread resume state
The next patch moves the target commit_resume method to be a
process_stratum_target-only method. The only non-process targets that
currently implement the commit_resume method are the btrace and full
record targets. The only reason they need to do so is to prevent a
commit resume from reaching the beneath (process) target if they are
currently replaying.
This is important if a record target is used on top of the remote target
(the only process target implementing the commit_resume method).
Currently, the remote target checks the `thread_info::executing` flag of
a thread to know if it should commit resume that thread:
if (!tp->executing || remote_thr->vcont_resumed)
continue;
The `tp->executing` flag is set by infrun when it has asked the target
stack to resume the thread, and therefore if the thread is executing,
from its point of view. It _not_ equivalent to whether the remote
target was asked to resume this thread.
Indeed, if infrun asks the target stack to resume some thread while the
record target is replaying, the record target won't forward the resume
request the remote target beneath, because we don't actually want to
resume the thread on the execution target. But the `tp->executing` flag
is still set, because from the point of view of infrun, the thread
executes. So, if the commit_resume call wasn't intercepted by the
record target as it is today and did reach the remote target, the remote
target would say "Oh, this thread should be executing and I haven't
vCont-resumed it! I must vCont-resume it!". But that would be wrong,
because it was never asked to resume this thread, the resume request did
not reach it. This is why the record targets currently need to
implement commit_resume: to prevent the beneath target from
commit_resuming threads it wasn't asked to resume.
Since commit_resume will become a method on process_stratum_target in
the following patch, record targets won't have a chance to intercept the
calls and that would result in the remote target commit_resuming threads
it shouldn't. To avoid this, this patch makes the remote target track
its own thread resumption state. That means, tracking which threads it
was asked to resume via target_ops::resume. Regardless of the context
of this patch, I think this change makes it easier to understand how
resume / commit_resume works in the remote target. It makes the target
more self-contained, as it only depends on what it gets asked to do via
the target methods, and not on tp->executing, which is a flag maintained
from the point of view of infrun.
I initially made it so this state was only used when the remote target
operates in non-stop mode, since commit_resume is only used when the
target is non-stop. However, it's more consistent and it can be useful
to maintain this state even in all-stop too. In all-stop, receiving a
stop notification for one thread means all threads of the target are
considered stopped.
From the point of view of the remote target, there are three states a
thread can be in:
1. not resumed
2. resumed but pending vCont-resume
3. resumed
State 2 only exists when the target is non-stop.
As of this patch, valid state transitions are:
- 1 -> 2 (through the target resume method if in non-stop)
- 2 -> 3 (through the target commit_resume method if in non-stop)
- 1 -> 3 (through the target resume method if in all-stop)
- 3 -> 1 (through a remote stop notification / reporting an event to the
event loop)
A subsequent patch will make it possible to go from 2 to 1, in case
infrun asks to stop a thread that was resumed but not commit-resumed
yet. I don't think it can happen as of now.
In terms of code, this patch replaces the vcont_resumed field with an
enumeration that explicitly represents the three states described above.
The last_resume_sig and last_resume_step fields are moved to a structure
which is clearly identified as only used when the thread is in the
"resumed but pending vCont-resume" state.
gdb/ChangeLog:
* remote.c (enum class resume_state): New.
(struct resumed_pending_vcont_info): New.
(struct remote_thread_info) <resume_state, set_not_resumed,
set_resumed_pending_vcont, resumed_pending_vcont_info,
set_resumed, m_resume_state, m_resumed_pending_vcont_info>:
New.
<last_resume_step, last_resume_sig, vcont_resumed>: Remove.
(remote_target::remote_add_thread): Adjust.
(remote_target::process_initial_stop_replies): Adjust.
(remote_target::resume): Adjust.
(remote_target::commit_resume): Rely on state in
remote_thread_info and not on tp->executing.
(remote_target::process_stop_reply): Adjust.
Change-Id: I10480919ccb4552faa62575e447a36dbe7c2d523
GDB Administrator [Thu, 14 Jan 2021 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 13 Jan 2021 22:18:49 +0000 (08:48 +1030)]
Re: SHF_LINK_ORDER fixup_link_order in ld
PR 27160
* ldelfgen.c (compare_link_order): Protect access of ELF section
data.
(add_link_order_input_section): Remove redundant NULL check.
Use bfd_get_flavour.
(ldelf_map_segments): Use bfd_get_flavour.
Simon Marchi [Wed, 13 Jan 2021 19:32:39 +0000 (14:32 -0500)]
gdb: convert arc to new-style debug macros
Add the standard arc_debug_printf, but also arc_linux_debug_printf,
arc_linux_nat_debug_printf and arc_newlib_debug_printf to match the
prefixes currently used in the debug messages.
gdb/ChangeLog:
* arc-tdep.h (arc_debug_printf): New.
* arc-tdep.c: Use arc_debug_printf.
* arc-linux-nat.c (arc_linux_nat_debug_printf): Add and use.
* arc-linux-tdep.c (arc_linux_debug_printf): Add and use.
* arc-newlib-tdep.c (arc_newlib_debug_printf): Add and use.
Change-Id: I5d937566ed7a1925f7982e8809802c8f0560d8c6
Simon Marchi [Wed, 13 Jan 2021 19:32:23 +0000 (14:32 -0500)]
gdb: turn arc_debug into a bool
Shahab suggested we get rid of the verbosity level for the ARC debug
logging [1]. This patch does that, before doing any other change.
gdb/ChangeLog:
* arc-tdep.h (arc_debug): Change type to bool.
* arc-tdep.c (arc_debug): Change type to bool.
(arc_analyze_prologue): Adjust.
(_initialize_arc_tdep): Use add_setshow_boolean_cmd.
* arc-linux-nat.c (ps_get_thread_area): Adjust.
[1] https://sourceware.org/pipermail/gdb-patches/2021-January/175075.html
Change-Id: I16688bd42ed8978ae1acf57012c8d41a943044a5
Simon Marchi [Wed, 13 Jan 2021 17:09:58 +0000 (12:09 -0500)]
gdb: bool-ify maybe_add_script_{text,file}
Bool-ify the return type of maybe_add_script_text and
maybe_add_script_file, the loaded parameter and related things.
gdb/ChangeLog:
* auto-load.c (struct loaded_script) <loaded>: Change to bool.
(maybe_add_script_file): Change return type to bool.
(maybe_add_script_text): Change return type and
loaded parameter to bool.
(source_script_file): Adjust.
(execute_script_contents): Adjust.
Change-Id: I59ab5862796fa7d154721b56e2ff8612ad5d734b
Simon Marchi [Wed, 13 Jan 2021 17:00:37 +0000 (12:00 -0500)]
gdb: bool-ify users of file_is_auto_load_safe
A previous patch missed those.
gdb/ChangeLog:
* auto-load.c (auto_load_objfile_script_1): Use bool.
(execute_script_contents): Use bool.
Change-Id: I214bf7ed25af36ced375eb3ec5a403ded2fa572e
Simon Marchi [Wed, 13 Jan 2021 16:57:24 +0000 (11:57 -0500)]
gdb: bool-ify ext_lang_auto_load_enabled and friends
Make it and related functions return bool. Move function comments to
header where applicable.
gdb/ChangeLog:
* auto-load.h (auto_load_gdb_scripts_enabled): Return bool, move
comment here.
* auto-load.c (auto_load_gdb_scripts_enabled): Return bool, move
comment to header.
* extension-priv.h (struct extension_language_script_ops)
<auto_load_enabled>: Return bool.
* extension.h (ext_lang_auto_load_enabled): Return bool, move
comment here.
* extension.c (ext_lang_auto_load_enabled): Return bool, move
comment to header.
* guile/guile-header.h (gdbscm_auto_load_enabled): Return bool,
move comment here.
* guile/scm-auto-load.c (gdbscm_auto_load_enabled): Return bool,
move comment to header.
* python/python-header.h (gdbpy_auto_load_enabled): Return bool,
move comment here.
* python/py-auto-load.c (gdbpy_auto_load_enabled): Return bool,
move comment to header.
Change-Id: I657a17d2dab77a36884a137ce9b23a2cc6d53140
Simon Marchi [Wed, 13 Jan 2021 16:44:24 +0000 (11:44 -0500)]
gdb: bool-ify file_is_auto_load_safe
Make it return bool and change the advice_printed to bool as well. Move
doc to header file.
gdb/ChangeLog:
* auto-load.h (file_is_auto_load_safe): Change return type to
bool, move comment here.
* auto-load.c (file_is_auto_load_safe): Change return type and
advice_printed to bool. Move comment to header.
Change-Id: Ia7395e7cea8880377800240833316e4be5251d49
Simon Marchi [Wed, 13 Jan 2021 15:48:51 +0000 (10:48 -0500)]
gdb: convert jit to new-style debug macros
Here's a sample output, with infrun debug enabled as well to show
nesting:
[infrun] fetch_inferior_event: enter
[infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
[infrun] print_target_wait_results:
4116727.
4116727.0 [process
4116727],
[infrun] print_target_wait_results: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] handle_inferior_event: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] start_step_over: enter
[infrun] start_step_over: stealing global queue of threads to step, length = 0
[infrun] operator(): step-over queue now empty
[infrun] start_step_over: exit
[infrun] handle_signal_stop: stop_pc=0x555555555229
[infrun] handle_jit_event: handling bp_jit_event
[jit] jit_read_descriptor: descriptor_addr = 0x5555555580b0
[jit] jit_register_code: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_bfd_try_read_symtab: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_breakpoint_re_set_internal: breakpoint_addr = 0x555555555229
[infrun] process_event_stop_test: BPSTAT_WHAT_SINGLE
[infrun] process_event_stop_test: no stepping, continue
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [process
4116727] at 0x555555555229
[infrun] prepare_to_wait: prepare_to_wait
[infrun] fetch_inferior_event: exit
gdb/ChangeLog:
* jit.c (jit_debug_printf): New, use throughout file.
Change-Id: Ic0f5eb3ffc926fb555de4914e7dc1076ada63a97
H.J. Lu [Wed, 13 Jan 2021 14:48:07 +0000 (06:48 -0800)]
ld: Check for ELF input before accessing ELF section data
commit
b209b5a6b8a accesses ELF section data without checking if input is
ELF. It caused:
sh: line 1:
1355479 Segmentation fault (core dumped) /export/build/gnu/tools-build/binutils-gitlab-x32/build-x86_64-linux-gnux32/ld/ld-new -o tmpdir/pe-x86-64-1 -z norelro -L/export/gnu/import/git/gitlab/x86-binutils/ld/testsuite/ld-x86-64 -m elf_x86_64 --entry=begin tmpdir/pe-x86-64-1a.obj tmpdir/pe-x86-64-1b.obj tmpdir/pe-x86-64-1c.obj 2>&1
FAIL: Build pe-x86-64-1
on Linux/x86-64 with PE/x86-64 inputs. Add check for ELF input before
accessing ELF section data.
* ldelfgen.c (add_link_order_input_section): Check for ELF input
before accessing ELF section data.
H.J. Lu [Wed, 13 Jan 2021 13:42:11 +0000 (05:42 -0800)]
x86: Don't generate GOT_symbol for PLT relocations
Don't generate the _GLOBAL_OFFSET_TABLE_ symbol for PLT relocations
since it isn't needed.
PR gas/27178
* config/tc-i386.c (lex_got::gotrel): Add need_GOT_symbol.
Don't generate GOT_symbol for PLT relocations.
* testsuite/gas/i386/i386.exp: Run PR gas/27178 tests.
* testsuite/gas/i386/no-got.d: New file.
* testsuite/gas/i386/no-got.s: Likewise.
* testsuite/gas/i386/x86-64-no-got.d: Likewise.
* testsuite/gas/i386/x86-64-no-got.s: Likewise.
Alan Modra [Wed, 13 Jan 2021 08:43:23 +0000 (19:13 +1030)]
Regen Makefile.in for jobserver.m4 aclocal.m4 dependency
bfd/
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
binutils/
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
gas/
* Makefile.in: Regenerate.
* Makefile.in: Regenerate.
gprof/
* Makefile.in: Regenerate.
ld/
* Makefile.in: Regenerate.
libctf/
* Makefile.in: Regenerate.
opcodes/
* Makefile.in: Regenerate.
Alan Modra [Wed, 13 Jan 2021 03:03:34 +0000 (13:33 +1030)]
SHF_LINK_ORDER fixup_link_order in ld
This moves the SHF_LINK_ORDER sorting from bfd_elf_final_link to
the linker which means generic ELF targets now support SHF_LINK_ORDER
and we cope with odd cases that require resizing of output sections.
The patch also fixes two bugs in the current implementation,
introduced by commit
cd6d537c48fa. The pattern test used by that
commit meant that sections matching something like
"*(.IA_64.unwind* .gnu.linkonce.ia64unw.*)" would not properly sort a
mix of sections matching the two wildcards. That commit also assumed
a stable qsort.
bfd/
PR 27160
* section.c (struct bfd_section): Remove pattern field.
(BFD_FAKE_SECTION): Adjust to suit.
* bfd-in2.h: Regenerate.
* elflink.c (compare_link_order, elf_fixup_link_order): Delete.
(bfd_elf_final_link): Don't call elf_fixup_link_order.
ld/
PR 27160
* ldlang.h (lang_output_section_statement_type): Add data field.
(lang_input_section_type, lang_section_bst_type): Add pattern field.
(statement_list): Declare.
(lang_add_section): Adjust prototype.
* emultempl/aarch64elf.em: Adjust lang_add_section calls.
* emultempl/armelf.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/cskyelf.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/nios2elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/vms.em: Likewise.
* ldelf.c: Likewise.
* ldelfgen.c: Include ldctor.h.
(struct os_sections): New.
(add_link_order_input_section, link_order_scan): New functions.
(compare_link_order, fixup_link_order): New functions.
(ldelf_map_segments): Call link_order_scan and fixup_link_order.
* ldlang.c (statement_list): Make global.
(output_section_callback_fast): Save pattern in tree node.
(lang_add_section): Add pattern parameter, save in lang_input_section.
(output_section_callback_tree_to_list): Adjust lang_add_section calls.
(lang_insert_orphan, output_section_callback): Likewise.
(ldlang_place_orphan): Likewise.
(gc_section_callback): Don't set section->pattern
* testsuite/ld-elf/pr26256-2a.d: Don't xfail generic.
* testsuite/ld-elf/pr26256-3b.d: Likewise.
* testsuite/ld-elf/pr26256-2b.d: Likewise. notarget xgate.
Alan Modra [Wed, 13 Jan 2021 04:47:56 +0000 (15:17 +1030)]
Remove sflag_info param from wild callback functions
* ldlang.h (callback_t): Remove flag_info function parameter.
* ldlang.c (walk_wild_consider_section): Adjust to suit.
(walk_wild_section_general): Likewise.
(output_section_callback_fast, output_section_callback): Likewise.
(check_section_callback, gc_section_callback): Likewise.
(find_relro_section_callback): Likewise.
Zebediah Figura [Wed, 13 Jan 2021 10:55:46 +0000 (10:55 +0000)]
Add SEH support to code generated by dlltool.
PR 27037
* dlltool.c (i386_trampoline): Adjust %rsp immediately on entry
and before exit.
(i386_x64_trampoline): Add SEH annotations.
(struct mac): Add how_seh field.
(make_delay_head): If how_set field is true add SEh instructions.
Mike Frysinger [Wed, 13 Jan 2021 06:22:05 +0000 (01:22 -0500)]
sim: watch: fix range expression processing
The code supports a <start>[,<end>] syntax, but the logic for handling
the <end> check was broken: it would detect the first byte was ",", but
then include that in the strtoul call meaning the result is always 0.
Further, it (re)assigned to arg0 when it meant arg1 which means this
code always processed a range expression as 0,0. Oops.
Mike Frysinger [Wed, 13 Jan 2021 06:21:22 +0000 (01:21 -0500)]
sim: watch: fix pc watchpoints on little endian host systems
My change
1ac72f0659d64d6a14da862242db0d841d2878d0 ("sim: convert to
bfd_endian") subtly broke the watchpoint module on little endian host
systems. The old code used 0 to mean "whatever the host endian is",
and while that was changed to use BFD_ENDIAN_UNKNOWN, this caller was
missed. Since its API used an int instead of an enum, the coercion
from 0 to the BFD endian enum was silently missed, and 0 happens to
be BFD_ENDIAN_BIG.
Instead of restoring the old logic by passing in BFD_ENDIAN_UNKNOWN,
we know the right host endian at compile time, so use that directly.
GDB Administrator [Wed, 13 Jan 2021 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sun, 10 Jan 2021 00:06:27 +0000 (19:06 -0500)]
src-release: fix indentation
The indentation of the body of the nested statements got out of sync
leading to the entire function being indented incorrectly and looking
like it's part of the for loop.
Simon Marchi [Tue, 12 Jan 2021 23:09:51 +0000 (18:09 -0500)]
gdb: fix indentation in infrun.c
gdb/ChangeLog:
* infrun.c (normal_stop): Fix indentation.
Change-Id: Icbae5272188f6ddb464b585a9194abd611f5ad27
Simon Marchi [Tue, 12 Jan 2021 19:19:49 +0000 (14:19 -0500)]
gdb: move read{now,never}_symbol_files declarations to symfile.h
... since they are defined in symfile.c.
gdb/ChangeLog:
* top.h (readnow_symbol_files, readnever_symbol_files): Move
declarations to ...
* symfile.h: ... here.
* symfile.c: Update doc.
Change-Id: Ie35a80d236bea70947bc496f66f62c8c621670b4
Simon Marchi [Tue, 12 Jan 2021 19:19:49 +0000 (14:19 -0500)]
gdb: move baud_rate and serial_parity declarations to serial.h
They are currently in target.h, it would make more sense to have them in
serial.h, since they are defined in serial.c.
gdb/ChangeLog:
* target.h (baud_rate, serial_parity): Move declarations...
* serial.h: ... here.
* main.c: Include serial.h.
* serial.c (baud_rate, serial_parity): Update doc.
Change-Id: Idc983c154c80ccc29b07ce68df3483cefe03fb71
Tom de Vries [Tue, 12 Jan 2021 16:36:51 +0000 (17:36 +0100)]
[gdb/testsuite] Add have_mpx in lib/gdb.exp
The sources for the test-cases gdb.arch/i386-mpx*.exp contain have_mpx
functions that test whether the processor supports mpx instructions.
OTOH, the test-cases are compiled using -mmpx -fcheck-pointer-bounds, which
instrument all functions with mpx instructions.
So, the function that is supposed to test whether mpx instruction are
supported contains mpx instructions, which is a bit odd.
We could fix this by:
- factoring out the have_mpx function into a single source file, and
- compiling it without "-mmpx -fcheck-pointer-bounds".
But having the mpx support test as part of the test-cases seems like an
unnecessary complication that makes the test-cases more difficult to analyze,
reason about and modify.
So we go one step further and factor out the mpx support test in into a
gdb_caching_proc.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-12 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-mpx-call.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-call.exp: Use have_mpx.
* gdb.arch/i386-mpx-map.c (have_mpx): Remove.
(main): Remote call to have_mpx.
* gdb.arch/i386-mpx-map.exp: Use have_mpx.
* gdb.arch/i386-mpx-sigsegv.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-sigsegv.exp: Use have_mpx.
* gdb.arch/i386-mpx-simple_segv.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-simple_segv.exp: Use have_mpx.
* gdb.arch/i386-mpx.c (have_mpx): Remove.
(main): Remote call to have_mpx.
* gdb.arch/i386-mpx.exp: Use have_mpx.
* lib/gdb.exp (have_mpx): New proc.
Simon Marchi [Tue, 12 Jan 2021 15:42:43 +0000 (10:42 -0500)]
gdb: remove pre_init_ui_hook from top.c
This hook appears to be unused. I guess it was used from insight or
something like that at some point. But I grepped in today's source of
insight [1] and there was no match. So I think it's safe to remove.
gdb/ChangeLog:
* top.c (pre_init_ui_hook): Remove.
[1] https://sourceware.org/git/?p=insight.git
Change-Id: Ia14499a4b6b9d79bb9a526d635fe44a654ef2a27
Srinath Parvathaneni [Tue, 12 Jan 2021 13:57:23 +0000 (13:57 +0000)]
aarch64: Add support for bfloat16 in gdb.
This patch adds support for bfloat16 in AArch64 gdb.
Also adds the field "bf" to vector registers h0-h31.
Also adds the vector "bf" to h field in vector registers v0-v31.
The following is how the vector register h and v looks like.
Before this patch:
(gdb) p $h0
$1 = {f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0}, s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
After this patch:
(gdb) p $h0
$1 = {bf = 0, f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {bf = 0x0, f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {bf = {0, 0, 0, 0, 0, 0, 0, 0}, f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0},
s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {bf = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
gdb/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* aarch64-tdep.c (aarch64_vnh_type): Add "bf" field in h registers.
(aarch64_vnv_type): Add "bf" type in h field of v registers.
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerated.
* features/aarch64-fpu.xml: Add bfloat16 type.
gdb/testsuite/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* gdb.arch/aarch64-fp.exp: Modify to test bfloat16 support.
H.J. Lu [Tue, 12 Jan 2021 13:45:28 +0000 (05:45 -0800)]
Implement a workaround for GNU mak jobserver
Compiling binutils using -flto=jobserver with GCC 11 leads to
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2 -fprofile-generate -flto=jobserver -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o config/tc-i386.o config/obj-elf.o config/atof-ieee.o ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a -L/tmp/binutils-gdb/objdir/zlib -lz ../libiberty/libiberty.a -ldl
lto-wrapper: warning: jobserver is not available: '--jobserver-auth=' is not present in 'MAKEFLAGS'
since the '+' is missing on the recipe line in Makefiles generated by
automake. Add the '+' to the recipe line by hand.
bfd/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
binutils/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
config/
PR binutils/26792
* jobserver.m4: New file.
gas/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
gprof/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
ld/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
libctf/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
opcodes/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
Tom de Vries [Tue, 12 Jan 2021 13:34:06 +0000 (14:34 +0100)]
[gdb/testsuite] Require is_amd64_regs_target in gdb.base/disasm-optim.exp
When running test-case gdb.base/disasm-optim.exp with target board unix/-m32,
we get:
...
Running disasm-optim.exp ...
gdb compile failed, disasm-optim.c: Assembler messages:
disasm-optim.c:35: Error: bad register name `%rip)'
disasm-optim.c:46: Error: bad register name `%rax)'
disasm-optim.c:57: Error: bad register name `%rip)'
=== gdb Summary ===
# of untested testcases 1
...
Fix this by requiring is_amd64_regs_target instead of istarget
"x86_64-*-linux*".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-12 Tom de Vries <tdevries@suse.de>
* gdb.base/disasm-optim.exp: Require is_amd64_regs_target.
H.J. Lu [Tue, 12 Jan 2021 13:10:58 +0000 (05:10 -0800)]
elf/x86-64: Adjust R_AMD64_DIR64/R_AMD64_DIR32 for PE/x86-64 inputs
Subtract the value of the section contents for R_AMD64_DIR64 and
R_AMD64_DIR32 relocations when generating ELF output from PE/x86-64
inputs.
bfd/
PR ld/27171
* reloc.c (bfd_perform_relocation): Adjust R_AMD64_DIR64 and
R_AMD64_DIR32 relocations for PE/x86-64 inputs.
ld/
PR ld/27171
* testsuite/ld-x86-64/pe-x86-64-5.obj.bz2: New file.
* testsuite/ld-x86-64/pe-x86-64-5.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-5.rd: Likewise.
* testsuite/ld-x86-64/pe-x86-64.exp: Run PR ld/27171 test.
Nick Clifton [Tue, 12 Jan 2021 13:18:50 +0000 (13:18 +0000)]
Updated translations for some subdirectories
Andrew Burgess [Mon, 11 Jan 2021 15:40:18 +0000 (15:40 +0000)]
gdb: fix debug dump of OP_BOOL expressions
Consider this GDB session:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x4055d90, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x4055d90, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL Unknown format
1 BINOP_ADD
2 OP_BOOL Unknown format
3 OP_NULL Unknown format
$1 = .TRUE.
The final dump of the OP_BOOL is completely wrong. After this patch
we now get:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x2d07470, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x2d07470, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL TRUE
$1 = .TRUE.
Much better. I added a test for this into the Fortran testsuite.
gdb/ChangeLog:
* expprint.c (dump_subexp_body_standard): Handle OP_BOOL.
gdb/testsuite/ChangeLog:
* gdb.fortran/debug-expr.exp: Add new tests.
Andrew Burgess [Mon, 11 Jan 2021 14:14:02 +0000 (14:14 +0000)]
gdb/fortran: add symbol base comparison operators
Fortran supports symbol based comparison operators as well as the
classic text based comparison operators, so we have:
Text | Symbol
Operator | Operator
---------|---------
.eq. | ==
.ne. | /=
.le. | <=
.ge. | >=
.gt. | >
.lt. | <
This commit adds the symbol based operators as well as some tests.
gdb/ChangeLog:
* f-exp.y (dot_ops): Rename to...
(fortran_operators): ...this. Add a header comment. Add symbol
based operators.
(yylex): Update to use fortran_operators not dot_ops. Remove
special handling for '**', this is now included in
fortran_operators.
gdb/testsuite/ChangeLog:
* gdb.fortran/dot-ops.exp: Add new tests.
Mike Frysinger [Tue, 12 Jan 2021 09:11:29 +0000 (04:11 -0500)]
sim: or1k: fix mixing of code & decl warning
Use the correct style of declaring variables at top of scope.
This fixes a few compiler warnings in the process.
Mike Frysinger [Tue, 12 Jan 2021 09:06:18 +0000 (04:06 -0500)]
sim: or1k: clean up stale build entries
This logic was migrated to the common code long ago so ports don't
need to declare them themselves.
Mike Frysinger [Tue, 12 Jan 2021 09:04:08 +0000 (04:04 -0500)]
sim: README-HACKING: clean up stale run references
The run.c interface was deleted long ago and everyone moved to nrun.c
(which is also the default), so no one needs to declare this anymore.