[lld] [LLD][COFF] Generate X64 thunks for ARM64EC entry points and patchable functions. (PR #105499)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 06:44:26 PDT 2024
================
@@ -1317,6 +1317,72 @@ void LinkerDriver::convertResources() {
f->includeResourceChunks();
}
+void LinkerDriver::maybeCreateECExportThunk(StringRef name, Symbol *&sym) {
+ Defined *def;
+ if (!sym)
+ return;
+ if (auto undef = dyn_cast<Undefined>(sym))
+ def = undef->getWeakAlias();
+ else
+ def = dyn_cast<Defined>(sym);
+ if (!def)
+ return;
+
+ if (def->getChunk()->getArm64ECRangeType() != chpe_range_type::Arm64EC)
----------------
cjacek wrote:
I think this is well-defined, there are comparison operators for comparing `std::optional` against a value. According to https://en.cppreference.com/w/cpp/utility/optional/operator_cmp:
> Compares opt with a value. The values are compared (using the corresponding operator of T) only if opt contains a value. Otherwise, opt is considered less than value.
I will added a test anyway. BTW, it's another difference with MSVC. MSVC linker in this example would generate a thunk, but also produce a bogus redirection data (it has redirection count of 1, but its RVA of redirection table is 0).
https://github.com/llvm/llvm-project/pull/105499
More information about the llvm-commits
mailing list