aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2018-02-23 21:32:06 +0000
committerSriraman Tallam <tmsriram@google.com>2018-02-23 21:32:06 +0000
commit609f8c013c0b68ee051294f3e7ad6786d83bafac (patch)
tree6b8f8a903e354f32b86238bc9ae1ef0dce25ad42 /llvm/lib/IR/Module.cpp
parent80af005a485357bf87e0d58f6d4fbab1d186881b (diff)
downloadllvm-609f8c013c0b68ee051294f3e7ad6786d83bafac.zip
llvm-609f8c013c0b68ee051294f3e7ad6786d83bafac.tar.gz
llvm-609f8c013c0b68ee051294f3e7ad6786d83bafac.tar.bz2
Intrinsics calls should avoid the PLT when "RtLibUseGOT" metadata is present.
Differential Revision: https://reviews.llvm.org/D42216 llvm-svn: 325962
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r--llvm/lib/IR/Module.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index c230a500..9f1e609 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -510,6 +510,15 @@ void Module::setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB) {
OwnedMemoryBuffer = std::move(MB);
}
+bool Module::getRtLibUseGOT() const {
+ auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("RtLibUseGOT"));
+ return Val && (cast<ConstantInt>(Val->getValue())->getZExtValue() > 0);
+}
+
+void Module::setRtLibUseGOT() {
+ addModuleFlag(ModFlagBehavior::Max, "RtLibUseGOT", 1);
+}
+
GlobalVariable *llvm::collectUsedGlobalVariables(
const Module &M, SmallPtrSetImpl<GlobalValue *> &Set, bool CompilerUsed) {
const char *Name = CompilerUsed ? "llvm.compiler.used" : "llvm.used";