Commit Graph

2339 Commits

Author SHA1 Message Date
christos
417fcb580b add aarch64 bits 2020-12-05 21:26:43 +00:00
rin
a3e196b030 gcc.old: Switch earmv6{,hf}eb to BE8, ported from gcc. 2020-12-01 02:39:48 +00:00
rin
8f72a86eed Switch earmv6{,hf}eb from BE32 (deprecated) to BE8 (new), which enables
- 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.
2020-12-01 02:39:08 +00:00
rin
a8c74629f6 Support aarch64eb in */config.guess.
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!
2020-11-17 10:35:10 +00:00
christos
a7b28dcb09 PR/55802: Andreas Gustafsson: Unbreak reproducible builds.
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.
2020-11-14 21:24:03 +00:00
christos
82c4abc314 Now that we are adding the thread in the bsd_kvm_ops target namespace,
make sure that the inferior's top namespace is that too.
2020-10-24 23:06:15 +00:00
kamil
fe62285e60 Install the NetBSD XML syscall definitions 2020-10-24 05:01:57 +00:00
rin
9f4a23d06a Fix assembling "isb sy" for aarch64{,eb} on LP64BE architectures.
Cherry-picked from upstream:

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=05cfb0d8cc9b7f8676f5ae55a93642f091d5405f;hp=0ec992e6647c00fc234cdf4c11732b6711b024af

Now, working kernel can be self-built on aarch64eb.

Thanks to ryo@ for fixing and upstreaming this!
2020-10-19 12:47:53 +00:00
maya
2256753ef0 Remove unused local diff. Pointed out by htodd. 2020-10-19 07:44:52 +00:00
kamil
375c406271 Limit the switch_to_thread() calls in startup_inferior()
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
2020-10-14 14:02:43 +00:00
rin
5919239d7d Reduce diff with upstream a bit.
No functional changes.
2020-10-13 07:12:00 +00:00
rin
271d6b3e72 Adjust for aarch64eb; it needs elf32-aarch64.c. 2020-10-09 23:55:48 +00:00
rin
11eeaade86 mknative-gdb.old for aarch64eb 2020-10-09 23:54:12 +00:00
rin
c4b815a64a Apply hack for GDB 8.3 on arm to GDB 11.
XXX
Not tested as GDB 11 does not build for arm at the moment.

Note that dist/gdb/dwarf2foo.c was renamed to dist/gdb/dwarf2/foo.c.
2020-10-08 08:32:57 +00:00
rin
75fa0b3cd9 GCC 9.3 miscompiles dwarf2{expr,loc}.c with -O2 for earmv5hf{,eb}
(-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.
2020-10-08 08:31:37 +00:00
kamil
933fb81256 Replace local patches adding NetBSD/aarch64 support with the upstream one
Cherry-pick:

From c0b313441717b65569edb01bf9984d2066d899de Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Mon, 5 Oct 2020 14:56:42 +0100
Subject: [PATCH] Add NetBSD AArch64 Little Endian and Big Endian BFD support.

bfd      * config.bfd (aarch64-*-netbsd*, aarch64_be-*-netbsd*): Add target.
2020-10-06 23:28:13 +00:00
kamil
c19751a211 Undo local patches
They are no longer needed (and are wrong).
2020-10-06 23:14:47 +00:00
kamil
6a134d1bf9 Remove NFC local delta 2020-10-06 22:17:42 +00:00
kamil
33673ac57c Fix typo
Remove delta with upstream.
2020-10-06 22:14:41 +00:00
kamil
cc2fb38879 Replace local patch with fix from upstream
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.
2020-10-06 22:04:09 +00:00
kamil
95bfe6ceb7 Undo local NFC patch 2020-10-06 21:54:01 +00:00
kamil
543accdbd7 Undo local patch having no impact
/tmp is picked from P_tmpdir earlier.
2020-10-06 21:49:22 +00:00
kamil
fef5fe3a2a Undo local NFC patch 2020-10-06 21:39:53 +00:00
christos
67dafae820 Apply by hand a patch to fix http://r6.ca/blog/20200929T023701Z.html
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.
2020-10-04 14:44:47 +00:00
kamil
4d7b5ca9b5 Do not assume that _lwp_getprivate() returns unbiased private pointer
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.
2020-10-02 14:36:54 +00:00
christos
5093c1f669 Add the generated version file 2020-09-24 14:54:03 +00:00
christos
bc11a54ebd Add version.cc 2020-09-24 14:53:35 +00:00
kamil
2c7c316aa6 Make gdbserver almost work
The only missing thing is the lack of generated version.c.
2020-09-24 03:06:01 +00:00
christos
70699dff37 Add build glue (does not link) 2020-09-23 23:36:59 +00:00
mrg
4cb0ef6be7 fix missing deps for cow-fs_dir* and cow-fs_ops*.
should fix build issues reported on current-users.
2020-09-21 20:00:44 +00:00
mrg
e9f99204c3 make depend files also depend on the generated headers.
fixes build issues.
2020-09-21 06:48:48 +00:00
christos
d2c8b54685 zero out the sockaddr, so that the length it guaranteed to be 0. 2020-09-20 21:18:45 +00:00
christos
eceb233b9b regen 2020-09-20 20:34:42 +00:00
christos
4d342c046e regen 2020-09-20 16:54:16 +00:00
christos
853ce42ed3 disable -Wstack-usage since some targets like vax don't support it 2020-09-20 16:41:25 +00:00
christos
ad295f62b7 undo previous, it was correct 2020-09-20 16:00:56 +00:00
christos
f80dfe5994 Don't read data from sections without contents on NetBSD. We end up reading
0's and svr4_exec_displacement read phdrs_target successfully, and we
end up in the rabbit-hole of 0 displacement for pie binaries and then we
can't load our shared libaries from the core file.
2020-09-20 14:39:26 +00:00
christos
10aefa730d remove mis-merged code and make the auxv core offset 0. Now loading auxv
from core files works.
2020-09-19 21:47:03 +00:00
christos
8ac0bbd165 The lid of the main thread == pid now. Should we fix the kernel to return
this? Now debugging live programs work.
2020-09-19 21:45:45 +00:00
christos
43893e6090 Provide better guesses for bsd systems, otherwise we end up calling
recursively opendir and gettimeofday until we run out of stack...
2020-09-18 17:46:47 +00:00
christos
e6d52d512c fix build. 2020-09-17 20:26:22 +00:00
christos
808b1dd7da commit generated man pages 2020-09-17 20:13:20 +00:00
christos
eff0df4904 Generate ctf-error.h 2020-09-17 16:45:35 +00:00
christos
c14ca8fd28 Add new libraries 2020-09-17 16:38:10 +00:00
christos
19ad82eb24 Add new libraries, adjust old ones 2020-09-17 16:36:38 +00:00
christos
6b8c077795 remove obsolete 2020-09-17 16:07:39 +00:00
christos
7ea3f33ef5 Avoid name conflict 2020-09-17 16:06:27 +00:00
christos
fbd0cba2e1 Avoid re-definitions 2020-09-17 16:05:14 +00:00
kamil
e849e4aef2 Use internal_ptrace() instead of ptrace()
Cherry-pick:

commit 0008fb343704bafc3469703be930b8a65d7c47fa
Author: Kamil Rytarowski <n54@gmx.com>
Date:   Mon Sep 14 10:10:49 2020 +0200

    [compiler-rt] [netbsd] Use internal_ptrace() instead of ptrace()
2020-09-17 15:43:24 +00:00
kamil
81809f8a14 Undo setting _KERNTYPES
The sparc ptrace(2) headers were fixed to work without defined _KERNTYPES.
2020-09-17 15:42:17 +00:00