"nat/gdb_ptrace.h" defines PT_STEP as 9, if it is not defined. nat-ptrace.c
depends on this; inf_ptrace_target::resume() uses PT_STEP unconditionally
when its ``step'' argument is non-zero. Therefore,
- Add comment that nbsd-nat.c should include <sys/ptrace.h> directly,
instead of "nat/gdb_ptrace.h".
- Add gdb_assert(step == 0) in nbsd_nat_target::resume() ifndef PT_STEP,
before calling inf_ptrace_target::resume().
- binary compatibility with earmv7{,hf}eb and later, as well as
COMPAT_NETBSD32 on aarch64eb
- unaligned memory access
whereas compatibility with earmv5{,hf}eb and prior is lost.
As we have never released kernel and userland for earmv6{,hf}eb yet,
this does not causes any compatibility problems.
Discussed on port-arm and tech-toolchain.
Cherry-picked from upstream:
https://git.savannah.gnu.org/gitweb/?p=config.git;a=commit;h=1c4398015583eb77bc043234f5734be055e64bea
Everything except external/apache2/llvm/dist/llvm/cmake/config.guess
is patched, which is under vendor tag and cannot be modified. I expect
that this file is not actually used as we use hand-crafted version of
configure script instead of cmake for building LLVM.
Note that external/apache2/llvm/autoconf/autoconf/config.guess has
already been committed on Oct. 20, but commit message disappeared as
cvs aborted due to "permission denied" when trying to modify the file
mentioned above. Sorry for confusing you.
Also note that GMP uses its own config.guess Patch for
external/lgpl3/gmp/dist/config.guess is provided by ryo@. Thanks!
For reproducible builds to work we need to have a consistent command
line (because the command line gets recorded in dwarf). So we can't
do:
-ffile-prefix-map=/joe/random/src=/usr/src
because then /joe/random/src gets recorded. We do instead:
-ffile-prefix-map=\$NETBSDSRCDIR=/usr/src
The patch restores the environment variable parsing that got lost
in the last 2 gcc upgrades.
Do not jump over the threads during the startup unless we encounter
TARGET_WAITKIND_STOPPED with SIGTRAP or TARGET_WAITKIND_EXECD.
Otherwise whenever a startup-with-shell processes signals on the
startup stage, it might indicate to switch to a non-existing
thread or a special-thread number (target lwp=0 on NetBSD means
that a signal was directed to all threads within a process).
This caused a crash with tcsh on NetBSD, where the tcsh shell
runs startup detection of the hostname. This action involves
spwaning a new process through fork.
GDB crashes this way:
$ SHELL=tcsh /usr/bin/gdb echo
(gdb) r
Starting program: /bin/echo
/usr/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/thread.c:1309:
internal-error: void switch_to_thread(thread_info*):
Assertion `thr != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
This patch has been submitted upstream for review:
https://sourceware.org/pipermail/gdb-patches/2020-October/172558.html
(-O1 is fine). This is a new regression introduced in GCC9.
For everyone's safety, extend -O0 hack to dwarf2{expr,loc}.c for
all arm variants with GCC >= 8.
Cherry-pick:
From e2a2a24a8e78427ff8667d625f5befbe88c328bb Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54@gmx.com>
Date: Wed, 23 Sep 2020 04:20:05 +0200
Subject: [PATCH] Preinitialize the sockaddr_un variable to zero
Don't pass random sun_len for the BSD's,
zero the whole structure as recommended for portability.
Reported by Coverity.
gdbsupport/ChangeLog:
* agent.cc (gdb_connect_sync_socket): Preinitialize addr with zeros.
aka "the memcmp bug", from a patch for gcc-10 in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189
Tested on x86_64 by running a full build, install and running it.
Testing that the problem has been fixed with one of the unit tests provided.
Cherry-pick and adapt:
From 2a9ce60de98e53198047daaeeec3cf09ece4e693 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54@gmx.com>
Date: Fri, 2 Oct 2020 16:13:09 +0200
Subject: [PATCH] [compiler-rt] [netbsd] Improve the portability of
ThreadSelfTlsTcb
Use __lwp_gettcb_fast() and __lwp_getprivate_fast(), as _lwp_getprivate()
can be a biased pointer and invalid for use in this function on all CPUs.