diff options
author | Eli Friedman <efriedma@quicinc.com> | 2023-04-17 13:15:46 -0700 |
---|---|---|
committer | Eli Friedman <efriedma@quicinc.com> | 2023-06-07 11:07:21 -0700 |
commit | 7198baccdae10d2b23ea3c21b3c09a59ec053ec9 (patch) | |
tree | c0af9abde10dbf8135e2ebdb43b22dbc01563630 /llvm/lib/MC/MCExpr.cpp | |
parent | f3df0cf3b00b33013f0d728063d0a0ef4bf58450 (diff) | |
download | llvm-7198baccdae10d2b23ea3c21b3c09a59ec053ec9.zip llvm-7198baccdae10d2b23ea3c21b3c09a59ec053ec9.tar.gz llvm-7198baccdae10d2b23ea3c21b3c09a59ec053ec9.tar.bz2 |
[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols
This is mostly useful for ARM64EC, which uses such symbols extensively.
One interesting quirk of ARM64EC is that we need to be able to emit weak
symbols that point at each other (so if either symbol is defined
elsewhere, both symbols point at the definition). This handling is
currently restricted to weak_anti_dep symbols, because we depend on the
current behavior of resolving weak symbols in some cases.
Differential Revision: https://reviews.llvm.org/D145208
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 210ed0f..fc2c3ee 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -761,6 +761,9 @@ bool MCExpr::evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const { } static bool canExpand(const MCSymbol &Sym, bool InSet) { + if (Sym.isWeakExternal()) + return false; + const MCExpr *Expr = Sym.getVariableValue(); const auto *Inner = dyn_cast<MCSymbolRefExpr>(Expr); if (Inner) { |