diff options
| author | Eli Friedman <efriedma@codeaurora.org> | 2018-12-20 19:46:14 +0000 |
|---|---|---|
| committer | Eli Friedman <efriedma@codeaurora.org> | 2018-12-20 19:46:14 +0000 |
| commit | 48397102d08f0768ecb49944482cfe0b272449ea (patch) | |
| tree | 334be2d1a3c12494e39d6fe00ff5dc83b321d2f5 /llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | |
| parent | 4648209e16789aaf7facad470ab95c10e581230a (diff) | |
| download | bcm5719-llvm-48397102d08f0768ecb49944482cfe0b272449ea.tar.gz bcm5719-llvm-48397102d08f0768ecb49944482cfe0b272449ea.zip | |
[MC] [AArch64] Correctly resolve ":abs_g1:3" etc.
We have to treat constructs like this as if they were "symbolic", to use
the correct codepath to resolve them. This mostly only affects movz
etc. because the other uses of classifySymbolRef conservatively treat
everything that isn't a constant as if it were a symbol.
Differential Revision: https://reviews.llvm.org/D55906
llvm-svn: 349800
Diffstat (limited to 'llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp')
| -rw-r--r-- | llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index edf361bc399..a65ddd478f4 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -5434,10 +5434,16 @@ AArch64AsmParser::classifySymbolRef(const MCExpr *Expr, // Check that it looks like a symbol + an addend MCValue Res; bool Relocatable = Expr->evaluateAsRelocatable(Res, nullptr, nullptr); - if (!Relocatable || !Res.getSymA() || Res.getSymB()) + if (!Relocatable || Res.getSymB()) return false; - DarwinRefKind = Res.getSymA()->getKind(); + // Treat expressions with an ELFRefKind (like ":abs_g1:3", or + // ":abs_g1:x" where x is constant) as symbolic even if there is no symbol. + if (!Res.getSymA() && ELFRefKind == AArch64MCExpr::VK_INVALID) + return false; + + if (Res.getSymA()) + DarwinRefKind = Res.getSymA()->getKind(); Addend = Res.getConstant(); // It's some symbol reference + a constant addend, but really |

