Commit graph

277302 commits

Author SHA1 Message Date
Dimitry Andric 70ab6e9b18 Revert commit 925a11a5f221 from llvm-project (by Nikolas Klauser):
[libc++] Simplify is_convertible

  GCC 13 has added __is_convertible(), so we don't need to keep the fallback implementation around.

  Reviewed By: #libc, Mordante

  Spies: Mordante, libcxx-commits

  Differential Revision: https://reviews.llvm.org/D157939

This should allow buildworld with gcc 12 to work again.

PR:		276104
MFC after:	1 month

(cherry picked from commit 2365f01295)
2024-04-20 12:29:10 +02:00
Dimitry Andric ac652ee7fb Merge commit 55c466da2f2f from llvm-project (by Benjamin Kramer):
[X86][AVX512BF16] Add a few missing insert/extract patterns

  These are really the same as the f16 (and i16) instructions, but we need
  them for any type that can occur.

Merge commit 2e4e04c59043 from llvm-project (by Phoebe Wang):

  [X86][BF16] Do not lower to VCVTNEPS2BF16 without AVX512VL (#86395)

  Fixes: #86305

These should fix "fatal error: error in backend: Cannot select: t71:
v32bf16 = insert_subvector t67, t64, Constant:i32<16>" when building the
misc/ncnn port.

PR:		278305
Reported by:	yuri
MFC after:	1 month

(cherry picked from commit 78d3648e73)
2024-04-20 12:29:10 +02:00
Dimitry Andric 3f0f6c9806 libllvm: add missed tlbgen headers and sources for BPF target
Noticed by:	vishwin
PR:		276104
MFC after:	1 month

(cherry picked from commit 442d351bd2)
2024-04-20 12:29:09 +02:00
Dimitry Andric 7334d08a3a libcompiler_rt Makefile.inc: include bsd.compiler.mk to fix build
Apparently libgcc_s has always included libcompiler_rt's Makefile.inc
without first including bsd.compiler.mk, even though Makefile.inc used
COMPILER_TYPE already. It looks like we were just lucky that the
expression was not malformed.

PR:		276104
Reported by:	Herbert J. Skuhra <herbert@gojira.at>
MFC after:	1 month

(cherry picked from commit 4c983a2886)
2024-04-20 12:29:09 +02:00
Dimitry Andric e2e4022725 libcompiler_rt Makefile.inc: don't build bfloat16 support for gcc < 13
Older versions of gcc produce "error: unknown type name '__bf16'".

PR:		276104
MFC after:	1 month

(cherry picked from commit 2e226748a9)
2024-04-20 12:29:09 +02:00
Dimitry Andric 5018444b28 libcompiler_rt Makefile.inc: remove debugging messages
PR:		276104
MFC after:	1 month

(cherry picked from commit d00b9344bb)
2024-04-20 12:29:09 +02:00
Dimitry Andric 89cc83362f Fix GENERIC-KASAN kernel build for amd64
Work around https://github.com/llvm/llvm-project/issues/87923, which
leads to an assertion failure compiling several kernel source files with
asan enabled.

PR:		276104
MFC after:	1 month

(cherry picked from commit b811dac211)
2024-04-20 12:29:09 +02:00
Dimitry Andric 0764680cf8 Fix arm64 build after llvm 18.1.3 upgrade (take 2)
Instead of compiling the whole sys/arm64/arm64/vfp.c file without
-mgeneral-regs-only, which might have unwanted side effects, add
".arch_extension fp" / ".arch_extension nofp" pairs to the inline
assembly.

PR:		276104
Suggested by:	andrew
MFC after:	1 month

(cherry picked from commit 61e482f2fc)
2024-04-20 12:29:09 +02:00
Dimitry Andric 7b86b92ec1 Fix arm64 build after llvm 18.1.3 upgrade
Apparently clang 18 has become more strict about using floating point
registers in inline assembly when -mgeneral-regs-only is used. This
causes sys/arm64/arm64/vfp.c to fail to compile, with "error:
instruction requires: fp-armv8", and "error: expected readable system
register".

To fix it, similar to other files compiled for arm64, disable
-mgeneral-regs-only for this particular file.

PR:		276104
MFC after:	1 month

(cherry picked from commit f4d93b6761)
2024-04-20 12:29:09 +02:00
Dimitry Andric 3a287a03cf Merge llvm-project release/18.x llvmorg-18.1.3-0-gc13b7485b879
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.3-0-gc13b7485b879.

PR:		276104
MFC after:	1 month

(cherry picked from commit 439352ac82)
2024-04-19 23:24:48 +02:00
Dimitry Andric 8e0b0a2827 Merge commit f5f3d5d6534f from llvm-project (by Qizhi Hu):
[Clang][Sema] Fix a crash in lambda instantiation (#85565)

  Fix https://github.com/llvm/llvm-project/issues/85343
  When build lambda expression in lambda instantiation, `ThisType` is
  required in `Sema::CheckCXXThisCapture` to build `this` capture. Set
  `this` type by import `Sema::CXXThisScopeRAII` and it will be used later
  in lambda expression transformation.

  Co-authored-by: huqizhi <836744285@qq.com>

This fixes 'Assertion failed: (!isNull() && "Cannot retrieve a NULL type
pointer"), function getCommonPtr" when building the x11-wm/wayfire port.

PR:		276104
MFC after:	1 month

(cherry picked from commit 49a6e426df)
2024-04-19 23:24:48 +02:00
Dimitry Andric 64816cf50d Revert commit 6255157d24e2 from llvm-project (by Dimitry Andric):
[libc++] Re-enable std::pair trivial copy constructor for FreeBSD >= 14

  After many years of using the really old std::pair ABI which did not yet
  have a trivial copy constructor, FreeBSD 14 and later will finally get
  rid of it. Only use the old ABI for FreeBSD 13 and earlier.

  Note: on the FreeBSD side, we will bump our libc++.so version for this,
  and keep an old compatibility library in a separate package.

  Differential Revision: https://reviews.llvm.org/D126462

This ABI change can cause crashes when binaries compiled against older
libc++ versions are run against binaries compiled against this libc++
version.

For example, lang/ldc uses a precompiled bootstrap ldc2 binary that was
compiled against the old libc++, but also links against libLLVM-15.so.
If libLLVM-15.so is compiled against the new libc++ version, the ABI
mismatch results in segfaults or even stack overflows.

Note: we can only re-enable the std::pair trivial copy constructors
again when the official libc++ ABI version is bumped to 2.

PR:		276104
MFC after:	1 month

(cherry picked from commit ce4f1f49e0)
2024-04-19 23:24:48 +02:00
Dimitry Andric b09953d54d Merge llvm-project release/18.x llvmorg-18.1.1-0-gdba2a75e9c7e
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.1-0-gdba2a75e9c7e.

PR:		276104
MFC after:	1 month

(cherry picked from commit 4c2d3b022a)
2024-04-19 23:24:47 +02:00
Dimitry Andric 7032a43521 Merge llvm-project release/18.x llvmorg-18.1.0-rc3-0-g6c90f8dd5463
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc3-0-g6c90f8dd5463.

PR:		276104
MFC after:	1 month

(cherry picked from commit 56727255ad)
2024-04-19 23:24:47 +02:00
Dimitry Andric c80674ff65 Merge llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442.

PR:		276104
MFC after:	1 month

(cherry picked from commit 74626c16ff)
2024-04-19 23:24:47 +02:00
Dimitry Andric 83e37ae556 Merge llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967.

PR:		276104
MFC after:	1 month

(cherry picked from commit b3edf44679)
2024-04-19 23:24:46 +02:00
Dimitry Andric af050415f0 [libc++] Rename __bit_reference template parameter to avoid conflict
As of 4d20cfcf4eb08217ed37c4d4c38dc395d7a66d26, `__bit_reference`
contains a template `__fill_n` with a bool `_FillValue` parameter.

Unfortunately there is a relatively widely used piece of scientific
software called NetCDF, which exposes a (C) macro `_FillValue` in its
public headers.

When building the NetCDF C++ bindings, this quickly leads to compilation
errors when the macro interferes with the template in `__bit_reference`.

Rename the parameter to `_FillVal` to avoid the conflict.

PR:		276104
MFC after:	1 month

(cherry picked from commit 868ee3f285)
2024-04-19 23:24:46 +02:00
Dimitry Andric 6c596be665 Merge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi):
[Clang][AST] Fix a crash on attaching doc comments (#78716)

  This crash is basically caused by calling
  `ASTContext::getRawCommentForDeclNoCacheImp` with its input arguments
  `RepresentativeLocForDecl` and `CommentsInTheFile` refering to different
  files. A reduced reproducer is provided in this patch.

  After the source locations for instantiations of funtion template are
  corrected in the commit 256a0b298c68b89688b80350b034daf2f7785b67, the
  variable `CommitsInThisFile` in the function
  `ASTContext::attachCommentsToJustParsedDecls` would refer to the source
  file rather than the header file for implicit function template
  instantiation. Therefore, in the first loop in
  `ASTContext::attachCommentsToJustParsedDecls`, `D` should also be
  adjusted for relevant scenarios like the second loop.

  Fixes #67979
  Fixes #68524
  Fixes #70550

This should fix a segfault when compiling graphics/gdal.

PR:		276104
MFC after:	1 month

(cherry picked from commit dc36515b62)
2024-04-19 23:24:46 +02:00
Dimitry Andric 3731f53de1 Merge commit 6e4930c67508 from llvm-project (by Alexander Kornienko):
Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)"

  This reverts commit 924701311aa79180e86ad8ce43d253f27d25ec7d. Causes compilation
  errors on valid code, see
  https://github.com/llvm/llvm-project/pull/77768#issuecomment-1908062472.

In particular, this fixes bogus "call to constructor of 'SomeType' is
ambiguous" errors.

PR:		276104
MFC after:	1 month

(cherry picked from commit ddbac700c2)
2024-04-19 23:24:45 +02:00
Dimitry Andric a1f98ae0a8 Merge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18-init-18361-g22683463740e.

PR:		276104
MFC after:	1 month

(cherry picked from commit 878ed4957e)
2024-04-19 23:24:45 +02:00
Dimitry Andric 206cf542ef Tentatively apply https://github.com/libcxxrt/libcxxrt/pull/27
This marks __cxa_allocate_exception, __cxa_free_exception and
__cxa_init_primary_exception noexcept, to ensure compatibility with
libc++'s declarations.

PR:		276104
MFC after:	1 month

(cherry picked from commit 3fb2e04579)
2024-04-19 23:24:45 +02:00
Dimitry Andric ab50317e96 Merge llvm-project main llvmorg-18-init-18359-g93248729cfae
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
last commit before the upstream release/18.x branch was created.

PR:		276104
MFC after:	1 month

(cherry picked from commit 7a6dacaca1)
2024-04-19 23:24:44 +02:00
Dimitry Andric 412542983a Redo libc++ customizations
* Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
* Instead, add direct major __FreeBSD__ check for using ::gets declaration
* Mark EINTEGRITY values as FreeBSD customization
* Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization

PR:		276104
MFC after:	1 month

(cherry picked from commit 46c59ea9b6)
2024-04-19 23:24:43 +02:00
Dimitry Andric 52e4ee64c2 Merge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

PR:		276104
MFC after:	1 month

(cherry picked from commit 297eecfb02)
2024-04-19 23:24:43 +02:00
Dimitry Andric ed89c59104 Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

PR:		276104
MFC after:	1 month

(cherry picked from commit 1db9f3b21e)
2024-04-19 23:24:41 +02:00
Dimitry Andric 335f7960dc Add two FreeBSD customizations to libc++
This is intended to better support ports usage of older clang versions:
* Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
  version checks, to avoid any warnings about support. This makes some
  ports that use -Werror fall over.
* When using clang < 15.0, avoid using a type visibility attribute on
  the std namespace, as older versions of clang do not support this.

PR:		276104
MFC after:	1 month

(cherry picked from commit 412fa3436f)
2024-04-19 23:24:41 +02:00
Dimitry Andric 15ce79bc8b Tentatively merge https://github.com/llvm/llvm-project/pull/77242
[libcxx] Re-include <osreldate.h> in __config for FreeBSD

  In 0a97720d0197 some changes were made to `__config` for assuming that
  `__BYTE_ORDER__` is always present.

  However, this deleted a `<osreldate.h>` include for FreeBSD, which is
  required to get the value of `__FreeBSD_version`, and that is used later
  in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
  enabled.

  Include `<osreldate.h>` just after the other includes used for feature
  detection, to fix this.

  Note that when FreeBSD 13 is EOLed, this can be removed, as then all
  supported FreeBSD versions will no longer have `gets()`.

PR:		276104
MFC after:	1 month

(cherry picked from commit 653487bbc8)
2024-04-19 23:24:41 +02:00
Dimitry Andric 0c85e2760f Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

PR:		276104
MFC after:	1 month

(cherry picked from commit 647cbc5de8)
2024-04-19 23:24:24 +02:00
Dimitry Andric 92d4d6f1f6 Revert commit 0e46b49de433 from llvm-project (by Matt Arsenault):
Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
https://github.com/llvm/llvm-project/issues/76416

PR:		276104
MFC after:	1 month

(cherry picked from commit edc2dc17b1)
2024-04-19 23:23:59 +02:00
Dimitry Andric a205596100 Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

PR:		276104
MFC after:	1 month

(cherry picked from commit cb14a3fe51)
2024-04-19 23:23:58 +02:00
Dimitry Andric b168c9a3e5 Tentatively apply https://github.com/llvm/llvm-project/pull/76175
This fixes libsa including compiler-rt builtins.

PR:		276104
MFC after:	1 month

(cherry picked from commit 3d68ee6cbd)
2024-04-19 23:23:57 +02:00
Dimitry Andric bdbe302c33 Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

PR:		276104
MFC after:	1 month

(cherry picked from commit 5f757f3ff9)
2024-04-19 23:23:40 +02:00
Michael Zhilin e7a1904fe1 snd_hda: fix "duplicated free" on module unloading
This is trivial fix of hdacc_detach to avoid duplicated free on snd_hda
unloading.

The first try of detaching (kldunload) may results into "device busy" error,
but codec->fgs is freed by detach. Second try attempts to free codec->fgs again
and system panicks.

Here is example:

pcm0: unregister: channel pcm0:virtual:dsp0.vp0 busy (pid 3428)
pulseaudio[3428] [oss] module-oss.c: DSP shutdown.
pcm0: detached
hdaa0: detached
panic: Duplicate free of 0xfffff80412ee7d20 from zone 0xfffffe006bc0ba00
(malloc-32) slab 0xfffff80412ee7fc8(105)
cpuid = 6
time = 1712999565
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0202f859e0
vpanic() at vpanic+0x135/frame 0xfffffe0202f85b10
panic() at panic+0x43/frame 0xfffffe0202f85b70
uma_dbg_free() at uma_dbg_free+0x105/frame 0xfffffe0202f85b90
uma_zfree_arg() at uma_zfree_arg+0x95/frame 0xfffffe0202f85be0
free() at free+0xa1/frame 0xfffffe0202f85c20
hdacc_detach() at hdacc_detach+0x2f/frame 0xfffffe0202f85c40
device_detach() at device_detach+0x197/frame 0xfffffe0202f85c80
devclass_driver_deleted() at devclass_driver_deleted+0x66/frame 0xfffffe0202f85c
devclass_delete_driver() at devclass_delete_driver+0x81/frame 0xfffffe0202f85d00
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe0202f85d50
module_unload() at module_unload+0x32/frame 0xfffffe0202f85d70
linker_file_unload() at linker_file_unload+0x1eb/frame 0xfffffe0202f85db0
kern_kldunload() at kern_kldunload+0x18e/frame 0xfffffe0202f85e00
amd64_syscall() at amd64_syscall+0x153/frame 0xfffffe0202f85f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0202f85f30

MFC after:              3 days
Reviewed by:            markj, christos
Differential Revision:  https://reviews.freebsd.org/D44778
Sponsored by:           Postgres Professional

(cherry picked from commit bed0b2146f)
2024-04-19 10:23:36 +03:00
Michael Zhilin 7929371054 snd_hda: Add the full Intel Meteor/Arrow/Lunar Lake HD Audio PCI IDs
This is based off the Linux file sound/hda/intel-dsp-config.c.

Tested on:              Lenovo Thinkbook 16 G6+ IMH
MFC after:              3 days
Reviewed by:            markj, christos
Differential Revision:  https://reviews.freebsd.org/D44777
Sponsored by:           Postgres Professional

(cherry picked from commit 1dd1a696c5)
2024-04-19 10:23:36 +03:00
Scott Long 8ee68ab867 Fix "set but not used" for the sym driver.
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5045cb8f18)
2024-04-18 21:41:36 +02:00
Marius Strobl 3d1d7c2c16 fib_algo(4): Lower level of algorithm switching messages to LOG_INFO
Otherwise, with the default flm_debug_level of LOG_NOTICE, it's rather
easy to trigger debug messages such as:
[fib_algo] inet.0 (bsearch4#18) rebuild_fd_flm: switching algo to
radix4_lockless

Also, the "severity" of these events generally only justifies LOG_INFO
and not LOG_NOTICE.

Reviewed by:	melifaro

(cherry picked from commit ed81a15517)
2024-04-18 21:41:36 +02:00
Kristof Provost 02ea70eff3 tcpdump: fix build
Apply the change that was supposed to be in bf0700716a
2024-04-18 17:55:34 +02:00
Kristof Provost bf0700716a tcpdump: cope with incorrect packet lengths
It's possible for the capture buffer to be smaller than indicated by the
header length. However, pfsync_print() only took the header length into
account. As a result we could read outside of the buffer.

Check that we have at least the expected amount of data before we start
parsing.

PR:		278034
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44580

(cherry picked from commit 4848eb3af2)
2024-04-18 09:41:28 +02:00
Gordon Bergling da013f1d5f atrtc(4): Fix a typo in a sysctl description
- s/emtpy/empty/

(cherry picked from commit 38cc6c3d95)
2024-04-18 06:34:52 +02:00
Alexander Motin 4bb54e8ec3 ahc/ahd: Fix target mode operation
After 5e63cdb457 the drivers didn't clear CAM_DIS_DISCONNECT in
ah*_handle_target_cmd() when needed, only set it.

Reported/tested by:	HP van Braam <hp@tmm.cx>
MFC after:	1 week

(cherry picked from commit f1e4c09577)
2024-04-17 09:40:06 -04:00
Konstantin Belousov 7cf0b203f5 Revert "acpidump: dump AMD IVRS table describing IOMMU layout"
and related helping commits on stable/13. This reverts commits
256ee428f5
f95a254aa7
f7fd7f8b88

The acpi-ca version on stable/13 is too old.
2024-04-17 12:40:04 +03:00
Konstantin Belousov 02dc74cc21 pciconf(8): dump AMD IOMMU Base Capability
(cherry picked from commit 1e6db7be69)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 6b771774c5 pcireg.h: Add AMD IOMMU Base Cap definitions
(cherry picked from commit 33adb388c7)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 6f8e8d0723 pcireg.h: add include guard
(cherry picked from commit 1cd9868f04)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 256ee428f5 acpidump: add Foundation copyright
(cherry picked from commit f1519a8229)
2024-04-17 11:13:18 +03:00
Konstantin Belousov f95a254aa7 acpidump: dump AMD IVRS table describing IOMMU layout
(cherry picked from commit 6d789b6126)
2024-04-17 11:13:18 +03:00
Konstantin Belousov f7fd7f8b88 acpidump: add printfield() helper
(cherry picked from commit 969a4b8be5)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 84944bf5e2 acpidump: bump WARNS to 6
(cherry picked from commit 29a6b72775)
2024-04-17 11:13:17 +03:00
Konstantin Belousov 930c76a733 acpidump: the acpi_get_fadt_revision() argument is unused
(cherry picked from commit 4262ad56a0)
2024-04-17 11:13:17 +03:00
Konstantin Belousov f77abc3526 acpidump: silent the warning about unaligned uuid
(cherry picked from commit de937ecb75)
2024-04-17 11:13:17 +03:00