summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WasmObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-01-09 22:48:37 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-01-09 22:48:37 +0000
commitd707c37072195e1e05edd8765b3f4bd79955b154 (patch)
treea9b9ceb62118f4b224669ece9819e1c0c263d39b /llvm/lib/MC/WasmObjectWriter.cpp
parent270ed1b39c1727c14b539c5287a4fa74d8307594 (diff)
downloadbcm5719-llvm-d707c37072195e1e05edd8765b3f4bd79955b154.tar.gz
bcm5719-llvm-d707c37072195e1e05edd8765b3f4bd79955b154.zip
Use a MCExpr for the size of MCFillFragment.
This allows the size to be found during ralaxation. This fixes pr35858. llvm-svn: 322131
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 782479e2651..37b12c63be4 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -528,7 +528,10 @@ static void addData(SmallVectorImpl<char> &DataBytes,
Align->getMaxBytesToEmit());
DataBytes.resize(Size, Value);
} else if (auto *Fill = dyn_cast<MCFillFragment>(&Frag)) {
- DataBytes.insert(DataBytes.end(), Fill->getSize(), Fill->getValue());
+ int64_t Size;
+ if (!Fill->getSize().evaluateAsAbsolute(Size))
+ llvm_unreachable("The fill should be an assembler constant");
+ DataBytes.insert(DataBytes.end(), Size, Fill->getValue());
} else {
const auto &DataFrag = cast<MCDataFragment>(Frag);
const SmallVectorImpl<char> &Contents = DataFrag.getContents();
OpenPOWER on IntegriCloud