Skip to content

Fix: AOT link memcpy.1 undefined — duplicate decl peers of #31894 (#31910) - #31911

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-31910-memcpy-aot-link
Aug 17, 2026
Merged

Fix: AOT link memcpy.1 undefined — duplicate decl peers of #31894 (#31910)#31911
PurHur merged 1 commit into
masterfrom
agent/issue-31910-memcpy-aot-link

Conversation

@PurHur

@PurHur PurHur commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add LibcExtern::ensureExternalDecl() — getNamedFunction-first pattern from Fix: AOT link fails for EVERY binary — duplicate memset declaration #31894, shared by peer ensureExternal() helpers
  • Fix ObStorageLlvm, OutputRewriteVarsStorage, UrlRewriterApplyRuntime, StringSscanfByRef, StringZlibJit, GcCollectCyclesRuntime duplicate memcpy/memset declarations that LLVM silently versioned to memcpy.N with no body
  • Refresh three prelinked helper units (IniJitHelper, AssertOptionsJitHelper, DomStandaloneAotInitJitHelper) that embedded stale memcpy.1 references

Closes #31910

Context

#31894 fixed memset.1 in GcCollectCyclesRuntime only. Master still failed aot-smoke 0/8 with undefined reference to memcpy.1 when using the committed helper-runtime tier — blocking all DOM/XML AOT verification.

Test plan

Verified in php-compiler:22.04-dev via ./script/docker-exec.sh:

rm -rf build/helper-runtime-cache
./script/aot-smoke.sh
# aot-smoke: 8 passed, 0 failed

php bin/compile.php -o /tmp/dom_xpath test/repro/dom_xpath_relative_aot_31738.php && /tmp/dom_xpath
# rel=1:y / self=1:root / abs=1:y / ok

php bin/compile.php -o /tmp/dom_contains test/repro/maintainer_gap_dom_contains_null_aot_31791.php && /tmp/dom_contains
# 0 / 0

Not covered: full helper-runtime --prelink sweep (409 units; only 3 refreshed). check-helper-runtime-prelink --strict reports 409 fresh, 1 unrelated stale (InfoJitHelper). Compliance suites not run.

Made with Cursor

…1910)

#31894 fixed memset versioning in GcCollectCyclesRuntime only. ObStorageLlvm,
OutputRewriteVarsStorage, UrlRewriterApplyRuntime, StringSscanfByRef, and
StringZlibJit still called addFunction('memcpy') when lookupFunction threw
while LibcExtern already owned the module symbol — LLVM silently versioned to
memcpy.N with no body and every default-cache AOT link failed.

Add LibcExtern::ensureExternalDecl() (getNamedFunction-first) and delegate peer
ensureExternal helpers. Refresh three prelinked helper units that embed the
stale memcpy.1 references.

Verified in php-compiler:22.04-dev:
  ./script/aot-smoke.sh → 8 passed, 0 failed (cold, no local helper cache)
  php bin/compile.php -o /tmp/x test/repro/dom_xpath_relative_aot_31738.php → ok
  maintainer_gap_dom_contains_null_aot_31791.php AOT → 0\n0

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit b58d12c into master Aug 17, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-31910-memcpy-aot-link branch August 17, 2026 07:47
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.

Fix: AOT link memcpy.1 undefined — duplicate decl peers of #31894 (lib/JIT/LibcExtern.php)

1 participant