[test][bazel][libc] Allow LLVM-libc tests to be run in full-build mode
This PR makes the required changes to run LLVM-libc full build tests in Bazel. After this PR, most tests pass:
```
bazel test @llvm-project//libc/test/... --config=ci --@llvm-project//libc:build_mode=full --keep_going
Executed 680 out of 853 tests: 681 tests pass and 172 fail to build.
```
Follow on PRs will fix specific tests that are failing (lots of missing deps etc).
This PR mostly involves propagating the correct dependencies and compiler/linker options from [`add_libc_hermetic`](https://github.com/llvm/llvm-project/blob/4098f568c46e06b6df470111868b4c165dd80f4d/libc/cmake/modules/LLVMLibCTestRules.cmake#L750). Slightly more involved changes:
- `BazelFilePath.cpp` also had to be fixed so that it doesn't depend on the non-namespaced `getenv` function. This PR models after https://github.com/llvm/llvm-project/commit/ee407f7e7069cccfdc1815de07e17cebf83d19f9 in order to conditionally use LLVM-libc's getenv under full-build mode.
- All tests have a dependency against `crt1.o` when run under full-build. This PR updates `merge_relocatable_object` so it also exposes a `CcInfo` with the merged object file and its transitive deps. In order to do so, this PR also makes the logic a little more careful about PIC vs non-PIC deps.
nvme: Add quirk for Amazon EBS NVMe Controller
This controller exhibits QUIRK_EMPTY_NAMESPACE_CHANGED_LOG behaviour.
A bug report has been filed with the vendor.
Reviewed by: imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D58232
(cherry picked from commit 14f5fd2395e3f1c3fadeee8b95756c142f7dcb0b)
rc+devd: Add growfs_postboot
In VM and cloud environments it is often possible to enlarge virtual
disks; this can be useful, for example, if a system is launched with a
small root disk and it later becomes clear that more space is needed.
On kernels which support run-time resizing of disks (for NVMe, this was
added in November 2025; some other disk types have supported this for
longer) a SIZECHANGE notification is sent to userland via devd.
Add a "nostart" rc.d script (runnable manually but not automatically at
boot time) and a devd script which invokes it when a notification
arrives. The rc.d script enlarges the "final partition" on partitioned
geoms, or the UFS filesystem or zpool device when triggered on a disk
containing either of those.
Reviewed by: imp, ziaee
MFC after: 2 weeks
Relnotes: Disk partitions and filesystems can be enlarged
[6 lines not shown]
nvme: Add quirk for broken namespace-change log
Add a QUIRK_EMPTY_NAMESPACE_CHANGED_LOG quirk which indicates that the
nvme controller may not properly populate the namespace-changed log
page. If we receive a NVME_LOG_CHANGED_NAMESPACE page for a device
with this quirk and the page is empty, probe all of the namespaces
rather than none of them.
Reviewed by: imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D58231
(cherry picked from commit 954098103ee287f39ecbf5d3144bcdfd16e7c41d)
[NFC][LowerTypeTests] Expand tests for CFI jump table hotness ordering
Expand pre-commit test coverage to establish the baseline CFI jump table
layout before implementing hotness-based reordering in
https://github.com/llvm/llvm-project/pull/221046.
We expand these tests to verify we accurately track hotness data
originating from `cfi.functions` metadata, BlockFrequencyInfo (BFI)
counts, and IR function attributes (hot/cold). By covering these inputs,
we ensure the correct hotness tier is propagated for layout decisions
across different profile sources and LTO targets.
These tests verify the baseline declaration-order layout where functions
within each strict type are placed without hotness consideration, making
the subsequent reordering diff explicit and easy to review.
PR Stack:
* https://github.com/llvm/llvm-project/pull/220776
* https://github.com/llvm/llvm-project/pull/221043
[9 lines not shown]
[LowerTypeTests] Reorder CFI jump table entries based on hotness
Order CFI jump table entries by function hotness. We use `cfi.functions`
metadata in ThinLTO, or `BlockFrequencyInfo` / function entry counts in
full LTO.
We want the hottest function to be optimized by the last entry thing for
SHT_LLVM_CFI_JUMP_TABLE. The linker deletes the final branch in the jump
table and moves the table directly before that target function so it
falls through.
This also ensures the jump table lands in a hot section (.text.hot)
instead of a cold section (.text.unlikely). Type contiguity is
preserved.
This PR reliably improves the performance of our server binary by 0.2%,
and some smaller binaries up to 5%.
PR Stack:
[11 lines not shown]
[CIR] Implement elementwise min/max/minimum/maximum/minnum/maxnum/etc (#222481)
These ended up being simple translations to llvm intrinsics, so other
than a single small 'magic decoder ring', this is a very trivial
implementation. The tests are taken from classic-codegen with some mild
modifications (as vector types don't work in arguments yet, and we are
testing more appropriately, as those were generated check lines).
This was found in an application we're trying to build.
[CIR] Remove the union spanning precondition
Bounding the rule at two eightbytes wasn't enough: a 16-byte union
with a 12-byte member still got refused, which is the Expected<T>
shape blocking the self-build. The rule was covering for a
classifier bug, so it's gone, along with the query it needed.
takeTailByteOrPtr needs #223859 and fails until that merges in.
Assisted-by: Cursor / claude-opus-5
[flang] Diagnose integer MOD/MODULO when the divisor is zero (#222790)
Flang currently prints a garbage integer when the divisor of integer
MOD/MODULO is zero. For example:
```
program mod0_var
integer :: a, p, r
a = 5
p = 0
r = mod(a, p)
print *, r
end program
```
Integer MOD/MODULO lower to arith.remsi. A zero divisor is undefined
behavior in LLVM, so the remainder can become poison and the program
neither crashes nor reports an error.
This change checks the second argument P when lowering integer
MOD/MODULO. If P is not a compile-time nonzero constant, a P == 0 test
[28 lines not shown]