From 609f8c013c0b68ee051294f3e7ad6786d83bafac Mon Sep 17 00:00:00 2001 From: Sriraman Tallam Date: Fri, 23 Feb 2018 21:32:06 +0000 Subject: Intrinsics calls should avoid the PLT when "RtLibUseGOT" metadata is present. Differential Revision: https://reviews.llvm.org/D42216 llvm-svn: 325962 --- llvm/lib/IR/Module.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/IR/Module.cpp') 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 MB) { OwnedMemoryBuffer = std::move(MB); } +bool Module::getRtLibUseGOT() const { + auto *Val = cast_or_null(getModuleFlag("RtLibUseGOT")); + return Val && (cast(Val->getValue())->getZExtValue() > 0); +} + +void Module::setRtLibUseGOT() { + addModuleFlag(ModFlagBehavior::Max, "RtLibUseGOT", 1); +} + GlobalVariable *llvm::collectUsedGlobalVariables( const Module &M, SmallPtrSetImpl &Set, bool CompilerUsed) { const char *Name = CompilerUsed ? "llvm.compiler.used" : "llvm.used"; -- cgit v1.1