[lld] [LLD][COFF] Add support for alternate entry point in CHPE metadata on ARM64X (PR #123346)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 02:42:27 PST 2025
================
@@ -2352,6 +2352,20 @@ void Writer::setECSymbols() {
delayIatCopySym, "__hybrid_auxiliary_delayload_iat_copy",
delayIdata.getAuxIatCopy().empty() ? nullptr
: delayIdata.getAuxIatCopy().front());
+
+ if (ctx.hybridSymtab) {
+ // For the hybrid image, set the alternate entry point to the EC entry
+ // point. In the hybrid view, it is swapped to the native entry point
+ // using ARM64X relocations.
+ if (auto altEntrySym = cast_or_null<Defined>(ctx.hybridSymtab->entry)) {
+ // If the entry is an EC export thunk, use its target instead.
+ if (auto thunkChunk =
+ dyn_cast<ECExportThunkChunk>(altEntrySym->getChunk()))
+ altEntrySym = thunkChunk->target;
+ symtab->findUnderscore("__arm64x_native_entrypoint")
+ ->replaceKeepingName(altEntrySym, sizeof(SymbolUnion));
----------------
cjacek wrote:
FWIW, we similarly dereference other symbols with `replaceSymbol` calls in this function.
Merged, thanks!
https://github.com/llvm/llvm-project/pull/123346
More information about the llvm-commits
mailing list