powerpc: Avoid panicking on alignment errors
PowerPC ISA specifies that an alignment fault can occur when any load or
store accesses cache-inhibited or write-through memory. Since
copyin/copyout don't know what type of memory they will access we can't
always trust that memory is well behaved, or that it's properly aligned.
Avoid a panic by giving the fault handler a chance to deal with it and
propagate the fault back up.
libkvm: Add basic sanity check in _kvm_pt_init
_kvm_pt_init() assumes that the map length passed in is an even multiple
of 8 bytes, and the loop over the map decrements by 8
(sizeof(uint64_t)). Since `res` is unsigned, if the result is not a
multiple of 8 then it wraps where it would otherwise stop, thereby
writing memory until a crash. Address this by just erroring out on
invalid input, since valid cores will never have a short size.
Reviewed by: kib
Sponsored by: Hewlett Packard Enterprise Development LP
Differential Revision: https://reviews.freebsd.org/D62333
netinet: Send to the next hop a pfil hook chose in ip_tryforward()
When an inbound pfil hook chooses the next hop (ipfw fwd),
ip_tryforward() looks up the route to it and keeps the address in dest,
which if_output() gets as the next hop when the route has no gateway.
After the outbound hooks dest is set back to the destination of the
packet. ipfw always installs an outbound hook, so a packet forwarded
to a next hop on a connected network leaves on the right interface but
for the wrong neighbour: the router tries to resolve the destination
of the packet there ("arpresolve: can't allocate llinfo") and the
packet is lost. This worked until 9ac7c6cfed72, before which the
address came from the route lookup.
Set dest from the packet only when the outbound hooks changed the
destination or chose a next hop. To tell, compare with the destination
as it was before these hooks, as ip6_tryforward() does. The comparison
with the destination before the inbound hooks, which is older than
9ac7c6cfed72, also lost the next hop of a packet whose destination an
inbound hook had rewritten, and for such a packet it repeated the check
[14 lines not shown]
[flang][acc] Allow zero-sized array sections in data clauses (#248296)
Lowering rejected data clause sections whose constant upper bound is
below the lower bound, e.g. `copyin(a(1:0))`, with "zero sized array
section". Such sections are valid and describe no data. Lower them to
regular `acc.bounds` and keep only the stride check.
RuntimeLibcalls: Make asan runtime available with out of tree support
The previous set of systems was based on what targets are built in the
compiler-rt sources. However a few targets have out of tree runtimes,
so list those too (MSVC on AArch64, AMDGPU, Emscripten and the
PlayStation SDK). Also, drop the stack poisoning functions from
AMDGPU since the pass skips inserting those for it.
Assisted-by: Claude
[libc] Fix zero sign when generic fused multiply-add (FMA) underflows (#248281)
IEEE 754 requires FMA return zero with the same sign as `x * y` when
adding zero to a non-zero product that underflows to zero.
`fputil::generic::fma` returns `cast<OutType>(x * y + z)` when `z` is
zero. Different rounding modes can influence whether `x * y + z` returns
positive or negative zero. For example, `-0.0 + +0.0 == +0.0` with
default rounding. `+0.0 + -0.0 == -0.0` with `FE_DOWNWARD` rounding.
Both results are different to the IEEE 754 spec.
This change removes checking whether `z` is zero from the `x * y + z`
fast path. It rounds the exact `DyadicFloat` product `x * y` directly to
`OutType` when `z` is zero. This preserves the sign of underflowed
zeroes, avoids double rounding for narrowing FMAs, and respects all
rounding modes on software-emulated types such as `float16`.
Assisted-by: Antigravity with Gemini
[AMDGPU][GlobalISel] Fix gisel `llvm.amdgcn.load.[async.]to.lds` crashes (#245024)
`llvm.amdgcn.load.[async.]to.lds` takes as argument `llvm_anyptr_ty`,
which when
- p1/p4, emits `global_load_lds_*`.
- p0, assumed to points to global addr-space, emits `global_load_lds_*`.
- Other AS except p7, not supported.
- E.g. p5 is not supported, though hardware have `scratch_load_lds_*`.
- DAG-isel is same here.
Current legal rule uses `VgprP1` which rejects p0/p4 and crashes.
Fix by switching to VgprPtr64, which accepts and preserves p0/p1/p4.
Fixes: https://github.com/llvm/llvm-project/issues/244451
Assisted-by: GPT-6.2-Sol
netipsec: Allow IPv6 extension headers before UDP encapsulated ESP
udp_ipsec_input() took the UDP header of an IPv6 packet to follow the
IPv6 header directly. With a hop-by-hop, routing or destination options
header in front of it, the SA was still found by its SPI, but the port
check then read the extension header instead of the UDP header, and the
packet was dropped as having no SA. The ESP protocol number was also
written to the next header field of the IPv6 header, not to the one that
led to the UDP header.
Derive the offset of the UDP header from the payload offset that
udp6_append() passes, and find the next header field with
ip6_get_prevhdr(), as ipsec6_input() does since 3d810fa261f1.
udp_ipsec_adjust_cksum() made the same assumption where it recomputes
the checksum of the inner TCP or UDP header
(net.inet.ipsec.natt_cksum_policy set to 1): it summed from the end of
the IPv6 header and stored the result at that offset, inside the
extension header. Use the offset of the transport header that the
[6 lines not shown]
games/vkquake: Improve pkg-message
Recent versions of the commercial game have redesigned localization,
making the last comment no longer necessary. Instead, explain how to
open the firewall for multiplayer :)
MFH: 2026Q4
(cherry picked from commit d87987ce334b1be6a421e6e93f80d22db8e0b5b4)
ValueMapper: Don't cache identity mappings of globals and leaf constants (#247935)
With RF_NoModuleLevelChanges and no materializer, nothing reads identity
mappings back from the map, and globals and ConstantData always map to
themselves. Return them directly instead of adding map entries.
Instructions retired by opt -O3:
tramp3d-v4, x86_64-linux: -0.13%, -0.18% without likely_module_local
hints, -0.10% with -g
CTMark geomean, arm64: -0.01%, -0.06% with -g
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
games/vkquake: Improve pkg-message
Recent versions of the commercial game have redesigned localization,
making the last comment no longer necessary. Instead, explain how to
open the firewall for multiplayer :)
MFH: 2026Q4
[llvm-jitlink] Move platform-setup into its own method. NFC. (#248302)
We'll be adding more platform code in the future, so break this out of
Session's constructor to keep it readable.
articles/freebsd-update-server: Move to distset-update-server
Move the article on building distribution set update server out of the
way so that the new article on building a base system package update
server can take it's place. Improve the warning at the top while here.
This article is unfortunately out of date and needs to be fixed because
distribution sets will be supported until 31 December 2029.
With hat: doceng@, re@
Approved by: cperciva
Differential Revision: https://reviews.freebsd.org/D61655
[SandboxVec][LoadStoreVec] Vectorize store chains whose loads have external uses
Loads that feed a store chain used to block vectorization whenever they
had more than one use. The store chain can now be vectorized even if the
loads have external uses. Once the scalar stores are erased, each
original load is rebuilt from the lanes it occupies in the new vector
load, and reinterpreted back to its original type if needed.
The legality check, canUnpack(), runs before any IR is created, so a load
whose lanes cannot be reinterpreted (for example, a non-integral pointer)
rejects the whole chain instead of leaving a partially rewritten block.
The unpacking itself is done by unpackIfNeeded() after the scalar stores
have been removed.
Co-authored-by: Cursor <cursoragent at cursor.com>
[flang][NFCI] Allow FortranObjectViewOpInterface to report no source. (#248212)
`getViewSource` takes an operation result. A follow-up change will
implement the interface for `fir.unboxchar`, which returns a character
address and a length. Only the address has a view source.
Extend the interface contract so that a null `Value` means the queried
result has no view source. Update callers to handle that case.
Assisted-by: Codex
[compiler-rt] Pass --sysroot to tests when CMAKE_SYSROOT is set (#247993)
We weren't passing --sysroot to tests which could lead to mismatch
between runtime libraries and test binaries resulting in runtime
failures. This uncovered several issues in RTSan and Scudo when using
older glibc version.
stdio: Fix negated wchar scansets
We were recording the start of the scanset before checking if it began
with a caret. We need to check for a caret first, then record whatever
comes next as the start of the scanset.
Note that scanf() did not have this bug, only wscanf(), but this adds
regression tests for both anyway.
MFC after: 1 week
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D62328
[clang] Fix crash on trailing comma in vectorize_width (#246804)
With `#pragma clang loop vectorize_width(4, )`, the token after the
comma is the end marker for the loop hint. The parser diagnoses the
missing argument, then lexes past the marker. Error recovery consumes
the following loop and crashes at the end of the file.
```text
Stack dump:
1. <eof> parser at end of file
2. <stdin>:1:10: parsing function body 'f'
3. <stdin>:1:10: in compound statement ('{}')
```
Leave the end marker for the existing recovery path so parsing resumes
at the following loop. Clang now emits only the malformed hint error.
```text
<stdin>:2:40: error: vectorize_width loop hint malformed; use vectorize_width(X, fixed) or vectorize_width(X, scalable) where X is an integer, or vectorize_width('fixed' or 'scalable')
[5 lines not shown]
[AMDGPU][GlobalISel] Use v_cmpx/s_andn2_wrexec form in RegBankLegalize waterfall loops
Port the UseNewExecInstructions path from SIInstrInfo's waterfall emission
to RegBankLegalizeHelper::executeInWaterfallLoop. On subtargets with
no-sdst v_cmpx and s_andn2_wrexec, the loop now narrows exec with deferred
V_CMPX_EQ_*_nosdst_e32_term compares and computes the remaining lanes with
S_ANDN2 from an exec PHI, written back by S_MOV_term. SIOptimizeExecMasking
then folds the pair into s_and_not1_wrexec, matching SelectionDAG.
Co-authored-by: Cursor <cursoragent at cursor.com>
TableGen: Add \x escape to string literals (#248201)
Accept \xHH in string literals, producing the character with the
hexadecimal value HH. This allows writing names that contain control
characters, such as the \01 prefix used to suppress symbol mangling. A
few edge cases in RuntimeLibcallsInfo need to do this (e.g., on Darwin
there is a function named "\01mcount").
Assisted-by: Claude