binutils-gdb.git
22 months agoUse require !skip_ctf_tests
Tom Tromey [Wed, 14 Dec 2022 16:33:00 +0000 (09:33 -0700)]
Use require !skip_ctf_tests

This changes some tests to use "require !skip_ctf_tests".

22 months agoUse require !skip_d_tests
Tom Tromey [Tue, 13 Dec 2022 23:12:18 +0000 (16:12 -0700)]
Use require !skip_d_tests

This changes some tests to use "require !skip_d_tests".

22 months agoUse require !skip_go_tests
Tom Tromey [Tue, 13 Dec 2022 23:11:58 +0000 (16:11 -0700)]
Use require !skip_go_tests

This changes some tests to use "require !skip_go_tests".

22 months agoUse require !skip_ada_tests
Tom Tromey [Tue, 13 Dec 2022 23:11:40 +0000 (16:11 -0700)]
Use require !skip_ada_tests

This changes some tests to use "require !skip_ada_tests".

22 months agoUse require !skip_fortran_tests
Tom Tromey [Tue, 13 Dec 2022 23:10:09 +0000 (16:10 -0700)]
Use require !skip_fortran_tests

This changes some tests to use "require !skip_fortran_tests".

22 months agoUse require !skip_rust_tests
Tom Tromey [Tue, 13 Dec 2022 23:08:13 +0000 (16:08 -0700)]
Use require !skip_rust_tests

This changes some tests to use "require !skip_rust_tests".

22 months agoUse require !skip_stl_tests
Tom Tromey [Tue, 13 Dec 2022 23:02:16 +0000 (16:02 -0700)]
Use require !skip_stl_tests

This changes some tests to use "require !skip_stl_tests".

22 months agoUse require !skip_dlmopen_tests
Tom Tromey [Tue, 13 Dec 2022 22:51:16 +0000 (15:51 -0700)]
Use require !skip_dlmopen_tests

This changes some tests to use "require !skip_dlmopen_tests".

22 months agoUse require !skip_shlib_tests
Tom Tromey [Tue, 13 Dec 2022 22:40:02 +0000 (15:40 -0700)]
Use require !skip_shlib_tests

This changes some tests to use "require !skip_shlib_tests".

22 months agoUse require !skip_cplus_tests
Tom Tromey [Tue, 13 Dec 2022 22:35:59 +0000 (15:35 -0700)]
Use require !skip_cplus_tests

This changes some tests to use "require !skip_cplus_tests".

22 months agoUse require is_x86_like_target
Tom Tromey [Tue, 13 Dec 2022 22:25:00 +0000 (15:25 -0700)]
Use require is_x86_like_target

This changes some tests to use "require is_x86_like_target".

22 months agoUse require dwarf2_support
Tom Tromey [Tue, 13 Dec 2022 22:21:57 +0000 (15:21 -0700)]
Use require dwarf2_support

This changes some tests to use "require dwarf2_support".

22 months agoUse require supports_process_record
Tom Tromey [Tue, 13 Dec 2022 22:16:16 +0000 (15:16 -0700)]
Use require supports_process_record

This changes some tests to use "require supports_process_record".

22 months agoUse require supports_reverse
Tom Tromey [Tue, 13 Dec 2022 22:04:18 +0000 (15:04 -0700)]
Use require supports_reverse

This changes some tests to use "require supports_reverse".

22 months agoUse unsupported in 'require'
Tom Tromey [Tue, 13 Dec 2022 22:59:39 +0000 (15:59 -0700)]
Use unsupported in 'require'

This changes 'require' to use 'unsupported' rather than 'untested'.
The latter doesn't really seem to be correct according to the DejaGNU
documentation:

    Declares a test was not run.  `untested' writes in the log file a
    message beginning with _UNTESTED_, appending the `message' argument.
    For example, you might use this in a dummy test whose only role is to
    record that a test does not yet exist for some feature.

The example there, and some text elsewhere, is what makes me think
this isn't a great fit.  On the other hand, 'unsupported' says:

    Declares that a test case depends on some facility that does not exist
    in the testing environment.

22 months agoChange 'require' to accept a list of predicates
Tom Tromey [Tue, 13 Dec 2022 22:00:07 +0000 (15:00 -0700)]
Change 'require' to accept a list of predicates

This changes 'require' to accept a list of simple predicates.  For
now, each predicate is just the name of a proc, optionally prefixed
with "!" to indicate that the result should be inverted.

It's possible to make this fancier, but so far I haven't done so.  One
idea I had is to allow a predicate to have associated text to display
on failure.  Another is to convert the predicates that need a running
gdb (e.g., skip_python_tests) to start their own gdb, and then
'require' could enforce the rule that gdb not be running when it is
called.

22 months agoDon't use ensure_gdb_index with require
Tom Tromey [Thu, 15 Dec 2022 00:04:35 +0000 (17:04 -0700)]
Don't use ensure_gdb_index with require

This series changes 'require' to take a list of simple predicates.
This patch backs out the one use of 'require' that doesn't conform to
this -- calling ensure_gdb_index.

22 months agogprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
Vladimir Mezentsev [Thu, 12 Jan 2023 20:51:48 +0000 (12:51 -0800)]
gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'

gprofng/ChangeLog
2023-01-12  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

PR gprofng/29987
* configure.ac: Remove dependencies on libbfd and libiberty.
* gprofng/src/Makefile.am: Likewise.
* configure: Rebuild.
* Makefile.in: Rebuild.
* src/Makefile.in: Rebuild.
* doc/Makefile.in: Rebuild.
* gp-display-html/Makefile.in: Rebuild.

22 months agolibsframe: replace an strncat with strcat
Indu Bhagat [Fri, 13 Jan 2023 19:15:43 +0000 (11:15 -0800)]
libsframe: replace an strncat with strcat

Calling strncat with the size of the src string is not so meaningful.
The length argument to strncat should specify the remaining bytes
bytes in the destination; although in this case, it appears to be
unncessary altogether to use strncat in the first place.

libsframe/
        * sframe-dump.c (dump_sframe_func_with_fres): Use of strcat is
just as fine.

22 months agogdbserver: add comments to read_inferior_memory function
Andrew Burgess [Thu, 20 Oct 2022 09:52:48 +0000 (10:52 +0100)]
gdbserver: add comments to read_inferior_memory function

Just adding some comments to the gdbserver read_inferior_memory
function.  No actual code changes.

22 months agogdb/infrun: add debug print in print_signal_received_reason
Andrew Burgess [Thu, 20 Oct 2022 10:59:55 +0000 (11:59 +0100)]
gdb/infrun: add debug print in print_signal_received_reason

It would have helped me to see an infrun debug line being printed from
print_signal_received_reason, so I'm adding one.

22 months agogdb: int to bool conversion for normal_stop
Andrew Burgess [Mon, 17 Oct 2022 14:01:24 +0000 (15:01 +0100)]
gdb: int to bool conversion for normal_stop

Change the return type of normal_stop (infrun.c) from int to bool.
Update callers.

I've also converted the (void) to () in the function declaration and
definition, given I was changing those lines anyway.

There should be no user visible changes after this commit.

22 months agoUpdated Romainian translation for the bfd sub-directory
Nick Clifton [Fri, 13 Jan 2023 11:42:33 +0000 (11:42 +0000)]
Updated Romainian translation for the bfd sub-directory

22 months agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Jan 2023 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

22 months agoDisable ptype/o for dynamic types
Tom Tromey [Fri, 6 Jan 2023 19:18:07 +0000 (12:18 -0700)]
Disable ptype/o for dynamic types

A user pointed out that "ptype/o" of a certain Ada type -- while in C
mode -- caused gdb to crash.

The bug here is that dynamic types can't really be printed this way.
This patch avoids the bug by disabling the "/o" feature in this case.

Note that using "ptype/o" in this way makes sense for the time being,
because the Ada code doesn't support the "/o" feature (yet); and in
any case gdb should not crash.

22 months agoARM: Fix ld bloat introduced between binutils-2.38 and 2.39
Hans-Peter Nilsson [Tue, 3 Jan 2023 02:19:54 +0000 (03:19 +0100)]
ARM: Fix ld bloat introduced between binutils-2.38 and 2.39

Since commit 9833b7757d24, "PR28824, relro security issues",
ELF_MAXPAGESIZE matters much more, with regards to layout of
the linked file.  That commit fixed an actual bug, but also
exposes a problem for targets were that value is too high.

For example, for ARM(32, a.k.a. "Aarch32") specifically
bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU)
targets pay an extra amount of up to 60 KiB of bloat in
DSO:s and executables.  This matters when there are many
such files, and where storage is expensive.

It's *mostly* bloat when using a Linux kernel, as ARM(32) is
a good example of an target where ELF_MAXPAGESIZE is set to
an extreme value for an obscure corner-case.  The ARM
(32-bit) kernel has 4 KiB pages, has had that value forever,
and can't be configured to any other value.  The use-case is
IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but
not just that, but a setup where the Linux page-size is
configured to something other than the *default* 4 KiB.  Not
sure there actually any such systems in use, again with
both Aarch32 compatibility support and a non-4KiB pagesize,
with all the warnings in the kernel config and requiring the
"EXPERT" level set on.

So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only
one default max-page-size" and set ELF_MAXPAGESIZE to 4096.

bfd:
* elf32-arm.c (ELF_MAXPAGESIZE): Always set to 0x1000.

22 months agold/testsuite: Adjust for ELF_MAXPAGESIZE 0x1000
Hans-Peter Nilsson [Wed, 11 Jan 2023 15:34:04 +0000 (16:34 +0100)]
ld/testsuite: Adjust for ELF_MAXPAGESIZE 0x1000

Many tests reflect a setting of ELF_MAXPAGESIZE to 64 KiB.
With ELF_MAXPAGESIZE changed to 4 KiB, layout is sometimes
different and symbols end up in other places.  Avoid churn
and regexpification of old test patterns by passing the
max-page-size setting active at the time.

ld/testsuite:

* testsuite/ld-arm/arm-elf.exp,
        testsuite/ld-arm/non-contiguous-arm2.d,
        testsuite/ld-arm/non-contiguous-arm3.d,
        testsuite/ld-arm/non-contiguous-arm5.d,
        testsuite/ld-arm/non-contiguous-arm6.d,
        testsuite/ld-arm/thumb-plt-got.d, testsuite/ld-arm/thumb-plt.d:
Pass -z max-page-size=0x10000 explicitly to test that rely on
that value in output-matching patterns.

22 months agolibctf: ctf-link outdated input check faulty
Nick Alcock [Mon, 9 Jan 2023 13:43:09 +0000 (13:43 +0000)]
libctf: ctf-link outdated input check faulty

This check has a pair of faults which, combined, can lead to memory
corruption.  Firstly, it assumes that the values of the ctf_link_inputs
hash are ctf_dict_t's: they are not, they are ctf_link_input_t's, a much
shorter structure.  So the flags check which is the core of this is
faulty (but happens, by chance, to give the right output on most
architectures, since usually we happen to get a 0 here, so the test that
checks this usually passes).  Worse, the warning that is emitted when
the test fails is added to the wrong dict -- it's added to the input
dict, whose warning list is never consumed, rendering the whole check
useless.  But the dict it adds to is still the wrong type, so we end up
overwriting something deep in memory (or, much more likely,
dereferencing a garbage pointer and crashing).

Fixing both reveals another problem: the link input is an *archive*
consisting of multiple members, so we have to consider whether to check
all of them for the outdated-func-info thing we are checking here.
However, no compiler exists that emits a mixture of members with this
flag on and members with it off, and the linker always reserializes (and
upgrades) such things when it sees them: so all members in a given
archive must have the same value of the flag, so we only need to check
one member per input archive.

libctf/
PR libctf/29983
* ctf-link.c (ctf_link_warn_outdated_inputs): Get the types of
        members of ctf_link_inputs right, fixing a possible spurious
        tesst failure / wild pointer deref / overwrite.  Emit the
        warning message into the right dict.

22 months agolibctf: skip the testsuite from inside dejagnu
Nick Alcock [Mon, 14 Nov 2022 14:17:55 +0000 (14:17 +0000)]
libctf: skip the testsuite from inside dejagnu

The libctf testsuite uses Tcl try/catch to trap run_output errors.  This
is only supported in reasonably recent Tcls, so we detect the lack of
try/catch and suppress the testsuite via an Automake conditional in its
absence.

But this turns out not to work: Automake produces a check-DEJAGNU target
regardless of the value of this conditional and sticks it in an
unconditionally-executed part of the makefile, so the testsuite gets
executed anyway, and fails with a nasty-looking syntax error.  We can't
disable it by taking "dejagnu" out of AUTOMAKE_OPTIONS, because if you
do that Automake stops you using RUNTEST, RUNTESTFLAGS and other
variables users would expect to work.

So move to disabling the testsuite from inside the testsuite itself,
importing the value of the former Automake conditional as a Tcl variable
and exiting very early in default.exp if it's false.

* configure.ac (TCL_TRY): No longer an Automake conditional.
Rename to...
(HAVE_TCL_TRY): ... this.
* Makefile.am: Drop TCL_TRY.
(development.exp): Set have_tcl_try.
* testsuite/config/default.exp: Exit if have_tcl_try is false.

* configure: Regenerated.
* Makefile.in: Likewise.

22 months agoctf: fix various dreadful typos in the ctf_archive format comments
Nick Alcock [Tue, 26 Jul 2022 20:26:09 +0000 (21:26 +0100)]
ctf: fix various dreadful typos in the ctf_archive format comments

When defining a format it helps to a) get the endianness right when you
explicitly state what it is and b) define things in terms of fields that
exist rather than fields that don't.

(A bunch of changes of names during implementation were not reflected in
these comments...)

Thanks to Jose "Eye of the Eagle" Marchesi for spotting these.

include/
* ctf.h (struct ctf_archive) [ctfa_ctfs]: The size element of
this is in little-endian byte order, not network byte order.
(struct ctf_archive_modent): This is positioned right after the
end fo the struct ctf_archive, not at the offset of a
nonexistent field.  The number of elements in the array depends
on ctfa_ndicts, not another nonexistent field.

22 months agoEnsure that libbacktrace/allocfail.sh is not deleted when creating release tarballs.
Nick Clifton [Thu, 12 Jan 2023 13:39:03 +0000 (13:39 +0000)]
Ensure that libbacktrace/allocfail.sh is not deleted when creating release tarballs.

        * Makefile.am (CLEANFILES): Import patch from upstream to prevent
        allocafail.sh from being removed when running 'make clean'.

22 months agoUse __func__ rather than __FUNCTION__
Alan Modra [Thu, 12 Jan 2023 06:16:23 +0000 (16:46 +1030)]
Use __func__ rather than __FUNCTION__

We already use C99's __func__ in places, use it more generally.  This
patch doesn't change uses in the testsuite.  I've also left one in
gold.h that is protected by GCC_VERSION < 4003.  If any of the
remaining uses bothers anyone I invite patches.

bfd/
* bfd-in.h: Replace __FUNCTION__ with __func__.
* elf32-bfin.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-sparc.c: Likewise.
* bfd-in2.h: Regenerate.
gas/
* config/tc-cris.c: Replace __FUNCTION__ with __func__.
* config/tc-m68hc11.c: Likewise.
* config/tc-msp430.c: Likewise.
gold/
* dwp.h: Replace __FUNCTION__ with __func__.
* gold.h: Likewise, except for use inside GCC_VERSION < 4003.
ld/
* emultempl/pe.em: Replace __FUNCTION__ with __func__.
* emultempl/pep.em: Likewise.
* pe-dll.c: Likewise.

22 months agoRemove myself as hppa32 maintainer
Alan Modra [Thu, 12 Jan 2023 03:11:33 +0000 (13:41 +1030)]
Remove myself as hppa32 maintainer

Reflects the reality that I haven't done much on hppa32 for years.

22 months agosim: build: drop subdir Makefile.in files
Mike Frysinger [Sun, 1 Jan 2023 23:25:57 +0000 (18:25 -0500)]
sim: build: drop subdir Makefile.in files

These aren't used anymore, so punt them all.

22 months agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Jan 2023 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

22 months agogdb/doc: fix install-html with Texinfo 7
Simon Marchi [Tue, 10 Jan 2023 05:07:25 +0000 (00:07 -0500)]
gdb/doc: fix install-html with Texinfo 7

Starting with Texinfo 7 (this commit [1]), the output directory for the
HTML doc format is gdb/doc/gdb_html, rather than gdb/doc/gdb previously.
This breaks the install-html target, which expects the HTML doc to be in
gdb/doc/gdb:

    $ make install-html MAKEINFO=makeinfo DESTDIR=/tmp/install
    make[1]: Entering directory '/home/simark/build/binutils-gdb/gdb'
    make[2]: Entering directory '/home/simark/build/binutils-gdb/gdb/doc'
    makeinfo  -DHAVE_MAKEINFO_CLICK --html  -I /home/simark/src/binutils-gdb/gdb/doc/../../readline/readline/doc -I /home/simark/src/binutils-gdb/gdb/doc/../mi -I /home/simark/src/binutils-gdb/gdb/doc /home/simark/src/binutils-gdb/gdb/doc/gdb.texinfo
    makeinfo  -DHAVE_MAKEINFO_CLICK --html  -I /home/simark/src/binutils-gdb/gdb/doc /home/simark/src/binutils-gdb/gdb/doc/stabs.texinfo
    makeinfo  -DHAVE_MAKEINFO_CLICK --html  -I /home/simark/src/binutils-gdb/gdb/doc /home/simark/src/binutils-gdb/gdb/doc/annotate.texinfo
    test -z "/usr/local/share/doc/gdb" || /bin/sh /home/simark/src/binutils-gdb/gdb/doc/../../mkinstalldirs "/tmp/install/usr/local/share/doc/gdb"
     /usr/bin/install -c -m 644 '/home/simark/src/binutils-gdb/gdb/doc/gdb' '/tmp/install/usr/local/share/doc/gdb/gdb'
    /usr/bin/install: cannot stat '/home/simark/src/binutils-gdb/gdb/doc/gdb': No such file or directory
     /usr/bin/install -c -m 644 '/home/simark/src/binutils-gdb/gdb/doc/stabs' '/tmp/install/usr/local/share/doc/gdb/stabs'
    /usr/bin/install: cannot stat '/home/simark/src/binutils-gdb/gdb/doc/stabs': No such file or directory
     /usr/bin/install -c -m 644 '/home/simark/src/binutils-gdb/gdb/doc/annotate' '/tmp/install/usr/local/share/doc/gdb/annotate'
    /usr/bin/install: cannot stat '/home/simark/src/binutils-gdb/gdb/doc/annotate': No such file or directory
    make[2]: *** [Makefile:278: install-html] Error 1
    make[2]: Leaving directory '/home/simark/build/binutils-gdb/gdb/doc'
    make[1]: *** [Makefile:2240: subdir_do] Error 1
    make[1]: Leaving directory '/home/simark/build/binutils-gdb/gdb'
    make: *** [Makefile:2006: install-html] Error 2

Fix this by adding -o switches to the HTML targets, to force the output
directories.

[1] https://git.savannah.gnu.org/cgit/texinfo.git/commit/?id=a868421baf9c44227c43490687f8d6b8d6c95414

Change-Id: Ie147dc7b4a52eb2348005b8dc006a41b0784621f

22 months agogdb: Update gdbarch.py with latest changes in gdbarch.c
Thiago Jung Bauermann [Wed, 11 Jan 2023 16:27:27 +0000 (16:27 +0000)]
gdb: Update gdbarch.py with latest changes in gdbarch.c

Commit 2b16913cdca2 ("gdb: make gdbarch_alloc take ownership of the tdep")
changed gdbarch.c without updating gdbarch.py.  As a result, running
gdbarch.py reverts those changes and causes the build to fail.

So change gdbarch.py to generate the current version of gdbarch.c.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
22 months agoSet _WIN32_WINNT in common.m4 configure check
Tom Tromey [Mon, 9 Jan 2023 14:43:29 +0000 (07:43 -0700)]
Set _WIN32_WINNT in common.m4 configure check

GCC recently added support for the Windows thread model, enabling
libstdc++ to support Windows natively.  However, this supporrt
requires a version of Windows later than the minimum version that is
supported by GDB.

PR build/29966 points out that the GDB configure test for std::thread
does not work in this situation, because _WIN32_WINNT is not defined
in test program, and so <thread> seems to be fine.

This patch is an attempt to fix the problem, by using the same setting
for _WIN32_WINNT at configure time as is used at build time.

I don't have access to one of the older systems so I don't think I can
truly test this.  I did do a mingw cross build, though.  I'm going to
ask the bug reporter to test it.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29966

22 months ago[gdb/testsuite] Fix regexp in gdb.threads/dlopen-libpthread.exp
Simon Marchi [Wed, 11 Jan 2023 17:37:20 +0000 (18:37 +0100)]
[gdb/testsuite] Fix regexp in gdb.threads/dlopen-libpthread.exp

Fix regexp in gdb.threads/dlopen-libpthread.exp:
'libpthread\\.so' -> '/libpthread\\.so'.

Tested on x86_64-linux.

22 months agoFix XPASS weak symbols on x86_64-mingw32
Alan Modra [Wed, 11 Jan 2023 13:01:01 +0000 (23:31 +1030)]
Fix XPASS weak symbols on x86_64-mingw32

Fixes commit 16fea92ccd99.

* testsuite/ld-scripts/weak.exp: Don't xfail x86_64 PE targets.
Do xfail other PE OS triplets by moving code setting xfails.

22 months agoFix a potential illegal memory access in the BFD library when parsing a corrupt DWARF...
Nick Clifton [Wed, 11 Jan 2023 12:12:25 +0000 (12:12 +0000)]
Fix a potential illegal memory access in the BFD library when parsing a corrupt DWARF file.

PR 29988
* dwarf2.c (read_indexed_address): Fix check for an out of range
offset.

22 months ago[gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc, again
Tom de Vries [Wed, 11 Jan 2023 10:44:00 +0000 (11:44 +0100)]
[gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc, again

On an x86_64 laptop running ubuntu 22.04.1 with unity desktop:
...
$ echo $XDG_CURRENT_DESKTOP
Unity:Unity7:ubuntu
...
I have:
...
$ echo $LD_PRELOAD
libgtk3-nocsd.so.0
...
due to package gtk3-nocsd, a package recommended by unity-session.

Consequently, for each exec these dependencies are pulled in, including
libpthread.so.0:
...
$ lddtree /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (interpreter => none)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
        ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
...

So, while test-case gdb.threads/dlopen-libpthread.exp appears to run ok:
...
 # of expected passes 12
 # of unsupported tests 1
...
with LD_PRELOAD="" we have instead:
...
(gdb) PASS: gdb.threads/dlopen-libpthread.exp: continue to breakpoint: notify
info sharedlibrary^M
From  To                  Syms Read   Shared Object Library^M
$hex  $hex  Yes         /lib64/ld-linux-x86-64.so.2^M
$hex  $hex  Yes         /lib/x86_64-linux-gnu/libc.so.6^M
$hex  $hex  Yes         dlopen-libpthread.so^M
(gdb) FAIL: gdb.threads/dlopen-libpthread.exp: libpthread.so found
...

The problem is that libpthread is expected as dependency of
dlopen-libpthread.so, but it's missing:
...
$ lddtree dlopen-libpthread.so
dlopen-libpthread.so => ./dlopen-libpthread.so (interpreter => none)
    libc.so.6 => $outputs/gdb.threads/dlopen-libpthread/dlopen-libpthread.so.d/libc.so.6
        ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
...
due to having glibc 2.35, which has libpthread integrated into libc.

Fix this by:
- adding a proc has_dependency
- using [has_dependency $exec libpthread.so] as hint that libpthread
  may be preloaded
- using ![has_dependency $shlib libpthread.so] to detect that
  the libpthread.so dependency is missing.

Also add a missing return after untested "no matching probes".

Tested on x86_64-linux, with and without LD_PRELOAD="".

22 months agogas/RISC-V: adjust assembler for opcode table re-ordering
Jan Beulich [Wed, 11 Jan 2023 09:31:43 +0000 (10:31 +0100)]
gas/RISC-V: adjust assembler for opcode table re-ordering

PR gas/29940

With the single-operand JAL entry now sitting ahead of the two-operand
one, the parsing of a two-operand insn would first try to parse an 'a'-
style operand, resulting in the insertion of bogus (and otherwise
unused) undefined symbols in the symbol table, having register names.
Since 'a' is used as 1st operand only with J and JAL, and since JAL is
the only insn _also_ allowing for a register as 1st operand (and then
there being a 2nd one), special case this parsing aspect right there.

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
22 months agoTidy some global bfd state used by gas
Alan Modra [Wed, 11 Jan 2023 07:58:33 +0000 (18:28 +1030)]
Tidy some global bfd state used by gas

* subsegs.c (subsegs_end): Clear abs and und userdata.

22 months agonow_seg after closing output file
Alan Modra [Wed, 11 Jan 2023 05:01:06 +0000 (15:31 +1030)]
now_seg after closing output file

now_seg, a pointer into the output file sections, isn't valid after
the output file is closed.  gas doesn't and shouldn't use now_seg
after this point of course, but let's be safe.

* output-file.c (output_file_close): Clear now_seg and now_subseg.

22 months agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Jan 2023 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

22 months agoFix bug in 'say_where' transform
Tom Tromey [Tue, 10 Jan 2023 23:35:08 +0000 (16:35 -0700)]
Fix bug in 'say_where' transform

The patch to change say_where into a method introduced a bug.  This
patch fixes it.

22 months agogas: Restore tc_pe_dwarf2_emit_offset for pe-aarch64
Mark Harmstone [Tue, 27 Dec 2022 22:16:04 +0000 (22:16 +0000)]
gas: Restore tc_pe_dwarf2_emit_offset for pe-aarch64

Restores tc_pe_dwarf2_emit_offset in tc-aarch64.c, which is needed to
make sure that DWARF offsets are encoded correctly (they're secrels in
COFF). There were remnants of this there before, but they were removed
by Jedidiah's original patch - presumably because we didn't yet have
.secrel32.

22 months agoAdd aarch64-w64-mingw32 target
Mark Harmstone [Thu, 5 Jan 2023 02:36:32 +0000 (02:36 +0000)]
Add aarch64-w64-mingw32 target

This adds a mingw target for aarch64, including windres and dlltool.

Note that the old value of jmp_aarch64_bytes was wrong, and this does
the same thing as MSVC does.

22 months agoAdd .secrel32 for pe-aarch64
Mark Harmstone [Thu, 15 Dec 2022 23:24:09 +0000 (23:24 +0000)]
Add .secrel32 for pe-aarch64

Adds the .secrel32 pseudo-directive and its corresponding relocation.

22 months agoAdd pe-aarch64 relocations
Mark Harmstone [Wed, 14 Dec 2022 00:54:34 +0000 (00:54 +0000)]
Add pe-aarch64 relocations

This adds the remaining pe-aarch64 relocations, and gets them working.
It also brings in the constant directives from ELF, as otherwise .word
would be 2 rather than 4 bytes, and .xword and .dword wouldn't be
defined.

22 months agoFix size of external_reloc for pe-aarch64
Mark Harmstone [Wed, 14 Dec 2022 00:51:57 +0000 (00:51 +0000)]
Fix size of external_reloc for pe-aarch64

This patch series finishes off the work by Jedidiah Thompson, and adds
support for creating aarch64 PE images.

This should be essentially complete: I've used this to create a "hello
world" Windows program in asm, and (with GCC patches) a UEFI program in
C. I think the only things missing are the .secidx relocation, which is
needed for PDBs, and the SEH pseudos used for C++ exceptions.

This first patch fixes the size of RELSZ; I'm not sure why it was 14 in
the first place. This is the size of the "Base Relocation Block" in
https://learn.microsoft.com/en-us/windows/win32/debug/pe-format, and
AFAIK should be 10 for everything.

22 months agogdb/dwarf2: Fix 'rw_pieced_value' for values casted to different type.
Rohr, Stephan [Wed, 21 Dec 2022 13:12:44 +0000 (14:12 +0100)]
gdb/dwarf2: Fix 'rw_pieced_value' for values casted to different type.

The 'rw_pieced_value' function is executed when fetching a (lazy)
variable described by 'DW_OP_piece' or 'DW_OP_bit_piece'.  The
function checks the 'type' and 'enclosing_type' fields of the value
for identity.

  * The 'type' field describes the type of a value.
  * In most cases, the 'enclosing_type' field is identical to the
    'type' field.
  * Scenarios where the 'type' and 'enclosing_type' of an object
    differ are described in 'gdb/value.c'.  Possible cases are:
    * If a value represents a C++ object, then the 'type' field
      gives the object's compile-time type.  If the object actually
      belongs to some class derived from `type', perhaps with other
      base classes and additional members, then `type' is just a
      subobject of the real thing, and the full object is probably
      larger than `type' would suggest.
    * If 'type' is a dynamic class (i.e. one with a vtable), then GDB
      can actually determine the object's run-time type by looking at
      the run-time type information in the vtable.  GDB may then elect
      to read the entire object.
    * If the user casts a variable to a different type
      (e.g. 'print (<type> []) <variable>'), the value's type is
      updated before reading the value.

If a lazy value is fetched, GDB allocates space based on the enclosing
type's length and typically reads the 'full' object.  This is not
implemented for pieced values and causes an internal error if 'type'
and 'enclosing_type' of a value are not identical.

However, GDB can read the value based on its type.  Thus, this patch
fixes the previously mentioned cases by removing the check for identity.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28605

gdb/ChangeLog:
2022-04-13  Stephan Rohr  <stephan.rohr@intel.com>

* dwarf2/loc.c (rw_pieced_value): Fix check on 'type' and
'enlcosing_type' when reading pieced value 'v'.

gdb/testsuite/ChangeLog:
2022-04-13  Stephan Rohr  <stephan.rohr@intel.com>

* gdb.dwarf2/shortpiece.exp: Added test cases.

22 months agoConvert say_where to method on code_breakpoint
Tom Tromey [Tue, 10 Jan 2023 15:17:28 +0000 (08:17 -0700)]
Convert say_where to method on code_breakpoint

'say_where' is only useful (and only called for) code breakpoints, so
convert it to be a protected method on code_breakpoint.

22 months agogdb/doc: use @value{GDBP} in some spots
Simon Marchi [Tue, 10 Jan 2023 05:06:43 +0000 (00:06 -0500)]
gdb/doc: use @value{GDBP} in some spots

Examples are supposed to use @value{GDBP} instead of the literal "(gdb)"
(many of them already do).  Update a bunch of spots where it wasn't the
case.

Change-Id: I601adaad61fd277a5fceea1759e49cede72e456d

22 months agogdb/doc: use @value{GDBN} in some spots
Simon Marchi [Tue, 10 Jan 2023 05:06:42 +0000 (00:06 -0500)]
gdb/doc: use @value{GDBN} in some spots

Change some spots to use "@value{GDBN}" instead of just "GDB".

Change-Id: I3fc26438e603538271cf33e4d148be5fda9ece7e

22 months agogdb/doc: some whitespace fixes
Simon Marchi [Tue, 10 Jan 2023 05:06:41 +0000 (00:06 -0500)]
gdb/doc: some whitespace fixes

For consistency, replace tabs with spaces in all gdb.texinfo menus.

Change-Id: I0801a72cf82a8afe49ec842244f42d30719634ce

22 months agoIBM zSystems: Fix offset relative to static TLS
Stefan Schulze Frielinghaus [Tue, 10 Jan 2023 13:34:16 +0000 (14:34 +0100)]
IBM zSystems: Fix offset relative to static TLS

For local exec TLS relocations of the form foo@NTPOFF+x the addend was
ignored.

bfd/ChangeLog:

* elf32-s390.c (elf_s390_relocate_section): Honor addend for
R_390_TLS_LE32.
* elf64-s390.c (elf_s390_relocate_section): Honor addend for
R_390_TLS_LE64.

ld/ChangeLog:

* testsuite/ld-s390/reloctlsle-1.d: New test.
* testsuite/ld-s390/reloctlsle-1.s: New test.

22 months agoPR 29981 references to init.texi
Pekka Seppänen [Tue, 10 Jan 2023 12:35:31 +0000 (23:05 +1030)]
PR 29981 references to init.texi

22 months agoRe: Move bfd_init to bfd.c
Alan Modra [Tue, 10 Jan 2023 09:58:18 +0000 (20:28 +1030)]
Re: Move bfd_init to bfd.c

Commit b1c95bc4dd73 resulted in
...bfd.texi:246: @include: could not find init.texi
which went unnoticed due to not building in a clean directory.

This fixes the problem by moving bfd_init earlier, giving it a
doc node, and stitching the nodes back together.

* bfd.c (bfd_init): Move earlier.  Give it a doc inode.
Adjust other inodes to suit.
* doc/bfd.texi: Don't include init.texi.  Adjust nodes to suit.

22 months agosim: disable recursive make in (most) subdirs
Mike Frysinger [Sun, 1 Jan 2023 20:05:18 +0000 (15:05 -0500)]
sim: disable recursive make in (most) subdirs

Now that all (other than ppc) build in the top-level, we can disable
the recursive make calls to them.  This speeds things up nicely.

22 months agosim: common: move test-hw-events to top-level build
Mike Frysinger [Mon, 2 Jan 2023 00:03:28 +0000 (19:03 -0500)]
sim: common: move test-hw-events to top-level build

This is an internal developer target that isn't normally compiled,
but it can still be occasionally useful.  Move it to the top-level
build so we can kill off common/Make-common.in.

22 months agosim: move arch-specific file compilation of common/ files to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:55:09 +0000 (14:55 -0500)]
sim: move arch-specific file compilation of common/ files to top-level

22 months agosim: v850: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:25:08 +0000 (14:25 -0500)]
sim: v850: move arch-specific file compilation to top-level

The arch-specific compiler flags are duplicated, but they'll be cleaned
up once we move all subdir compiles to the top-level.

22 months agosim: sh: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:24:38 +0000 (14:24 -0500)]
sim: sh: move arch-specific file compilation to top-level

22 months agosim: rx: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:24:16 +0000 (14:24 -0500)]
sim: rx: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: rl78: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:23:04 +0000 (14:23 -0500)]
sim: rl78: move arch-specific file compilation to top-level

22 months agosim: riscv: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:22:46 +0000 (14:22 -0500)]
sim: riscv: move arch-specific file compilation to top-level

The arch-specific compiler flags are duplicated, but they'll be cleaned
up once we move all subdir compiles to the top-level.

22 months agosim: pru: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:22:04 +0000 (14:22 -0500)]
sim: pru: move arch-specific file compilation to top-level

22 months agosim: or1k: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:21:09 +0000 (14:21 -0500)]
sim: or1k: move arch-specific file compilation to top-level

The arch-specific compiler flags are duplicated, but they'll be cleaned
up once we move all subdir compiles to the top-level.

22 months agosim: msp430: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:20:42 +0000 (14:20 -0500)]
sim: msp430: move arch-specific file compilation to top-level

22 months agosim: moxie: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:19:54 +0000 (14:19 -0500)]
sim: moxie: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: mn10300: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:17:46 +0000 (14:17 -0500)]
sim: mn10300: move arch-specific file compilation to top-level

The arch-specific compiler flags are duplicated, but they'll be cleaned
up once we move all subdir compiles to the top-level.

22 months agosim: mips: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:16:58 +0000 (14:16 -0500)]
sim: mips: move arch-specific file compilation to top-level

The arch-specific compiler flags are duplicated, but they'll be cleaned
up once we move all subdir compiles to the top-level.

22 months agosim: microblaze: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:16:31 +0000 (14:16 -0500)]
sim: microblaze: move arch-specific file compilation to top-level

22 months agosim: mcore: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:16:00 +0000 (14:16 -0500)]
sim: mcore: move arch-specific file compilation to top-level

22 months agosim: m68hc11: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:15:00 +0000 (14:15 -0500)]
sim: m68hc11: move arch-specific file compilation to top-level

The arch-specific compiler flags are duplicated, but they'll be cleaned
up once we move all subdir compiles to the top-level.

22 months agosim: m32r: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:14:05 +0000 (14:14 -0500)]
sim: m32r: move arch-specific file compilation to top-level

22 months agosim: m32c: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:12:55 +0000 (14:12 -0500)]
sim: m32c: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: lm32: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 19:11:43 +0000 (14:11 -0500)]
sim: lm32: move arch-specific file compilation to top-level

22 months agosim: iq2000: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:46:12 +0000 (13:46 -0500)]
sim: iq2000: move arch-specific file compilation to top-level

22 months agosim: h8300: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:45:42 +0000 (13:45 -0500)]
sim: h8300: move arch-specific file compilation to top-level

22 months agosim: ft32: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:45:15 +0000 (13:45 -0500)]
sim: ft32: move arch-specific file compilation to top-level

22 months agosim: frv: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:43:06 +0000 (13:43 -0500)]
sim: frv: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: example-synacor: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:42:43 +0000 (13:42 -0500)]
sim: example-synacor: move arch-specific file compilation to top-level

22 months agosim: erc32: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:41:16 +0000 (13:41 -0500)]
sim: erc32: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: d10v: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:40:52 +0000 (13:40 -0500)]
sim: d10v: move arch-specific file compilation to top-level

22 months agosim: cris: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:40:11 +0000 (13:40 -0500)]
sim: cris: move arch-specific file compilation to top-level

22 months agosim: cr16: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:39:19 +0000 (13:39 -0500)]
sim: cr16: move arch-specific file compilation to top-level

22 months agosim: bfin: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:38:44 +0000 (13:38 -0500)]
sim: bfin: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: bpf: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:37:18 +0000 (13:37 -0500)]
sim: bpf: move arch-specific file compilation to top-level

We can drop the arch-specific rules from the subdir as they're no
longer used.

22 months agosim: avr: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:38:06 +0000 (13:38 -0500)]
sim: avr: move arch-specific file compilation to top-level

22 months agosim: arm: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 1 Jan 2023 18:36:50 +0000 (13:36 -0500)]
sim: arm: move arch-specific file compilation to top-level

The arch-specific flags are only used by the arch-specific modules,
not the common/ files, so we can delete them too.

22 months agosim: aarch64: move arch-specific file compilation to top-level
Mike Frysinger [Sun, 6 Nov 2022 03:59:27 +0000 (10:59 +0700)]
sim: aarch64: move arch-specific file compilation to top-level

22 months agosim: build: add basic framework for compiling arch objects in top-level
Mike Frysinger [Tue, 27 Dec 2022 04:20:46 +0000 (23:20 -0500)]
sim: build: add basic framework for compiling arch objects in top-level

The code so far has been assuming that we only compile common/ objects.
Now that we're ready to compile arch-specific objects, refactor some of
the flags & checks a bit to support both.

22 months agosim: modules.c: move generation to top-level
Mike Frysinger [Sun, 6 Nov 2022 09:56:39 +0000 (16:56 +0700)]
sim: modules.c: move generation to top-level

Now that all arches create libsim.a from the top-level, we have full
access to their inputs, and can move the actual generation from the
subdir up to the top-level.  This avoids recursive makes and will
help simplify state passing between the two.

22 months agosim: build: drop common/nrun.o subdir hack
Mike Frysinger [Sat, 31 Dec 2022 20:51:38 +0000 (15:51 -0500)]
sim: build: drop common/nrun.o subdir hack

Now that all the subdirs handle their own builds, we can drop this
common rule as it's unused, and we don't want to use it anymore.

22 months agosim: build: drop support for creating libsim.a in subdirs
Mike Frysinger [Tue, 27 Dec 2022 03:39:03 +0000 (22:39 -0500)]
sim: build: drop support for creating libsim.a in subdirs

Now that all ports have moved to creating libsim.a in the top-level,
drop all the support code to create it in a subdir.

22 months agosim: v850: move libsim.a creation to top-level
Mike Frysinger [Tue, 27 Dec 2022 03:31:29 +0000 (22:31 -0500)]
sim: v850: move libsim.a creation to top-level

The objects are still compiled in the subdir, but the creation of the
archive itself is in the top-level.  This is a required step before we
can move compilation itself up, and makes it easier to review.

The downside is that each object compile is a recursive make instead of
a single one.  On my 4 core system, it adds ~100msec to the build per
port, so it's not great, but it shouldn't be a big deal.  This will go
away of course once the top-level compiles objects.

22 months agosim: sh: move libsim.a creation to top-level
Mike Frysinger [Tue, 27 Dec 2022 03:29:53 +0000 (22:29 -0500)]
sim: sh: move libsim.a creation to top-level

The objects are still compiled in the subdir, but the creation of the
archive itself is in the top-level.  This is a required step before we
can move compilation itself up, and makes it easier to review.

The downside is that each object compile is a recursive make instead of
a single one.  On my 4 core system, it adds ~100msec to the build per
port, so it's not great, but it shouldn't be a big deal.  This will go
away of course once the top-level compiles objects.