Maciej W. Rozycki [Thu, 12 Jul 2018 19:01:44 +0000 (20:01 +0100)]
MIPS/LD/testsuite: Limit reloc 6 tests to DSO targets
Complement commit
500c05ddbe98 ("MIPS/ld/testsuite: Limit export class
call reloc tests to DSO targets") and also check for target's shared
library support in determining whether to run reloc 6 tests, which
require it. No changes in results as all targets currently enabled for
NewABI testing support shared libraries.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Limit reloc 6 tests to
shared library targets.
Sergio Durigan Junior [Thu, 12 Jul 2018 17:03:31 +0000 (13:03 -0400)]
Declare 'ioarg' (from ser-tcp.c:try_connect) as 'u_long' when on Windows (and unbreak build on mingw32)
When building GDB on mingw32, it fails with:
../../binutils-gdb/gdb/ser-tcp.c: In function 'int try_connect(const addrinfo*, unsigned int*)':
../../binutils-gdb/gdb/ser-tcp.c:176:25: error: invalid conversion from 'int*' to 'u_long* {aka long unsigned int*}' [-fpermissive]
ioctl (sock, FIONBIO, &ioarg);
^~~~~~
In file included from ../../binutils-gdb/gdb/serial.h:23:0,
from ../../binutils-gdb/gdb/ser-tcp.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:977:34: note: initializing argument 3 of 'int ioctlsocket(SOCKET, long int, u_long*)'
WINSOCK_API_LINKAGE int WSAAPI ioctlsocket(SOCKET s,__LONG32 cmd,u_long *argp);
^~~~~~~~~~~
make[2]: *** [Makefile:1610: ser-tcp.o] Error 1
The problem happens because the IPv6
commit (
c7ab0aef11d91b637bf091aa9176b8dc4aadee46) wrongly removed the
code responsible for declaring 'ioarg' with a different type if
building for Windows. This patch restores that.
gdb/ChangeLog:
2018-07-12 Sergio Durigan Junior <sergiodj@redhat.com>
* ser-tcp.c (try_connect): Declare 'ioarg' as 'u_long' if building
on Windows.
Nick Clifton [Thu, 12 Jul 2018 14:46:17 +0000 (15:46 +0100)]
This patch adds support for the SSBB and PSSBB speculation barrier instructions to the AArch64 assembler and disassembler.
For more details see: https://static.docs.arm.com/ddi0596/a/DDI_0596_ARM_a64_instruction_set_architecture.pdf
opcodes * aarch64-tbl.h (aarch64_opcode_table): Add entry for
ssbb and pssbb and update dsb flags to F_HAS_ALIAS.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.
gas * testsuite/gas/aarch64/system.s: Add test for ssbb
and pssbb.
* testsuite/gas/aarch64/system.d: Update accordingly
and remove explicit addresses.
Tamar Christina [Thu, 12 Jul 2018 09:28:46 +0000 (10:28 +0100)]
Add remainder of Em16 restrictions for AArch64 gas.
This adds the missing Em16 constraints the rest of the instructions requiring them
and also adds a testcase to test all the instructions so these are checked from
now on.
The Em16 operand constrains the valid registers to the lower 16 registers when used
with a half precision qualifier.
The list has been cross checked (by hand) through the Arm ARM version Ca.
opcodes/
PR binutils/23192
* aarch64-tbl.h (sqdmlal, sqdmlal2, smlsl, smlsl2, sqdmlsl, sqdmlsl2,
mul, smull, smull2, sqdmull, sqdmull2, sqdmulh, sqrdmulh, mla, umlal,
umlal2, mls, umlsl, umlsl2, umull, umull2, sqdmlal, sqdmlsl, sqdmull,
sqdmulh, sqrdmulh): Use Em16.
gas/
PR binutils/23192
* testsuite/gas/aarch64/illegal-by-element.s: New.
* testsuite/gas/aarch64/illegal-by-element.d: New.
* testsuite/gas/aarch64/illegal-by-element.l: New.
Francois H. Theron [Wed, 11 Jul 2018 16:14:16 +0000 (18:14 +0200)]
readelf: Don't print section type twice for --section-details
* readelf.c (process_section_headers): Don't print section type
twice for --section-details.
GDB Administrator [Thu, 12 Jul 2018 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Fri, 18 May 2018 05:29:24 +0000 (01:29 -0400)]
Implement IPv6 support for GDB/gdbserver
This patch implements IPv6 support for both GDB and gdbserver. Based
on my research, it is the fourth attempt to do that since 2006. Since
I used ideas from all of the previous patches, I also added their
authors's names on the ChangeLogs as a way to recognize their
efforts. For reference sake, you can find the previous attempts at:
https://sourceware.org/ml/gdb-patches/2006-09/msg00192.html
https://sourceware.org/ml/gdb-patches/2014-02/msg00248.html
https://sourceware.org/ml/gdb-patches/2016-02/msg00226.html
The basic idea behind the patch is to start using the new
'getaddrinfo'/'getnameinfo' calls, which are responsible for
translating names and addresses in a protocol-independent way. This
means that if we ever have a new version of the IP protocol, we won't
need to change the code again (or, at least, won't have to change the
majority of the code).
The function 'getaddrinfo' returns a linked list of possible addresses
to connect to. Dealing with multiple addresses proved to be a hard
task with the current TCP auto-retry mechanism implemented on
ser-tcp:net_open. For example, when gdbserver listened only on an
IPv4 socket:
$ ./gdbserver --once 127.0.0.1:1234 ./a.out
and GDB was instructed to try to connect to both IPv6 and IPv4
sockets:
$ ./gdb -ex 'target extended-remote localhost:1234' ./a.out
the user would notice a somewhat big delay before GDB was able to
connect to the IPv4 socket. This happened because GDB was trying to
connect to the IPv6 socket first, and had to wait until the connection
timed out before it tried to connect to the IPv4 socket.
For that reason, I had to rewrite the main loop and implement a new
method for handling multiple connections. After some discussion,
Pedro and I agreed on the following algorithm:
1) For each entry returned by 'getaddrinfo', we try to open a socket
and connect to it.
2.a) If we have a successful 'connect', we just use that connection.
2.b) If we don't have a successfull 'connect', but if we've got a
ECONNREFUSED (meaning the the connection was refused), we keep track
of this fact by using a flag.
2.c) If we don't have a successfull 'connect', but if we've got a
EINPROGRESS (meaning that the connection is in progress), we perform
a 'select' call on the socket until we have a result (either a
successful connection, or an error on the socket).
3) If tcp_auto_retry is true, and we haven't gotten a successful
connection, and at least one of our attempts failed with
ECONNREFUSED, then we wait a little bit (i.e., call
'wait_for_connect'), check to see if there was a
timeout/interruption (in which case we bail out), and then go back
to (1).
After multiple tests, I was able to connect without delay on the
scenario described above, and was also able to connect in all other
types of scenarios.
I also implemented some hostname parsing functions (along with their
corresponding unit tests) which are used to help GDB and gdbserver to
parse hostname strings provided by the user. These new functions are
living inside common/netstuff.[ch]. I've had to do that since IPv6
introduces a new URL scheme, which defines that square brackets can be
used to enclose the host part and differentiate it from the
port (e.g., "[::1]:1234" means "host ::1, port 1234"). I spent some
time thinking about a reasonable way to interpret what the user wants,
and I came up with the following:
- If the user has provided a prefix that doesn't specify the protocol
version (i.e., "tcp:" or "udp:"), or if the user has not provided
any prefix, don't make any assumptions (i.e., assume AF_UNSPEC when
dealing with 'getaddrinfo') *unless* the host starts with "[" (in
which case, assume it's an IPv6 host).
- If the user has provided a prefix that does specify the protocol
version (i.e., "tcp4:", "tcp6:", "udp4:" or "udp6:"), then respect
that.
This method doesn't follow strictly what RFC 2732 proposes (that
literal IPv6 addresses should be provided enclosed in "[" and "]")
because IPv6 addresses still can be provided without square brackets
in our case, but since we have prefixes to specify protocol versions I
think this is not an issue.
Another thing worth mentioning is the new 'GDB_TEST_SOCKETHOST'
testcase parameter, which makes it possible to specify the
hostname (without the port) to be used when testing GDB and
gdbserver. For example, to run IPv6 tests:
$ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]'
Or, to run IPv4 tests:
$ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp4:127.0.0.1'
This required a few changes on the gdbserver-base.exp, and also a
minimal adjustment on gdb.server/run-without-local-binary.exp.
Finally, I've implemented a new testcase,
gdb.server/server-connect.exp, which is supposed to run on the native
host and perform various "smoke tests" using different connection
methods.
This patch has been regression-tested on BuildBot and locally, and
also built using a x86_64-w64-mingw32 GCC, and no problems were found.
gdb/ChangeLog:
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Paul Fertser <fercerpav@gmail.com>
Tsutomu Seki <sekiriki@gmail.com>
Pedro Alves <palves@redhat.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
'unittests/parse-connection-spec-selftests.c'.
(COMMON_SFILES): Add 'common/netstuff.c'.
(HFILES_NO_SRCDIR): Add 'common/netstuff.h'.
* NEWS (Changes since GDB 8.2): Mention IPv6 support.
* common/netstuff.c: New file.
* common/netstuff.h: New file.
* ser-tcp.c: Include 'netstuff.h' and 'wspiapi.h'.
(wait_for_connect): Update comment. New parameter
'gdb::optional<int> sock' instead of 'struct serial *scb'.
Use 'sock' directly instead of 'scb->fd'.
(try_connect): New function, with code from 'net_open'.
(net_open): Rewrite main loop to deal with multiple
sockets/addresses. Handle IPv6-style hostnames; implement
support for IPv6 connections.
* unittests/parse-connection-spec-selftests.c: New file.
gdb/gdbserver/ChangeLog:
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Paul Fertser <fercerpav@gmail.com>
Tsutomu Seki <sekiriki@gmail.com>
* Makefile.in (SFILES): Add '$(srcdir)/common/netstuff.c'.
(OBS): Add 'common/netstuff.o'.
(GDBREPLAY_OBS): Likewise.
* gdbreplay.c: Include 'wspiapi.h' and 'netstuff.h'.
(remote_open): Implement support for IPv6
connections.
* remote-utils.c: Include 'netstuff.h', 'filestuff.h'
and 'wspiapi.h'.
(handle_accept_event): Accept connections from IPv6 sources.
(remote_prepare): Handle IPv6-style hostnames; implement
support for IPv6 connections.
(remote_open): Implement support for printing connections from
IPv6 sources.
gdb/testsuite/ChangeLog:
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Paul Fertser <fercerpav@gmail.com>
Tsutomu Seki <sekiriki@gmail.com>
* README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST'
parameter.
* boards/native-extended-gdbserver.exp: Do not set 'sockethost'
by default.
* boards/native-gdbserver.exp: Likewise.
* gdb.server/run-without-local-binary.exp: Improve regexp used
for detecting when a remote debugging connection succeeds.
* gdb.server/server-connect.exp: New file.
* lib/gdbserver-support.exp (gdbserver_default_get_comm_port):
Do not prefix the port number with ":".
(gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement
support for detecting and using it. Add '$debughost_gdbserver'
to the list of arguments used to start gdbserver. Handle case
when gdbserver cannot resolve a network name.
gdb/doc/ChangeLog:
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Paul Fertser <fercerpav@gmail.com>
Tsutomu Seki <sekiriki@gmail.com>
* gdb.texinfo (Remote Connection Commands): Add explanation
about new IPv6 support. Add new connection prefixes.
Pedro Alves [Wed, 11 Jul 2018 22:31:44 +0000 (23:31 +0100)]
GDB: Work around D;PID handling bug in older GDBservers (PR gdb/23377)
This commit adds a GDB workaround for the GDBserver bug exposed by
commit
f2ffa92bbce9 ("gdb: Eliminate the 'stop_pc' global"), so that
newer GDBs can continue working with older GDBservers.
gdb/ChangeLog:
2018-07-11 Pedro Alves <palves@redhat.com>
PR gdb/23377
* remote.c (remote_target::remote_detach_pid): Call
set_current_process.
Pedro Alves [Wed, 11 Jul 2018 22:31:44 +0000 (23:31 +0100)]
GDBserver: Don't assume a current process in D;PID implementation (PR gdb/23377)
This fixes a gdb.base/multi-forks.exp regression with GDBserver.
Git commit
f2ffa92bbce9 ("gdb: Eliminate the 'stop_pc' global") caused
the regression by exposing a latent bug in gdbserver.
The bug is that GDBserver's implementation of the D;PID packet
incorrectly assumes that the selected thread points to the process
being detached. This happens via the any_persistent_commands call,
which calls current_process:
(gdb) bt
#0 0x000000000040a57e in internal_error(char const*, int, char const*, ...)
(file=0x4a53c0 "src/gdb/gdbserver/inferiors.c", line=212, fmt=0x4a539e "%s:
Assertion `%s' failed.") at src/gdb/gdbserver/../common/errors.c:54
#1 0x0000000000420acf in current_process() () at
src/gdb/gdbserver/inferiors.c:212
#2 0x00000000004226a0 in any_persistent_commands() () at
gdb/gdbserver/mem-break.c:308
#3 0x000000000042cb43 in handle_detach(char*) (own_buf=0x6f0280 "D;62ea") at
src/gdb/gdbserver/server.c:1210
#4 0x0000000000433af3 in process_serial_event() () at
src/gdb/gdbserver/server.c:4055
#5 0x0000000000434878 in handle_serial_event(int, void*) (err=0,
client_data=0x0)
The "eliminate stop_pc" commit exposes the problem because before that
commit, GDB's switch_to_thread always read the newly-selected thread's
PC, and that would end up forcing GDBserver's selected thread to
change accordingly as side effect. After that commit, GDB no longer
reads the thread's PC, and GDBserver does not switch the thread.
Fix this by removing the assumption from GDBserver.
gdb/gdbserver/ChangeLog:
2018-07-11 Pedro Alves <palves@redhat.com>
PR gdb/23377
* mem-break.c (any_persistent_commands): Add process_info
parameter and use it instead of relying on the current process.
Change return type to bool.
* mem-break.h (any_persistent_commands): Add process_info
parameter and change return type to bool.
* server.c (handle_detach): Remove require_running_or_return call.
Look up the process_info for the process we're about to detach.
If not found, return back error to GDB. Adjust
any_persistent_commands call to pass down a process pointer.
Pedro Alves [Wed, 11 Jul 2018 19:39:12 +0000 (20:39 +0100)]
gdb: Remove traces of h8300 ecoff support
There's this little bit of ecoff support in the h8300 port that I ran
into that I think we could remove. Grepping around BFD, I don't think
ECOFF is supported for h8300.
And if not, I'm failing to see why we'd support ECOFF debug info in
ELF for h8300 (.mdebug). It kind of seems like someone just installed
the set_gdbarch_ecoff_reg_to_regnum hook at the same time the dwarf2
and stabs hooks were installed.
I'm removing this so that greps for ecoff stuff only lead to MIPS, as
ISTR that Linux/MIPS support still relies on some subset of ECOFF for
something.
gdb/ChangeLog:
2018-07-11 Pedro Alves <palves@redhat.com>
* h8300-tdep.c (h8300_gdbarch_init): Remove
set_gdbarch_ecoff_reg_to_regnum calls.
Sergio Durigan Junior [Sat, 7 Jul 2018 21:16:55 +0000 (17:16 -0400)]
Fix PR c++/23373: GDB hangs when printing a struct with a static member of itself
This patch fixes a failure that happens when a structure has a static
member whose type is the same as itself. From the bug report:
Example code:
struct A
{
static A Empty;
int a;
};
int main(void) {
A a;
return 0;
}
Output:
(gdb) ptype/o A
/* offset | size */ type = struct A {
static struct A {
static struct A {
static struct A {
static struct A {
static struct A {
static struct A {
... # infinite loop
The problem here is that GDB is not taking into account the fact that
static members inside a class/struct are not stored in the
class/struct, and therefore they should not be accounted for during
the display of the offsets/sizes. The fix is simple: we just check if
the field we're dealing with (on
c-typeprint.c:c_type_print_base_struct_union) is static, and if it is
then we don't iterate over it.
This patch also adds a new test for this case, and doesn't introduce
any regressions. I believe it is important enough to be included in
the 8.2 branch.
OK?
gdb/ChangeLog:
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
PR c++/23373
* c-typeprint.c (c_type_print_base_struct_union): Don't print
offsets/sizes for static members of a class/struct.
gdb/testsuite/ChangeLog:
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
PR c++/23373
* gdb.base/ptype-offsets.cc (struct static_member): New
struct.
(main) <stmember>: New variable.
* gdb.base/ptype-offsets.exp: Add test for printing a struct
with a static member in it.
Pedro Alves [Wed, 11 Jul 2018 18:49:19 +0000 (19:49 +0100)]
GDBserver: Fix "Cond. jump or move depends on uninit value" in x87 code
Running gdbserver under Valgrind I get:
==26925== Conditional jump or move depends on uninitialised value(s)
==26925== at 0x473E7F: i387_cache_to_xsave(regcache*, void*) (i387-fp.c:579)
==26925== by 0x46E3ED: x86_fill_xstateregset(regcache*, void*) (linux-x86-low.c:418)
==26925== by 0x45E747: regsets_store_inferior_registers(regsets_info*, regcache*) (linux-low.c:5456)
==26925== by 0x45EEF8: linux_store_registers(regcache*, int) (linux-low.c:5731)
==26925== by 0x426441: regcache_invalidate_thread(thread_info*) (regcache.c:89)
==26925== by 0x45CCAF: linux_resume_one_lwp_throw(lwp_info*, int, int, siginfo_t*) (linux-low.c:4447)
==26925== by 0x45CE2A: linux_resume_one_lwp(lwp_info*, int, int, siginfo_t*) (linux-low.c:4519)
==26925== by 0x45E17C: proceed_one_lwp(thread_info*, lwp_info*) (linux-low.c:5216)
==26925== by 0x45DC81: linux_resume_one_thread(thread_info*, bool) (linux-low.c:5031)
==26925== by 0x45DD34: linux_resume(thread_resume*, unsigned long)::{lambda(thread_info*)#2}::operator()(thread_info*) const (linux-low.c:5095)
==26925== by 0x462907: void for_each_thread<linux_resume(thread_resume*, unsigned long)::{lambda(thread_info*)#2}>(linux_resume(thread_resume*, unsigned long)::{lambda(thread_info*)#2}) (gdbthread.h:150)
==26925== by 0x45DE62: linux_resume(thread_resume*, unsigned long) (linux-low.c:5093)
==26925==
==26925== Conditional jump or move depends on uninitialised value(s)
==26925== at 0x473EBD: i387_cache_to_xsave(regcache*, void*) (i387-fp.c:586)
==26925== by 0x46E3ED: x86_fill_xstateregset(regcache*, void*) (linux-x86-low.c:418)
==26925== by 0x45E747: regsets_store_inferior_registers(regsets_info*, regcache*) (linux-low.c:5456)
==26925== by 0x45EEF8: linux_store_registers(regcache*, int) (linux-low.c:5731)
==26925== by 0x426441: regcache_invalidate_thread(thread_info*) (regcache.c:89)
==26925== by 0x45CCAF: linux_resume_one_lwp_throw(lwp_info*, int, int, siginfo_t*) (linux-low.c:4447)
==26925== by 0x45CE2A: linux_resume_one_lwp(lwp_info*, int, int, siginfo_t*) (linux-low.c:4519)
==26925== by 0x45E17C: proceed_one_lwp(thread_info*, lwp_info*) (linux-low.c:5216)
==26925== by 0x45DC81: linux_resume_one_thread(thread_info*, bool) (linux-low.c:5031)
==26925== by 0x45DD34: linux_resume(thread_resume*, unsigned long)::{lambda(thread_info*)#2}::operator()(thread_info*) const (linux-low.c:5095)
==26925== by 0x462907: void for_each_thread<linux_resume(thread_resume*, unsigned long)::{lambda(thread_info*)#2}>(linux_resume(thread_resume*, unsigned long)::{lambda(thread_info*)#2}) (gdbthread.h:150)
==26925== by 0x45DE62: linux_resume(thread_resume*, unsigned long) (linux-low.c:5093)
The problem is a type/width mismatch in code like this, in
gdbserver/i387-fp.c:
/* Some registers are 16-bit. */
collect_register_by_name (regcache, "fctrl", &val);
fp->fctrl = val;
In the above code:
#1 - 'val' is a 64-bit unsigned long.
#2 - "fctrl" is 32-bit in the register cache, thus half of 'val' is
left uninitialized by collect_register_by_name, which works with
an untyped raw buffer output (i.e., void*).
#3 - fp->fctrl is an unsigned short (16-bit). For some such
registers we're masking off the uninitialized bits with 0xffff,
but not in all cases.
We end up in such a fragile situation because
collect_registers_by_name works with an untyped output buffer pointer,
making it easy to pass a pointer to a variable of the wrong size.
Fix this by using regcache_raw_get_unsigned instead (actually a new
regcache_raw_get_unsigned_by_name wrapper), which always returns a
zero-extended ULONGEST register value. It ends up simplifying the
i387-tdep.c code a bit, even.
gdb/gdbserver/ChangeLog:
2018-07-11 Pedro Alves <palves@redhat.com>
* i387-fp.c (i387_cache_to_fsave, cache_to_fxsave)
(i387_cache_to_xsave): Use regcache_raw_get_unsigned_by_name
instead of collect_register_by_name.
* regcache.c (regcache_raw_get_unsigned_by_name): New.
* regcache.h (regcache_raw_get_unsigned_by_name): New.
Sudakshina Das [Wed, 11 Jul 2018 17:05:34 +0000 (18:05 +0100)]
Adds the speculation barrier instructions to the ARM assembler and disassembler.
See:
https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/download-the-whitepaper
opcodes * arm-dis.c (arm_opcodes): Add ssbb and pssbb and move
csdb together with them.
(thumb32_opcodes): Likewise.
gas * config/tc-arm.c (insns): Add new ssbb and pssbb instructions.
* testsuite/gas/arm/csdb.s: Add new tests for ssbb and pssbb.
* testsuite/gas/arm/csdb.d: Likewise
* testsuite/gas/arm/thumb2_it_bad.s: Likewise.
* testsuite/gas/arm/thumb2_it_bad.l: Likewise.
* testsuite/gas/arm/barrier.d: Update with ssbb.
* testsuite/gas/arm/barrier-thumb.d: Likewise.
Maciej W. Rozycki [Wed, 11 Jul 2018 16:44:45 +0000 (17:44 +0100)]
MIPS/BFD: Fix TLS relocation resolution for regular executables
Correct an issue with commit
0f20cc3522e7 ("TLS support for MIPS"),
<https://sourceware.org/ml/binutils/2005-02/msg00607.html>, where a
condition used to determine whether to use a dynamic symbol for GD, LD
and IE TLS dynamic relocations against a symbol that has been defined
locally has been incorrectly reversed.
It's executables rather than dynamic shared objects where no symbol is
required, because such symbols cannot be preempted and therefore their
values (thread pointer offsets) are fixed at the static link time as is
the associated module ID of the main executable, so the original
condition should have been `shared' instead of `!shared'. This wrong
condition was then later converted from `!shared' to `!bfd_link_pic',
with commit
0e1862bb401f ("Add output_type to bfd_link_info").
Use the correct `bfd_link_dll' condition then, and adjust code for the
dynamic symbol index possibly being -1 as with symbols that have been
forced local, removing unnecessary dynamic relocations from dynamic
regular executables. PIE executables are unaffected as the existing
condition excluded them by chance due to the conversion mentioned above.
Adjust test cases accordingly.
bfd/
* elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
than `!bfd_link_pic' in determining the dynamic symbol index.
Avoid the index of -1.
(mips_elf_initialize_tls_slots): Likewise. Flatten code by
moving `dyn' to the beginning of the function block.
ld/
* testsuite/ld-mips-elf/tlsdyn-o32.d: Update test for dynamic
relocation removal.
* testsuite/ld-mips-elf/tlsdyn-o32.got: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-1.d: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise.
* testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
Maciej W. Rozycki [Wed, 11 Jul 2018 16:44:45 +0000 (17:44 +0100)]
PR ld/22570: MIPS/BFD: Fix TLS relocation resolution for PIE executables
Correct a commit
0e1862bb401f ("Add output_type to bfd_link_info") issue
and use `bfd_link_dll' rather than `bfd_link_pic' in determining whether
to fully resolve GD, LD and IE TLS relocations referring to symbols
locally defined rather than deferring them to the load time by means of
dynamic relocations.
Such symbols cannot be preempted in PIE executables, which are
necessarily PIC, and therefore their values (thread pointer offsets) are
fixed at the static link time as is the associated module ID of the main
executable.
Given the `tlsbin-o32.s' and `tlsdyn-o32.s' sources from our test suite
this removes the absolute TLS relocations from the static:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
1000002c R_MIPS_TLS_TPREL32 *ABS*
10000030 R_MIPS_TLS_DTPMOD32 *ABS*
10000038 R_MIPS_TLS_DTPMOD32 *ABS*
and the dynamic:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
1000002c R_MIPS_TLS_TPREL32 *ABS*
10000038 R_MIPS_TLS_DTPMOD32 *ABS*
10000044 R_MIPS_TLS_DTPMOD32 *ABS*
10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd
10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd
10000040 R_MIPS_TLS_TPREL32 tlsvar_ie
PIE executable respectively, as reported by `objdump -R', and fills the
corresponding GOT slots with the values expected, as recorded with the
test cases added. The new output from `objdump -R' is:
DYNAMIC RELOCATION RECORDS (none)
and:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd
10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd
10000040 R_MIPS_TLS_TPREL32 tlsvar_ie
for the static and the dynamic executable respectively.
2018-07-11 Maciej W. Rozycki <macro@mips.com>
Rich Felker <bugdal@aerifal.cx>
bfd/
PR ld/22570
* elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
than `bfd_link_pic' to determine whether dynamic relocations are
to be produced.
(mips_elf_initialize_tls_slots): Likewise.
ld/
PR ld/22570
* testsuite/ld-mips-elf/tlsbin-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsbin-pie-o32.got: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.got: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Franz Sirl [Wed, 24 Jan 2018 13:39:11 +0000 (13:39 +0000)]
Fix printing the size of GOLD's memory areana on Cygwin based systems.
I just stumbled over this with 2.29.1 while building a cross-toolchain, on Cygwin64, but it's still the same for 2.30. m.arena has size_t on Cygwin64 and thus errors out due to -Werror=format.
gold * main.cc: Print m.arena as long long.
Alan Hayward [Wed, 11 Jul 2018 07:34:50 +0000 (08:34 +0100)]
Rename tdesc_register_size to tdesc_register_bitsize
tdesc_register_size returns number of bits, not bytes.
Rename to make it clearer.
Also, fixed bug in aarch64_get_tdesc_vq which assumed bytes.
gdb/
* target-descriptions.c (tdesc_register_bitsize): Rename.
* target-descriptions.h (tdesc_register_bitsize): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Use new name.
* aarch64-tdep.c (aarch64_get_tdesc_vq): Convert size.
Jan Beulich [Wed, 11 Jul 2018 08:30:00 +0000 (10:30 +0200)]
x86: adjust monitor/mwait templates
Architecturally, MONITOR's and MONITORX'es memory operand is a 16- or
32-bit register outside of 64-bit mode, and a 64- or 32-bit register
inside 64-bit mode. The other register operands, including all of them
for MWAIT and MWAITX, are uniformly 32-bit, irrespective of mode. Retain
the original 64-bit MONITOR{,X} templates for compatibility only, and
fold the MWAIT{,X} ones.
Jan Beulich [Wed, 11 Jul 2018 08:28:56 +0000 (10:28 +0200)]
x86: drop {,reg16_}inoutportreg variables
The checking against reg16_inoutportreg can be had with a simple test of
a bit, and the value setting from inoutportreg can be replaced by using
the actual register's reg_type field.
Note that the so far redundant 2nd instance of OPERAND_TYPE_INOUTPORTREG
is left in place, for its use in type_names[].
Jan Beulich [Wed, 11 Jul 2018 08:28:16 +0000 (10:28 +0200)]
x86: simplify legacy prefix emission
The check_prefix label was bogus from the beginning: The special
checking is supposed to happen for PadLock insns only; no
3-opcode-byte insn should go this path.
Jan Beulich [Wed, 11 Jul 2018 08:25:40 +0000 (10:25 +0200)]
x86/Intel: accept memory operand size specifiers for CET insns
Jan Beulich [Wed, 11 Jul 2018 08:24:44 +0000 (10:24 +0200)]
x86: replace off-by-one OTMax
With its name it should equal to the largest prior enumerator, which is
not very helpful as that will change every once in a while. Rename it to
OTNum instead to make name and value match, and correct use sites to no
longer use one too large a value.
Jan Beulich [Wed, 11 Jul 2018 08:23:48 +0000 (10:23 +0200)]
x86: fix "REP RET" with -madd-bnd-prefix
Just like any other branches, RET should gain a BND prefix also when
already prefixed in source by REP.
Alan Modra [Wed, 11 Jul 2018 04:23:20 +0000 (13:53 +0930)]
Revise "ld testsuite use of notarget"
git commit
624940689a wrongly changed fill.d and fill16.d notarget
entries to xfail, so revert that change and instead replace notarget
with skip. The two tests are complementary.
This patch also modifies the pr20022 test to use .data, avoiding
xfails on targets that complain about dynamic relocations in .text.
This shows a bug in metag which discards section _foo in pr2022.so.
* testsuite/ld-elf/hash.d: Comment on mips xfail.
* testsuite/ld-gc/pr20022b.s: Use .data not .text.
* testsuite/ld-gc/pr20022.d: Remove xfails.
* testsuite/ld-scripts/fill.d: Revert most of last patch, but use
skip rather than notarget.
* testsuite/ld-scripts/fill16.d: Likewise.
Tom Tromey [Tue, 5 Jun 2018 16:35:38 +0000 (10:35 -0600)]
Use std::vector for moribund_locations
This changes moribund_locations to use a std::vector rather than VEC.
I also noticed that moribund_locations is only used in breakpoint.c,
so now it is static as well.
It might be possible to make this code a bit simpler by using a
ref_ptr in moribund_locations; however, I have not done this.
Tested by the buildbot.
gdb/ChangeLog
2018-07-10 Tom Tromey <tom@tromey.com>
* breakpoint.c (moribund_locations): Now static and a
std::vector.
(breakpoint_init_inferior, moribund_breakpoint_here_p)
(build_bpstat_chain, update_global_location_list)
(breakpoint_retire_moribund): Update.
* breakpoint.h (bp_location_p): Remove typedef. Don't declare
VEC.
GDB Administrator [Wed, 11 Jul 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Tue, 10 Jul 2018 23:56:46 +0000 (16:56 -0700)]
MIPS/ld/testsuite: Limit export class call reloc tests to DSO targets
Only run MIPS/LD export class call relocation tests with shared library
targets, avoiding:
.../ld/ld-new: -shared not supported
linker errors and removing:
FAIL: MIPS export class call relocation test (o32)
regressions with `mipsel-ps2-elf' and `mips64el-ps2-elf' targets.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Limit export class call
relocation tests to shared library targets.
Maciej W. Rozycki [Tue, 10 Jul 2018 23:42:43 +0000 (00:42 +0100)]
BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors:
cc1: warnings being treated as errors
.../bfd/elflink.c: In function 'bfd_elf_final_link':
.../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration
/usr/include/stdio.h:154: error: shadowed declaration is here
which for versions of GCC before 4.8 prevent support for ELF targets
from being built. See also GCC PR c/53066.
bfd/
* elflink.c (bfd_elf_final_link): Rename `remove' local variable
to `remove_section'.
Alan Modra [Tue, 10 Jul 2018 02:39:28 +0000 (12:09 +0930)]
xgate testsuite fixes
binutils/
* testsuite/lib/binutils-common.exp (supports_gnu_unique): Return
zero for xgate.
ld/
* testsuite/lib/ld-lib.exp (check_gc_sections_available): Return 0
for xgate.
* testsuite/ld-elf/elf.exp: Add xgate to pr21703 xfails.
* testsuite/ld-elf/shared.exp: Add xgate to pr21703 xfails.
* testsuite/ld-discard/extern.d: xfail xgate.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/attributes.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr14156b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr20528a.d: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/ld-elf/pr22836-1a.d: Likewise.
* testsuite/ld-elf/pr22836-1b.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
Alan Modra [Sat, 7 Jul 2018 11:53:53 +0000 (21:23 +0930)]
xgate cleanup
elf32-xgate.c contains many functions that are only stubs and
elf32-xgate.h contains unused declarations. While this might be
reasonable for the initial commit of a port with subsequent work
fleshing out the stubs, xgate has only had two minor target specific
patches since the initial commit over six years ago. The rest of the
changes have been general maintenance work applied to all ELF targets,
and some of this work could have been avoided if the stubs hadn't been
there. So this patch removes all the stubs.
I've kept the functionality of the old elf32_xgate_add_symbol_hook,
implemented in elf32_xgate_backend_symbol_processing. Presumably,
that's to set the symbol st_target_internal flag for use in
elf32-m68hc1x.c:elf32_m68hc11_relocate_section.
The empty elf32_xgate_relocate_section meant that xgate had no linker.
Or at least, no linker relocation processing. Deleting the
elf_backend_relocate_section define means the target will now use the
generic linker reloc processing. How good that is will depend on the
accuracy of the reloc howtos..
I haven't updated the ld testsuite to xfail tests expected to fail
for generic elf targets.
bfd/
* elf32-xgate.h: Delete.
* elf32-xgate.c: Delete unnecessary forward declarations, add two
that are now needed.
(xgate_elf_bfd_link_hash_table_create)
(xgate_elf_bfd_link_hash_table_free)
(xgate_elf_set_mach_from_flags, struct xgate_scan_param)
(stub_hash_newfunc, elf32_xgate_add_symbol_hook)
(elf32_xgate_setup_section_lists, elf32_xgate_size_stubs)
(elf32_xgate_build_stubs, elf32_xgate_check_relocs)
(elf32_xgate_relocate_section, _bfd_xgate_elf_set_private_flags)
(elf32_xgate_post_process_headers): Delete.
(elf32_xgate_backend_symbol_processing): New function.
(xgate_elf_ignore_reloc, xgate_elf_special_reloc)
(_bfd_xgate_elf_print_private_bfd_data): Make static.
(ELF_TARGET_ID, elf_info_to_howto, elf_backend_check_relocs)
(elf_backend_relocate_section, elf_backend_object_p)
(elf_backend_final_write_processing, elf_backend_can_gc_sections)
(elf_backend_post_process_headers, elf_backend_add_symbol_hook)
(bfd_elf32_bfd_link_hash_table_create)
(bfd_elf32_bfd_set_private_flags)
(xgate_stub_hash_lookup): Don't define.
(elf_backend_symbol_processing): Define.
* elf-bfd.h (elf_target_id): Delete XGATE_ELF_DATA.
ld/
* emulparams/xgateelf.sh (TEMPLATE_NAME) Set to generic.
(EXTRA_EM_FILE): Set to genelf.
Alan Modra [Tue, 10 Jul 2018 13:43:10 +0000 (23:13 +0930)]
ld testsuite use of notarget
Much of the time it is better to use xfail rather than notarget to
hide a testsuite failure no one is planning on fixing.
1) When a target is fixed, an inappropriate xfail results in XPASS
whereas notarget is silent. Leaving in an inappropriate notarget
entry risks the bug reappearing later, silently.
2) Tests might be used as a template for a new test, carrying over
notarget and/or xfail. Inappropriate notarget entries are silent.
3) An xfailed test that mysteriously XPASSes might actually indicate a
bug.
* testsuite/ld-elf/attributes.d: Use xfail rather than notarget.
* testsuite/ld-elf/hash.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/overlay.d: Likewise.
* testsuite/ld-elf/pr14926.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr19539.d: Likewise.
* testsuite/ld-elf/pr22319.d: Likewise.
* testsuite/ld-misc/defsym1.d: Likewise.
* testsuite/ld-pe/pr19803.d: Likewise.
* testsuite/ld-scripts/assign-loc.d: Likewise.
* testsuite/ld-scripts/defined4.d: Likewise.
* testsuite/ld-scripts/empty-address-1.d: Likewise.
* testsuite/ld-scripts/empty-address-2a.d: Likewise.
* testsuite/ld-scripts/empty-address-2b.d: Likewise.
* testsuite/ld-scripts/fill.d: Likewise.
* testsuite/ld-scripts/fill16.d: Likewise.
* testsuite/ld-scripts/pr14962.d: Likewise.
* testsuite/ld-scripts/pr14962-2.d: Likewise.
* testsuite/ld-unique/pr21529.d: Likewise.
* testsuite/ld-elf/compress1a.d: Likewise, and adjust targets.
* testsuite/ld-elf/compressed1a.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/compressed1e.d: Likewise.
* testsuite/ld-elf/eh5.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/pr21884.d: Likewise.
* testsuite/ld-gc/pr19167.d: Likewise.
* testsuite/ld-gc/pr20022.d: Likewise.
* testsuite/ld-gc/start.d: Likewise.
* testsuite/ld-elf/orphan-11.d: Delete notarget.
* testsuite/ld-elf/orphan-12.d: Likewise.
* testsuite/ld-gc/stop.d: Likewise.
* testsuite/ld-scripts/empty-address-3a.d: Likewise.
* testsuite/ld-scripts/empty-address-3b.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Delete duplicate notarget.
* testsuite/ld-scripts/section-match-1.d: Comment fix.
Andrew Burgess [Tue, 10 Apr 2018 19:21:58 +0000 (20:21 +0100)]
gdb/testsuite: Run test with software and hardware watchpoints
Expand the gdb.base/watchpoint-reuse-slot.exp test to be run twice,
once with hardware watchpoints disabled (this is new) and then with
hardware watchpoints enabled (the old way).
Running with hardware watchpoints enabled is skipped if the board file
says that hardware watchpoints are not supported on this target.
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-reuse-slot.exp: Test with hardware
watchpoints enabled and disabled.
Andrew Burgess [Sun, 8 Apr 2018 10:08:32 +0000 (11:08 +0100)]
gdb/riscv: Fix assertion in inferior call code
An assertion when setting up arguments for an inferior call checks the
size of the argument against xlen. However, if xlen and flen are
different sizes, and the argument is being placed into a floating
pointer register then we should be comparing against flen not xlen.
This issue shows up as an assertion failure when running on an rv32g
target with a binary compiled using the rv32f abi and making an
inferior call involving large floating point arguments, for example
the test gdb.base/infcall-nested-structs.exp.
gdb/ChangeLog:
* riscv-tdep.c (riscv_is_fp_regno_p): New function.
(riscv_register_reggroup_p): Use new function, remove unneeded
parenthesis.
(riscv_push_dummy_call): Extend assert to compare against xlen or
flen based on register type.
Andrew Burgess [Sun, 8 Apr 2018 10:07:56 +0000 (11:07 +0100)]
gdb/riscv: Use TYPE_SAFE_NAME
In debug printing, use TYPE_SAFE_NAME instead of replicating the
functionality using TYPE_NAME and a null check.
gdb/ChangeLog:
* riscv-tdep.c (riscv_print_arg_location): Use TYPE_SAFE_NAME.
Maciej W. Rozycki [Tue, 10 Jul 2018 00:28:46 +0000 (01:28 +0100)]
MIPS/LD/testsuite: Make Linux dumps for n64 GOT relocation tests the default
The current default dumps for n64 GOT relocation tests only work for
IRIX targets really, while the Linux dumps are suitable for non-Linux
targets as well. Make the Linux dumps the default then and handle the
IRIX ones as a special case.
Define an `irix' variable as a shorthand for `[istarget *-*-irix*]' and
use it for these n64 GOT relocation tests as well as export class call
relocation tests.
ld/
* testsuite/ld-mips-elf/elf-rel-got-n64.d: Rename to...
* testsuite/ld-mips-elf/elf-rel-got-n64-irix.d: ... this.
* testsuite/ld-mips-elf/elf-rel-got-n64-linux.d: Rename to...
* testsuite/ld-mips-elf/elf-rel-got-n64.d: ... this.
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: Rename to...
* testsuite/ld-mips-elf/elf-rel-xgot-n64-irix.d: ... this.
* testsuite/ld-mips-elf/elf-rel-xgot-n64-linux.dd: Rename to...
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: ... this.
* testsuite/ld-mips-elf/mips-elf.exp: Update accordingly.
Define `irix' as a shorthand for `[istarget *-*-irix*]' and use
it throughout.
GDB Administrator [Tue, 10 Jul 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Cary Coutant [Mon, 9 Jul 2018 23:12:27 +0000 (16:12 -0700)]
Fix test for availability of emplace_back.
Testing for the GCC version 5 or later isn't right, since C++ 11 support
wasn't enabled by default until later. This patch tests the C++ standard
support directly instead of inferring it from the GCC version.
gold/
* incremental.cc (Sized_incremental_binary::setup_readers): Use
emplace_back for C++ 11 or later.
Maciej W. Rozycki [Mon, 9 Jul 2018 22:43:27 +0000 (23:43 +0100)]
MIPS/LD/testsuite: Fix IRIX dumps for n64 GOT relocation tests
Factor in the presence of a `.gnu.attributes' section at the end of the
respective dumps:
Disassembly of section .gnu.attributes:
0000000000000000 <.gnu.attributes>:
0:
41000000 bc0f 4 <__dso_displacement+0x4>
4:
0f676e75 jal
d9db9d4 <__dso_displacement+0xd9db9d4>
8:
00010000 sll zero,at,0x0
c:
00070401 0x70401
and also ignore any trailing output with the IRIX variant of n64 GOT
relocation tests, like already done with the Linux and the embedded
ones, removing:
FAIL: MIPS ELF got reloc n64
FAIL: MIPS ELF xgot reloc n64
LD testsuite regressions with the `mips-sgi-irix6' target.
ld/
* testsuite/ld-mips-elf/elf-rel-got-n64.d: Add `#pass' at the
end.
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
Maciej W. Rozycki [Mon, 9 Jul 2018 20:30:44 +0000 (21:30 +0100)]
MIPS/BFD: Do not redirect to discarded lazy binding stubs
Correct a MIPS/BFD linker issue with dynamic symbol and corresponding
GOT entry values being redirected to lazy binding stubs where the stubs
section has been discarded by assigning to the `/DISCARD/' output
section in the linker script used. The issue manifests itself by the
values entered being relative to the absolute section, which is what any
discarded sections are internally assigned in the linker.
For the `stub-dynsym-2.s' piece of code included as a test case with
this change this issue results in the dynamic symbol table and the GOT
looking like:
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00000010 0 FUNC GLOBAL DEFAULT UND bar
2:
00000000 0 FUNC GLOBAL DEFAULT UND foo
Primary GOT:
Canonical gp value:
00097ff0
Reserved entries:
Address Access Initial Purpose
00090000 -32752(gp)
00000000 Lazy resolver
00090004 -32748(gp)
80000000 Module pointer (GNU extension)
Global entries:
Address Access Initial Sym.Val. Type Ndx Name
00090008 -32744(gp)
00000010 00000010 FUNC UND bar
0009000c -32740(gp)
00000000 00000000 FUNC UND foo
if assembled to regular MIPS code, or:
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
0000000d 0 FUNC GLOBAL DEFAULT UND bar
2:
00000001 0 FUNC GLOBAL DEFAULT UND foo
Primary GOT:
Canonical gp value:
00097ff0
Reserved entries:
Address Access Initial Purpose
00090000 -32752(gp)
00000000 Lazy resolver
00090004 -32748(gp)
80000000 Module pointer (GNU extension)
Global entries:
Address Access Initial Sym.Val. Type Ndx Name
00090008 -32744(gp)
0000000d 0000000d FUNC UND bar
0009000c -32740(gp)
00000001 00000001 FUNC UND foo
if assembled to microMIPS code. Symbol values and GOT entries record
the offset into the inexistent stubs section and the ISA bit rather than
zero, which would be the case if a lazy binding stub was not used for
other reasons, such as the value of the symbol being taken for a purpose
other than making a function call (e.g. an R_MIPS_GOT16 relocation).
Correct the issue by refraining from redirecting symbols to lazy binding
stubs if the stubs section is going to be discarded.
bfd/
* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Don't set
`->needs_lazy_stub' if the stubs output section is the absolute
section.
ld/
* testsuite/ld-mips-elf/stub-dynsym-2.dd: New test.
* testsuite/ld-mips-elf/stub-dynsym-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.dd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.dd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.gd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.sd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-2.ld: New test linker
script.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.ld: New test
linker script.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Andrew Burgess [Mon, 2 Jul 2018 21:28:22 +0000 (22:28 +0100)]
gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
Switch to use add_setshow_zuinteger_unlimited_cmd for some of the
control variables in remote.c. The variables
hardware-watchpoint-limit, hardware-breakpoint-limit, and
hardware-watchpoint-length-limit are all changed. For example, a user
will now see this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is unlimited.
Instead of this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is -1.
And can do this:
(gdb) set remote hardware-breakpoint-limit unlimited
However, previously any negative value implied "unlimited", now only
-1, or the text "unlimited" can be used for unlimited. Any other
negative value will give an error about invalid input. This is a
small change in the user interface, but, hopefully, this will not
cause too many problems.
I've also added show functions for these three variables to allow for
internationalisation.
gdb/ChangeLog:
* remote.c (show_hardware_watchpoint_limit): New function.
(show_hardware_watchpoint_length_limit): New function.
(show_hardware_breakpoint_limit): New function.
(_initialize_remote): Use add_setshow_zuinteger_unlimited_cmd
where appropriate, update help text.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Update descriptions for
set/show of hardware-watchpoint-limit, hardware-breakpoint-limit,
and hardware-watchpoint-length-limit variables.
Jeff Law [Mon, 9 Jul 2018 16:35:12 +0000 (10:35 -0600)]
* testsuite/nds32/ji-jr.d: Fix name tag.
Maciej W. Rozycki [Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)]
LD/testsuite: run_dump_test: Report UNSUPPORTED for excluded targets
Bring the LD implementation of `run_dump_test' in line with its binutils
and GAS counterparts and report the UNSUPPORTED status for tests the run
of which has been prevented by means of one or more of `target',
`alltargets' and `notarget' tags. Define `skip', `anyskip' and `noskip'
tags, which do not report anything for tests that are not run.
The rationale behind this is that we want to have unsupported tests
reported to ensure that they have actually been attempted and have not
been accidentally suppressed. Then tests which have target-specific
variants that cannot be expressed with a single .d file can make use of
the newly added tags to silently suppress the uninteresting variants.
ld/
* testsuite/lib/ld-lib.exp (run_dump_test): Call `unsupported'
if the target being tested has been excluded by means of one or
more of `target', `alltargets' and `notarget' tags. Add support
for `skip', `anyskip' and `noskip' tags.
Maciej W. Rozycki [Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)]
LD/testsuite: run_dump_test: Use the intended test name ASAP
Bring the LD implementation of `run_dump_test' in line with its binutils
and GAS counterparts and use the intended test name, from the `name' tag
if set, for test status reporting as soon as it is available.
ld/
* testsuite/lib/ld-lib.exp (run_dump_test): Move the setting of
`testname' earlier on and use it for test status reporting.
Maciej W. Rozycki [Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)]
S12Z/opcodes: Correct a `reg' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors:
cc1: warnings being treated as errors
.../opcodes/s12z-dis.c: In function 'lea_reg_xys_opr':
.../opcodes/s12z-dis.c:814: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
.../opcodes/s12z-dis.c: In function 'lea_reg_xys':
.../opcodes/s12z-dis.c:843: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
.../opcodes/s12z-dis.c: In function 'print_insn_loop_primitive':
.../opcodes/s12z-dis.c:2206: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
which for versions of GCC before 4.8 prevent support for S12Z targets
from being built. See also GCC PR c/53066.
opcodes/
* s12z-dis.c (lea_reg_xys_opr): Rename `reg' local variable to
`reg_xys'.
(lea_reg_xys): Likewise.
(print_insn_loop_primitive): Rename `reg' local variable to
`reg_dxy'.
Andrew Burgess [Fri, 2 Feb 2018 15:51:31 +0000 (15:51 +0000)]
gdb/testsuite: Allow for failure to read some memory addresses
In the gdb.base/examine-backward.exp test script, we check to see if
address zero is readable, and then read memory first forward from
address zero, and then backward from address zero.
The problem is, being able to read address zero does not guarantee
that you'll be able to read from the other end of the address space,
and the test probably shouldn't assume that is the case.
This patch updates the test script so that even if address zero is
known non-readable, we still run the tests, the tests in question are
mostly about, can GDB calculate the correct address to read from, we
can confirm this even if the final read ultimately fails. We also no
longer assume that if address zero is readable, then the other end of
the address space will be readable.
One further change is that, when we examined the memory at address
zero, the regexp used to match the address expected that the zero
address would have two '0' digits as the least significant digits. As
GDB strips leading zeros from addresses this was causing the test to
fail. I've reduced the zero address to a single 0 digit.
gdb/testsuite/ChangeLog:
* gdb.base/examine-backward.exp: Still run tests around address
0x0, even if address 0x0 is not readable. Update the pattern for
matching address 0x0 in expected output.
Tom Tromey [Mon, 2 Jul 2018 13:36:04 +0000 (07:36 -0600)]
Don't mention XM_CDEPS or NAT_CLIBS
Neither XM_CDEPS nor NAT_CLIBS are defined anywhere, so remove the
uses.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (CDEPS): Don't mention XM_CDEPS.
(CLIBS): Don't mention NAT_CLIBS.
Tom Tromey [Mon, 2 Jul 2018 13:32:10 +0000 (07:32 -0600)]
Remove ADD_FILES and ADD_DEPS from Makefile.in
Nothing defines XM_ADD_FILES, TM_ADD_FILES, or NAT_ADD_FILES any more,
so consequently ADD_FILES and ADD_DEPS are no longer needed. So, this
removes them.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (ADD_FILES, ADD_DEPS): Remove.
(LIBGDB_OBS, clean mostlyclean): Update.
(gdb$(EXEEXT), insight$(EXEEXT)): Update.
Tom Tromey [Mon, 2 Jul 2018 13:29:03 +0000 (07:29 -0600)]
Minimize yacc and lex output
This minimizes the "make" output from the yacc and lex rules,
following the same technique as the rest of the Makefile.
The lex rule had a special case to deal with the situation where flex
is not available. I don't think this is needed, so I removed it. If
flex is truly unavailable, the person building gdb can simply "touch"
the output file.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (%.c: %.y): Use ECHO_YACC.
(%.c: %.l): Use ECHO_LEX. Just fail if flex not available.
* silent-rules.mk (ECHO_YACC, ECHO_LEX): New variables.
Tom Tromey [Mon, 2 Jul 2018 13:09:37 +0000 (07:09 -0600)]
Fix exec.c handling in Makefile
exec.c ws handled specially in COMMON_OBS, but there doesn't seem to
be a reason for this. This changes the Makefile to treat exec.c as an
ordinary source file.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (ALLDEPFILES): Remove exec.c.
(COMMON_OBS): Remove exec.o.
(COMMON_SFILES): Add exec.c.
Tom Tromey [Mon, 2 Jul 2018 13:07:35 +0000 (07:07 -0600)]
Remove lint support
I don't think anyone uses lint any more, so this removes the support
for it from the Makefile.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (LINT, LINTFLAGS, LINTFILES, lint): Remove.
Tom Tromey [Mon, 2 Jul 2018 13:06:27 +0000 (07:06 -0600)]
Use a stamp file for version.c
This introduces a stamp file for version.c, preventing unnecessary
version.o rebuilds.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (clean mostlyclean): Remove stamp-version.
(version.c): Depend on stamp-version.
(stamp-version): New rule, from version.c rule.
Tom Tromey [Mon, 2 Jul 2018 13:03:13 +0000 (07:03 -0600)]
Use a stamp file for init.c
This introduces a stamp file for init.c. This prevents constant
rebuilds of init.o, by arranging for init.c to only be modified when
its contents change. (FWIW this is a standard idiom in use by
Automake and by gdb itself for many years.)
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (init.c): Depend on stamp-init.
(stamp-init): New rule, from init.c rule.
(clean mostlyclean): Remove stamp-init.
Tom Tromey [Mon, 2 Jul 2018 00:31:08 +0000 (18:31 -0600)]
Simplify INIT_FILES
This simplifies the INIT_FILES variable. COMMON_OBS includes
CONFIG_OBS and SUBDIR_GCC_COMPILE_OBS, so there's no need to reference
CONFIG_OBS or SUBDIR_GCC_COMPILE_SRCS there. Once this is done, it it
clear that duplicates can't occur, so remove the duplicate-removing
code as well.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (INIT_FILES): Remove CONFIG_SRCS,
SUBDIR_GCC_COMPILE_SRCS.
Tom Tromey [Mon, 2 Jul 2018 00:29:42 +0000 (18:29 -0600)]
Remove some unused code from init.c build rule
The init.c build rule has a few sed expressions that aren't necessary
any more. This removes them.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (init.c): Remove some unused sed rules.
Tom Tromey [Sun, 1 Jul 2018 23:34:51 +0000 (17:34 -0600)]
Remove TSOBS from gdb/Makefile.in
The TSOBS variable doesn't seem to serve a useful purpose in
gdb/Makefile.in, so remove it.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (TSOBS): Remove.
(INIT_FILES): Update.
(LIBGDB_OBS): Update.
(COMMON_SFILES): Add inflow.c.
(SFILES): Remove inflow.c.
H.J. Lu [Mon, 9 Jul 2018 13:51:17 +0000 (06:51 -0700)]
bfd: Use changequote for "i[3-7]86-*-linux-*"
Use changequote to match "i[3-7]86-*-linux-*", instead of
"i3-786-*-linux-*".
PR ld/23388
* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
* configure: Regenerated.
Alan Modra [Mon, 9 Jul 2018 02:39:59 +0000 (12:09 +0930)]
m68hc1* fixes
With config.sub now properly returning m68hc12-unknown-elf rather than
m68hc12-unknown-none, more ELF tests run. This patch enables
STB_GNU_UNIQUE processing fixing some testsuite failures that probably
no m68hc12 user cares about, and removes some XPASSes.
bfd/
* elf32-m68hc1x.c (elf32_m68hc11_post_process_headers): Call
_bfd_elf_post_process_headers.
ld/
* testsuite/ld-discard/extern.d: Remove m68hc12 xfail.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
Christophe Lyon [Mon, 9 Jul 2018 07:45:46 +0000 (07:45 +0000)]
[ARM] Fix warning cannot find thumb start symbol
In case params.thumb_entry_symbol has its default NULL value, using it
to print a warning in gld${EMULATION_NAME}_finish results in a crash.
Use h->root.string instead which either points to
params.thumb_entry_symbol name or to entry_symbol name.
2018-07-09 Christophe Lyon <christophe.lyon@linaro.org>
* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use the right
symbol name in case of warning.
Change-Id: Iec61a833c0ad538b1440bf326ba67834c314dd63
GDB Administrator [Mon, 9 Jul 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 8 Jul 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Jan Kratochvil [Sat, 7 Jul 2018 21:02:36 +0000 (23:02 +0200)]
contrib/gdb-add-index.sh -dwarf-5
------------------------------------------------------------------------------
(gdb) help save gdb-index
Save a gdb-index file.
Usage: save gdb-index [-dwarf-5] DIRECTORY
No options create one file with .gdb-index extension for pre-DWARF-5
compatible .gdb_index section. With -dwarf-5 creates two files with
extension .debug_names and .debug_str for DWARF-5 .debug_names section.
------------------------------------------------------------------------------
But gdb-add-index command provided no way how to pass the -dwarf-5 option.
gdb/ChangeLog
2018-07-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* contrib/gdb-add-index.sh ($dwarf5): New, use it.
Simon Marchi [Sat, 7 Jul 2018 15:13:14 +0000 (11:13 -0400)]
ia64-tdep.c: Fix -Wwrite-strings errors
Simply add const where necessary to get rid of errors like:
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’
#define STRINGIFY_1(x) #x
^
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:29: note: in expansion of macro ‘STRINGIFY’
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
^~~~~~~~~
gdb/ChangeLog:
* ia64-tdep.c (get_reg_name, get_fpreg_name, get_saveloc_name,
is_signal_frame_name, step_name, init_remote_name,
create_addr_space_name, destroy_addr_space_name,
search_unwind_table_name, find_dyn_list_name): Constify.
GDB Administrator [Sat, 7 Jul 2018 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Max Filippov [Mon, 2 Jul 2018 18:12:44 +0000 (11:12 -0700)]
xtensa: don't emit dynamic relocation for weak undefined symbol
Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:
void weak_function (void);
if (weak_function)
weak_function ();
This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.
bfd/
2018-07-06 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
space for dynamic relocation for undefined weak symbol.
(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
relocation for undefined weak symbols.
(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
section for relocations against undefined weak symbols.
Alan Hayward [Fri, 6 Jul 2018 15:25:21 +0000 (16:25 +0100)]
Add checks for the NT_ARM_SVE section in a core file.
The NT_ARM_SVE section is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt
* A NT_ARM_SVE note will be added to each coredump for each thread of the
dumped process. The contents will be equivalent to the data that would have
been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread
when the coredump was generated.
* elf.c (elfcore_grok_aarch_sve): New function.
(elfcore_grok_note): Check for Aarch64 SVE.
(elfcore_write_aarch_sve): New function.
(elfcore_write_register_note): Check for Aarch64 SVE.
* elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
Tamar Christina [Fri, 6 Jul 2018 15:18:19 +0000 (16:18 +0100)]
Fix SBO bit in disassembly mask for ldrah on AArch64.
The disassembly mask for ldarh incorrectly didn't mask out bit 20 which
is part of the SBO part of the instruction and shouldn't be considered input.
This fixes the wrong bit fixing the disassembly of instructions to
ldarh and makes the behavior consistent.
opcodes/
PR binutils/23242
* aarch64-tbl.h (ldarh): Fix disassembly mask.
Tamar Christina [Fri, 6 Jul 2018 15:15:41 +0000 (16:15 +0100)]
Fix the read/write flag for these registers on AArch64
The previous constraints were based on information already in opcodes and it
seems that a few of them were wrong. I have now hand verified the ones changed
by the previous patch and corrected where needed.
This prevents a warning to be issued when one shouldn't be.
opcodes/
PR binutils/23369
* aarch64-opc.c (aarch64_sys_regs): Make read/write csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1.
gas/testsuite/
PR binutils/23369
* gas/aarch64/msr.d (csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1): New.
* gas/aarch64/msr.s: Likewise.
Andrew Burgess [Tue, 10 Apr 2018 19:18:53 +0000 (20:18 +0100)]
gdb/testsuite: Ensure test links in malloc and free
The test associated with the source file
gdb.base/share-env-with-gdbserver.c relies on calling malloc and free
within the inferior from GDB. However, as the test source itself
makes no use of these functions, there's no requirement that they be
linked into the test executable.
This commit adds a dummy call to malloc and free to ensure they are
linked into the test executable.
gdb/testsuite/ChangeLog:
* gdb.base/share-env-with-gdbserver.c (main): Add call to
malloc/free.
Nick Clifton [Fri, 6 Jul 2018 12:52:59 +0000 (13:52 +0100)]
Stop readelf from reporting gaps in the gnu build notes if the gap crosses a section boundary.
* readelf.c (same_section): New function.
(print_gnu_build_attribute_description): Do not complain about
gaps that cross a section boundary.
Nick Clifton [Fri, 6 Jul 2018 10:46:14 +0000 (11:46 +0100)]
Fix the relocs created to adjust notes created by the assembler.
* write.c (maybe_generate_build_notes): Bias reloc offsets by the
number of notes already generated.
Sebastian Huber [Fri, 6 Jul 2018 06:23:40 +0000 (08:23 +0200)]
Update config.sub
* config.sub: Sync with upstream version 2018-07-03.
Alan Modra [Fri, 6 Jul 2018 05:37:08 +0000 (15:07 +0930)]
Fix diagnostic errors
Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.
include/
* diagnostics.h: Comment on macro usage.
bfd/
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
Alan Modra [Thu, 5 Jul 2018 15:38:16 +0000 (01:08 +0930)]
[GOLD] PowerPC .gnu.attributes support
elfcpp/
* powerpc.h (Tag_GNU_Power_ABI_FP): Define.
(Tag_GNU_Power_ABI_Vector, Tag_GNU_Power_ABI_Struct_Return): Define.
gold/
* powerpc.cc: Include attributes.h.
(Powerpc_relobj::attributes_section_data_): New variable, with
accessor and associated constructor and destructor support.
(Powerpc_dynobj::attributes_section_data_): Likewise.
(Powerpc_relobj::do_read_symbols): Stash SHT_GNU_ATTRIBUTES section
contents in attributes_section_data_.
(Powerpc_dynobj::do_read_symbols): Likewise.
(Target_powerpc): Add attributes_section_data_, last_fp_, last_ld_,
last_vec_, and last_struct_ vars.
(Target_powerpc::merge_object_attributes): New function.
(Target_powerpc::do_finalize_sections): Iterate over input objects
merging attributes. Create output attributes section.
Simon Marchi [Fri, 6 Jul 2018 01:50:12 +0000 (21:50 -0400)]
darwin: Silence syscall deprecated declaration warning
This patch silences this warning:
/Users/simark/src/binutils-gdb/gdb/darwin-nat.c:839:10: error: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Werror,-Wdeprecated-declarations]
res = syscall (SYS___pthread_kill, thread->gdb_port, nsignal);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
The comment of the new pthread_kill function explains why we use the
syscall function directly.
include/ChangeLog:
* diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS):
Define for clang.
gdb/ChangeLog:
* darwin-nat.c (darwin_pthread_kill): New function.
(darwin_resume_thread): Use darwin_pthread_kill.
Jim Wilson [Fri, 6 Jul 2018 00:49:11 +0000 (17:49 -0700)]
RISC-V: Add riscv-*-* configure support, and minor cleanup.
bfd/
* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
(riscv64*-*-*): Likewise.
(riscv-*-*): Add as an alias for riscv32*-*-*.
ld/
* configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.
GDB Administrator [Fri, 6 Jul 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 5 Jul 2018 18:44:02 +0000 (19:44 +0100)]
MIPS/LD/testsuite: Use $linux_gnu consistently across `mips-elf.exp'
Replace two remaining spelled-out calls to `[istarget mips*-*-linux*]'
in `mips-elf.exp' with $linux_gnu, which is equivalent.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Replace remaining calls to
`[istarget mips*-*-linux*]' with $linux_gnu.
H.J. Lu [Thu, 5 Jul 2018 16:24:07 +0000 (09:24 -0700)]
x86: Remove x86 ISA properties with empty bits
There is no need to generate x86 ISA properties with empty bits in
linker output.
bfd/
PR ld/23372
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
ISA properties with empty bits.
ld/
PR ld/23372
* testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b.
* testsuite/ld-i386/pr23372a.d: New file.
* testsuite/ld-i386/pr23372a.s: Likewise.
* testsuite/ld-i386/pr23372b.d: Likewise.
* testsuite/ld-i386/pr23372b.s: Likewise.
* testsuite/ld-i386/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372a.s: Likewise.
* testsuite/ld-x86-64/pr23372b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372b.d: Likewise.
* testsuite/ld-x86-64/pr23372b.s: Likewise.
* testsuite/ld-x86-64/pr23372c.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32,
pr23372b and pr23372b-x32.
Sebastian Huber [Fri, 29 Jun 2018 11:06:40 +0000 (13:06 +0200)]
Update config.guess and config.sub
* config.guess: Sync with upstream version 2018-06-26.
* config.sub: Sync with upstream version 2018-07-02.
Nick Clifton [Thu, 5 Jul 2018 11:16:56 +0000 (12:16 +0100)]
Updated Russian, Bulgarian, and Brazilian Portuguese translations for various components of the binutuls.
ld * po/bg.po: Updated Bulgarian translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.
binutils* po/bg.po: Updated Bulgarian translation.
bfd,gas * po/ru.po: Updated Russian translation.
Tom de Vries [Sat, 16 Jun 2018 16:39:30 +0000 (18:39 +0200)]
[gdb] Fix build error in macroexp.c
When doing a combined build with the gcc and binutils-gdb repos, I run into
this build error in gdb:
...
gdb/macroexp.c: \
In function ‘void get_next_token_for_substitution(macro_buffer*, \
macro_buffer*, char**, macro_buffer*, char**, int*, bool*)’:
gdb/macroexp.c:925:17: error: \
implicitly-declared ‘constexpr macro_buffer& \
macro_buffer::operator=(const macro_buffer&)’ is deprecated \
[-Werror=deprecated-copy]
*token = *lookahead;
...
Wdeprecated-copy is a new gcc warning added after gcc 8.
This patch fixes the build error by adding an explicit copy operator to the
macro_buffer class. I've added asserts to ensure that both the dest and src
of the copy are shared, in other words, neither is owner of the text pointer.
I've run the gdb testsuite on x86_64-linux and the asserts did not trigger.
2018-07-05 Tom de Vries <tdevries@suse.de>
* macroexp.c (macro_buffer) <operator=>: New member function.
Alan Modra [Wed, 4 Jul 2018 01:11:31 +0000 (10:41 +0930)]
Error for mismatched powerpc ABI tags
And report the two input files that are incompatible rather than
reporting that an input file is incompatible with the output.
bfd/
* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
on mismatch. Remove "warning: " from messages. Track last bfd
used to set tags.
(ppc_elf_merge_obj_attributes): Likewise. Handle status from
_bfd_elf_ppc_merge_fp_attributes.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
from _bfd_elf_ppc_merge_fp_attributes.
ld/
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.
GDB Administrator [Thu, 5 Jul 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 4 Jul 2018 17:32:50 +0000 (11:32 -0600)]
Use exit_inferior in darwin_attach_pid
Commit
a50c11c666 was intended to use exit_inferior in
darwin_attach_pid, but I accidentally pushed the wrong version of the
patch. This fixes the problem.
gdb/ChangeLog
2018-07-04 Tom Tromey <tom@tromey.com>
* darwin-nat.c (darwin_attach_pid): Use exit_inferior.
Simon Marchi [Wed, 4 Jul 2018 16:40:25 +0000 (12:40 -0400)]
darwin: Don't use sbrk
This patch gets rid of this warning on macOS:
CXX main.o
/Users/simark/src/binutils-gdb/gdb/main.c:492:27: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
lim_at_start = (char *) sbrk (0);
^
/usr/include/unistd.h:585:1: note: 'sbrk' has been explicitly marked deprecated here
__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
^
/usr/include/sys/cdefs.h:176:37: note: expanded from macro '__deprecated'
#define __deprecated __attribute__((deprecated))
^
sbrk on macOS is not useful for our purposes, since sbrk(0) always
returns the same value. From what I read, brk/sbrk on macOS is just an
emulation, it always returns a pointer in a 4MB section reserved for
that.
So instead of letting users use "maint set per-command space on" and
print silly results, I think we should just disable that feature for
this platform (as we do for platforms that don't have sbrk).
I defined a HAVE_USEFUL_SBRK macro and used that instead of HAVE_SBRK.
gdb/ChangeLog:
* common/common-defs.h (HAVE_USEFUL_SBRK): Define.
* main.c: Use HAVE_USEFUL_SBRK instead of HAVE_SBRK.
* maint.c: Likewise.
* top.c: Likewise.
Joel Brobecker [Wed, 4 Jul 2018 15:48:05 +0000 (08:48 -0700)]
Update NEWS post GDB 8.2 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Wed, 4 Jul 2018 15:42:44 +0000 (08:42 -0700)]
Bump version to 8.2.50.DATE-git.
Now that the GDB 8.2 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 8.2 branch created (
1b919490e8ba30bf1d6941df0ed112b0e557017e):
* version.in: Bump version to 8.2.50.DATE-git.
Vyacheslav Barinov [Wed, 4 Jul 2018 15:13:29 +0000 (16:13 +0100)]
Warn if /proc is not accessible
There's a buildroot where I want to debug a binary, and I tried to
connect to it from outside, but got very weird errors like
architecture mismatch or protocol errors. At last, after switching on
'--debug' for gdbserver I found a message 'Can't open /proc/pid/'
message and suddenly found that I forgot to mount procfs in my
buildroot.
Make discovering the problem easier by making GDB / GDBserver warn
(even without --debug) if /proc can not be accessed.
Native debugging:
(gdb) start
Temporary breakpoint 1 at 0x400835: file test.c, line 10.
Starting program: /tmp/test
warning: /proc is not accessible.
GDBserver/remote debugging:
$ ./gdbserver :9999 ./gdbserver
gdbserver: /proc is not accessible.
gdb/ChangeLog:
2018-07-04 Vyacheslav Barinov <v.barinov@samsung.com>
Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_init_ptrace): Rename to ...
(linux_init_ptrace_procfs): ... this. Call
linux_proc_init_warnings.
(linux_nat_target::post_attach)
(linux_nat_target::post_startup_inferior): Adjust.
* nat/linux-procfs.c (linux_proc_init_warnings): Define function.
* nat/linux-procfs.h (linux_proc_init_warnings): Declare function.
gdb/gdbserver/ChangeLog:
2018-07-04 Vyacheslav Barinov <v.barinov@samsung.com>
Pedro Alves <palves@redhat.com>
* linux-low.c (initialize_low): Call linux_proc_init_warnings.
H.J. Lu [Wed, 4 Jul 2018 13:27:58 +0000 (06:27 -0700)]
ld: Set non_ir_ref_regular for --undefined SYMBOL
Set non_ir_ref_regular to TRUE for symbols forced into the output file
so that they won't be removed by garbage collection with LTO.
PR ld/23309
* ldlang.c (insert_undefined): Set non_ir_ref_regular to TRUE.
* plugin.c (is_visible_from_outside): Don't scan entry_symbol.
* testsuite/ld-plugin/pr23309.c: New file.
* testsuite/ld-plugin/pr23309.d: Likewise.
H.J. Lu [Wed, 4 Jul 2018 13:22:40 +0000 (06:22 -0700)]
ld: Properly display default for -z separate-code
Check DEFAULT_LD_Z_SEPARATE_CODE to display default for -z separate-code.
PR ld/23358
* lexsup.c (elf_shlib_list_options): Properly display default
for -z separate-code.
H.J. Lu [Wed, 4 Jul 2018 13:18:22 +0000 (06:18 -0700)]
Also install diagnostics.h
Since bfd.h is an installed header, also install diagnostics.h.
* Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
* Makefile.in: Regenerated.
Tom de Vries [Tue, 3 Jul 2018 22:07:30 +0000 (00:07 +0200)]
[gdb/symtab] Fix version check in dwarf compilation unit header
The version check of the dwarf compilation unit header in
error_check_comp_unit_head is done too late, and consequently dwarf code with
an unsupported version in the compilation unit header is interpreted as dwarf5
code in read_comp_unit_head.
Fixed by moving the check earlier.
Build and reg-tested on x86_64-linux.
2018-07-04 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (error_check_comp_unit_head): Move dwarf version
check ...
(read_comp_unit_head): ... here.
* gdb.dwarf2/dw2-error.exp: Update expected error message.
Tom Tromey [Tue, 5 Jun 2018 16:22:01 +0000 (10:22 -0600)]
Remove VEC from breakpoint
This removes a use of VEC from breakpoint.h, also removing the
now-unnecessary breakpoint_p typedef.
This patch fixes a latent memory leak in
find_matching_tracepoint_location, which neglected to free the vector
returned by all_tracepoints.
Tested by the buildbot.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* tracepoint.c (process_tracepoint_on_disconnect, start_tracing)
(stop_tracing, tstatus_command)
(find_matching_tracepoint_location, merge_uploaded_tracepoints)
(print_one_static_tracepoint_marker): Update.
* breakpoint.c (static_tracepoints_here, all_tracepoints): Return
std::vector.
* breakpoint.h (breakpoint_p): Remove typedef. Don't declare
VEC.
(all_tracepoints, static_tracepoints_here): Return std::vector.
GDB Administrator [Wed, 4 Jul 2018 00:01:24 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 11 Jun 2018 20:45:22 +0000 (14:45 -0600)]
Remove ptid_equal
Remove ptid_equal in favor of using "==".
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_equal): Remove.
* common/ptid.h (ptid_equal): Don't declare.
* ada-tasks.c: Update.
* breakpoint.c: Update.
* common/agent.c: Update.
* corelow.c: Update.
* darwin-nat-info.c: Update.
* darwin-nat.c: Update.
* dcache.c: Update.
* dtrace-probe.c: Update.
* dummy-frame.c: Update.
* fbsd-nat.c: Update.
* frame.c: Update.
* gdbthread.h: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* inf-loop.c: Update.
* inf-ptrace.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* inflow.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-thread-db.c: Update.
* mi/mi-cmd-var.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* nto-procfs.c: Update.
* ppc-linux-tdep.c: Update.
* procfs.c: Update.
* python/py-inferior.c: Update.
* python/py-record-btrace.c: Update.
* python/py-record.c: Update.
* ravenscar-thread.c: Update.
* regcache.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* sol-thread.c: Update.
* solib.c: Update.
* target.c: Update.
* tui/tui-stack.c: Update.
* varobj.c: Update.
* windows-nat.c: Update.
* windows-tdep.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* lynx-low.c: Update.
* mem-break.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 20:35:00 +0000 (14:35 -0600)]
Remove ptid_match
This removes ptid_match in favor of the ptid_t::matches method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_match): Remove.
* common/ptid.h (ptid_match): Don't declare.
* fbsd-nat.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* linux-nat.c: Update.
* record-btrace.c: Update.
* regcache.c: Update.
* remote.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* server.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:22:04 +0000 (12:22 -0600)]
Remove ptid_tid_p
This removes ptid_tid_p in favor of the ptid_t::tid_p method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_tid_p): Remove.
* common/ptid.h (ptid_tid_p): Don't declare.
* sol-thread.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:20:11 +0000 (12:20 -0600)]
Remove ptid_lwp_p
This removes ptid_lwp_p in favor of the ptid_t::lwp_p method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_lwp_p): Remove.
* common/ptid.h (ptid_lwp_p): Don't declare.
* fbsd-nat.c: Update.
* linux-nat.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* sol-thread.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:18:15 +0000 (12:18 -0600)]
Remove ptid_is_pid
This removes ptid_is_pid in favor of the ptid_t::is_pid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_is_pid): Remove.
* common/ptid.h (ptid_is_pid): Don't declare.
* infrun.c: Update.
* linux-nat.c: Update.
* mi/mi-interp.c: Update.
* remote.c: Update.
* thread.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:14:34 +0000 (12:14 -0600)]
Remove ptid_get_tid
This removes ptid_get_tid in favor of calling the ptid_t::tid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_tid): Remove.
* common/ptid.h (ptid_get_tid): Don't declare.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* bsd-uthread.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* i386-darwin-nat.c: Update.
* infrun.c: Update.
* linux-tdep.c: Update.
* nto-procfs.c: Update.
* ppc-ravenscar-thread.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* sol-thread.c: Update.
* sparc-ravenscar-thread.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* target.c: Update.