[ci] Verify the OOP runtime probe chain via relocation + env-var.#943
Closed
vgvassilev wants to merge 3 commits intocompiler-research:mainfrom
Closed
[ci] Verify the OOP runtime probe chain via relocation + env-var.#943vgvassilev wants to merge 3 commits intocompiler-research:mainfrom
vgvassilev wants to merge 3 commits intocompiler-research:mainfrom
Conversation
The bake-at-build-time install path from `[jit] Self-contain the
OOP-JIT runtime in CppInterOp's distribution.` is fragile under
relocation: an installed CppInterOp moved to a different prefix
(rpm `--prefix`, conda relocation, AppImage) can't find the runtime
parts because the macro holds the original
`CMAKE_INSTALL_FULL_LIBDIR`.
`configureBundledOOPRuntime` now probes a layered list, most-reliable
first, before falling back to the baked path:
1. `$CPPINTEROP_RUNTIME_DIR` -- sysadmin override; trumps every
other source so packagers can point CppInterOp at a runtime
extracted to a separate location.
2. `<dir of libclangCppInterOp>/cppinterop-rt` -- self-DSO discovery
via `dladdr` (POSIX). Works for any non-static link: if the
`.so` moves, the runtime moves with it, no env-var needed.
3. `CPPINTEROP_RUNTIME_BUILD_DIR` -- in-tree test runs.
4. `CPPINTEROP_RUNTIME_INSTALL_DIR` -- baked install path; last
resort when self-DSO discovery isn't available (Windows, or
CppInterOp statically linked into a host binary).
Windows has no self-DSO discovery yet -- a `GetModuleHandleEx` port
can be added when Windows OOP support arrives. The clang resource
directory (`CLANG_RESOURCE_DIR`) suffers the same
bake-at-build-time-vs-relocation problem and would benefit from the
same layering; left as follow-up.
The layered probe chain in `configureBundledOOPRuntime` from `[jit] Add a layered probe chain for relocatable OOP runtime discovery.` adds two new lookup layers (`CPPINTEROP_RUNTIME_DIR` env-var override and `dladdr`-based self-DSO probe) that the existing in-tree test path doesn't exercise -- in-tree the baked `CPPINTEROP_RUNTIME_BUILD_DIR` probe wins first, so a regression in either new layer would be silent. After the install-layout assertion succeeds, move the install to a fresh prefix and re-run the OOP-tagged tests with `DYLD_LIBRARY_PATH`/`LD_LIBRARY_PATH` pointing at the moved tree: the `dladdr` probe must follow the relocated `.so` and find the runtime alongside it. Then stage the runtime parts at a third location, wipe the moved `cppinterop-rt/` subdir, and re-run with `CPPINTEROP_RUNTIME_DIR` set to the staged copy: only the env-var probe can win. Both runs assert that the `[CreateClangInterpreter]: --use-oop-jit requested but the bundled OOP runtime ... is missing` fallback warning does NOT appear in the test output. Negative-control verified locally -- with all probe locations wiped the warning does fire, confirming the assertion isn't dead. Filter is `CppInterOpTest/OutOfProcessJIT.Jit_StreamRedirectJIT`, the only OOP-tagged test that calls `CreateInterpreter()` before its skip check; the test itself fails with a preexisting `stdio.h not found` issue in the OOP child interpreter, which is orthogonal to the probe chain and doesn't trip the bundling warning.
The asan-ubsan CI row started exercising the OOP-JIT path after `[ci] Build the bundled OOP-JIT runtime in non-cling LLVM>=22 caches.` (compiler-research#940) made OOP run by default for every llvm22+ row. `EnumReflection_GetEnums` then trips the assertion at `llvm/lib/ExecutionEngine/Orc/Core.cpp:2800`: Resolving symbol with incorrect flags ASan instruments globals with extra metadata that changes the `JITSymbolFlags` declared in the host process; when the EPC-based out-of-process executor reports back the resolved flags, they don't match. The in-process JIT path doesn't compare across an IPC boundary so it's unaffected, and other OOP tests don't define the kinds of common symbols that hit the resolution path. Skip just this test under OOP-when-sanitized rather than disabling the OOP fixture wholesale -- the remaining OOP tests on the asan-ubsan row keep running. Likely upstream LLVM bug; can be removed once the EPC symbol-flag tracking is fixed.
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Contributor
Author
|
Landed in #942 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The layered probe chain in
configureBundledOOPRuntimefrom[jit] Add a layered probe chain for relocatable OOP runtime discovery.adds two new lookup layers (CPPINTEROP_RUNTIME_DIRenv-var override and
dladdr-based self-DSO probe) that theexisting in-tree test path doesn't exercise -- in-tree the baked
CPPINTEROP_RUNTIME_BUILD_DIRprobe wins first, so a regressionin either new layer would be silent.
After the install-layout assertion succeeds, move the install to
a fresh prefix and re-run the OOP-tagged tests with
DYLD_LIBRARY_PATH/LD_LIBRARY_PATHpointing at the moved tree:the
dladdrprobe must follow the relocated.soand find theruntime alongside it. Then stage the runtime parts at a third
location, wipe the moved
cppinterop-rt/subdir, and re-run withCPPINTEROP_RUNTIME_DIRset to the staged copy: only the env-varprobe can win.
Both runs assert that the
[CreateClangInterpreter]: --use-oop-jit requested but the bundled OOP runtime ... is missingfallback warning does NOT appear inthe test output. Negative-control verified locally -- with all
probe locations wiped the warning does fire, confirming the
assertion isn't dead.
Filter is
CppInterOpTest/OutOfProcessJIT.Jit_StreamRedirectJIT,the only OOP-tagged test that calls
CreateInterpreter()beforeits skip check; the test itself fails with a preexisting
stdio.h not foundissue in the OOP child interpreter, which isorthogonal to the probe chain and doesn't trip the bundling
warning.