aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeiming Zhao <wmzhao.code@gmail.com>2018-04-11 23:09:20 +0000
committerWeiming Zhao <wmzhao.code@gmail.com>2018-04-11 23:09:20 +0000
commit66258c988815c0a7469627cfd41a7aa8398558b9 (patch)
treefa8b8e8c09fb5136c56453c061a405502f84965b
parent125b8deb816d911fd95b5a4ff19c6e58b5358e1c (diff)
Add missing vtable anchors
Summary: This patch adds anchor() for MemoryBuffer, raw_fd_ostream, RTDyldMemoryManager, SectionMemoryManager, etc. Reviewers: jlebar, eli.friedman, dblaikie Reviewed By: dblaikie Subscribers: mehdi_amini, mgorny, dblaikie, weimingz, llvm-commits Differential Revision: https://reviews.llvm.org/D45244 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329861 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ExecutionEngine/ObjectMemoryBuffer.h1
-rw-r--r--include/llvm/ExecutionEngine/RTDyldMemoryManager.h6
-rw-r--r--include/llvm/ExecutionEngine/SectionMemoryManager.h2
-rw-r--r--include/llvm/Support/MemoryBuffer.h3
-rw-r--r--include/llvm/Support/raw_ostream.h5
-rw-r--r--lib/ExecutionEngine/MCJIT/MCJIT.cpp4
-rw-r--r--lib/ExecutionEngine/MCJIT/MCJIT.h1
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp2
-rw-r--r--lib/ExecutionEngine/SectionMemoryManager.cpp2
-rw-r--r--lib/LTO/LLVMBuild.txt1
-rw-r--r--lib/Support/MemoryBuffer.cpp2
-rw-r--r--lib/Support/raw_ostream.cpp6
12 files changed, 35 insertions, 0 deletions
diff --git a/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h b/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h
index 0f00ad006a7..03567530fb3 100644
--- a/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h
+++ b/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h
@@ -56,6 +56,7 @@ public:
private:
SmallVector<char, 0> SV;
std::string BufferName;
+ void anchor() override;
};
} // namespace llvm
diff --git a/include/llvm/ExecutionEngine/RTDyldMemoryManager.h b/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
index ee75202d2b6..23d651f6d1b 100644
--- a/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
+++ b/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
@@ -47,6 +47,9 @@ public:
/// newly loaded object.
virtual void notifyObjectLoaded(ExecutionEngine *EE,
const object::ObjectFile &) {}
+
+private:
+ void anchor() override;
};
// RuntimeDyld clients often want to handle the memory management of
@@ -142,6 +145,9 @@ protected:
};
typedef std::vector<EHFrame> EHFrameInfos;
EHFrameInfos EHFrames;
+
+private:
+ void anchor() override;
};
// Create wrappers for C Binding types (see CBindingWrapping.h).
diff --git a/include/llvm/ExecutionEngine/SectionMemoryManager.h b/include/llvm/ExecutionEngine/SectionMemoryManager.h
index d76e37113c6..ee7978c1299 100644
--- a/include/llvm/ExecutionEngine/SectionMemoryManager.h
+++ b/include/llvm/ExecutionEngine/SectionMemoryManager.h
@@ -182,6 +182,8 @@ private:
std::error_code applyMemoryGroupPermissions(MemoryGroup &MemGroup,
unsigned Permissions);
+ void anchor() override;
+
MemoryGroup CodeMem;
MemoryGroup RWDataMem;
MemoryGroup RODataMem;
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index 2997ae458e7..535579ecff5 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -148,6 +148,9 @@ public:
virtual BufferKind getBufferKind() const = 0;
MemoryBufferRef getMemBufferRef() const;
+
+private:
+ virtual void anchor();
};
/// This class is an extension of MemoryBuffer, which allows copy-on-write
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index d11f5a83779..14212017d04 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/include/llvm/Support/raw_ostream.h
@@ -329,6 +329,8 @@ private:
/// Copy data into the buffer. Size must not be greater than the number of
/// unused bytes in the buffer.
void copy_to_buffer(const char *Ptr, size_t Size);
+
+ virtual void anchor();
};
/// An abstract base class for streams implementations that also support a
@@ -336,6 +338,7 @@ private:
/// but needs to patch in a header that needs to know the output size.
class raw_pwrite_stream : public raw_ostream {
virtual void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) = 0;
+ void anchor() override;
public:
explicit raw_pwrite_stream(bool Unbuffered = false)
@@ -383,6 +386,8 @@ class raw_fd_ostream : public raw_pwrite_stream {
/// Set the flag indicating that an output error has been encountered.
void error_detected(std::error_code EC) { this->EC = EC; }
+ void anchor() override;
+
public:
/// Open the specified file for writing. If an error occurs, information
/// about the error is put into EC, and the stream should be immediately
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 438e656b60f..eb99312bb73 100644
--- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -28,6 +28,8 @@
using namespace llvm;
+void llvm::ObjectMemoryBuffer::anchor() {}
+
namespace {
static struct RegisterJIT {
@@ -665,3 +667,5 @@ LinkingSymbolResolver::findSymbol(const std::string &Name) {
return nullptr;
return ClientResolver->findSymbol(Name);
}
+
+void LinkingSymbolResolver::anchor() {}
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.h b/lib/ExecutionEngine/MCJIT/MCJIT.h
index 110cfa675cf..7ac792497f7 100644
--- a/lib/ExecutionEngine/MCJIT/MCJIT.h
+++ b/lib/ExecutionEngine/MCJIT/MCJIT.h
@@ -42,6 +42,7 @@ public:
private:
MCJIT &ParentEngine;
std::shared_ptr<LegacyJITSymbolResolver> ClientResolver;
+ void anchor() override;
};
// About Module states: added->loaded->finalized.
diff --git a/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp b/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
index 99e84b7496d..e774af05ebd 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
@@ -298,4 +298,6 @@ void *RTDyldMemoryManager::getPointerToNamedFunction(const std::string &Name,
return (void*)Addr;
}
+void RTDyldMemoryManager::anchor() {}
+void MCJITMemoryManager::anchor() {}
} // namespace llvm
diff --git a/lib/ExecutionEngine/SectionMemoryManager.cpp b/lib/ExecutionEngine/SectionMemoryManager.cpp
index 2dc66a1502f..05ab4a074e3 100644
--- a/lib/ExecutionEngine/SectionMemoryManager.cpp
+++ b/lib/ExecutionEngine/SectionMemoryManager.cpp
@@ -232,6 +232,8 @@ SectionMemoryManager::~SectionMemoryManager() {
SectionMemoryManager::MemoryMapper::~MemoryMapper() {}
+void SectionMemoryManager::anchor() {}
+
namespace {
// Trivial implementation of SectionMemoryManager::MemoryMapper that just calls
// into sys::Memory.
diff --git a/lib/LTO/LLVMBuild.txt b/lib/LTO/LLVMBuild.txt
index a1993314e36..b74e9a790cc 100644
--- a/lib/LTO/LLVMBuild.txt
+++ b/lib/LTO/LLVMBuild.txt
@@ -37,3 +37,4 @@ required_libraries =
Support
Target
TransformUtils
+ MCJIT
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index a9064654f2c..86dd559d5b3 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -531,3 +531,5 @@ MemoryBufferRef MemoryBuffer::getMemBufferRef() const {
StringRef Identifier = getBufferIdentifier();
return MemoryBufferRef(Data, Identifier);
}
+
+void MemoryBuffer::anchor() {}
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 5ecb18fc72f..c0e210bcd5e 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -474,6 +474,8 @@ raw_ostream &raw_ostream::indent(unsigned NumSpaces) {
return *this;
}
+void raw_ostream::anchor() {}
+
//===----------------------------------------------------------------------===//
// Formatted Output
//===----------------------------------------------------------------------===//
@@ -727,6 +729,8 @@ bool raw_fd_ostream::has_colors() const {
return sys::Process::FileDescriptorHasColors(FD);
}
+void raw_fd_ostream::anchor() {}
+
//===----------------------------------------------------------------------===//
// outs(), errs(), nulls()
//===----------------------------------------------------------------------===//
@@ -804,3 +808,5 @@ uint64_t raw_null_ostream::current_pos() const {
void raw_null_ostream::pwrite_impl(const char *Ptr, size_t Size,
uint64_t Offset) {}
+
+void raw_pwrite_stream::anchor() {}