summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 83fcec92e2b..17a0edcc954 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -114,10 +114,16 @@ bool MCAssembler::isThumbFunc(const MCSymbol *Symbol) const {
if (!Symbol->isVariable())
return false;
- // FIXME: It looks like gas supports some cases of the form "foo + 2". It
- // is not clear if that is a bug or a feature.
const MCExpr *Expr = Symbol->getVariableValue();
- const MCSymbolRefExpr *Ref = dyn_cast<MCSymbolRefExpr>(Expr);
+
+ MCValue V;
+ if (!Expr->evaluateAsRelocatable(V, nullptr, nullptr))
+ return false;
+
+ if (V.getSymB() || V.getRefKind() != MCSymbolRefExpr::VK_None)
+ return false;
+
+ const MCSymbolRefExpr *Ref = V.getSymA();
if (!Ref)
return false;
OpenPOWER on IntegriCloud