summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/MC
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2017-05-25 16:15:19 +0000
committerdim <dim@FreeBSD.org>2017-05-25 16:15:19 +0000
commitea8decded162c663e1a10d48adb2bf74c2f6c811 (patch)
treed3a005ac04169cac732a891904a32652e2e9af5b /contrib/llvm/lib/MC
parent6af62215519a65dc8c1ec36c4cb07eee277dd316 (diff)
downloadFreeBSD-src-ea8decded162c663e1a10d48adb2bf74c2f6c811.zip
FreeBSD-src-ea8decded162c663e1a10d48adb2bf74c2f6c811.tar.gz
MFC r318655:
Pull in r302416 from upstream llvm trunk (by Martin Storsjö): [ARM] Clear the constant pool cache on explicit .ltorg directives Multiple ldr pseudoinstructions with the same constant value will reuse the same constant pool entry. However, if the constant pool is explicitly flushed with a .ltorg directive, we should not try to reference constants in the previous pool any longer, since they may be out of range. This fixes assembling hand-written assembler source which repeatedly loads the same constant value, across a binary size larger than the pc-relative fixup range for ldr instructions (4096 bytes). Such assembler source already uses explicit .ltorg instructions to emit constant pools with regular intervals. However if we try to reuse constants emitted in earlier pools, they end up out of range. This makes the output of the testcase match what binutils gas does (prior to this patch, it would fail to assemble). Differential Revision: https://reviews.llvm.org/D32847 This should fix "out of range pc-relative fixup value" errors, when compiling certain ARM inline assembly for www/webkit-gtk[23]. Reported by: mmel
Diffstat (limited to 'contrib/llvm/lib/MC')
-rw-r--r--contrib/llvm/lib/MC/ConstantPools.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/llvm/lib/MC/ConstantPools.cpp b/contrib/llvm/lib/MC/ConstantPools.cpp
index 9608c2c..bf2c39e 100644
--- a/contrib/llvm/lib/MC/ConstantPools.cpp
+++ b/contrib/llvm/lib/MC/ConstantPools.cpp
@@ -54,6 +54,10 @@ const MCExpr *ConstantPool::addEntry(const MCExpr *Value, MCContext &Context,
bool ConstantPool::empty() { return Entries.empty(); }
+void ConstantPool::clearCache() {
+ CachedEntries.clear();
+}
+
//
// AssemblerConstantPools implementation
//
@@ -95,6 +99,13 @@ void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
}
}
+void AssemblerConstantPools::clearCacheForCurrentSection(MCStreamer &Streamer) {
+ MCSection *Section = Streamer.getCurrentSectionOnly();
+ if (ConstantPool *CP = getConstantPool(Section)) {
+ CP->clearCache();
+ }
+}
+
const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
const MCExpr *Expr,
unsigned Size, SMLoc Loc) {
OpenPOWER on IntegriCloud