H.J. Lu [Thu, 17 Jun 2021 17:32:27 +0000 (10:32 -0700)]
x86-64: Use $NOPIE_LDFLAGS/$NOPIE_CFLAGS on protected-func-1
PR ld/27973
* testsuite/ld-x86-64/x86-64.exp: Pass $NOPIE_LDFLAGS and
$NOPIE_CFLAGS to protected-func-1 without PIE.
H.J. Lu [Thu, 17 Jun 2021 17:19:29 +0000 (10:19 -0700)]
x86-64: Test protected function pointers
On x86-64, function pointers in executable for external funtions may be
resolved to their PLT entries in executable. If it happens, function
pointers of protected funtions in shared libraries must be resolved to
the PLT entries in executable, not addresses of protected funtions in
shared libraries.
PR ld/27973
* testsuite/ld-x86-64/x86-64.exp: Run protected function tests.
* testsuite/ld-x86-64/protected-func-1.h: New file.
* testsuite/ld-x86-64/protected-func-1a.s: Likewise.
* testsuite/ld-x86-64/protected-func-1b.c: Likewise.
Fangrui Song [Thu, 17 Jun 2021 17:18:28 +0000 (10:18 -0700)]
ld: Add ChangeLog entry for -no-pie
Fangrui Song [Thu, 17 Jun 2021 16:57:40 +0000 (09:57 -0700)]
ld: Add -no-pie
gold has had this option for many years. Not having this option caused
some confusion to users. The help message clarifies the default state.
ld/
* ldlex.h (enum option_values): Add OPTION_NO_PIE.
* lexsup.c (struct ld_options): Add -no-pie.
(parse_args): Handle -no-pie.
* ld.texi: Document -no-pie.
Pedro Alves [Thu, 17 Jun 2021 15:16:55 +0000 (16:16 +0100)]
Add a unit test for scoped_ignore_sigpipe
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* Makefile.in (SELFTESTS_SRCS): Add
unittests/scoped_ignore_signal-selftests.c.
* unittests/scoped_ignore_signal-selftests.c: New.
Change-Id: Idce24aa9432a3f1eb7065bc9aa030b1d0d7dcad5
Pedro Alves [Thu, 17 Jun 2021 15:16:55 +0000 (16:16 +0100)]
scoped_ignore_signal: Use sigprocmask+sigtimedwait instead of signal
The problem with using signal(...) to temporarily ignore a signal, is
that that changes the the signal disposition for the whole process.
If multiple threads do it at the same time, you have a race.
Fix this by using sigprocmask + sigtimedwait to implement the ignoring
instead, if available, which I think probably means everywhere except
Windows nowadays. This way, we only change the signal mask for the
current thread, so there's no race.
Change-Id: Idfe3fb08327ef8cae926f3de9ee81c56a83b1738
gdbsupport/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* scoped_ignore_signal.h
(scoped_ignore_signal::scoped_ignore_signal)
[HAVE_SIGPROCMASK]: Use sigprocmask to block the signal instead of
changing the signal disposition for the whole process.
(scoped_ignore_signal::~scoped_ignore_signal) [HAVE_SIGPROCMASK]:
Use sigtimedwait and sigprocmask to flush and unblock the signal.
Pedro Alves [Thu, 17 Jun 2021 15:16:54 +0000 (16:16 +0100)]
Introduce scoped_restore_signal
We currently have scoped_restore_sigttou and scoped_restore_sigpipe
doing basically the same thing -- temporarily ignoring a specific
signal.
This patch introduce a scoped_restore_signal type that can be used for
both. This will become more important for the next patch which
changes how the signal-ignoring is implemented.
scoped_restore_sigpipe is a straight alias to
scoped_restore_signal<SIGPIPE> on systems that define SIGPIPE, and an
alias to scoped_restore_signal_nop (a no-op version of
scoped_restore_signal) otherwise.
scoped_restore_sigttou is not a straight alias because it wants to
check the job_control global.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* gdbsupport/scoped_ignore_signal.h: New.
* compile/compile.c: Include gdbsupport/scoped_ignore_signal.h
instead of <signal.h>. Don't include <unistd.h>.
(scoped_ignore_sigpipe): Remove.
* gdbsupport/scoped_ignore_sigttou.h: Include gdbsupport/scoped_ignore_signal.h
instead of <signal.h>. Don't include <unistd.h>.
(lazy_init): New.
(scoped_ignore_sigttou): Reimplement using scoped_ignore_signal
and lazy_init.
Change-Id: Ibb44d0bd705e96df03ef0787c77358a4a7b7086c
Pedro Alves [Thu, 17 Jun 2021 15:16:54 +0000 (16:16 +0100)]
Move scoped_ignore_sigttou to gdbsupport/
A following patch will want to use scoped_ignore_sigttou in code
shared between GDB and GDBserver. Move it under gdbsupport/.
Note that despite what inflow.h/inflow.c's first line says, inflow.c
is no longer about ptrace, it is about terminal management. Some
other files were unnecessarily including inflow.h, I guess a leftover
from the days when inflow.c really was about ptrace. Those inclusions
are simply dropped.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* Makefile.in (HFILES_NO_SRCDIR): Remove inflow.h.
* inf-ptrace.c, inflow.c, procfs.c: Don't include "inflow.h".
* inflow.h: Delete, moved to gdbsupport/ under a different name.
* ser-unix.c: Don't include "inflow.h". Include
"gdbsupport/scoped_ignore_sigttou.h".
gdbsupport/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* scoped_ignore_sigttou.h: New file, moved from gdb/ and renamed.
Change-Id: Ie390abf42c3a78bec6d282ad2a63edd3e623559a
Nick Clifton [Thu, 17 Jun 2021 15:19:20 +0000 (16:19 +0100)]
Fix an assertion failure in the AArch64 assembler triggered by incorrect instruction syntax.
PR 27904
* config/tc-aarch64.c (ldst_lo12_determine_real_reloc_type):
Generate a syntax error message if the reloc qualifier does not
match the instruction's size.
Clément Chigot [Tue, 15 Jun 2021 09:06:52 +0000 (11:06 +0200)]
gas: handle csect in bss section for XCOFF
Latest gcc versions are now generating csects instead of .lcomm
for bss symbols.
Some adjustements are needed in order to handle them.
* config/tc-ppc.c (md_begin): Create bss section with dummy
symbol.
(ppc_frob_symbol): Output XTY_CM for bss csects.
(ppc_fix_adjustable): Adjust condition to avoid bss csects.
Simon Marchi [Thu, 17 Jun 2021 13:41:59 +0000 (09:41 -0400)]
gdb/testsuite: gdb.base/args.exp: add KFAIL for native-extended-gdbserver
This test tests passing arguments made of exactly two single-quotes
('') or a single newline character through the --args argument of GDB.
For some reason, GDB adds some extra single quotes when transmitting the
arguments to GDBserver. This produces some FAILs when testing with the
native-extended-gdbserver board:
FAIL: gdb.base/args.exp: argv[2] for one empty (with single quotes)
FAIL: gdb.base/args.exp: argv[2] for two empty (with single quotes)
FAIL: gdb.base/args.exp: argv[3] for two empty (with single quotes)
FAIL: gdb.base/args.exp: argv[2] for one newline
FAIL: gdb.base/args.exp: argv[2] for two newlines
FAIL: gdb.base/args.exp: argv[3] for two newlines
This is documented as PR 27989. Add some appropriate KFAILs.
gdb/testsuite/ChangeLog:
* gdb.base/args.exp: Check target, KFAIL if remote.
(args_test): Add parameter and use it.
Change-Id: I49225d1c7df7ebaba480ebdd596df80f8fbf62f0
Simon Marchi [Thu, 17 Jun 2021 13:41:58 +0000 (09:41 -0400)]
gdb/testsuite: gdb.base/args.exp: remove trailing parenthesis in test names
Some test names end with a parenthesis, we don't want that:
https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages
Fix that.
gdb/testsuite/ChangeLog:
* gdb.base/args.exp: Remove trailing parenthesis in test names.
Change-Id: I0306ea202bae3a4ed5bf0bd65e0ab5ed5de52fe1
Simon Marchi [Thu, 17 Jun 2021 13:41:58 +0000 (09:41 -0400)]
gdb/testsuite: gdb.base/args.exp: use $old_gdbflags last two tests
All tests in this file append to GDBFLAGS instead of overwriting it,
except the last two. I noticed because when testing with the
native-extended-remote board, it removes the "set sysroot" argument, and
it causes the test to be very long to run, due to big glibc debug info
being read through the remote target.
I think this oddity is due to a race condition between these two
commits:
[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=
c22261528c50f7760dd6a2e29314662b377eebb4
[2] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=
6b8ce727297b1e40738e50f83a75881b290fe6a6
The first one added the two tests. The second one changes the test to
append to GDBFLAGS instead of overwriting it. But the second one was
probably written before the first one was it, so missed the new tests.
Change those two tests to be like the others.
gdb/testsuite/ChangeLog:
* gdb.base/args.exp: Use $old_gdbflags in all tests.
Change-Id: I531276125ecb70e80f52adbd320ebb85b0c8eba0
Simon Marchi [Thu, 17 Jun 2021 13:41:58 +0000 (09:41 -0400)]
gdb/testsuite: gdb.base/args.exp: use save_vars
Use save_vars instead of manually saving/restoring. This ensures that
if anything throws an error, GDBFLAGS will be correctly restored.
Remove the global GDBFLAGS declaration at the top, it's not necessary.
gdb/testsuite/ChangeLog:
* gdb.base/args.exp: Use save_vars.
Change-Id: I3a45e4fc1635ec0212de2415040f91eecaf4a057
Pedro Alves [Thu, 17 Jun 2021 10:57:56 +0000 (11:57 +0100)]
Make the TUI command window support the mouse
Currently, when the focus is on the command window, we disable the
keypad. This means that when the command window has the focus, keys
such as up/down/home/end etc. are not processed by curses, and their
escape sequences go straight to readline.
A side effect of disabling keypad mode is that wgetch no longer
processes mouse escape sequences, with the end result being the mouse
doesn't work, and worse, the raw mouse escape sequences are printed on
the terminal.
This commit makes the TUI command window support the mouse as well, by
always enabling the keypad, and then to avoid losing support for
up/down browsing the command history, home/end/left/right moving the
cursor position, etc., we forward those keys as raw escape sequences
to readline. Note we don't make an effort to pass down to readline
all keys returned by curses, only the common ones that readline
understands by default. Given users can specify their own readline
bindings (inputrc file, bind utility), this approach is good in
practice, though not 100% transparent or perfect.
Note that the patch makes it so that CTLC-L is always passed to
readline even if the command window does not have the focus. It was
simpler to implement that way, and it just seems correct to me. I
don't know of a reason we shouldn't do that.
The patch improves the TUI behavior in a related way. Now we can pass
special keys to readline irrespective of which window has the focus.
First, we try to dispatch the key to a window, via
tui_displatch_ctrl_char. If the key is dispatched, then we don't pass
it to readline. E.g., pressing "up" when you have the source window
in focus results in scrolling the source window, and nothing else. If
however, you press ctrl-del instead, that results in killing the next
word in the command window, no matter which window has has focus.
Before, it would only work if you had the command window in focus.
Similarly, ctrl-left/ctrl-right to move between words, etc.
Similarly, the previous spot where we handled mouse events was
incorrect. It was never reached if the window with focus can't
scroll, which is the case for the command window. Mouse scrolling
affects the window under the mouse cursor, not the window in focus.
We now always try to dispatch mouse events.
One last bit in the patch -- now if we don't recognize the non-8-bit
curses key, then we don't pass it down to readline at all. Before
that would result in bogus characters in the input line.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* tui/tui-io.c (tui_dispatch_mouse_event): New, factored out from
...
(tui_dispatch_ctrl_char): ... this. Move CTRL-L handling to
tui_getc_1.
(cur_seq, start_sequence): New.
(tui_getc_1): Pass key escape sequences for curses control keys to
readline. Handle mouse and ctrl-l here.
(tui_resize_all): Disable/reenable the keypad if the command
window has the focus too.
* tui/tui-win.c (tui_set_focus_command): Don't change keypad
setting.
* tui/tui.c (tui_rl_other_window): Don't change keypad setting.
Change-Id: Ie0a7d849943cfb47f4a6589e1c73341563740fa9
Clément Chigot [Mon, 14 Jun 2021 11:25:42 +0000 (13:25 +0200)]
gas: ensure sections contents is zero for BFD_RELOC_PPC*_TLSM on XCOFF.
AIX ld expects the section contents for relocations BFD_RELOC_PPC_TLSM
or BFD_RELOC_PPC64_TLSM to be zero.
Actually, it seems to be the case for all the TLS relocations
generated by AIX assembly but only these two are mandatory.
* config/tc-ppc.c (md_apply_fix): Adjust addend to nullify
section contents for BFD_RELOC_PPC_TLSM or
BFD_RELOC_PPC64_TLSM.
* testsuite/gas/ppc/xcoff-tlsm-32.d: New test.
* testsuite/gas/ppc/xcoff-tlsm-64.d: New test.
* testsuite/gas/ppc/xcoff-tlsm.s: New test.
* testsuite/gas/ppc/aix.exp: Run new tests.
Alan Modra [Wed, 16 Jun 2021 07:05:53 +0000 (16:35 +0930)]
powerpc: move cell "or rx,rx,rx" hints
* ppc-opc.c (powerpc_opcodes): Move cell db*cyc to proper location
in table.
Mike Frysinger [Thu, 17 Jun 2021 04:12:15 +0000 (00:12 -0400)]
sim: mn10300: tweak static inlines
Use INLINE2 instead of INLINE to fix builds when -O0 are used -- the
latter define is omitted at -O0 levels while the former is always
set to inline. These helper funcs are used by defines in here but
the defines aren't always called.
Mike Frysinger [Mon, 14 Jun 2021 02:14:40 +0000 (22:14 -0400)]
sim: split sim/callback.h include out
The sim-basics.h is too big and includes too many things. This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.
Start with splitting out sim/callback.h.
GDB Administrator [Thu, 17 Jun 2021 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 16 Jun 2021 15:55:53 +0000 (11:55 -0400)]
sim: make some rules silent by default in Make-common.in
Use GDB's silent-rules.mk to make some rules silent by default. These
rules cover most of what is built in sim/.
gdb/ChangeLog:
* silent-rules.mk (ECHO_CCLD, ECHO_AR, ECHO_RANLIB): New.
sim/ChangeLog:
* common/Make-common.in (COMPILE, libsim.a, run$(EXEEXT),
gentmap.o, gentmap): Make rules silent.
Change-Id: Idf9ba5beaee10c7c614859ace5fbdcd1de0287db
Felix Willgerodt [Wed, 16 Jun 2021 13:31:23 +0000 (15:31 +0200)]
gdb, doc: Fix missed ChangeLog entry.
My previous commit "btrace, doc: Clarify record function-call-history
documentation." didn't add this to the actual ChangeLog file. Fix that.
Felix Willgerodt [Wed, 16 Jun 2021 11:06:11 +0000 (13:06 +0200)]
btrace, doc: Clarify record function-call-history documentation.
The documentation for 'record function-call-history' mentions lines instead
of functions when talking about the number of functions printed, as currently
there is only one line printed per function. Yet the code actually handles
this on function granularity not on line basis. Future patches will
extend the number of lines printed per function. This also makes it
consistent with the 'record instruction-history' command, where multiple
lines can be printed per instruction.
gdb/doc/ChangeLog:
2021-06-16 Felix Willgerodt <felix.willgerodt@intel.com>
* gdb.texinfo (Process Record and Replay): Stop mentioning lines
for "record function-call-history" and
"set record function-call-history-size".
Tom de Vries [Wed, 16 Jun 2021 10:44:30 +0000 (12:44 +0200)]
[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder(), again
This is another attempt at fixing the problem described in commit
4cf88725da1
"[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()", which was
reverted in commit
3db19b2d724.
First off, some context.
A DWARF CU can be viewed as a symbol table: toplevel children of a CU DIE
represent symbol table entries for that CU. Furthermore, there is a
hierarchy: a symbol table entry such as a function itself has a symbol table
containing parameters and local variables.
The dwarf reader maintains a notion of current symbol table (that is: the
symbol table a new symbol needs to be entered into) in dwarf2_cu member
list_in_scope.
A problem then presents itself when reading inter-CU references:
- a new symbol read from a CU B needs to be entered into the symbol table of
another CU A.
- the notion of current symbol table is tracked on a per-CU basis.
This is addressed in inherit_abstract_dies by temporarily overwriting the
list_in_scope for CU B with the one for CU A.
The current symbol table is one aspect of the current dwarf reader context
that is tracked, but there are more, f.i. ones that are tracked via the
dwarf2_cu member m_builder, f.i. m_builder->m_local_using_directives.
A similar problem exists in relation to inter-CU references, but a different
solution was chosen:
- to keep track of an ancestor field in dwarf2_cu, which is updated
when traversing inter-CU references, and
- to use the ancestor field in dwarf2_cu::get_builder to return the m_builder
in scope.
There is no actual concept of a CU having an ancestor, it just marks the most
recent CU from which a CU was inter-CU-referenced. Consequently, when
following inter-CU references from a CU A to another CU B and back to CU A,
the ancestors form a cycle, which causes dwarf2_cu::get_builder to hang or
segfault, as reported in PR26327.
ISTM that the ancestor implementation is confusing and fragile, and should
go. Furthermore, it seems that keeping track of the m_builder in scope can be
handled simply with a per-objfile variable.
Fix the hang / segfault by:
- keeping track of the m_builder in scope using a new variable
per_obj->sym_cu, and
- using it in dwarf2_cu::get_builder.
Tested on x86_64-linux (openSUSE Leap 15.2), no regressions for config:
- using default gcc version 7.5.0
(with 5 unexpected FAILs)
- gcc 10.3.0 and target board
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects
(with 1000 unexpected FAILs)
gdb/ChangeLog:
2021-06-16 Tom de Vries <tdevries@suse.de>
PR symtab/26327
* dwarf2/cu.h (dwarf2_cu::ancestor): Remove.
(dwarf2_cu::get_builder): Declare and move ...
* dwarf2/cu.c (dwarf2_cu::get_builder): ... here. Use sym_cu instead
of ancestor. Assert return value is non-null.
* dwarf2/read.c (read_file_scope): Set per_objfile->sym_cu.
(follow_die_offset, follow_die_sig_1): Remove setting of ancestor.
(dwarf2_per_objfile): Add sym_cu field.
Jan Beulich [Wed, 16 Jun 2021 06:55:52 +0000 (08:55 +0200)]
gas: fix hex float parsing from .dcb.? directives
Unlike for .dc.? the parsing here failed to skip the colon before
calling hex_float(). To avoid both variants of parsing going out of sync
again, introduce a helper used by both.
Jan Beulich [Wed, 16 Jun 2021 06:55:20 +0000 (08:55 +0200)]
gas: fix overflow diagnostics
While the logic in fixup_segment() so far was off by 1 for fixups
dealing with quantities without known signedness, thus failing to report
an overflow when e.g. a byte-sized resulting value is -0x100, the logic
in emit_expr_with_reloc() reported an overflow even on large negative
values when the respective positive ones would not be warned
about, and when fixup_segment() wouldn't do so either. Such diagnostics
all ought to follow a similar pattern of what value range is acceptable.
(If expressions' X_unsigned was reliably set, emit_expr_with_reloc()'s
checking might make sense to tighten based on that flag.)
Note that with commit
80aab57939a0 ("Changes to let cons handle bignums
like general expressions") having added handling of nbytes >
sizeof(valueT) in the O_constant case, converting to O_big, the setting
to zero of "hibit" had become dead. With "hibit" no longer used, this
code now gets dropped altogether. But additionally a respective know()
gets inserted.
Mike Frysinger [Tue, 15 Jun 2021 05:09:49 +0000 (01:09 -0400)]
sim: mips: add printf attribute to trace func
This helps catch format errors in code, although they're all clean
at this point already.
Mike Frysinger [Tue, 15 Jun 2021 04:41:22 +0000 (00:41 -0400)]
sim: mips: rework dynamic printf logic to avoid compiler warnings
The compiler doesn't like passing non-constant strings to printf
functions, so tweak the code to always pass one in. This code is
a little more verbose, but it's probably the same performance.
The macro usage is a bit ugly, but maybe less than copying &
pasting the extended conditional format logic.
Mike Frysinger [Tue, 15 Jun 2021 04:40:17 +0000 (00:40 -0400)]
sim: mips: tweak buffer sign
This model uses unsigned char buffers, but this temporary pointer is
declared as signed. Switch it to unsigned since it's just a temporary
variable to hold the new pointer.
Mike Frysinger [Tue, 15 Jun 2021 04:39:28 +0000 (00:39 -0400)]
sim: mips: fix uninitialized register use
In the default case, this code will read from this variable before
it is initialized as a dummy access. Set it to 0 to fix the compiler
warning.
Mike Frysinger [Wed, 16 Jun 2021 02:48:50 +0000 (22:48 -0400)]
sim: drop obsolete AC_EXEEXT call
The current autoconf 2.69 defines this to nothing because the logic
in AC_PROG_CC takes care of it all the time now. Delete the call.
Mike Frysinger [Wed, 16 Jun 2021 01:17:55 +0000 (21:17 -0400)]
sim: ppc: use common sim-assert setting
The common sim code already sets this up for us, so no need to
duplicate the logic.
Mike Frysinger [Wed, 16 Jun 2021 00:58:31 +0000 (20:58 -0400)]
sim: ppc: convert to bfd_endian
Rather than re-invent endian defines, as well as maintain our own list
of OS & arch-specific includes, punt all that logic in favor of the bfd
ones already set up and maintained elsewhere. We already rely on the
bfd library, so leveraging the endian aspect should be fine.
This was done for all the other ports years ago, so catch ppc up.
Mike Frysinger [Wed, 16 Jun 2021 00:50:16 +0000 (20:50 -0400)]
sim: ppc: replace local __attribute__ fallback
The common ansidecl.h provides fallbacks for these so we don't need to.
Mike Frysinger [Wed, 16 Jun 2021 00:46:10 +0000 (20:46 -0400)]
sim: ppc: use common ATTRIBUTE_PRINTF macros
Use the common ansidecl.h macros to replace our ad-hoc printf attributes.
Mike Frysinger [Wed, 16 Jun 2021 00:43:22 +0000 (20:43 -0400)]
sim: ppc: use common ATTRIBUTE_PACKED macro
Drop local packed attribute with the common ansidecl.h define.
Mike Frysinger [Wed, 16 Jun 2021 00:40:31 +0000 (20:40 -0400)]
sim: ppc: replace local NORETURN macros with common one
Drop local NORETURN macro with the common ansidecl.h ATTRIBUTE_NORETURN define.
Mike Frysinger [Wed, 16 Jun 2021 00:38:45 +0000 (20:38 -0400)]
sim: ppc: replace local UNUSED macros with common one
Drop local UNUSED macro with the common ansidecl.h ATTRIBUTE_UNUSED define.
Mike Frysinger [Wed, 16 Jun 2021 00:35:37 +0000 (20:35 -0400)]
sim: ppc: replace local CONCAT macros with common ones
Drop local copies of CONCAT macros that the common ansidecl.h provides.
Mike Frysinger [Wed, 16 Jun 2021 00:28:35 +0000 (20:28 -0400)]
sim: ppc: change bool variable name to boolean
This is a reserved type with stdbool.h.
Mike Frysinger [Wed, 16 Jun 2021 00:20:11 +0000 (20:20 -0400)]
sim: ppc: drop host endian configure option
The --enable-sim-hostendian flag was purely so people had an escape route
for when cross-compiling. This is because historically, AC_C_BIGENDIAN
did not work in those cases. That was fixed a while ago though, so we can
require that macro everywhere now and simplify a good bit of code.
This was done for all the other ports years ago, so catch ppc up.
Mike Frysinger [Tue, 15 Jun 2021 04:00:29 +0000 (00:00 -0400)]
sim: mips: fix format warnings when setting up memory
The majority of these inputs are not long's, so don't use %lx.
This fixes compiler warnings about type mismatches.
Mike Frysinger [Sun, 13 Jun 2021 05:54:48 +0000 (01:54 -0400)]
sim: drop arch-specific config.h
All of the settings in here are handled by the common top-level
config.h, so drop the individual arch-config.h files entirely.
This will also help guarantee that we don't add any new arch
specific defines that would affect common code which will help
with the effort of unifying them.
Mike Frysinger [Sun, 13 Jun 2021 05:52:01 +0000 (01:52 -0400)]
sim: move dv-sockser define to CPPFLAGS
This is the only define left in m4/ that is not in the common config.h,
so move it to sim_hw_cflags so we can drop the arch-specific config.h.
GDB Administrator [Wed, 16 Jun 2021 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Tue, 15 Jun 2021 00:38:52 +0000 (20:38 -0400)]
sim: switch modules.c & version.c to stamp files
This fixes remaking of these files and avoids unnecessary rebuilds.
Also add both to `make clean` to match other stamp files.
Carl Love [Tue, 15 Jun 2021 18:40:11 +0000 (13:40 -0500)]
Fix typo in vsx-regs.exp test
gdb/ChangeLog
2021-06-15 Carl Love <cel@us.ibm.com>
* testsuite/gdb.arch/vsx-regs.exp (gdb_test_no_output): Fix typo
in set \$vs$i.v2_double.
Nick Clifton [Tue, 15 Jun 2021 10:43:43 +0000 (11:43 +0100)]
Allow readelf to recognise GO buildid notes.
binutils * readelf.c (get_note_type): Add support for NT_GO_BUILDID.
include * elf/common.h (NT_GO_BUILDID): Define.
Jan Beulich [Tue, 15 Jun 2021 06:01:12 +0000 (08:01 +0200)]
x86: bring "gas --help" output for --32 etc in sync with reality
The testsuite uses the output to determine whether BFD64 is in effect.
--x32 is supported for ELF only; don't advertise it for PE/COFF. --64 is
also supported for Mach-O; advertise it. Adjust the testsuite's BFD64
check accordingly.
Also replace "code" by "object", since it's the object format that the
options primarily control. It's also _initial_ code bitness, but this
can be changed by directives.
Jan Beulich [Tue, 15 Jun 2021 06:00:45 +0000 (08:00 +0200)]
x86: simplify .dispNN setting
First of all eliminate the disp{16,32,32s} static variables, which are
used solely for setting a temporary variable in build_modrm_byte(). The
effect there can be had without use of such a temporary and without
operand_type_or(), by just setting the single bit each that needs
setting.
Then use operand_type_and_not(..., anydisp) when all dispNN bits want
clearing together.
Jan Beulich [Tue, 15 Jun 2021 06:00:17 +0000 (08:00 +0200)]
x86: slightly simplify offset_in_range()
Applying a mask with all bits set (or its inverse, with hence all bits
clear) won't alter the result (or won't trigger the warning). Re-arrange
the code to eliminate two more of the somewhat odd (2 << width_minus_1)
constructs.
Jan Beulich [Tue, 15 Jun 2021 05:59:44 +0000 (07:59 +0200)]
x86: harmonize disp with imm handling
Certain disp values may trigger "... shortened to ..." warnings when
equivalent imm ones don't. In some of the cases there are also
differences (for non-64-bit code) between BFD64 and !BFD64 builds. The
resulting encodings (i.e. use [or not] of the shorter disp8 / imm8
forms) are also different in some cases. Make this handling consistent.
Note that using equivalent 16-bit mode displacements / immediates
continues to expose entirely different behavior (see the disp-imm-16
testcase added by an earlier patch). This may want to be the subject of
further changes, but it'll then quickly become obvious that e.g. keying
use of extend_to_32bit_address() to non-64-bit mode isn't appropriate
either: Once we allow wrapping operands, we would better do so
consistently, in which case all of this would need to become dependent
upon address or operand size instead of mode.
Jan Beulich [Tue, 15 Jun 2021 05:58:57 +0000 (07:58 +0200)]
x86: make offset_in_range()'s warning contents useful (again)
In case there is something which gets shortened (perhaps only on a BFD64
build targeting a 32-bit binary), seeing the full original value is
often helpful to understand what's actually going wrong. Of course for
non-64-bit binaries we better wouldn't be seeing such warnings at all,
as they're often indicative of a behavioral difference between BFD64 and
!BFD64 builds.
Prior to "gas: drop sprint_value()", which introduced the use of
bfd_sprintf_vma(), the output had other shortcomings.
Jan Beulich [Tue, 15 Jun 2021 05:58:18 +0000 (07:58 +0200)]
x86: off-by-1 in offset_in_range()
Just like e.g. 0x10000 triggers a warning for size 2, -0x10000 ought to
as well.
Note that some of the encodings produced aren't ones one would expect,
and hence the generated code is not being checked for in the new
testcases.
Jan Beulich [Tue, 15 Jun 2021 05:57:11 +0000 (07:57 +0200)]
x86: permit parenthesized expressions again as addressing scale factor
The description of
e68c3d59acd0 ("x86: better respect quotes in
parse_operands()") wrongly states:
"In i386_att_operand(), which needs adjustment to remain in sync, besides
respecting double quotes now, also change the logic such that we don't
count parentheses anymore: Finding any opening or closing parenthesis or
any double quote means we're done, because the subsequent parsing code
wouldn't accept (extra) instances of these anyway."
I didn't pay attention to the possibility of the scale factor being
specified as an expression, which may contain parentheses. Thanks to
Martin for pointing this out. Restore prior behavior or matching
parentheses (backwards), while giving the variable a more suitable name.
Note that this simple and immediate fix is not ging to be enough: This
expression could itself involve quoted symbols. However, to address this
backwards parsing needs to be done away with altogether here (such that
parentheses which are part of such a quoted symbol name can also
properly be accounted for), which is going to be a more intrusive
change.
Alan Modra [Fri, 11 Jun 2021 04:53:57 +0000 (14:23 +0930)]
readelf: report DF_1_PIE as "Position-Independent Executable"
I finally found time to teach readelf to identify PIEs in the file
header display and program header display. So in place of
"DYN (Shared object file)" which isn't completely true, show
"DYN (Position-Independent Executable file)".
It requires a little bit of untangling code in readelf due to
process_program_headers setting up dynamic_addr and dynamic_size,
needed to scan .dynamic for the DT_FLAGS_1 entry, and
process_program_headers itself wanting to display the file type in
some cases. At first I modified process_program_header using a
"probe" parameter similar to get_section_headers in order to inhibit
output, but decided it was cleaner to separate out
locate_dynamic_sections.
binutils/
* readelf.c (locate_dynamic_section, is_pie): New functions.
(get_file_type): Replace e_type parameter with filedata. Call
is_pie for ET_DYN. Update all callers.
(process_program_headers): Use local variables dynamic_addr and
dynamic_size, updating filedata on exit from function. Set
dynamic_size of 1 to indicate no dynamic section or segment.
Update tests of dynamic_size throughout.
* testsuite/binutils-all/x86-64/pr27708.dump: Update expected output.
ld/
* testsuite/ld-pie/vaddr-0.d: Update expected output.
gdb/
* testsuite/lib/gdb.exp (exec_is_pie): Match new PIE readelf output.
Mike Frysinger [Tue, 15 Jun 2021 03:45:42 +0000 (23:45 -0400)]
sim: mn10300: enable -Werror
Now that all warnings are fixed in this port, enable -Werror by default.
Mike Frysinger [Tue, 15 Jun 2021 03:44:48 +0000 (23:44 -0400)]
sim: mn10300: switch abort to sim_engine_abort
This allows the caller to catch engine aborts if they want, and fixes
the warning about missing stdlib.h include by not using abort().
Mike Frysinger [Tue, 15 Jun 2021 03:25:01 +0000 (23:25 -0400)]
sim: erc32: fix build w/out F_{G,S}ETFL
Add conditional logic around fcntl.h F_{G,S}ETFL usage to fix builds
on systems that don't have it (e.g. Windows). The code is only used
to save & restore limited terminal stdin state.
Mike Frysinger [Tue, 15 Jun 2021 03:23:19 +0000 (23:23 -0400)]
sim: erc32: fix build w/out termios.h
Add conditional logic around termios.h usage to fix builds on systems
that don't have it (e.g. Windows).
Mike Frysinger [Tue, 15 Jun 2021 03:16:49 +0000 (23:16 -0400)]
sim: drop redundant SIM_AC_OPTION_WARNINGS
The common code already calls this, so no need to do so in arch dirs.
We leave the calls that disable -Werror. This will help unify the
configure scripts.
Mike Frysinger [Mon, 14 Jun 2021 23:54:04 +0000 (19:54 -0400)]
sim: enable silent rules in common builds
We only do the common code as automake simplifies the logic.
GDB Administrator [Tue, 15 Jun 2021 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Tue, 8 Jun 2021 22:04:28 +0000 (18:04 -0400)]
gnulib: define the path to gnulib's parent dir
The current setting assumes that gnulib is only used by dirs
immediately under the source root. Trying to build it two or
more levels deep fails. Switch GNULIB_BUILDDIR to a relative
GNULIB_PARENT_DIR so that it can be used to construct both the
build & source paths.
John Baldwin [Mon, 14 Jun 2021 21:28:26 +0000 (14:28 -0700)]
fbsd nat: Disable address space randomization when requested.
Use procctl(2) with PROC_ASLR_CTL to disable address space
randomization in the current gdb process before forking a child
process for a new inferior when address space randomization is
disabled.
gdb/ChangeLog:
* configure.ac: Check for <sys/procctl.h>.
* config.in, configure: Regenerate.
* fbsd-nat.c: Include <sys/procctl.h> if present.
[PROC_ASLR_CTL] (maybe_disable_address_space_randomization): New.
(fbsd_nat_target::create_inferior)
(fbsd_nat_target::supports_disable_randomization): New.
* fbsd-nat.h (fbsd_nat_target::create_inferior)
(fbsd_nat_target::supports_disable_randomization): New.
Pedro Alves [Mon, 14 Jun 2021 20:29:32 +0000 (21:29 +0100)]
Fix silent gdb.base/annota1.exp test coverage regression
This commit fixes a test coverage regression caused by:
commit
b001de2320446ec803b4ee5e0b9710b025b84469
Author: Andrew Burgess <andrew.burgess@embecosm.com>
AuthorDate: Mon Nov 26 17:56:39 2018 +0000
Commit: Andrew Burgess <andrew.burgess@embecosm.com>
CommitDate: Wed Dec 12 17:33:52 2018 +0000
gdb: Update test pattern to deal with native-extended-gdbserver
While looking at a regression caused by a local patch I was working
on, I noticed this:
\1a\1apre-prompt
(gdb)
\1a\1aprompt
PASS: gdb.base/annota1.exp: breakpoint info
PASS: gdb.base/annota1.exp: run until main breakpoint
run
\1a\1apost-prompt
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.base/annota1/annota1
next
Note how above, we get the "run until main breakpoint" pass even
before "run" shows up in the log! The issue is that the test isn't
really testing anything, it always passes regardless of the gdb
output.
There are a few problems here, fixed by this commit:
- using {} to build the list for [join], when the strings we're
joining include variable names that must be expanded. Such list
need to be built with [list] instead.
- [join] joins strings with a space character by default. We need to
pass the empty string as second parameter so that it just concats
the strings.
- doing too much in a "-re" (calling procedures), which doesn't work
correctly. I've seen this before and never digged deeper into why.
Probably something to do with how gdb_test_multiple is implemented.
Regardless, easy and clear enough to build the pattern first into a
variable.
gdb/testsuite/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* gdb.base/annota1.exp: Build list using [list] instead of {}.
Tell [join] to join with no character. Build expected pattern in
separate variable instead of in the -re expression directly.
Change-Id: Ib3c89290f0e9ae4a0a43422853fcd4a7a7e12b18
Bernd Edlinger [Mon, 14 Jun 2021 12:49:21 +0000 (14:49 +0200)]
Include missing header signal.h
2021-06-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* compile/compile.c: Include missing header signal.h.
Eric Botcazou [Mon, 14 Jun 2021 13:43:19 +0000 (15:43 +0200)]
Use consistent type in binutils/dwarf.c
If you look at the type used for implicit_const objects in binutils/dwarf.c,
you'll get sometimes bfd_signed_vma and sometimes dwarf_signed_vma.
They are the same on 64-bit hosts, but not on 32-bit hosts, and the latter
discrepancy, in particular in process_abbrev_set, is responsible for the
following error issued by objdump on some object files containing DWARF 5:
binutils/dwarf.c:1108: read LEB value is too large to store in destination
variable
binutis/
* dwarf.c (struct abbrev_attr): Change type of implicit_const.
(add_abbrev_attr): Likewise.
(process_abbrev_set): Likewise.
(display_debug_abbrev): Adjust to above change.
Michael Forney [Mon, 14 Jun 2021 13:05:39 +0000 (14:05 +0100)]
GNU gettext introduced this change[0] in version 0.19.8 to fix gettext detection with musl libc, since it does not define these internal symbols.
This allows binutils to build with musl gettext rather than falling
back to the bundled version.
[0] https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commit;h=
b67399b4
2021-06-13 Michael Forney <mforney@mforney.org>
config/ChangeLog:
* gettext.m4 (AM_GNU_GETTEXT): Skip checks for the internal
symbols _nl_msg_cat_cntr, _nl_domain_bindings, and
_nl_expand_alias, if __GNU_GETTEXT_SUPPORTED_REVISION is defined.
Backport of gettext serial 68 patch.
intl/ChangeLog:
* configure: Regenerate.
---
Thi
Jan Beulich [Mon, 14 Jun 2021 06:18:58 +0000 (08:18 +0200)]
gas: fold three as_warn() in emit_expr_with_reloc()
Simply use the available abstraction instead of, effectively, trying to
open-code it.
Jan Beulich [Mon, 14 Jun 2021 06:18:07 +0000 (08:18 +0200)]
gas: drop TC_ADDRESS_BYTES conditionals
I've been repeatedly confused by, in particular, the .dc.a potable[]
entry being conditional. Grepping in gas/config/ reveals only very few
targets actually #define-ing it. But as of
7be1c4891a20 the symbol is
always defined, so #ifdef-s are pointless (and, as said, potentially
confusing).
Also adjust documentation to reflect this.
Mike Frysinger [Mon, 14 Jun 2021 01:35:05 +0000 (21:35 -0400)]
sim: ppc: use common version.o too
The common version.o we're building can be used for the ppc subdir,
so switch it over too.
Mike Frysinger [Sun, 13 Jun 2021 05:32:33 +0000 (01:32 -0400)]
sim: rx: move cycle-accurate settings to CPPFLAGS
This is the last unique setting that rx has in its config.h, so by
moving this to CPPFLAGS, we can drop its config.h entirely.
GDB Administrator [Mon, 14 Jun 2021 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 29 May 2021 20:07:43 +0000 (16:07 -0400)]
sim: start unifying portability shims
There are some functions that gnulib does not yet provide fallbacks
for, so start a common file of our own for holding existing stubs.
Mike Frysinger [Mon, 7 Jun 2021 05:48:06 +0000 (01:48 -0400)]
sim: unify sim-load.o building
Since this file does not rely on any port-specific settings, move it
up to building as part of the common step so we only do it once in a
multibuild.
Mike Frysinger [Sat, 12 Jun 2021 16:01:27 +0000 (12:01 -0400)]
sim: rx: replace cycle-stats with common profile settings
The common sim-profile option controls whether to keep track of
runtime execution (like cycle count), so switch the rx-specific
cycle-stats option over to that.
Mike Frysinger [Sat, 29 May 2021 19:20:28 +0000 (15:20 -0400)]
sim: assume sys/select.h always exists
Now that gnulib provides this, assume it exists.
Mike Frysinger [Wed, 9 Jun 2021 22:05:25 +0000 (18:05 -0400)]
sim: erc32: replace caddr_t with void*
This BSDism was never accepted into standards, so replace it with the
portable void* type instead.
Mike Frysinger [Wed, 9 Jun 2021 22:04:57 +0000 (18:04 -0400)]
sim: erc32/ppc: fix handling of $EXEEXT
Mike Frysinger [Mon, 7 Jun 2021 04:54:20 +0000 (00:54 -0400)]
sim: overhaul alignment settings management
Currently, the sim-config module will abort if alignment settings
haven't been specified by the port's configure.ac. This is a bit
weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's
optional to use. Thus everyone invokes it.
There are 4 alignment settings, but really only 2 matters: strict
and nonstrict. The "mixed" setting is just the default ("unset"),
and "forced" isn't used directly by anyone (it's available as a
runtime option for some ports).
The m4 macro has 2 args: the "wire" settings (which represents the
hardwired port behavior), and the default settings (which are used
if nothing else is specified). If none are specified, then the
build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't
called). If default settings are provided, then that is used, but
we allow the user to override at runtime. Otherwise, the "wire"
settings are used and user runtime options to change are ignored.
Most ports specify a default, or set the "wire" to nonstrict. A
few set "wire" to strict, but it's not clear that's necessary as
it doesn't make the code behavior, by default, any different. It
might make things a little faster, but we should provide the user
the choice of the compromises to make: force a specific mode at
compile time for faster runtime, or allow the choice at runtime.
More likely it seems like an oversight when these ports were
initially created, and/or copied & pasted from existing ports.
With all that backstory, let's get to what this commit does.
First kill off the idea of a compile-time default alignment and
set it to nonstrict in the common code. For any ports that want
strict alignment by default, that code is moved to sim_open while
initializing the sim. That means WITH_DEFAULT_ALIGNMENT can be
completely removed.
Moving the default alignment to the runtime also allows removal
of setting the "wire" settings at configure time. Which allows
removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving
that call to common code.
The macro logic can be reworked to not pass WITH_ALIGNMENT as -D
CPPFLAG and instead move it to config.h.
All of these taken together mean we can hoist the macro up to the
top level and share it among all sims so behavior is consistent
among all the ports.
Mike Frysinger [Mon, 7 Jun 2021 00:48:46 +0000 (20:48 -0400)]
sim: unify bug & package settings
Move these options up to the common dir so we only test & export
them once across all ports. The AC_INIT macro does a lot of the
heavy lifting already which allows further simplification.
Mike Frysinger [Mon, 7 Jun 2021 00:35:02 +0000 (20:35 -0400)]
sim: unify debug/stdio/trace/profile build settings
Move these options up to the common dir so we only test & export
them once across all ports.
The ppc code needs a little extra care with its trace settings as
it's not exactly the same API as the common code. The other knobs
are the same though.
Mike Frysinger [Mon, 7 Jun 2021 00:16:48 +0000 (20:16 -0400)]
sim: split debug/stdio/trace/profile options into dedicated m4 files
This follows existing organizational structure with one configure option
per m4 file, and will make it easier to move to the common configure dir.
GDB Administrator [Sun, 13 Jun 2021 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 12 Jun 2021 17:18:29 +0000 (13:18 -0400)]
sim: ppc: unify header & function & type tests too
Since ppc now shares a config.h with the top-level, move all of its
relevant settings up a level. The ppc port tests a lot more funcs,
but that's because its syscall emulation is a lot more complete.
We'll probably utilize some of these in the common code too.
John Baldwin [Sat, 12 Jun 2021 17:43:29 +0000 (10:43 -0700)]
remote: Fix indentation in remote_new_objfile.
gdb/remote.c:14541:5: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
if (current_inferior ()->in_initial_library_scan)
^
gdb/remote.c:14527:3: note: previous statement is here
if (remote == nullptr)
^
gdb/ChangeLog:
* remote.c (remote_new_objfile): Fix indentation.
Mike Frysinger [Sat, 12 Jun 2021 16:57:02 +0000 (12:57 -0400)]
sim: ppc: unify env settings too
The ppc port doesn't share a lot of the common logic, but there are
a few bits that bleed across. Have it use the common configure for
environment settings too to avoid duplicate define errors after the
recent unification with the other ports.
Mike Frysinger [Mon, 7 Jun 2021 00:11:02 +0000 (20:11 -0400)]
sim: unify environment build settings
Move the --sim-enable-environment option up to the common dir so we
only test & export it once across all ports.
Mike Frysinger [Sun, 6 Jun 2021 22:45:05 +0000 (18:45 -0400)]
sim: unify assert build settings
Move the --sim-enable-assert option up to the common dir so we only
test & export it once across all ports.
Mike Frysinger [Tue, 18 May 2021 00:34:52 +0000 (20:34 -0400)]
sim: unify platform function & header tests
Move the various platform tests up a level to avoid duplication
across the ports. When building multiple versions, this speeds
things up a bit.
For now we move the obvious stuff up a level, but we don't turn
own the config.h entirely just yet -- we still have some tests
related to libraries that need consideration.
Alan Modra [Sat, 12 Jun 2021 02:29:22 +0000 (11:59 +0930)]
readelf: don't clear section_headers in process_file_header
* readelf.c (process_file_header): Don't clear section_headers.
Alan Modra [Sat, 12 Jun 2021 01:24:21 +0000 (10:54 +0930)]
Re: readelf section reading
Fix commit
4de91c10cdd9, which cached the single section header read
to pick up file header extension fields. Also, testing e_shoff in
get_section_headers opened a hole for fuzzers where we'd end up with
segfaults due to non-zero e_shnum but NULL section_headers.
* readelf.c (get_section_headers): Don't test e_shoff here, leave
that to get_32bit_section_headers or get_64bit_section_headers.
(process_object): Throw away section header read to print file
header extension.
GDB Administrator [Sat, 12 Jun 2021 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 11 Jun 2021 22:09:57 +0000 (18:09 -0400)]
Fix ChangeLog entry location
This ChangeLog entry is in the wrong file, fix that.
Change-Id: I43464e1bdb94d2f40d4c7dfaf425fc498851964c
Kevin Buettner [Thu, 10 Jun 2021 02:52:08 +0000 (19:52 -0700)]
mi-sym-info.exp: Increase timeout for 114-symbol-info-functions
Loading libc.so's symbols increased the amount of time needed for
114-symbol-info-function to fetch symbols, causing a timeout during my
testing. I enclosed the entire block with a "with_timeout_factor 4",
which fixes the problem for me. (Using 2 also fixed it for me, but it
might not be enough when running this test on slower machines.)
gdb/testsuite/ChangeLog:
* gdb.mi/mi-sym-info.exp (114-symbol-info-function test): Increase
timeout.
Kevin Buettner [Thu, 10 Jun 2021 02:31:18 +0000 (19:31 -0700)]
print-symbol-loading.exp: Allow libc symbols to be already loaded
One consequence of changing libpthread_name_p() in solib.c to (also)
match libc is that the symbols for libc will now be loaded by
solib_add() in solib.c. I think this is mostly harmless because
we'll likely want these symbols to be loaded anyway, but it did cause
two failures in gdb.base/print-symbol-loading.exp.
Specifically...
1)
sharedlibrary .*
(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib
now looks like this:
sharedlibrary .*
Symbols already loaded for /lib64/libc.so.6
(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib
2)
sharedlibrary .*
Loading symbols for shared libraries: .*
(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib
now looks like this:
sharedlibrary .*
Loading symbols for shared libraries: .*
Symbols already loaded for /lib64/libc.so.6
(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib
Fixing case #2 ended up being easier than #1. #1 had been using
gdb_test_no_output to correctly match this no-output case. I
ended up replacing it with gdb_test_multiple, matching the exact
expected output for each of the two now acceptable cases.
For case #2, I simply added an optional non-capturing group
for the potential new output.
gdb/testsuite/ChangeLog:
* gdb.base/print-symbol-loading.exp (proc test_load_shlib):
Allow "Symbols already loaded for..." messages.
Kevin Buettner [Thu, 10 Jun 2021 01:56:23 +0000 (18:56 -0700)]
testsuite/glib-2.34: Match/consume optional libthread_db related output
When using glibc-2.34, we now see messages related to the loading of
the thread library for non-thread programs. E.g. for the test case,
gdb.base/execl-update-breakpoints.exp, we will see the following when
starting the program:
(gdb) break -qualified main
Breakpoint 1 at 0x100118c: file /ironwood1/sourceware-git/f34-2-glibc244_fix/bld/../../worktree-glibc244_fix/gdb/testsuite/gdb.base/execl-update-breakpoints.c, line 34.
(gdb) run
Starting program: [...]/execl-update-breakpoints1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
The two lines of output related to libthread_db are new; we didn't see
these in the past. This is a side effect of libc now containing the
pthread API - we can no longer tell whether the program is
multi-threaded by simply looking for libpthread.so. That said, I
think that we now want to load libthread_db anyway since it's used to
resolve TLS variables; i.e. we need it for correctly determining the
value of errno.
This commit adds the necessary regular expressions to match this
(optional) additional output in the two tests which were failing
without it.
gdb/testsuite/ChangeLog:
* gdb.base/execl-update-breakpoints.exp: Add regular
expression for optionally matching output related to
libthread_db.
* gdb.base/fork-print-inferior-events.exp: Likewise.
Kevin Buettner [Thu, 10 Jun 2021 01:07:45 +0000 (18:07 -0700)]
libthread_db initialization changes related to upcoming glibc-2.34
This commit makes some adjustments to accomodate the upcoming
glibc-2.34 release. Beginning with glibc-2.34, functionality formerly
contained in libpthread has been moved to libc. For the time being,
libpthread.so still exists in the file system, but it won't show up in
ldd output and therefore won't be able to trigger initialization of
libthread_db related code. E.g...
Fedora 34 / glibc-2.33.9000:
[kev@f34-2 gdb]$ ldd testsuite/outputs/gdb.threads/tls/tls
linux-vdso.so.1 (0x00007ffcf94fa000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ff0ba9af000)
libm.so.6 => /lib64/libm.so.6 (0x00007ff0ba8d4000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff0ba8b9000)
libc.so.6 => /lib64/libc.so.6 (0x00007ff0ba6c6000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff0babf0000)
Fedora 34 / glibc-2.33:
[kev@f34-1 gdb]$ ldd testsuite/outputs/gdb.threads/tls/tls
linux-vdso.so.1 (0x00007fff32dc0000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f815f6de000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f815f4bf000)
libm.so.6 => /lib64/libm.so.6 (0x00007f815f37b000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f815f360000)
libc.so.6 => /lib64/libc.so.6 (0x00007f815f191000)
/lib64/ld-linux-x86-64.so.2 (0x00007f815f721000)
Note that libpthread is missing from the ldd output for the
glibc-2.33.9000 machine.
This means that (unless we happen to think of some entirely different
mechanism), we'll now need to potentially match "libc" in addition to
"libpthread" as libraries which might be thread libraries. This
accounts for the change made in solib.c. Note that the new code
attempts to match "/libc." via strstr(). That trailing dot (".")
avoids inadvertently matching libraries such as libcrypt (and
all the other many libraries which begin with "libc").
To avoid attempts to load libthread_db when encountering older
versions of libc, we now attempt to find "pthread_create" (which is a
symbol that we'd expect to be in any pthread library) in the
associated objfile. This accounts for the changes in
linux-thread-db.c.
I think that other small adjustments will need to be made elsewhere
too. I've been working through regressions on my glibc-2.33.9000
machine; I've fixed some fairly "obvious" changes in the testsuite
(which are in other commits). For the rest, it's not yet clear to me
whether the handful of remaining failures represent a problem in glibc
or gdb. I'm still investigating, however, I'll note that these are
problems that I only see on my glibc-2.33.9000 machine.
gdb/ChangeLog:
* solib.c (libpthread_name_p): Match "libc" in addition
to "libpthread".
* linux-thread-db.c (libpthread_objfile_p): New function.
(libpthread_name_p): Adjust preexisting callers to use
libpthread_objfile_p().
Simon Marchi [Fri, 11 Jun 2021 15:36:48 +0000 (11:36 -0400)]
gdb: remove unused struct call_site_stuff forward declaration
This is unused (and was event when it was introduced). Remove it.
gdb/ChangeLog:
* dwarf2/loc.h (struct call_site_stuff): Remove.
Change-Id: Iaa82cb7cfd9768998553b4c9211aca7529eb402f