Skip to content

[JSC] The pcrtoaddr offlineasm instruction should be lowered differently to support global labels#59296

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
ast-hugger:eng/The-pcrtoaddr-offlineasm-instruction-should-be-lowered-differently-to-support-global-labels
Feb 24, 2026
Merged

[JSC] The pcrtoaddr offlineasm instruction should be lowered differently to support global labels#59296
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
ast-hugger:eng/The-pcrtoaddr-offlineasm-instruction-should-be-lowered-differently-to-support-global-labels

Conversation

@ast-hugger
Copy link
Contributor

@ast-hugger ast-hugger commented Feb 24, 2026

586f364

[JSC] The pcrtoaddr offlineasm instruction should be lowered differently to support global labels
rdar://170991136
https://bugs.webkit.org/show_bug.cgi?id=308517

Reviewed by Yusuke Suzuki.

The `pcrtoaddr` instruction is lowered for arm64 into a single `adr` instruction. This works
reliably for local labels. JSPI implementation adds a case where the instruction is used to load an
address of a global label. In this situation, `adr` appears to work only in some build
configurations and in others causes an "unknown fixup kind" build error.

This patch augments `pcrtoaddr` implementation so that for global labels it translates into an
`adrp`/`add` instruction sequence. For local labels it keeps the existing single-instruction scheme.
It also adds a useful externOrGlobal? predicate to LabelReference, used elsewhere for a similar
conditional.

Testing: integration-tested at its call sites.
Canonical link: https://commits.webkit.org/308139@main

d37b07f

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests ❌ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe loading 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@ast-hugger ast-hugger requested a review from a team as a code owner February 24, 2026 04:41
@ast-hugger ast-hugger self-assigned this Feb 24, 2026
@ast-hugger ast-hugger added the WebAssembly For bugs in JavaScript WebAssembly label Feb 24, 2026
@ast-hugger ast-hugger added the merge-queue Applied to send a pull request to merge-queue label Feb 24, 2026
…tly to support global labels

rdar://170991136
https://bugs.webkit.org/show_bug.cgi?id=308517

Reviewed by Yusuke Suzuki.

The `pcrtoaddr` instruction is lowered for arm64 into a single `adr` instruction. This works
reliably for local labels. JSPI implementation adds a case where the instruction is used to load an
address of a global label. In this situation, `adr` appears to work only in some build
configurations and in others causes an "unknown fixup kind" build error.

This patch augments `pcrtoaddr` implementation so that for global labels it translates into an
`adrp`/`add` instruction sequence. For local labels it keeps the existing single-instruction scheme.
It also adds a useful externOrGlobal? predicate to LabelReference, used elsewhere for a similar
conditional.

Testing: integration-tested at its call sites.
Canonical link: https://commits.webkit.org/308139@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/The-pcrtoaddr-offlineasm-instruction-should-be-lowered-differently-to-support-global-labels branch from d37b07f to 586f364 Compare February 24, 2026 18:40
@webkit-commit-queue
Copy link
Collaborator

Committed 308139@main (586f364): https://commits.webkit.org/308139@main

Reviewed commits have been landed. Closing PR #59296 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 586f364 into WebKit:main Feb 24, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebAssembly For bugs in JavaScript WebAssembly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants