Skip to content

[ci] Verify the OOP runtime probe chain via relocation + env-var.#943

Closed
vgvassilev wants to merge 3 commits intocompiler-research:mainfrom
vgvassilev:ci-bundle-oop-runtime-test
Closed

[ci] Verify the OOP runtime probe chain via relocation + env-var.#943
vgvassilev wants to merge 3 commits intocompiler-research:mainfrom
vgvassilev:ci-bundle-oop-runtime-test

Conversation

@vgvassilev
Copy link
Copy Markdown
Contributor

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 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.
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Copy Markdown
Contributor Author

Landed in #942

@vgvassilev vgvassilev closed this Apr 27, 2026
@vgvassilev vgvassilev deleted the ci-bundle-oop-runtime-test branch April 27, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant