Alexandre Oliva [Sat, 30 Jun 2018 02:49:28 +0000 (23:49 -0300)]
Introduce @unless/@endunless and postbootstrap Makefile targets
This patch turns dependencies of non-bootstrap targets on bootstrap
targets for bootstrap builds into dependencies on stage_last. This
arrangement gets stage1-bubble to run from stage_last if we haven't
started a bootstrap yet, and to use the current stage otherwise. This
was already the case of target libs, just not of non-bootstrapped host
modules.
In order to retain preexisting dependencies in non-bootstrap builds,
or in gcc-less builds, this introduces support for @unless/@endunless
pairs in Makefile.in.
There is a remaining possibility of problem if activating, in a tree
configured for bootstrap, a parallel build of two or more modules, at
least one bootstrapped and one not. In this case, make might decide
to build stage_current and stage_last in parallel, the latter will
start a submake to build stage1 while the initial make, having
satisfied stage_current, proceeds to build the bootstrapped module in
non-bootstrapped configurations. The two builds will overlap and will
likely conflict. This situation does NOT arise in normal settings,
however: a post-bootstrap build of all-host all-target will indeed
activate such targets concurrently, but only after building all
bootstrapped modules successfully, and it will have both stage_last
and stage_current targets already satisfied, so the potential race
between builds will not arise.
Another remaining problem, that is slightly expanded with this patch,
is that of an interrupted build in a tree configured for bootstrap,
continued with a non-bootstrapped target. Target modules that were
not bootstrapped would already fail to complete the current stage when
activated explicitly in the command line for a retry; host modules,
however, would attempt to build their bootstrapped dependencies, which
is what led to the problem of concurrent builds addressed with this
patch. An interrupted or failed build might still recover correctly,
if the non-bootstrapped target is activated in both builds, because
then make will remove stage_last when its build command is
interrupted, so that it will attempt to recreate it with stage1-bubble
in the second try. A bootstrap build, however, will not be attempting
to build stage_last, so the file will remain and the retry won't go
through stage1-bubble. We have lived with that for target modules, so
we can probably live with that for host modules too.
Another undesirable consequence of this change is that non-boostrapped
host modules, in a tree configured for bootstrap, when activated as
make all-<module>, will build all of stage1 instead of only the
module's usual dependencies. This is intentional and necessary to fix
the parallel-build problem. If it's not desirable, disabling the
unnecessary bootstrap configuration will suffice to restore the
original set of dependencies.
for ChangeLog
* configure.ac: Introduce support for @unless/@endunless.
* Makefile.tpl (dep-kind): Rewrite with cond; return
postbootstrap in some cases.
(make-postboot-dep, postboot-targets): New.
(dependencies): Do not output postbootstrap dependencies at
first. Output non-target ones changed for configure to depend
on stage_last @if gcc-bootstrap, and the original deps @unless
gcc-bootstrap.
* configure.in, Makefile.in: Rebuilt.
Sergio Durigan Junior [Sat, 30 Jun 2018 01:36:42 +0000 (21:36 -0400)]
Add missing parameter to 'amd64_create_target_description' (and unbreak build)
While building gdbserver on GNU/Linux, the build failed with:
../../../binutils-gdb/gdb/gdbserver/linux-x86-tdesc.c: In function ‘const target_desc* amd64_linux_read_description(uint64_t, bool)’:
../../../binutils-gdb/gdb/gdbserver/linux-x86-tdesc.c:121:67: error: too few arguments to function ‘target_desc* amd64_create_target_description(uint64_t, bool, bool, bool)’
*tdesc = amd64_create_target_description (xcr0, is_x32, true);
^
In file included from ../../../binutils-gdb/gdb/gdbserver/linux-x86-tdesc.c:26:0:
../../../binutils-gdb/gdb/gdbserver/../arch/amd64.h:21:14: note: declared here
target_desc *amd64_create_target_description (uint64_t xcr0, bool is_x32,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
According to Joel Brobecker:
> I think the parameter should be set to "true". Otherwise, it will
> not include the fs_base and gs_base register in the list of registers.
> Although the name of the source file says x86, the code itself is
> protected by...
>
> #ifdef __x86_64__
>
> ... and is inside a function called amd64_linux_read_description.
> I also verified that this file gets compiled on amd64-linux platforms.
> See gdb/gdbserver/configure.srv:
>
> x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
>
> The last piece of confirmation is that setting the parameter to "true"
> provides the behavior before the parameter was added; and the reason
> for adding the parameter was to remove the {fs,gs}_base registers
> from the list for Windows only.
Therefore I'm pushing the patch to unbreak the build.
gdb/gdbserver/ChangeLog:
2018-06-29 Joel Brobecker <brobecker@adacore.com>
* linux-x86-tdesc.c (amd64_linux_read_description): Add missing
parameter in call to 'amd64_create_target_description'.
GDB Administrator [Sat, 30 Jun 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Fri, 29 Jun 2018 22:42:27 +0000 (18:42 -0400)]
fix GDB build failure for various amd64 targets
The following patch caused some amd64-*-tdep files to fail to compile:
| commit
de52b9607d2623f18b7a7dbee3e1123d8d63f5da
| Date: Tue Jun 26 16:33:27 2018 +0100
| Subject: x86_64-windows GDB crash due to fs_base/gs_base registers
This is because we added one additional "segments" argument to
function amd64_target_description and forgot to update all the callers.
This patch fixes the omissions.
gdb/ChangeLog:
* amd64-darwin-tdep.c (x86_darwin_init_abi_64): Add missing
parameter in call to amd64_target_description.
* amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise.
* amd64-fbsd-tdep.c (amd64fbsd_core_read_description)
(amd64fbsd_init_abi): Likewise.
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise.
* amd64-obsd-tdep.c (amd64obsd_init_abi): Likewise.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Likewise.
* amd64-fbsd-nat.c (amd64_fbsd_nat_target): Likewise.
The change to amd64-fbsd-nat.c was done "blind" (no access to system),
but is reasonably straightforward. The changes to the -tdep.c files
were verify by rebuilding GDB on x86_64-linux when configured with
--enable-targets=all.
Jim Wilson [Fri, 29 Jun 2018 22:12:23 +0000 (15:12 -0700)]
RISC-V: Add gas support for "fp" register.
gas/
* config/tc-riscv.c (md_begin): Call hash_reg_name for "fp".
Pedro Alves [Tue, 26 Jun 2018 15:33:27 +0000 (16:33 +0100)]
x86_64-windows GDB crash due to fs_base/gs_base registers
GDB is currently crashing anytime we try to access the fs_base/gs_base
registers, either to read them, or to write them. This can be observed
under various scenarios:
- Explicit reference to those registers (eg: print $fs_base) --
probably relatively rare;
- Calling a function in the inferior, with the crash happening
because we are trying to read those registers in order to save
their value ahead of making the function call;
- Just a plain "info registers";
The crash was introduced by the following commit:
| commit
48aeef91c248291dd03583798904612426b1f40a
| Date: Mon Jun 26 18:14:43 2017 -0700
| Subject: Include the fs_base and gs_base registers in amd64 target descriptions.
The Windows-nat implementation was unfortunately not prepared to deal
with those new registers. In particular, the way it fetches registers
is done by using a table where the index is the register number, and
the value at that index is the offset in the area in the thread's CONTEXT
data where the corresponding register value is stored.
For instance, in amd64-windows-nat.c, we can find the mappings static
array containing the following 57 elements in it:
#define context_offset(x) (offsetof (CONTEXT, x))
static const int mappings[] =
{
context_offset (Rax),
[...]
context_offset (FloatSave.MxCsr)
};
That array is then used by windows_fetch_one_register via:
char *context_offset = ((char *) &th->context) + mappings[r];
The problem is that fs_base's register number is 172, which is
well past the end of the mappings array (57 elements in total).
We end up getting an undefined offset, which happens to be so large
that it then causes the address where we try to read the register
value (a little bit later) to be invalid, thus crashing GDB with
a SEGV.
This patch side-steps the issue entirely by removing support for
those registers in GDB on x86_64-windows, because a look at the
CONTEXT structure indicates no support for getting those registers.
A more comprehensive fix would patch the potential buffer overflow
of the mappings array, but this can be done as a separate commit.
gdb/ChangeLog:
* gdb/amd64-tdep.h (amd64_create_target_description): Add
"segments" parameter.
* gdb/amd64-tdep.c (amd64_none_init_abi, amd64_x32_none_init_abi)
(_initialize_amd64_tdep): Update call to
amd64_create_target_description.
(amd64_target_description): Add "segments" parameter. Adjust
the implementation to use it.
* gdb/amd64-linux-tdep.c (amd64_linux_read_description): Update
call to amd64_create_target_description.
* gdb/amd64-windows-tdep.c (amd64_windows_init_abi): Likewise.
* gdb/arch/amd64.h (amd64_create_target_description): Add
"segments" register.
* gdb/arch/amd64.c (amd64_create_target_description): Add
"segments" parameter. Call create_feature_i386_64bit_segments
only if SEGMENTS is true.
* gdb/gdbserver/win32-i386-low.c (i386_arch_setup): Update
call to amd64_create_target_description.
Tested on x86_64-windows using AdaCore's testsuite (by Joel Brobecker
<brobecker at adacore dot com>).
Pedro Alves [Fri, 29 Jun 2018 19:45:35 +0000 (20:45 +0100)]
Improve alignment of "info threads" output, align "Target Id" column
It's long annoyed me that "info threads"'s columns are misaligned.
Particularly the "Target Id" column's content is usually longer than
the specified column width, so the table ends up with the "Frame"
column misaligned. For example, currently we get this:
(gdb) info threads
Id Target Id Frame
1 Thread 0x7ffff7fb5740 (LWP 9056) "threads" 0x00007ffff7bc28ad in __pthread_join (threadid=
140737345763072, thread_return=0x7fffffffd3e8) at pthread_join.c:90
2 Thread 0x7ffff7803700 (LWP 9060) "function0" thread_function0 (arg=0x0) at threads.c:90
* 3 Thread 0x7ffff7002700 (LWP 9061) "threads" thread_function1 (arg=0x1) at threads.c:106
The fact that the "Frame" heading is in a weird spot is particularly
annoying.
This commit turns the above into into this:
(gdb) info threads
Id Target Id Frame
1 Thread 0x7ffff7fb5740 (LWP 7548) "threads" 0x00007ffff7bc28ad in __pthread_join (threadid=
140737345763072, thread_return=0x7fffffffd3e8) at pthread_join.c:90
2 Thread 0x7ffff7803700 (LWP 7555) "function0" thread_function0 (arg=0x0) at threads.c:91
* 3 Thread 0x7ffff7002700 (LWP 7557) "threads" thread_function1 (arg=0x1) at threads.c:104
It does that by computing the max width of the "Target Id" column and
using that as column width when creating the table.
This results in calling target_pid_to_str / target_extra_thread_info /
target_thread_name twice for each thread, but I think that it doesn't
matter in practice performance-wise, because the remote target caches
the info, and with native targets it shouldn't be noticeable. It
could matter if we have many threads (say, thousands), but then "info
threads" is practically useless in such a scenario anyway -- better
thread filtering and aggregation would be necessary.
(Note: I have an old branch somewhere where I attempted at making
gdb's "info threads"-like tables follow a model/view design, so that a
general framework took care of issues like these, but it's incomplete
and a much bigger change. This patch doesn't prevent going in that
direction in the future, of course.)
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* thread.c (thread_target_id_str): New, factored out from ...
(print_thread_info_1): ... here. Use it to compute the max
"Target Id" column width.
gdb/testsuite/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.threads/names.exp: Adjust expected "info threads" output.
Pedro Alves [Fri, 29 Jun 2018 19:45:34 +0000 (20:45 +0100)]
remote & target_extra_thread_info, use cache w/ qThreadExtraInfo and qP too
The following patch will make "info threads" call target_extra_thread_info
more frequently. When I looked at the remote implementation, I noticed
that if we're not using qXfer:threads:read, then we'd be increasing the
remote protocol traffic. This commit prevents that from happening.
Also, it removes a gratuitous local static buffer, which seems good on
its own.
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* remote.c (remote_target::extra_thread_info): Delete
'display_buf' and 'n' locals. from the cache, regardless of
packet mechanims is in use. Use cache for qThreadExtra and qP
methods too.
Pedro Alves [Fri, 29 Jun 2018 18:31:49 +0000 (19:31 +0100)]
"break LINENO/*ADDRESS", inline functions and "info break" output
While experimenting with the previous patch, I noticed this inconsistency
in GDB's output:
(gdb) b 32
Breakpoint 1 at 0x40062f: file inline-break.c, line 32. (1)
(gdb) r
....
Breakpoint 1, func1 (x=1) at inline-break.c:32 (2)
32 return x * 23; /* break here */
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x40062f in main at inline-break.c:32 (3)
breakpoint already hit 1 time
(gdb)
Notice that when the breakpoint as set, GDB showed "inline-break.c,
line 32" (1), the same line number that was specified in the command.
When we run to the breakpoint, we present the stop at the same line
number, and correctly show "func1" as the function name (2).
But in "info break" output (3), notice that we say "in main", not "in
func1".
The same thing happens if you set a breakpoint by address. I.e.:
(gdb) b *0x40062f
Breakpoint 2 at 0x40062f: file inline-break.c, line 32.
(gdb) info breakpoints
Num Type Disp Enb Address What
2 breakpoint keep y 0x000000000040062f in main at inline-break.c:32
(gdb) r
....
Breakpoint 2, func1 (x=1) at inline-break.c:32
32 return x * 23; /* break here */
The problem is that the breakpoints were set at an inline function,
but when we set such a breakpoint by line number or address, we don't
record the functions symbol in the sal, and as consequence the
breakpoint location does not have an associated symbol either.
Then, in print_breakpoint_location, if the location does not have a
symbol, we call find_pc_sect_function to find one, and this is what
finds "main", because find_pc_sect_function uses
block_linkage_function:
/* Return the symbol for the function which contains a specified
lexical block, described by a struct block BL. The return value
will not be an inlined function; the containing function will be
returned instead. */
struct symbol *
block_linkage_function (const struct block *bl)
To fix this, this commit adds an alternative to find_pc_sect_function
that uses block_containing_function instead:
/* Return the symbol for the function which contains a specified
block, described by a struct block BL. The return value will be
the closest enclosing function, which might be an inline
function. */
struct symbol *
block_containing_function (const struct block *bl)
(It seems odd to me that block_linkage_function says "the CONTAINING
function will be returned", and then block_containing_function says it
returns "the closest enclosing function". Something seems reversed
here. Still, I've kept the same nomenclature and copied the comments,
so that at least there's consistency. Maybe we should fix that up
somehow.)
Then I wondered, why make print_breakpoint_location look up the symbol
every time it is called, instead of just always storing the symbol
when the location is created, since the location already stores the
symbol in some cases. So to find which cases might be missing setting
the symbol in the sal which is used to create the breakpoint location,
I added an assertion to print_breakpoint_location, and ran the
testsuite. That caught a few places, unsurprisingly:
- setting a breakpoint by line number
- setting a breapoint by address
- ifunc resolving
Those are all fixed by this commit. I decided not to add the
assertion to block_linkage_function and leave the existing "if (sym)"
check in place, because it's plausible that we have symtabs with line
info but no symbols. I.e., that would not be a GDB bug, but
a peculiarity of debug info input.
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* blockframe.c (find_pc_sect_containing_function): New function.
* breakpoint.c (print_breakpoint_location): Don't call
find_pc_sect_function.
* linespec.c (create_sals_line_offset): Record the location's
symbol in the sal.
* linespec.c (convert_address_location_to_sals): Fill in sal's
symbol with find_pc_sect_containing_function.
* symtab.c (find_function_start_sal): Rename to ...
(find_function_start_sal_1): ... this.
(find_function_start_sal): Reimplement as wrapper around
find_function_start_sal_1, and use
find_pc_sect_containing_function to fill in the sal's symbol.
(find_function_start_sal(symbol*, bool)): Adjust.
* symtab.h (find_pc_function, find_pc_sect_function): Adjust
comments.
(find_pc_sect_containing_function): Declare.
gdb/testsuite/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.exp (line number, address): Add "info
break" tests.
Pedro Alves [Fri, 29 Jun 2018 18:31:49 +0000 (19:31 +0100)]
Fix running to breakpoint set in inline function by lineno/address
Commit
61b04dd04ac2 ("Change inline frame breakpoint skipping logic
(fix gdb.gdb/selftest.exp)") caused a GDB crash when you set a
breakpoint by line number in an inline function, and then run to the
breakpoint:
$ gdb -q test Reading symbols from test...done.
(gdb) b inline-break.c:32
Breakpoint 1 at 0x40062f: file inline-break.c, line 32.
(gdb) run
Starting program: /[...]/test
[1] 75618 segmentation fault /[...]/gdb -q test
The problem occurs because we assume that a bp_location's symbol is
not NULL, which is not true when we set the breakpoint with a linespec
location:
Program received signal SIGSEGV, Segmentation fault.
0x00000000006f42bb in stopped_by_user_bp_inline_frame (
stop_chain=<optimized out>, frame_block=<optimized out>)
at gdb/inline-frame.c:305
305 && frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
(gdb) p loc->symbol
$1 = (const symbol *) 0x0
The same thing happens if you run to a breakpoint set in an inline
function by address:
(gdb) b *0x40062f
Breakpoint 3 at 0x40062f: file inline-break.c, line 32.
To fix this, add a null pointer check, to avoid the crash, and make it
so that if there's no symbol for the location, then we present the
stop at the inline function. This preserves the previous behavior
when e.g., setting a breakpoint by address, with "b *ADDRESS".
gdb/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* inline-frame.c (stopped_by_user_bp_inline_frame): Return
true if the the location has no symbol.
gdb/testsuite/ChangeLog:
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.c (func1): Add "break here" marker.
* gdb.opt/inline-break.exp: Test setting breakpoints by line
number and address and running to them.
Pedro Alves [Fri, 29 Jun 2018 18:32:57 +0000 (19:32 +0100)]
Fix format of last gdb/testsuite/ChangeLog entry
Richard Bunt [Fri, 29 Jun 2018 16:34:58 +0000 (17:34 +0100)]
Remove unstable test output
Changed test output from:
PASS: gdb.base/watchpoint-hw-attach.exp: attach 25501
to
PASS: gdb.base/watchpoint-hw-attach.exp: attach
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-hw-attach.exp: Remove unstable output.
Maciej W. Rozycki [Fri, 29 Jun 2018 14:45:28 +0000 (15:45 +0100)]
MIPS/BFD: Remove extraneous undefined weak symbol visibility check
Remove an extraneous symbol visibility check made for undefined weak
symbols in determination whether an R_MIPS_REL32 dynamic relocation has
to be placed in output, complementing commit
ad9512030937 ("mips: Check
UNDEFWEAK_NO_DYNAMIC_RELOC"). That check duplicates one already made by
the UNDEFWEAK_NO_DYNAMIC_RELOC macro as a part of a broader condition
used to decide if to enter undefined weak symbols to the dynamic symbol
table or not.
bfd/
* elfxx-mips.c (allocate_dynrelocs): Remove extraneous symbol
visibility check made for undefined weak symbols.
Ramana Radhakrishnan [Fri, 29 Jun 2018 12:06:05 +0000 (13:06 +0100)]
[Patch AArch64] Warn on unpredictable stlxrb , stlxrh and stlxr cases.
A recent case in golang highlighted that gas wasn't warning on these
unpredictable cases in the architecture. Fixed thusly.
I need to audit gcc to make sure we have early clobbers on the
patterns but that's a separate patch.
Tested aarch64-none-elf and gas
Ok ?
Ramana
2018-06-29 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* config/tc-aarch64.c (warn_unpredictable_ldst): Add
unpredictable cases for ldxp, stlxrb, stlxrh, stlxr. *
testsuite/gas/aarch64/diagnostic.s: New tests. *
testsuite/gas/aarch64/diagnostic.l: Adjust.
Tamar Christina [Fri, 29 Jun 2018 11:12:27 +0000 (12:12 +0100)]
Fix AArch64 encodings for by element instructions.
Some instructions in Armv8-a place a limitation on FP16 registers that can be
used as the register from which to select an element from.
e.g. fmla restricts Rm to 4 bits when using an FP16 register. This restriction
does not apply for all instructions, e.g. fcmla does not have this restriction
as it gets an extra bit from the M field.
Unfortunately, this restriction to S_H was added for all _Em operands before,
meaning for a large number of instructions you couldn't use the full register
file.
This fixes the issue by introducing a new operand _Em16 which applies this
restriction only when paired with S_H and leaves the _Em and the other
qualifiers for _Em16 unbounded (i.e. using the full 5 bit range).
Also the patch updates all instructions that should be affected by this.
opcodes/
PR binutils/23192
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-dis.c (aarch64_ext_reglane): Add AARCH64_OPND_Em16 constraint.
* aarch64-opc.c (operand_general_constraint_met_p,
aarch64_print_operand): Likewise.
* aarch64-tbl.h (aarch64_opcode_table): Change Em to Em16 for smlal,
smlal2, fmla, fmls, fmul, fmulx, sqrdmlah, sqrdlsh, fmlal, fmlsl,
fmlal2, fmlsl2.
(AARCH64_OPERANDS): Add Em2.
gas/
PR binutils/23192
* config/tc-aarch64.c (process_omitted_operand, parse_operands): Add
AARCH64_OPND_Em16
* testsuite/gas/aarch64/advsimd-armv8_3.s: Expand tests to cover upper
16 registers.
* testsuite/gas/aarch64/advsimd-armv8_3.d: Likewise.
* testsuite/gas/aarch64/advsimd-compnum.s: Likewise.
* testsuite/gas/aarch64/advsimd-compnum.d: Likewise.
* testsuite/gas/aarch64/sve.d: Likewise.
include/
PR binutils/23192
*opcode/aarch64.h (aarch64_opnd): Add AARCH64_OPND_Em16.
GDB Administrator [Fri, 29 Jun 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 28 Jun 2018 16:32:13 +0000 (10:32 -0600)]
Add --enable-codesign to gdb's configure
macOS requires that the gdb executable be signed in order to be able
to successfully use ptrace. This must be done after each link.
This patch adds a new --enable-codesign configure option so that this
step can be automated.
gdb/ChangeLog
2018-06-28 Tom Tromey <tom@tromey.com>
* NEWS: Mention --enable-codesign.
* silent-rules.mk (ECHO_SIGN): New variable.
* configure.ac: Add --enable-codesign.
* configure: Rebuild.
* Makefile.in (CODESIGN, CODESIGN_CERT): New variables.
(gdb$(EXEEXT)): Optionally invoke codesign.
Pedro Alves [Thu, 28 Jun 2018 19:18:24 +0000 (20:18 +0100)]
gdb: Eliminate the 'stop_pc' global
In my multi-target work, I need to add a few more
scoped_restore_current_thread and switch_to_thread calls in some
places, and in some lower-level places I was fighting against the fact
that switch_to_thread reads/refreshes the stop_pc global.
Instead of piling on workarounds, let's just finally eliminate the
stop_pc global. We already have the per-thread
thread_info->suspend.stop_pc field, so it's mainly a matter of using
that more/instead.
gdb/ChangeLog:
2018-06-28 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct thread_suspend_state) <stop_pc>: Extend
comments.
(switch_to_thread_no_regs): Adjust comment.
* infcmd.c (stop_pc): Delete.
(post_create_inferior, info_program_command): Replace references
to stop_pc with references to thread_info->suspend.stop_pc.
* inferior.h (stop_pc): Delete declaration.
* infrun.c (proceed, handle_syscall_event, fill_in_stop_func)
(handle_inferior_event_1, handle_signal_stop)
(process_event_stop_test, keep_going_stepped_thread)
(handle_step_into_function, handle_step_into_function_backward)
(print_stop_location): Replace references to stop_pc with
references to thread_info->suspend.stop_pc.
(struct infcall_suspend_state) <stop_pc>: Delete field.
(save_infcall_suspend_state, restore_infcall_suspend_state):
Remove references to inf_stat->stop_pc.
* linux-fork.c (fork_load_infrun_state): Likewise.
* record-btrace.c (record_btrace_set_replay): Likewise.
* record-full.c (record_full_goto_entry): Likewise.
* remote.c (print_one_stopped_thread): Likewise.
* target.c (target_resume): Extend comment.
* thread.c (set_executing_thread): New.
(set_executing): Use it.
(switch_to_thread_no_regs, switch_to_no_thread, switch_to_thread):
Remove references to stop_pc.
Pedro Alves [Thu, 28 Jun 2018 15:57:18 +0000 (16:57 +0100)]
Fix follow-exec regression / crash
After commit
00431a78b28f ("Use thread_info and inferior pointers more
throughout"), following an exec can result in gdb crashing. On some
systems, this is visible with gdb.multi/multi-arch-exec.exp and
gdb.base/foll-exec-mode.exp. E.g.:
$ make check TESTS="gdb.multi/multi-arch-exec.exp gdb.base/foll-exec-mode.exp"
[snip]
FAIL: gdb.multi/multi-arch-exec.exp: first_arch=1: selected_thread=1: follow_exec_mode=new: continue across exec that changes architecture (GDB internal error)
ERROR: : spawn id exp10 not open
while executing
Running multi-arch-exec under Valgrind we easily spot the problem:
process 16305 is executing new program: ..../gdb.multi/multi-arch-exec/1-multi-arch-exec-hello
[New inferior 2 (process 0)]
[New process 16305]
==16129== Invalid read of size 8
==16129== at 0x7FA14D: get_thread_regcache(thread_info*) (regcache.c:399)
==16129== by 0x75E54B: handle_inferior_event_1(execution_control_state*) (infrun.c:5292)
==16129== by 0x75E82D: handle_inferior_event(execution_control_state*) (infrun.c:5382)
==16129== by 0x75BC6A: fetch_inferior_event(void*) (infrun.c:3918)
==16129== by 0x748DA3: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43)
==16129== by 0x464B5D: handle_target_event(int, void*) (linux-nat.c:4359)
==16129== by 0x7047E0: handle_file_event(file_handler*, int) (event-loop.c:733)
==16129== by 0x704D83: gdb_wait_for_event(int) (event-loop.c:859)
==16129== by 0x703BF6: gdb_do_one_event() (event-loop.c:322)
==16129== by 0x703CA2: start_event_loop() (event-loop.c:371)
==16129== by 0x791D95: captured_command_loop() (main.c:330)
==16129== by 0x79311C: captured_main(void*) (main.c:1157)
==16129== Address 0x15a5bad0 is 32 bytes inside a block of size 600 free'd
==16129== at 0x4C2E1E8: operator delete(void*) (vg_replace_malloc.c:576)
==16129== by 0x8A15D0: delete_thread_1(thread_info*, bool) (thread.c:465)
==16129== by 0x8A15FA: delete_thread(thread_info*) (thread.c:476)
==16129== by 0x8A0D43: add_thread_silent(ptid_t) (thread.c:291)
==16129== by 0x8A0DF0: add_thread_with_info(ptid_t, private_thread_info*) (thread.c:317)
==16129== by 0x8A0E79: add_thread(ptid_t) (thread.c:331)
==16129== by 0x75764C: follow_exec(ptid_t, char*) (infrun.c:1233)
==16129== by 0x75E534: handle_inferior_event_1(execution_control_state*) (infrun.c:5290)
==16129== by 0x75E82D: handle_inferior_event(execution_control_state*) (infrun.c:5382)
==16129== by 0x75BC6A: fetch_inferior_event(void*) (infrun.c:3918)
==16129== by 0x748DA3: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43)
==16129== by 0x464B5D: handle_target_event(int, void*) (linux-nat.c:4359)
The problem is that handle_inferior_event_1 is reading the stop_pc off
of a thread that was deleted by follow_exec. Before commit
00431a78b28f, we didn't crash because we were passing down a ptid to
get_thread_regcache instead of ecs->event_thread.
Fix this by simply moving the stop_pc reading until after
ecs->event_thread is refreshed.
gdb/ChangeLog:
2018-06-28 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event_1) <TARGET_WAITKIND_EXECD>:
Moving fetching stop_pc until after ecs->event_thread is refreshed.
Tom Tromey [Tue, 5 Jun 2018 15:42:15 +0000 (09:42 -0600)]
Make dwarf2_free_objfile static
I noticed that dwarf2_free_objfile can be made static, by changing it
to be a registry cleanup function. This simplifies the code, as well,
because now symbol readers don't have to explicitly call it.
Tested by the buildbot.
gdb/ChangeLog
2018-06-28 Tom Tromey <tom@tromey.com>
* coffread.c (coff_symfile_finish): Update.
* xcoffread.c (xcoff_symfile_finish): Update.
* elfread.c (elf_symfile_finish): Update.
* symfile.h (dwarf2_free_objfile): Don't declare.
* dwarf2read.c (_initialize_dwarf2_read): Use
register_objfile_data_with_cleanup.
(dwarf2_free_objfile): Now static. Change signature.
Jan Kratochvil [Thu, 28 Jun 2018 14:09:37 +0000 (16:09 +0200)]
Remove 2 excessive executable permission flags
Fedora rpmbuild has been complaining:
*** WARNING: ./usr/src/debug/gdb-8.1.50.
20180618-24.fc28.x86_64/gdb/gdbserver/x86-tdesc.h is executable but has empty or no shebang, removing executable bit
gdb/gdbserver/ChangeLog
2018-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* x86-tdesc.h: Remove executable permission flag.
gdb/testsuite/ChangeLog
2018-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/compiler.c: Remove executable permission flag.
Richard Bunt [Thu, 28 Jun 2018 07:59:59 +0000 (08:59 +0100)]
Fixed top frame assumption in watchpoint-hw-attach
watchpoint-hw-attach.exp was noticed to fail on some machines.
Thanks to the input from sergiodj and palves on the IRC channel,
it was concluded that the test case incorrectly assumed that on
attach it was landed in the top-most frame of the inferior. This
was fixed by running to a break point in main by explicitly
defining the source file name before continuing with the test.
Tested on the following architectures x86_64, aarch64 and ppc64le.
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-hw-attach.c (main): Remove unneeded
code.
* gdb.base/watchpoint-hw-attach.exp: Break in outermost frame.
Petr Tesarik [Thu, 28 Jun 2018 06:33:17 +0000 (08:33 +0200)]
Add an optional offset option to the "add-symbol-file" command
If all sections of a symbol file are loaded with a fixed offset, it
is easier to specify that offset than listing all sections
explicitly. There is also a similar option for "symbol-file".
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command, _initialize_symfile): Add
option "-o" to add-symbol-file-load to add an offset to each
section's load address.
* symfile.c (set_objfile_default_section_offset): New function.
gdb/doc/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.texinfo (Files): Document "add-symbol-file -o offset".
gdb/testsuite/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Add test for "add-symbol-file -o ".
Petr Tesarik [Thu, 28 Jun 2018 06:32:27 +0000 (08:32 +0200)]
Make sure that sorting does not change section order
Symbol files may contain multiple sections with the same name.
Section addresses specified by add-symbol-file are assigned to the
corresponding BFD sections in addr_info_make_relative using sorted
indexes of both vectors. Since the sort algorithm is not inherently
stable, the comparison function uses sectindex to maintain the
original order. However, add_symbol_file_command uses zero for all
sections, so if the user specifies multiple sections with the same
name, they will be assigned randomly to symbol file sections with
the same name.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command): Make sure that sections
Petr Tesarik [Thu, 28 Jun 2018 06:30:42 +0000 (08:30 +0200)]
Make add-symbol-file's address argument optional
The (first) .text section must be always specified as the second
non-option argument. The documentation states that GDB cannot
figure out this address by itself. This is true if the object file
was indeed relocated, but it is also confusing, because all other
sections can be omitted and will use the address provided by BFD.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (add_symbol_file_command, _initialize_symfile): Do not
require the second argument. If omitted, load sections at the
addresses specified in the file.
gdb/doc/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.texinfo (Files): The address argument for "add-symbol-file"
is no longer mandatory.
gdb/testsuite/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Test add-symbol-file behavior when the
address argument is omitted.
Petr Tesarik [Thu, 28 Jun 2018 06:01:33 +0000 (08:01 +0200)]
Add an optional offset option to the "symbol-file" command
If the main file is relocated at runtime, all symbols are offset by
a fixed amount. Let the user specify this offset when loading a
symbol file.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* symfile.c (symbol_file_command, symbol_file_add_main_1)
(_initialize_symfile): Add option "-o" to symbol-file to add an
offset to each section of the symbol file.
gdb/doc/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.texinfo (Files): Document "symbol-file -o offset".
gdb/testsuite/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Add test for "symbol-file -o ".
Petr Tesarik [Thu, 28 Jun 2018 06:01:33 +0000 (08:01 +0200)]
Add myself as a write-after-approval GDB maintainer.
gdb/ChangeLog:
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* MAINTAINERS (Write After Approval): Add Petr Tesarik.
GDB Administrator [Thu, 28 Jun 2018 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 5 Jun 2018 15:23:48 +0000 (09:23 -0600)]
Update "func" help text to GNU standards
In my earlier series to change help text to follow the GNU standards
for metasyntactic variables, I missed one: the "func" command. This
patch updates its help text.
Tested by the buildbot.
gdb/ChangeLog
2018-06-27 Tom Tromey <tom@tromey.com>
* stack.c (_initialize_stack): Update "func" help text.
Tom Tromey [Tue, 5 Jun 2018 16:02:45 +0000 (10:02 -0600)]
Remove a VEC from py-unwind.c
This removes a use of VEC from py-unwind.c, replacing it wit
std::vector. It also changes saved_regs to hold a gdbpy_ref<>,
simplifying the memory management.
Tested against gdb.python on x86-64 Fedora 26.
gdb/ChangeLog
2018-06-27 Tom Tromey <tom@tromey.com>
* python/py-unwind.c (unwind_info_object) <saved_regs>: Now a
std::vector.
(unwind_infopy_str, pyuw_create_unwind_info)
(unwind_infopy_add_saved_register, pyuw_sniffer)
(unwind_infopy_dealloc, unwind_infopy_add_saved_register):
Update.
(struct saved_reg): Add constructor.
<value>: Now a gdbpy_ref<>.
Tom Tromey [Wed, 27 Jun 2018 19:06:33 +0000 (13:06 -0600)]
Fix crash in machoread.c
"./gdb ./gdb" was crashing for me on macOS. Investigating showed that
macho_symfile_read was crashing because "symbol_table" was being freed
too soon. This was introduced by my earlier patch to change
macho_symfile_read to use a std::vector.
Tested on macOS 10.13.5 using "./gdb ./gdb". This should un-break
various already existing tests (testsuite/gdb.gdb at least), so no new
test case.
I'm checking this in as obvious.
gdb/ChangeLog
2018-06-27 Tom Tromey <tom@tromey.com>
* machoread.c (macho_symfile_read): Define "symbol_table" earlier.
Simon Marchi [Wed, 27 Jun 2018 19:31:05 +0000 (15:31 -0400)]
Format gdb-gdb.py.in with autopep8
Format using "autopep8 -i".
gdb/ChangeLog:
* gdb-gdb.py.in: Format using autopep8.
Simon Marchi [Wed, 27 Jun 2018 19:21:47 +0000 (15:21 -0400)]
Add pretty-printer for CORE_ADDR
Add a pretty-printer that prints CORE_ADDR values in hex.
gdb/ChangeLog:
* gdb-gdb.py.in (CoreAddrPrettyPrinter): New class.
(type_lookup_function): Recognize CORE_ADDR values.
Simon Marchi [Wed, 27 Jun 2018 18:32:07 +0000 (14:32 -0400)]
gdb-gdb.py.in: Don't print value's tag_name
This has been removed recently.
gdb/ChangeLog:
* gdb-gdb.py.in (StructMainTypePrettyPrinter) <to_string>: Don't
print tag_name.
Simon Marchi [Wed, 27 Jun 2018 18:32:05 +0000 (14:32 -0400)]
gdb-gdb.py.in: Fix ordering of TypeFlags objects with Python 3
Python 3 doesn't use __cmp__ to order objects, it uses __lt__. Because
of this, we get this exception when trying to pretty-print "type"
objects:
I tested it with Python 2.7 as well.
gdb/ChangeLog:
* gdb-gdb.py.in (TypeFlag) <__cmp__>: Remove.
<__lt__>: Add.
Simon Marchi [Wed, 27 Jun 2018 18:32:02 +0000 (14:32 -0400)]
Copy gdb-gdb.py to build dir
I have thought for a long time how nice it would be to have cool pretty
printers for GDB's internal types. Well, turns out there are few
already in gdb-gdb.py! Unfortunately, if you build GDB outside of the
source directory, that file never gets loaded. top-gdb will look for a
file called
../path/to/build/gdb/gdb-gdb.py
but that file is in the source directory at
../path/to/src/gdb/gdb-gdb.py
This patch makes it so we copy it to the build directory, just like we
do for gdb-gdb.gdb. With this, I can at least see the file getting
automatically loaded:
(top-gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128
objfile /home/emaisin/build/binutils-gdb/gdb/gdb pretty-printers:
type_lookup_function
I noticed that running "make" didn't re-generate gdb-gdb.py from
gdb-gdb.py.in. That's because it's copied when running the configure
script and that's it. I added a rule in the Makefile for that (and for
gdb-gdb.gdb too) and added them as a dependency to the "all" target.
gdb/ChangeLog:
* gdb-gdb.py: Move to...
* gdb-gdb.py.in: ... here.
* configure.ac (AC_CONFIG_FILES): Add gdb-gdb.py.
* Makefile.in (all): Add gdb-gdb.gdb and gdb-gdb.py as
dependencies.
(distclean): Remove gdb-gdb.py when cleaning.
(gdb-gdb.py, gdb-gdb.gdb): New rules.
* configure: Re-generate.
Pedro Alves [Wed, 27 Jun 2018 16:19:32 +0000 (17:19 +0100)]
Fix Cell debugging regression
Commit
00431a78b28f ("Use thread_info and inferior pointers more
throughout") broke Cell multi-arch debugging, because it made the
proc-service routines (ps_lgetregs etc.) access registers using the
SPU architecture if GDB happens to interrupt SPU code. The
proc-service routines must always operate on the "main" (in this case
PowerPC) architecture, because that's the register set libthread_db
expects to be using.
Restore the previous behavior, but wrapped in a new
get_ps_regcache function with a describing comment.
Also, the ps_l*regs routines have an explicit lwpid parameter that
said commit missed; with the commit mentioned above, we started always
reading the registers off of the current thread, which is incorrect.
That is fixed by this commit too.
gdb/ChangeLog:
2018-06-27 Pedro Alves <palves@redhat.com>
* proc-service.c (get_ps_regcache): New.
(ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
(ps_lsetfpregs): Use it.
Omair Javaid [Tue, 15 May 2018 14:04:21 +0000 (19:04 +0500)]
Fix lost line info for symbol at addr zero
This patch fixes a unique condition where GDB fails to provide line
information of symbol at address zero when code is compiled with text
address zero but loaded at an offset > 0.
For example lets compile following code snippet:
int main() {
return 0;
}
gcc -O0 -g3 -nostdlib -emain -Wl,-Ttext=0x00 -o file.out file.c
Start gdb and run:
add-symbol-file file.out 0xffff0000
info line main
GDB will return error saying no line info is available for the symbol.
This is a direct consequence of the fix for PR 12528 where GDB tries to ignore
line table for a function which has been garbage collected by the linker.
As the garbage collected symbols are sent to address zero GDB assumes a symbol
actually placed at address zero as garbage collected.
This was fixed with an additional check address < lowpc. But when symbol is
loaded at an offset lowpc becomes lowpc + offset while no offset is added to
address rather final symbol address is calculated based on baseaddr and address
added together. So in case where symbols are loaded at an offset the condition
address < lowpc will always return true.
This patch fixes this by comparing address against a non offset lowpc.
This patch also adds a GDB test case to replicate this behavior.
gdb:
2018-06-27 Omair Javaid <omair.javaid@linaro.org>
PR gdb/21695
* dwarf2read.c (lnp_state_machine::check_line_address): Update declaration.
(dwarf_decode_lines_1): Adjust.
gdb/testsuite:
2018-06-27 Omair Javaid <omair.javaid@linaro.org>
PR gdb/21695
* gdb.base/infoline-reloc-main-from-zero.exp: New test.
* gdb.base/infoline-reloc-main-from-zero.c: New file.
Simon Marchi [Wed, 27 Jun 2018 14:52:57 +0000 (10:52 -0400)]
Add overrides, fix FreeBSD build
Fix this:
CXX fbsd-nat.o
In file included from fbsd-nat.c:44:
./fbsd-nat.h:40:7: error: 'find_memory_regions' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
int find_memory_regions (find_memory_region_ftype func, void *data);
^
./target.h:702:17: note: overridden virtual function is here
virtual int find_memory_regions (find_memory_region_ftype func, void *data)
^
In file included from fbsd-nat.c:44:
./fbsd-nat.h:42:8: error: 'info_proc' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool info_proc (const char *, enum info_proc_what);
^
./target.h:950:18: note: overridden virtual function is here
virtual bool info_proc (const char *, enum info_proc_what);
^
gdb/ChangeLog:
* fbsd-nat.h (class fbsd_nat_target) <find_memory_regions>: Add
override.
<info_proc>: Likewise.
Alan Modra [Wed, 27 Jun 2018 03:17:13 +0000 (12:47 +0930)]
gas object file locations
With the update to newer autotools, some gas object files are now
built in config/, breaking xtensa-elf and ia64-vms. This patch fixes
the dependencies.
* configure.ac: Specify extra_objects with leading "config/"
for xtensa-relax.o and te-vms.o. Use case statements to unique
extra_objects. Formatting.
* configure: Regenerate.
GDB Administrator [Wed, 27 Jun 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Tue, 26 Jun 2018 21:38:32 +0000 (14:38 -0700)]
Minor reorganization of fetch_registers/store_registers in windows-nat.c
This patch is a small reorganizational patch that splits
do_windows_fetch_inferior_registers into two parts:
(a) One part that first reloads the thread's context when needed,
and then decides based on the given register number whether
one register needs to be fetched or all of them.
This part is moved to windows_nat_target::fetch_registers.
(b) The rest of the code, which actually fetches the register value
and supplies it to the regcache.
A similar treatment is applied to do_windows_store_inferior_registers.
This change is preparation work for changing the way we calculate
the location of a given register in the thread context structure,
and should be a no op.
gdb/ChangeLog:
* windows-nat.c (do_windows_fetch_inferior_registers): Rename
to windows_fetch_one_register, and only handle the case of
fetching one register. Move the code that reloads the context
and iterates over all registers if R is negative to...
(windows_nat_target::fetch_registers): ... here.
(do_windows_store_inferior_registers): Rename to
windows_store_one_register, and only handle the case of storing
one register. Move the code that handles the case where r is
negative to...
(windows_nat_target::store_registers) ... here.
Tested on x86-windows and x86_64-windows using AdaCore's testsuite.
Tom Tromey [Fri, 8 Jun 2018 19:18:25 +0000 (13:18 -0600)]
Support ptype/o in Rust
This adds support for ptype/o to the Rust language code.
By default, the Rust compiler reorders fields to reduce padding. So,
the Rust language code sorts the fields by offset before printing.
This may yield somewhat odd-looking results, but it is faithful to
"what really happens", and might be useful when doing lower-level
debugging.
The reordering can be disabled using #[repr(c)]; ptype/o might be more
useful in this case.
gdb/ChangeLog
2018-06-26 Tom Tromey <tom@tromey.com>
PR rust/22574:
* typeprint.c (whatis_exp): Allow ptype/o for Rust.
* rust-lang.c (rust_print_struct_def): Add podata parameter.
Update.
(rust_internal_print_type): Add podata parameter.
(rust_print_type): Update.
gdb/testsuite/ChangeLog
2018-06-26 Tom Tromey <tom@tromey.com>
PR rust/22574:
* gdb.rust/simple.exp (test_one_slice): Add ptype/o tests.
* gdb.rust/simple.rs (struct SimpleLayout): New.
Tom Tromey [Fri, 8 Jun 2018 18:43:47 +0000 (12:43 -0600)]
Move ptype/o printing code to typeprint.c
This moves the hole-printing support code for ptype/o from
c-typeprint.c to be methods on print_offset_data. This allows the
code to be used from non-C languages.
gdb/ChangeLog
2018-06-26 Tom Tromey <tom@tromey.com>
* typeprint.h (struct print_offset_data) <update, finish,
maybe_print_hole>: New methods.
<indentation>: New constant.
* typeprint.c (print_offset_data::indentation): Define.
(print_offset_data::maybe_print_hole, print_offset_data::update)
(print_offset_data::finish): Move from c-typeprint.c and rename.
* c-typeprint.c (OFFSET_SPC_LEN): Remove.
(print_spaces_filtered_with_print_options): Update.
(c_print_type_union_field_offset, maybe_print_hole)
(c_print_type_struct_field_offset): Move to typeprint.c and
rename.
(c_type_print_base_struct_union): Update.
Nick Clifton [Tue, 26 Jun 2018 13:03:16 +0000 (14:03 +0100)]
Updated translations.
gas * po/uk.po: Updated Ukranian translation.
bfd * po/uk.po: Updated Ukranian translation.
ld * po/uk.po: Updated Ukranian translation.
gold * po/uk.po: Updated Ukranian translation.
opcodes * po/uk.po: Updated Ukranian translation.
* po/de.po: Updated German translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.
binutils* po/sv.po: Updated Swedish translation.
* po/uk.po: Updated Ukranian translation.
Nick Clifton [Tue, 26 Jun 2018 12:40:13 +0000 (13:40 +0100)]
Fix the MSP430 assembler's parsing of register names.
PR 23335
* config/tc-msp430.c (check_reg): Only accept register name
strings that do not end in an alphanumeric character.
* testsuite/gas/msp430/msp430x.d: Update expected disassembly.
Alan Modra [Tue, 26 Jun 2018 05:00:16 +0000 (14:30 +0930)]
PR23169 bogus test
The testcase isn't valid. If it happens to run on your target, you're
lucky.
PR 23169
* testsuite/ld-ifunc/ifunc.exp: Don't run pr23169 tests on
powerpc. Comment.
Alan Modra [Tue, 26 Jun 2018 04:59:28 +0000 (14:29 +0930)]
Fix parens in ld bootstrap.exp
Seen with tcl 8.5.13:
ERROR: tcl error sourcing .../ld/testsuite/ld-bootstrap/bootstrap.exp.
ERROR: expected boolean value but got " [istarget ia64-*-elf*] || [istarget ia64-*-linux*"
while executing
"if { "$flags" == "--static" && { [istarget ia64-*-elf*] || [istarget ia64-*-linux*] }
|| [istarget mips*-*-linux*] } {
# On ia64 and mips, tmpdir/l..."
* testsuite/ld-bootstrap/bootstrap.exp: Use parentheses rather
than curly braces in logical expression.
Alan Modra [Thu, 21 Jun 2018 13:49:41 +0000 (23:19 +0930)]
Revert "Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS"
This reverts commit
57c0d77c2ce5e583dab322e05f8291bcbad0ccd3.
Nick Clifton [Tue, 26 Jun 2018 11:56:23 +0000 (12:56 +0100)]
Fix spelling mistakes.
opcodes * nfp-dis.c: Fix spelling mistake.
ld * emultempl/aarch64elf.em: Fix spelling mistake.
* emultempl/avrelf.em: Likewise.
* emultempl/elf32.em: Likewise.
binutils* doc/binutils.texi: Fix spelling mistakes.
* README--how-to-make-a-release: Likewise.
GDB Administrator [Tue, 26 Jun 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Mon, 25 Jun 2018 16:18:18 +0000 (17:18 +0100)]
gdb: For macOS, s/thread_info/struct thread_info/
The macOS build currently fails with several instances of this problem:
In file included from ../../src/gdb/darwin-nat.h:22:0,
from ../../src/gdb/i386-darwin-nat.c:37:
../../src/gdb/gdbthread.h:376:59: error: type/value mismatch at argument 1 in template parameter list for 'template<class T, class Policy> class gdb::ref_ptr'
= gdb::ref_ptr<thread_info, refcounted_object_ref_policy>;
^
../../src/gdb/gdbthread.h:376:59: note: expected a type, got 'thread_info'
../../src/gdb/gdbthread.h:396:28: error: variable or field 'delete_thread' declared void
extern void delete_thread (thread_info *thread);
^
(...)
This is because there's a thread_info function in the Darwin/XNU/mach API:
http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html
Fix this in the same way it had been fixed in commit
7aabaf9d4ad5
("Create private_thread_info hierarchy"), by adding an explicit
"struct" keyword.
gdb/ChangeLog:
2018-06-25 Pedro Alves <palves@redhat.com>
* gdbthread.h (thread_info_ref, delete_thread)
(delete_thread_silent, first_thread_of_inferior)
(any_thread_of_inferior, switch_to_thread)
(enable_thread_stack_temporaries)
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries, can_access_registers_thread):
Spell out "struct thread_info" instead of just "thread_info".
* inferior.h (notice_new_inferior): Likewise.
Pedro Alves [Mon, 25 Jun 2018 16:42:22 +0000 (17:42 +0100)]
gdb: Fix build on several hosts/ports
Commit
00431a78b28f ("Use thread_info and inferior pointers more
throughout") missed updating some callers, like e.g.,:
gdb/remote-sim.c: In member function 'virtual void gdbsim_target::mourn_inferior()':
gdb/remote-sim.c:1198:50: error: cannot convert 'ptid_t' to 'thread_info*' for argument '1' to 'void delete_thread_silent(thread_info*)'
delete_thread_silent (sim_data->remote_sim_ptid);
gdb/mygit/src/gdb/procfs.c: In member function ‘virtual void procfs_target::detach(inferior*, int)’:
gdb/mygit/src/gdb/procfs.c:1931:23: error: invalid conversion from ‘int’ to ‘inferior*’ [-fpermissive]
detach_inferior (pid);
^
In file included from gdb/mygit/src/gdb/procfs.c:24:0:
gdb/mygit/src/gdb/inferior.h:476:13: note: initializing argument 1 of ‘void detach_inferior(inferior*)’
etc.
This fixes it.
The delete_thread_silent calls in both go32-nat.c and remote-sim.c are
unnecessary because generic_mourn_inferior calls exit_inferior, which
deletes the inferior's threads.
gdb/ChangeLog:
2018-06-25 Pedro Alves <palves@redhat.com>
* windows-nat.c (windows_delete_thread): Use find_thread_ptid and
pass thread_info pointer to delete_thread.
(windows_nat_target::detach): Pass inferior pointer to
detach_inferior.
* aix-thread.c (sync_threadlists): Pass thread_info pointer to
delete_thread.
* bsd-kvm.c (bsd_kvm_target::close): Use discard_all_inferiors.
* darwin-nat.c (darwin_check_new_threads): Use find_thread_ptid
and pass a thread_info pointer to delete_thread.
* fbsd-nat.c (fbsd_nat_target::wait): Use find_thread_ptid and
pass thread_info pointer to delete_thread.
* go32-nat.c (go32_nat_target::mourn_inferior): Remove
delete_thread_silent call.
* procfs.c (procfs_target::detach): Pass inferior pointer to
detach_inferior.
(procfs_target::wait): Pass thread_info pointer to delete_thread.
* remote-sim.c (gdbsim_target::mourn_inferior): Remove
delete_thread_silent call.
* windows-nat.c (windows_delete_thread): Use find_thread_ptid and
pass thread_info pointer to delete_thread.
(windows_nat_target::detach): Pass inferior pointer to
delete_inferior.
Tom Tromey [Mon, 25 Jun 2018 03:25:44 +0000 (21:25 -0600)]
Add a syntax table to dwarf-mode.el
This adds a syntax table for dwarf-mode to dwarf-mode.el. I noticed
the need for this when trying to use mark-sexp (C-M-SPC) on a hex
number -- it copied the trailing ">" as well, which isn't desirable.
I've also bumped the version number to make this simpler to install
via the Emacs package system.
Tested locally. I'm checking this in.
binutils/ChangeLog
2018-06-25 Tom Tromey <tom@tromey.com>
* dwarf-mode.el (dwarf-mode-syntax-table): New variable.
Bump version number.
Nick Clifton [Mon, 25 Jun 2018 11:49:14 +0000 (12:49 +0100)]
Fix compile time warning message for the AArch64 BFD backend, about a possible attempt to call sprintf on a NULL buffer pointer.
* elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check
for malloc returning NULL.
(_bfd_aarch64_erratum_843419_fixup): Check for
_bfd_aarch64_erratum_835769_stub_name returning NULL.
GDB Administrator [Mon, 25 Jun 2018 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Sun, 24 Jun 2018 19:09:10 +0000 (20:09 +0100)]
Add more updated to release notes
Nick Clifton [Sun, 24 Jun 2018 18:13:01 +0000 (19:13 +0100)]
Regenerate configure and pot files with updated binutils version number.
Nick Clifton [Sun, 24 Jun 2018 17:46:33 +0000 (18:46 +0100)]
Update version number on development (aka HEAD) branch.
Nick Clifton [Sun, 24 Jun 2018 17:36:15 +0000 (18:36 +0100)]
Add 2.30 branch notes to ChangeLogs and NEWS files.
GDB Administrator [Sun, 24 Jun 2018 00:01:17 +0000 (00:01 +0000)]
Automatic date update in version.in
Cary Coutant [Sat, 23 Jun 2018 07:46:13 +0000 (00:46 -0700)]
Bump version number and summarize new features in 1.16.
gold/
* version.cc (version_string): Bump to 1.16.
* NEWS: Add new features in 1.16.
Cary Coutant [Sat, 23 Jun 2018 07:26:07 +0000 (00:26 -0700)]
Fix "may be used uninitialized" warning.
gold/
PR gold/22914
* x86_64.cc (Target_x86_64::record_gnu_property): Initialize val.
Cary Coutant [Sat, 23 Jun 2018 00:28:05 +0000 (17:28 -0700)]
Add x86-64 support for Indirect Branch Tracking (IBT).
gold/
PR gold/22915
* x86_64.cc (Output_data_plt_x86_64_ibt): New class.
(Target_x86_64::do_make_data_plt): (All instantiations) Check for
IBT feature bit and create IBT PLTs.
Cary Coutant [Sat, 23 Jun 2018 06:36:50 +0000 (23:36 -0700)]
Update support for .note.gnu.property sections.
The original patch did not give the target enough hooks to discover that
an input object file does not have a particular property. For the
GNU_PROPERTY_X86_FEATURE_1_AND property, for example, where a missing
property should be assumed to be all zeroes, and ANDed with other
object modules, this is essential. We now store the target-specific
properties locally in the Target structure as native uint32_t fields,
then AND the per-object feature bits with the program's feature bits
when we're finished processing each input object file. The target-specific
properties are then added back to the output note section during
finalization.
gold/
PR gold/22914
* layout.cc (read_sized_value): Fix spelling of section name.
(Layout::layout_gnu_property): Call Sized_target::record_gnu_property
for target-specific properties;
don't store them with target-independent properties yet.
(Layout::merge_gnu_properties): New method.
(Layout::add_gnu_property): New method.
(Layout::create_gnu_properties_note): Call target to finalize
target-specific properties. Fix spelling of output section name.
* layout.h (Layout::merge_gnu_properties): New method.
(Layout::add_gnu_property): New method.
* object.cc (Sized_relobj_file::do_layout): Call
Layout::merge_gnu_properties.
* target.h (Target::merge_gnu_property): Remove.
(Target::finalize_gnu_properties): New method.
(Target::do_merge_gnu_property): Move to Sized_target and rename.
(Target::do_finalize_gnu_properties): New virtual method.
(Sized_target::record_gnu_property): Moved and renamed from
Target::do_merge_gnu_property.
(Sized_target::merge_gnu_properties): New virtual method.
* x86_64.cc (Target_x86_64::isa_1_used_, isa_1_needed_)
(feature_1_, object_feature_1_, seen_first_object_): New data members.
(Target_x86_64::do_merge_gnu_property): Rename to ...
(Target_x86_64::record_gnu_property): ... this. Save target-specific
properties in Target class object.
(Target_x86_64::merge_gnu_properties): New method.
(add_property): New static inline function.
(Target_x86_64::do_finalize_gnu_properties): New method.
* testsuite/Makefile.am (gnu_property_test): Remove C source file;
link directly without compiler driver.
* testsuite/Makefile.in: Regenerate.
* testsuite/gnu_property_a.S: Add _start.
Cary Coutant [Sat, 23 Jun 2018 01:19:51 +0000 (18:19 -0700)]
Silence GCC 9 error about deprecated implicit copy constructor.
Replacing push_back() with emplace_back() eliminates the calls to the
copy constructor, but I still had to provide explicit copy constructors
because of the call to vector::reserve(), which tries to instantiate them
even though they'll never actually be called when reserve() is called
on an empty vector.
gold/
* incremental.cc (Sized_incremental_binary::setup_readers): Use
emplace_back for GCC 5 and later.
* incremental.h (Incremental_binary::Input_reader): Provide copy
constructor.
(Sized_incremental_binary::Sized_input_reader): Likewise.
GDB Administrator [Sat, 23 Jun 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 22 Jun 2018 17:40:47 +0000 (13:40 -0400)]
Fix "info registers" regexes in gdb.base/jit-reader.exp
Commit
e813d34 ("Align natural-format register values to the same column")
changed the output of "info registers" (tabs to spaces), but didn't
update gdb.base/jit-reader.exp. Update the regexes to expect spaces
instead.
gdb/testsuite/ChangeLog:
* gdb.base/jit-reader.exp (jit_reader_test): Expect spaces in
"info registers" output.
Cary Coutant [Fri, 22 Jun 2018 16:27:39 +0000 (09:27 -0700)]
Add support for .note.gnu.property sections.
elfcpp/
PR gold/22914
* elfcpp.h (NT_GNU_PROPERTY_TYPE_0): New note type.
(GNU_PROPERTY_*): New Gnu property types.
* x86_64.h (GNU_PROPERTY_X86_FEATURE_1_IBT)
(GNU_PROPERTY_X86_FEATURE_1_SHSTK): New x86 feature bits.
gold/
PR gold/22914
* layout.cc (Layout::Layout): Initialize gnu_properties_.
(read_sized_value, write_sized_value): New functions.
(Layout::layout_gnu_property): New method.
(Layout::create_notes): Call create_gnu_properties_note.
(Layout::create_gnu_properties_note): New method.
* layout.h (Layout::layout_gnu_property): New method.
(Layout::create_gnu_properties_note): New method.
(Layout::Gnu_property, Layout::Gnu_properties): New types.
(Layout::gnu_properties_): New data member.
* object.cc (Sized_relobj_file::layout_gnu_property_section): New
method.
(Sized_relobj_file::do_layout): Handle .note.gnu.property sections.
* object.h (Sized_relobj_file::layout_gnu_property_section): New
method.
* target.h (Target::merge_gnu_property): New method.
(Target::do_merge_gnu_property): New virtual method.
* x86_64.cc (Target_x86_64::do_merge_gnu_property): New method.
* testsuite/Makefile.am (gnu_property_test): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/gnu_property_a.S: New source file.
* testsuite/gnu_property_b.S: New source file.
* testsuite/gnu_property_c.S: New source file.
* testsuite/gnu_property_main.c: New source file.
* testsuite/gnu_property_test.sh: New test script.
Alan Hayward [Wed, 20 Jun 2018 17:19:05 +0000 (18:19 +0100)]
Use partial register read/writes in transfer_regset
This avoids assert failures when the register is bigger than the
slot size. This happens on Aarch64 when truncating Z registers
into an fpsimd structure. This can be triggered by running
gdb command "generate-core-file".
Also, when the register is smaller then the slot size, then
zero pad when writing to the slot, and truncate when writing
to the regcache. This happens on Aarch64 with the CPSR register.
Continue to ensure registers are invalidated when both buffers
are null.
gdb/
* regcache.c (readable_regcache::read_part): Fix asserts.
(reg_buffer::raw_collect_part): New function.
(regcache::write_part): Fix asserts.
(reg_buffer::raw_supply_part): New function.
(regcache::transfer_regset_register): New helper function.
(regcache::transfer_regset): Call new functions.
(regcache_supply_regset): Use gdb_byte*.
(regcache::supply_regset): Likewise.
(regcache_collect_regset): Likewise.
(regcache::collect_regset): Likewise.
* regcache.h (reg_buffer::raw_collect_part): New declaration.
(reg_buffer::raw_supply_part): Likewise.
(regcache::transfer_regset_register): Likewise.
(regcache::transfer_regset): Use gdb_byte*.
Tamar Christina [Fri, 22 Jun 2018 11:27:53 +0000 (12:27 +0100)]
Correct negs aliasing on AArch64.
This patch fixes a disassembly issue with the aliases to subs with a shifted
register. The subs instruction with the zero register as destination is
supposed to alias to cmp and when the first input register is the zero register
the subs is supposed to be aliased to negs.
This means that a subs with destination and first input registers the zero
register is supposed to be a cmp.
This is done by raising the priority of the cmp alias.
opcodes/
* aarch64-tbl.h (aarch64_opcode_table): Fix alias flag for negs
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.
gas/
* testsuite/gas/aarch64/addsub.s: Add negs to zero reg test.
* testsuite/gas/aarch64/addsub.d: Likewise.
Alan Hayward [Fri, 22 Jun 2018 09:26:51 +0000 (10:26 +0100)]
Fix up HAS_SVE_STATE macro
Prevents build break on aarch64 Suse.
2018-06-22 Alan Hayward <alan.hayward@arm.com>
gdb/
* nat/aarch64-sve-linux-ptrace.h (HAS_SVE_STATE): Use &.
GDB Administrator [Fri, 22 Jun 2018 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 21 Jun 2018 21:45:47 +0000 (22:45 +0100)]
MIPS/opcodes: Fix a typo in `-M ginv' option description
opcodes/
* mips-dis.c (print_mips_disassembler_options): Fix a typo in
`-M ginv' option description.
Cary Coutant [Thu, 21 Jun 2018 20:51:16 +0000 (13:51 -0700)]
Fix treatment of symbol versions with unused as-needed libraries.
When we have a weak reference to a symbol defined in an
as-needed library, and that library ends up not-needed, gold
simply clears the version information in the symbol table, even
if the symbol could have been resolved by a needed library later
in the link order. This results in a loss of version information,
which can cause the program to bind to the wrong version at run
time.
This patch lets a dynamic definition override an earlier one if
the earlier one is from a not-needed library, so that we can
retain the version information from the binding to the needed
library. In order to do that, the tracking of needed/not-needed
had to be moved up to symbol resolution time, instead of during
Symbol_table::set_dynsym_indexes().
In cases where we still end up discarding version information,
I've added a warning.
For the original problem report and discussion, see:
https://stackoverflow.com/questions/
50751421/undefined-behavior-in-shared-lib-using-libpthread-but-not-having-it-in-elf-as-d
gold/
* resolve.cc (Symbol_table::resolve): Rename tobinding to
orig_tobinding. Call set_is_needed() for objects that resolve
non-weak references.
(Symbol_table::should_override): Allow a dynamic definition to
override an earlier one in a not-needed library.
* symtab.cc (Symbol_table::set_dynsym_indexes): Remove separate
processing for as-needed symbols. Add warning when discarding
version informatin.
* testsuite/Makefile.am (weak_as_needed): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/weak_as_needed.sh: New test script.
* testsuite/weak_as_needed_a.c: New source file.
* testsuite/weak_as_needed_b.c: New source file.
* testsuite/weak_as_needed_b.script: New version script.
* testsuite/weak_as_needed_c.c: New source file.
* testsuite/weak_as_needed_c.script: New version script.
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:57 +0000 (21:40 +0100)]
MIPS/BFD: Correct formatting of compact EH backend methods
Correct the formatting of `_bfd_mips_elf_compact_eh_encoding' and
`_bfd_mips_elf_cant_unwind_opcode' definitions which extend beyond 79
columns.
bfd/
* elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding)
(_bfd_mips_elf_cant_unwind_opcode): Correct formatting.
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:56 +0000 (21:40 +0100)]
MIPS/BFD: Keep EI_ABIVERSION setting together
Shuffle code in `_bfd_mips_post_process_headers' so that the setting of
the EI_ABIVERSION ELF file header field is complete before calling
`_bfd_elf_post_process_headers'. This used to be the case, but was
changed with commit
351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and
FP64A ABI extensions") for no reason.
bfd/
* elfxx-mips.c (_bfd_mips_post_process_headers): Keep
EI_ABIVERSION setting together.
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:56 +0000 (21:40 +0100)]
MIPS/BFD: Use enumeration constants for EI_ABIVERSION
Define enumeration constants based on generated `libc-abis.h' from GNU
libc, adding a MIPS_ prefix as these are port-specific. Use them to
replace magic numbers stored in the EI_ABIVERSION field of the ELF file
header.
bfd/
* elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
(MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
(MIPS_LIBC_ABI_MAX): New enumeration constants.
(_bfd_mips_post_process_headers): Use them in place of magic
numbers.
Jim Wilson [Thu, 21 Jun 2018 18:45:43 +0000 (11:45 -0700)]
RISC-V: Fix 3 PIE related ld testsuite failures.
bfd/
* elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
Use SYMBOL_REFERENCES_LOCAL. Add asserts for h->got.offset.
Pedro Alves [Thu, 21 Jun 2018 16:09:31 +0000 (17:09 +0100)]
Use thread_info and inferior pointers more throughout
This is more preparation bits for multi-target support.
In a multi-target scenario, we need to address the case of different
processes/threads running on different targets that happen to have the
same PID/PTID. E.g., we can have both process 123 in target 1, and
process 123 in target 2, while they're in reality different processes
running on different machines. Or maybe we've loaded multiple
instances of the same core file. Etc.
To address this, in my WIP multi-target branch, threads and processes
are uniquely identified by the (process_stratum target_ops *, ptid_t)
and (process_stratum target_ops *, pid) tuples respectively. I.e.,
each process_stratum instance has its own thread/process number space.
As you can imagine, that requires passing around target_ops * pointers
in a number of functions where we're currently passing only a ptid_t
or an int. E.g., when we look up a thread_info object by ptid_t in
find_thread_ptid, the ptid_t alone isn't sufficient.
In many cases though, we already have the thread_info or inferior
pointer handy, but we "lose" it somewhere along the call stack, only
to look it up again by ptid_t/pid. Since thread_info or inferior
objects know their parent target, if we pass around thread_info or
inferior pointers when possible, we avoid having to add extra
target_ops parameters to many functions, and also, we eliminate a
number of by ptid_t/int lookups.
So that's what this patch does. In a bit more detail:
- Changes a number of functions and methods to take a thread_info or
inferior pointer instead of a ptid_t or int parameter.
- Changes a number of structure fields from ptid_t/int to inferior or
thread_info pointers.
- Uses the inferior_thread() function whenever possible instead of
inferior_ptid.
- Uses thread_info pointers directly when possible instead of the
is_running/is_stopped etc. routines that require a lookup.
- A number of functions are eliminated along the way, such as:
int valid_gdb_inferior_id (int num);
int pid_to_gdb_inferior_id (int pid);
int gdb_inferior_id_to_pid (int num);
int in_inferior_list (int pid);
- A few structures and places hold a thread_info pointer across
inferior execution, so now they take a strong reference to the
(refcounted) thread_info object to avoid the thread_info pointer
getting stale. This is done in enable_thread_stack_temporaries and
in the infcall.c code.
- Related, there's a spot in infcall.c where using a RAII object to
handle the refcount would be handy, so a gdb::ref_ptr specialization
for thread_info is added (thread_info_ref, in gdbthread.h), along
with a gdb_ref_ptr policy that works for all refcounted_object types
(in common/refcounted-object.h).
gdb/ChangeLog:
2018-06-21 Pedro Alves <palves@redhat.com>
* ada-lang.h (ada_get_task_number): Take a thread_info pointer
instead of a ptid_t. All callers adjusted.
* ada-tasks.c (ada_get_task_number): Likewise. All callers
adjusted.
(print_ada_task_info, display_current_task_id, task_command_1):
Adjust.
* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
inferior_thread.
(breakpoint_kind): Adjust.
(remove_breakpoints_pid): Rename to ...
(remove_breakpoints_inf): ... this. Adjust to take an inferior
pointer. All callers adjusted.
(bpstat_clear_actions): Use inferior_thread.
(get_bpstat_thread): New.
(bpstat_do_actions): Use it.
(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
to take a thread_info pointer. All callers adjusted.
(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
(breakpoint_re_set_thread): Use inferior_thread.
* breakpoint.h (struct inferior): Forward declare.
(bpstat_stop_status): Update.
(remove_breakpoints_pid): Delete.
(remove_breakpoints_inf): New.
* bsd-uthread.c (bsd_uthread_target::wait)
(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd): Adjust.
(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
inferior_thread.
* cli/cli-interp.c: Include "inferior.h".
* common/refcounted-object.h (struct
refcounted_object_ref_policy): New.
* compile/compile-object-load.c: Include gdbthread.h.
(store_regs): Use inferior_thread.
* corelow.c (core_target::close): Use current_inferior.
(core_target_open): Adjust to use first_thread_of_inferior and use
the current inferior.
* ctf.c (ctf_target::close): Adjust to use current_inferior.
* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
Take a thread_info pointer instead of a ptid_t.
* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
(dummy_frame_discard, register_dummy_frame_dtor): Take a
thread_info pointer instead of a ptid_t.
* elfread.c: Include "inferior.h".
(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
Use inferior_thread.
* eval.c (evaluate_subexp): Likewise.
* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
inferior_thread.
* gdb_proc_service.h (struct thread_info): Forward declare.
(struct ps_prochandle) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
* gdbarch.h, gdbarch.c: Regenerate.
* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
'thread' parameter. All implementations and callers adjusted.
* gdbthread.h (thread_info) <set_running>: New method.
(delete_thread, delete_thread_silent): Take a thread_info pointer
instead of a ptid.
(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_live_thread_of_process): Delete, replaced by ...
(any_live_thread_of_inferior): ... this new function. All callers
adjusted.
(switch_to_thread, switch_to_no_thread): Declare.
(is_executing): Delete.
(enable_thread_stack_temporaries): Update comment.
<enable_thread_stack_temporaries>: Take a thread_info pointer
instead of a ptid_t. Incref the thread.
<~enable_thread_stack_temporaries>: Decref the thread.
<m_ptid>: Delete
<m_thr>: New.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries, can_access_registers_thread):
Take a thread_info pointer instead of a ptid_t. All callers
adjusted.
* infcall.c (get_call_return_value): Use inferior_thread.
(run_inferior_call): Work with thread pointers instead of ptid_t.
(call_function_by_hand_dummy): Work with thread pointers instead
of ptid_t. Use thread_info_ref.
* infcmd.c (proceed_thread_callback): Access thread's state
directly.
(ensure_valid_thread, ensure_not_running): Use inferior_thread,
access thread's state directly.
(continue_command): Use inferior_thread.
(info_program_command): Use find_thread_ptid and access thread
state directly.
(proceed_after_attach_callback): Use thread state directly.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(exit_inferior): Take an inferior pointer instead of a pid. All
callers adjusted.
(exit_inferior_silent): New.
(detach_inferior): Delete.
(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
(gdb_inferior_id_to_pid, in_inferior_list): Delete.
(detach_inferior_command, kill_inferior_command): Use
find_inferior_id instead of valid_gdb_inferior_id and
gdb_inferior_id_to_pid.
(inferior_command): Use inferior and thread pointers.
* inferior.h (struct thread_info): Forward declare.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(detach_inferior): Delete declaration.
(exit_inferior, exit_inferior_silent): Take an inferior pointer
instead of a pid. All callers adjusted.
(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
(valid_gdb_inferior_id): Delete.
* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
(struct displaced_step_inferior_state) <pid>: Delete, replaced by
...
<inf>: ... this new field.
<step_ptid>: Delete, replaced by ...
<step_thread>: ... this new field.
(get_displaced_stepping_state): Take an inferior pointer instead
of a pid. All callers adjusted.
(displaced_step_in_progress_any_inferior): Adjust.
(displaced_step_in_progress_thread): Take a thread pointer instead
of a ptid_t. All callers adjusted.
(displaced_step_in_progress, add_displaced_stepping_state): Take
an inferior pointer instead of a pid. All callers adjusted.
(get_displaced_step_closure_by_addr): Adjust.
(remove_displaced_stepping_state): Take an inferior pointer
instead of a pid. All callers adjusted.
(displaced_step_prepare_throw, displaced_step_prepare)
(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
All callers adjusted.
(start_step_over): Adjust.
(infrun_thread_ptid_changed): Remove bit updating ptids in the
displaced step queue.
(do_target_resume): Adjust.
(fetch_inferior_event): Use inferior_thread.
(context_switch, get_inferior_stop_soon): Take an
execution_control_state pointer instead of a ptid_t. All callers
adjusted.
(switch_to_thread_cleanup): Delete.
(stop_all_threads): Use scoped_restore_current_thread.
* inline-frame.c: Include "gdbthread.h".
(inline_state) <inline_state>: Take a thread pointer instead of a
ptid_t. All callers adjusted.
<ptid>: Delete, replaced by ...
<thread>: ... this new field.
(find_inline_frame_state): Take a thread pointer instead of a
ptid_t. All callers adjusted.
(skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Take a thread
pointer instead of a ptid_t. All callers adjusted.
* inline-frame.h (skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Likewise.
* linux-fork.c (delete_checkpoint_command): Adjust to use thread
pointers directly.
* linux-nat.c (get_detach_signal): Likewise.
* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
(thread_db_notice_clone): Adjust.
(thread_db_find_new_threads_silently)
(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
a thread pointer instead of a ptid_t. All callers adjusted.
* mi/mi-cmd-var.c: Include "inferior.h".
(mi_cmd_var_update_iter): Update to use thread pointers.
* mi/mi-interp.c (mi_new_thread): Update to use the thread's
inferior directly.
(mi_output_running_pid, mi_inferior_count): Delete, bits factored
out to ...
(mi_output_running): ... this new function.
(mi_on_resume_1): Adjust to use it.
(mi_user_selected_context_changed): Adjust to use inferior_thread.
* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
directly.
(interrupt_thread_callback): : Adjust to use thread and inferior
pointers.
* proc-service.c: Include "gdbthread.h".
(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
* progspace-and-thread.c: Include "inferior.h".
* progspace.c: Include "inferior.h".
* python/py-exitedevent.c (create_exited_event_object): Adjust to
hold a reference to an inferior_object.
* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
inferior_thread.
* python/py-inferior.c (struct inferior_object): Give the type a
tag name instead of a typedef.
(python_on_normal_stop): No need to check if the current thread is
listed.
(inferior_to_inferior_object): Change return type to
inferior_object. All callers adjusted.
(find_thread_object): Delete, bits factored out to ...
(thread_to_thread_object): ... this new function.
* python/py-infthread.c (create_thread_object): Use
inferior_to_inferior_object.
(thpy_is_stopped): Use thread pointer directly.
(gdbpy_selected_thread): Use inferior_thread.
* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(btpy_insn_or_gap_new): Drop const.
(btpy_list_new): Take a thread pointer instead of a ptid_t. All
callers adjusted.
* python/py-record.c: Include "gdbthread.h".
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
(gdbpy_current_recording): Use inferior_thread.
* python/py-record.h (recpy_record_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_element_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
* python/py-threadevent.c: Include "gdbthread.h".
(get_event_thread): Use thread_to_thread_object.
* python/python-internal.h (struct inferior_object): Forward
declare.
(find_thread_object, find_inferior_object): Delete declarations.
(thread_to_thread_object, inferior_to_inferior_object): New
declarations.
* record-btrace.c: Include "inferior.h".
(require_btrace_thread): Use inferior_thread.
(record_btrace_frame_sniffer)
(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
(get_thread_current_frame): Use scoped_restore_current_thread and
switch_to_thread.
(get_thread_current_frame): Use thread pointer directly.
(record_btrace_replay_at_breakpoint): Use thread's inferior
pointer directly.
* record-full.c: Include "inferior.h".
* regcache.c: Include "gdbthread.h".
(get_thread_arch_regcache): Use the inferior's address space
directly.
(get_thread_regcache, registers_changed_thread): New.
* regcache.h (get_thread_regcache(thread_info *thread)): New
overload.
(registers_changed_thread): New.
(remote_target) <remote_detach_1>: Swap order of parameters.
(remote_add_thread): <remote_add_thread>: Return the new thread.
(get_remote_thread_info(ptid_t)): New overload.
(remote_target::remote_notice_new_inferior): Use thread pointers
directly.
(remote_target::process_initial_stop_replies): Use
thread_info::set_running.
(remote_target::remote_detach_1, remote_target::detach)
(extended_remote_target::detach): Adjust.
* stack.c (frame_show_address): Use inferior_thread.
* target-debug.h (target_debug_print_thread_info_pp): New.
* target-delegates.c: Regenerate.
* target.c (default_thread_address_space): Delete.
(memory_xfer_partial_1): Use current_inferior.
(target_detach): Use current_inferior.
(target_thread_address_space): Delete.
(generic_mourn_inferior): Use current_inferior.
* target.h (struct target_ops) <thread_address_space>: Delete.
(target_thread_address_space): Delete.
* thread.c (init_thread_list): Use ALL_THREADS_SAFE. Use thread
pointers directly.
(delete_thread_1, delete_thread, delete_thread_silent): Take a
thread pointer instead of a ptid_t. Adjust all callers.
(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_thread_of_process): Rename to ...
(any_thread_of_inferior): ... this, and take an inferior pointer.
(any_live_thread_of_process): Rename to ...
(any_live_thread_of_inferior): ... this, and take an inferior
pointer.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Take a thread pointer instead
of a ptid_t. Adjust all callers.
(thread_info::set_running): New.
(validate_registers_access): Use inferior_thread.
(can_access_registers_ptid): Rename to ...
(can_access_registers_thread): ... this, and take a thread
pointer.
(print_thread_info_1): Adjust to compare thread pointers instead
of ptids.
(switch_to_no_thread, switch_to_thread): Make extern.
(scoped_restore_current_thread::~scoped_restore_current_thread):
Use m_thread pointer directly.
(scoped_restore_current_thread::scoped_restore_current_thread):
Use inferior_thread.
(thread_command): Use thread pointer directly.
(thread_num_make_value_helper): Use inferior_thread.
* top.c (execute_command): Use inferior_thread.
* tui/tui-interp.c: Include "inferior.h".
* varobj.c (varobj_create): Use inferior_thread.
(value_of_root_1): Use find_thread_global_id instead of
global_thread_id_to_ptid.
Alan Hayward [Wed, 20 Jun 2018 08:31:37 +0000 (09:31 +0100)]
Avoid memcpys in regcache read_part/write_part for full registers.
Additionally, tidy up the functions: Remove asserts, use gdb_byte,
update comments.
gdb/
* regcache.c (readable_regcache::read_part): Avoid memcpy when
possible.
(regcache::write_part): Likewise.
(readable_regcache::cooked_read_part): Update comment.
(readable_regcache::cooked_write_part): Likewise.
* regcache.h: (readable_regcache::read_part): Likewise.
(regcache::write_part): Likewise.
Alan Modra [Wed, 20 Jun 2018 04:46:52 +0000 (14:16 +0930)]
Regen doc/Makefile.in
Also make the automake strictness "foreign". My regeneration of the
three doc/Makefile.in files already had --foreign in the automake
invocation, so this just makes it explicit.
bfd/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
binutils/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
gas/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
zlib/
* Makefile.in: Regenerate.
Richard Bunt [Thu, 21 Jun 2018 13:09:34 +0000 (14:09 +0100)]
Enable hardware watchpoints on attach for aarch64
This commit fixes a bug whereby hardware watchpoints are not used on
aarch64 when attaching to a target. The fix adds an aarch64 specialization
of post_attach which records the number of available hardware debug registers
using aarch64_linux_get_debug_reg_capacity. This implementation mirrors that
of aarch64_linux_child_post_startup_inferior which successfully enables the
use of hardware watchpoints when launching the target under the debugger.
gdb/ChangeLog:
* aarch64-linux-nat.c (post_attach): New.
(aarch64_linux_nat_target::post_attach): Override post_attach to
record the number of hardware debug registers.
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-hw-attach.c: New test.
* gdb.base/watchpoint-hw-attach.exp: New file.
Alan Hayward [Thu, 21 Jun 2018 08:37:58 +0000 (09:37 +0100)]
Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS
For sections that are not SHT_NOBITS, use sh_offset and p_offset instead of
sh_addr and p_vaddr when calculating if a section fits in a segment. Both
methods are valid when using the GNU linker.
include/
* elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check addresses
for non SHT_NOBITS.
Tom Tromey [Wed, 20 Jun 2018 21:35:04 +0000 (15:35 -0600)]
Fix a memory leak in py-param.c
Mark Wielaard pointed out this memory leak to me:
==17633== 775 bytes in 1 blocks are definitely lost in loss record 13,346 of 13,967
==17633== at 0x4C2DB6B: malloc (vg_replace_malloc.c:299)
==17633== by 0x6652B7: xmalloc (common-utils.c:45)
==17633== by 0xC4C889: xstrdup (xstrdup.c:34)
==17633== by 0x5A71FD: unicode_to_encoded_string(_object*, char const*) (py-utils.c:81)
==17633== by 0x5A73EB: python_string_to_host_string(_object*) (py-utils.c:158)
==17633== by 0x59CC6C: get_doc_string(_object*, _object*) (py-param.c:334)
==17633== by 0x59D2AA: parmpy_init(_object*, _object*, _object*) (py-param.c:728)
The bug here is that parmpy_init is written as though
add_setshow_generic takes ownership of its doc-string arguments.
However, it does not. This patch fixes the bug in a straightforward
way and also applies some missing constification to make the problem
more apparent.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-06-20 Tom Tromey <tom@tromey.com>
* python/py-param.c (add_setshow_generic): Make parameters const.
(parmpy_init): Update.
GDB Administrator [Thu, 21 Jun 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 20 Jun 2018 16:49:03 +0000 (12:49 -0400)]
Rename regcache_cooked_read_ftype and make a function_view
regcache_cooked_read_ftype can be converted to a function_view, which
allows us to use lambda functions and therefore avoid having to pass an
opaque pointer parameter.
Adjusting the fallouts showed that the "const regcache &" passed to the
readonly_detached_regcache constructor is cast to non-const in
do_cooked_read. I changed the constructor parameter to be non-const.
Finally, I renamed the typedef from regcache_cooked_read_ftype to
register_read_ftype, since there is nothing that forces us to use it
only for regcaches nor cooked registers.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_ftype): Rename to...
(register_read_ftype): ...this, change type to function_view.
(class reg_buffer) <save>: Remove src parameter.
(readonly_detached_regcache) <readonly_detached_regcache>: Make
parameter non-const in first overload. Remove src parameter in
second overload.
* regcache.c (do_cooked_read): Remove.
(readonly_detached_regcache::readonly_detached_regcache): Make
parameter non-const, adjust call to other constructor.
(reg_buffer::save): Remove src parameter.
* frame.c (do_frame_register_read): Remove.
(frame_save_as_regcache): Use lambda function.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Change type of src
parameter to ppu2spu_data *.
(ppu2spu_sniffer): Use lambda function.
Simon Marchi [Wed, 20 Jun 2018 16:46:28 +0000 (12:46 -0400)]
testsuite: Fix cc-with-tweaks.sh being executed in the wrong shell
The cc-with-tweaks.sh script needs to be executed with bash. When
trying to run this:
make check RUNTESTFLAGS="--target_board=dwarf4-gdb-index" TESTS="gdb.base/return.exp"
I get:
gdb compile failed, /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: 174: /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: Bad substitution
The reason is that the board files execute cc-with-tweaks.sh using
/bin/sh, which points to dash on my machine. Remove the /bin/sh part
and let the shebang choose the right interpreter.
gdb/testsuite/ChangeLog:
* boards/cc-with-tweaks.exp: Don't call cc-with-tweaks.sh
through /bin/sh.
* boards/dwarf4-gdb-index.exp: Likewise.
* boards/fission-dwp.exp: Likewise.
Simon Marchi [Wed, 20 Jun 2018 16:40:54 +0000 (12:40 -0400)]
Remove struct keyword in range-based for-loop
Fix this with gcc 6.3.0, and make the loop variable const while at it:
/home/simark/src/binutils-gdb/gdb/record-full.c: In member function 'virtual int record_full_target::insert_breakpoint(gdbarch*, bp_target_info*)':
/home/simark/src/binutils-gdb/gdb/record-full.c:1789:8: error: types may not be defined in a for-range-declaration [-Werror]
for (struct record_full_breakpoint &bp : record_full_breakpoints)
gdb/ChangeLog:
* record-full.c (record_full_target::insert_breakpoint): Remove
"struct" keyword, add const.
Nick Clifton [Wed, 20 Jun 2018 15:30:05 +0000 (16:30 +0100)]
Fix potential illegal memroy access when using a build-id note with a negative size.
PR 23316
* opncls.c (get_build_id): Check for a negative or excessive data
size in the build-id note.
Ulrich Weigand [Wed, 20 Jun 2018 14:24:16 +0000 (16:24 +0200)]
Improve gdb.base/float128.exp failure message
If the "print large128" sub-test fails in a manner that typically
indicates internal overflow due to GDB being built without MPFR
support, explicitly state this in the failure message.
gdb/testsuite/ChangeLog:
2018-06-20 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.base/float128.exp: Add comment and improved fail message
to the failure case of "print large128" test.
Renlin Li [Fri, 27 Apr 2018 09:48:18 +0000 (10:48 +0100)]
[BFD][AARCH64]Properly truncate no overflow checking relocation value for load/store immediate.
bfd/ChangeLog:
2018-06-20 Renlin Li <renlin.li@arm.com>
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use PG_OFFSET
to resolve BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
ld/ChangeLog:
2018-06-20 Renlin Li <renlin.li@arm.com>
* testsuite/ld-aarch64/emit-relocs-115.d: Update test with new value.
* testsuite/ld-aarch64/emit-relocs-534.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-555.d: Likewise.
Nick Clifton [Wed, 20 Jun 2018 11:38:10 +0000 (12:38 +0100)]
Change the ARM assembler's ADR and ADRl pseudo-ops so that they will only set the bottom bit of imported thumb function symbols if the -mthumb-interwork option is active.
For more information see the email thread starting here:
https://www.sourceware.org/ml/binutils/2018-05/msg00348.html
PR 21458
* tc-arm.c (do_adr): Only set the bottom bit of an imported thumb
function symbol address if -mthumb-interwork is active.
(do_adrl): Likewise.
* doc/c-arm.texi: Update descriptions of the -mthumb-interwork
option and the ADR and ADRL pseudo-ops.
* NEWS: Mention the new behaviour of the ADR and ADRL pseudo-ops.
* testsuite/gas/arm/pr21458.d: Add -mthumb-interwork option to
assembler command line.
* testsuite/gas/arm/adr.d: Likewise.
* testsuite/gas/arm/adrl.d: Likewise.
Nick Clifton [Wed, 20 Jun 2018 09:43:00 +0000 (10:43 +0100)]
Stop objcopy from corrupting mach-o files.
PR 23299
* mach-o.c (cputype): New function.
(cpusubtype): New function.
(bfd_mach_o_bfd_print_private_data): New function. Dispalys the
values in the MACH-O file header.
(bfd_mach_o_bfd_copy_private_header_data): Copy the cputype and
cpusubtype fields from the input bfd's mach-o header to the output
bfd.
* mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data):
Redefine to bfd_mach_o_bfd_print_private_data.
* mach-o.h (bfd_mach_o_bfd_print_private_bfd_data): Prototype.
Cary Coutant [Wed, 20 Jun 2018 08:24:11 +0000 (01:24 -0700)]
Fix problem where gold does not create base version for executables.
gold/
PR gold/23268
* dynobj.cc (Versions::Versions): Change init for needs_base_version_.
(Versions::record_version): Add verdefs for both shared objects and
executables.
(Versions::add_def): Likewise for base version.
(Versions::add_need): Don't add base version for executables.
(Versions::version_index): Look up version for both shared objects and
executables.
* testsuite/Makefile.am (ver_test_14): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ver_test_14.script: New version script.
* testsuite/ver_test_14.sh: New test script.
Sebastian Huber [Tue, 19 Jun 2018 05:12:48 +0000 (07:12 +0200)]
RISC-V: Accept constant operands in la and lla
opcodes/
PR gas/23305
* riscv-opc.c (riscv_opcodes): Use new format specifier 'B' for
la and lla.
gas/
PR gas/23305
* config/tc-riscv.c (riscv_ip): Add format specifier 'B' for
constants and symbols.
* testsuite/gas/riscv/lla32.d: New file.
* testsuite/gas/riscv/lla32.s: Likewise.
* testsuite/gas/riscv/lla64-fail.d: Likewise.
* testsuite/gas/riscv/lla64-fail.l: Likewise.
* testsuite/gas/riscv/lla64-fail.s: Likewise.
* testsuite/gas/riscv/lla64.d: Likewise.
* testsuite/gas/riscv/lla64.s: Likewise.
Cary Coutant [Wed, 20 Jun 2018 02:03:25 +0000 (19:03 -0700)]
Fix typo in most recent entry.
Cary Coutant [Wed, 20 Jun 2018 01:57:28 +0000 (18:57 -0700)]
Replace thread config with automatic config using ax_pthread.m4.
The autotools library macro (AX_PTHREAD) is now used to detect if
pthreads is present and multi-threaded linking in gold is automatically
enabled if it is found. This enables multi-threaded gold on platforms
where pthreads is enabled via other methods than just -lpthread
(e.g., MinGW).
2018-06-19 Joshua Watt <jpewhacker@gmail.com>
Cary Coutant <ccoutant@gmail.com>
gold/
* configure.ac: Replace manual thread configuration with AX_PTHREAD.
Add --enable-threads=auto.
* Makefile.am (THREADFLAGS, THREADLIBS): New defines.
(AM_CFLAGS, AM_CXXFLAGS): Add $(THREADFLAGS.
(THREADSLIB): Remove; change all references to THREADLIBS.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.am (THREADSLIB): Replace with...
(THREADFLAGS, THREADLIBS): ... these.
(LDADD): Remove; add as individual defines for...
(object_unittest, binary_unittest, leb128_unittest)
(overflow_unittest): ... these tests.
(tls_test, tls_pic_test, tls_pie_test, tls_pie_pic_test)
(tls_shared_test, tls_shared_ie_test, tls_shared_gd_to_ie_test)
(tls_shared_gnu2_gd_to_ie_test, tls_shared_gnu2_test_LDFLAGS)
(tls_shared_nonpic_test_LDFLAGS): Add $(THREADFLAGS) and ($THREADLIBS).
* testsuite/Makefile.in: Regenerate.
Cary Coutant [Tue, 19 Jun 2018 23:52:54 +0000 (16:52 -0700)]
Remove *.stderr when "make clean".
gold/
* testsuite/Makefile.am (MOSTLYCLEANFILES): Add *.stderr.
* testsuite/Makefile.in: Regenerate.
GDB Administrator [Wed, 20 Jun 2018 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in