[PATCH] D42564: [WebAssembly] ignore non-SymbolRef MCExpr.
Patrick Cheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 22:10:26 PST 2018
patcheng updated this revision to Diff 133991.
https://reviews.llvm.org/D42564
Files:
lib/MC/WasmObjectWriter.cpp
Index: lib/MC/WasmObjectWriter.cpp
===================================================================
--- lib/MC/WasmObjectWriter.cpp
+++ lib/MC/WasmObjectWriter.cpp
@@ -430,9 +430,13 @@
if (SymA && SymA->isVariable()) {
const MCExpr *Expr = SymA->getVariableValue();
- const auto *Inner = cast<MCSymbolRefExpr>(Expr);
- if (Inner->getKind() == MCSymbolRefExpr::VK_WEAKREF)
- llvm_unreachable("weakref used in reloc not yet implemented");
+ if (Expr->getKind() == MCExpr::SymbolRef) {
+ const auto *Inner = cast<MCSymbolRefExpr>(Expr);
+ if (Inner->getKind() == MCSymbolRefExpr::VK_WEAKREF)
+ llvm_unreachable("weakref used in reloc not yet implemented");
+ } else {
+ llvm_unreachable("expression kind not supported");
+ }
}
// Put any constant offset in an addend. Offsets can be negative, and
@@ -490,8 +494,12 @@
static const MCSymbolWasm* ResolveSymbol(const MCSymbolWasm& Symbol) {
if (Symbol.isVariable()) {
const MCExpr *Expr = Symbol.getVariableValue();
- auto *Inner = cast<MCSymbolRefExpr>(Expr);
- return cast<MCSymbolWasm>(&Inner->getSymbol());
+ if (Expr->getKind() == MCExpr::SymbolRef) {
+ auto *Inner = cast<MCSymbolRefExpr>(Expr);
+ return cast<MCSymbolWasm>(&Inner->getSymbol());
+ } else {
+ llvm_unreachable("expression kind not supported");
+ }
}
return &Symbol;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42564.133991.patch
Type: text/x-patch
Size: 1410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180213/667c6c56/attachment.bin>
More information about the llvm-commits
mailing list