[orc-rt] Add Windows virtual memory support (#224521)
Adds Windows virtual-memory support for ORC-RT
Also adds a small Windows error helper that converts GetLastError()
results into ORC-RT Error values with the corresponding system message.
Turns back on all the memory tests for windows.
[RISC-V][MC] Update ELF streamer ArchString when emitting RISCVAttrs::ARCH
During LTO, the TargetMachine subtarget is initialized with the linker's
default CPU (e.g. `generic-rv64`, `rv64i2p1`), while
RISCVAsmPrinter::emitStartOfAsmFile() reconstructs the module's actual ISA from
the `riscv-isa` module flag and emits RISCVAttrs::ARCH via
RISCVTargetELFStreamer::emitTextAttribute(). Previously only
RISCVAsmParser::parseDirectiveAttribute() called setArchString() after
emitTextAttribute(RISCVAttrs::ARCH, ...), so direct object emission bypassed
the update and tagged `.text` with `$xrv64i2p1` instead of the module's
full architecture string.
Move the setArchString() call into RISCVTargetELFStreamer::emitTextAttribute()
when emitting RISCVAttrs::ARCH so both `.attribute arch` and
RISCVTargetStreamer::emitTargetAttributes() update the active mapping symbol
ISA.
This commit was created with the help of AI tools
[libc] Move Linux TLS routines from crt1.o into libc.a (#225418)
init_tls, cleanup_tls, and set_thread_ptr are per-thread routines used
by both Thread::run in libc.a and main-thread startup in crt1.o, but
tls.cpp was previously only merged into crt1.o. Linking libc.a without
crt1.o (such as a self-contained shared library statically linking
libc.a, or an executable built with -nostartfiles) failed with undefined
hidden symbols when thread.cpp.o was pulled in.
Move {x86_64,aarch64,riscv}/tls.cpp from libc/startup/linux/ to
libc/src/__support/threads/linux/ alongside tcb.h (matching prior
migrations of auxv and program_invocation_name from startup into src so
dependencies flow from startup -> src). Expose them via a forwarding
ALIAS target libc.src.__support.threads.linux.tls depended on by both
thread and do_start, and remove tls from merge_relocatable_object(crt1).
Mark init_tls with [[gnu::flatten]] and compile tls with
${libc_opt_high_flag}. Once tls.cpp.o is in libc.a rather than first on
the link line inside crt1.o, an earlier object compiled with
[9 lines not shown]
[libc++] Extract building libc++ into a composite action (#224670)
This allows reusing the same build script for the PR benchmark and
the historical benchmarking jobs. This also opens the door to adding
new configurations where the library isn't rebuilt (e.g. where the
artifacts are pulled from a pre-built location, or even testing against
non-libc++.
Assisted by Claude
[clang-tidy] Fix crash in readability-identifier-naming (#220221)
This PR contains the fix for the `readability-identifier-naming` crash.
The crash happens because the checker calls `hasMemberName` on a base
class without checking if that base class actually has a definition
first (like when it's just forward-declared). I added a
`RD->hasDefinition()` guard to fix it.
Fixes #213948
[lld-macho] Print Objective-C stubs in map files (#225302)
Match ld-prime by listing synthesized Objective-C message-send stubs in
Mach-O map files, including their final addresses and mode-specific sizes.
[LICM] Relax Hoistable Branch if all of the incoming node are hoistable
Like PhiNode, a branch is possibly hoistable if all of the parents are
possible to hoist. The only difference is that we cannot hoisting to
PreHeader as it might erase itself in getOrCreateHoistedBlock. This is
why we have IsReplicatedBy check in hasExactlyReplicatedControlFlow.
In phi, it is not a matter as we only change the incoming node from a
phi node without overwrite its dominator.
Also, we fix a bug while we have nested hoisted node. In that case, we
have to find the LCA of the dominators of all users.
[orc-rt] Add gmock matchers for Error and Expected<T> (#225596)
Ports llvm/Testing/Support/Error.h to orc_rt: EXPECT_THAT_ERROR and
ASSERT_THAT_ERROR, EXPECT_THAT_EXPECTED and ASSERT_THAT_EXPECTED, and
the Succeeded, Failed, Failed<InfoT>, FailedWithMessage and HasValue
matchers.
Two departures from the original. An orc_rt Error carries at most one
ErrorInfoBase -- there is no joinErrors -- so the holder keeps a single
error, FailedWithMessage takes one matcher rather than a variadic pack,
and FailedWithMessageArray is dropped. ErrorInfoBase has
dynamicRTTIName, so a type mismatch names the type that did turn up
rather than reporting only that the expected one was absent.
Header-only, under test/unit with the other test helpers rather than in
a shipped testing library. ErrorMatchersTest exercises each matcher
against a matching and a non-matching value, the latter through gtest's
failure interception.
[WebKit Checkers] Add alpha.webkit.UnborrowedLocalVarsChecker (#225274)
This is a new checker that requires a Borrow<T> when using a
pointer/reference/view that is lifetimebound to a CanBorrow type.
A CanBorrow type is a type that tracks views into its interior at
runtime, and calls crashIfBorrowed() when it invalidates such views.
Vector is the motivating example.
A design description is available at:
https://github.com/WebKit/WebKit/wiki/SaferCPP:-Borrowed-Pointer-Use-After-Destruction
I implemented UnborrowedLocalVarsChecker in terms of the existing
alpha.webkit.*LocalVarsChecker system because the requirement to hold an
overlooking smart-pointer-like-thing is pretty similar.
In some cases where the new checker is stricter than the existing
checker, this patch conditionalizes the strictness. The plan is to
upgrade existing checkers in a follow-up patch.
Assisted-by: Claude
[orc-rt] Reconcile check-rt-process-info changes. (#225592)
3648582c0a41 was supposed to make this test more generic, but
accidentally removed it instead.
Reconcile the dropped changes with 3648582c0a41, which added page-size
checking.