[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
Sat Jan 18 04:57:10 PST 2025
================
@@ -2352,6 +2352,23 @@ 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;
+ Symbol *nativeEntrySym =
+ symtab->findUnderscore("__arm64x_native_entrypoint");
+ replaceSymbol<DefinedAbsolute>(
+ nativeEntrySym, ctx, "__arm64x_native_entrypoint",
+ ctx.config.imageBase + altEntrySym->getRVA());
----------------
cjacek wrote:
Good point, I will change it with `replaceKeepingName`. I think I can just use `sizeof(SymbolUnion)` here since I know that both symbols are from the symbol table. Thanks!
https://github.com/llvm/llvm-project/pull/123346
More information about the llvm-commits
mailing list