summaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-01-21 18:31:27 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-01-21 18:31:27 +0000
commita747cf1c4d740dfe5fd1b3cd1b3d43251892457a (patch)
tree3640e0852df6d853ed2b84c2a1ccce517a3c336a /lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent92e658b56616cf389de242df230682f0b1c9e4fd (diff)
downloadllvm-a747cf1c4d740dfe5fd1b3cd1b3d43251892457a.tar.gz
llvm-a747cf1c4d740dfe5fd1b3cd1b3d43251892457a.tar.bz2
llvm-a747cf1c4d740dfe5fd1b3cd1b3d43251892457a.tar.xz
Adding new LTO APIs to parse metadata nodes and extract linker options and
dependent libraries from a bitcode module. Differential Revision: http://llvm-reviews.chandlerc.com/D2343 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--lib/CodeGen/TargetLoweringObjectFileImpl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 60e74cf8ef..3621b58287 100644
--- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -402,6 +402,16 @@ TargetLoweringObjectFileELF::InitializeELF(bool UseInitArray_) {
// MachO
//===----------------------------------------------------------------------===//
+/// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
+/// option string. Returns StringRef() if the option does not specify a library.
+StringRef TargetLoweringObjectFileMachO::
+getDepLibFromLinkerOpt(StringRef LinkerOption) const {
+ const char *LibCmd = "-l";
+ if (LinkerOption.startswith(LibCmd))
+ return LinkerOption.substr(strlen(LibCmd));
+ return StringRef();
+}
+
/// emitModuleFlags - Perform code emission for module flags.
void TargetLoweringObjectFileMachO::
emitModuleFlags(MCStreamer &Streamer,
@@ -774,6 +784,14 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
return DataSection;
}
+StringRef TargetLoweringObjectFileCOFF::
+getDepLibFromLinkerOpt(StringRef LinkerOption) const {
+ const char *LibCmd = "/DEFAULTLIB:";
+ if (LinkerOption.startswith(LibCmd))
+ return LinkerOption.substr(strlen(LibCmd));
+ return StringRef();
+}
+
void TargetLoweringObjectFileCOFF::
emitModuleFlags(MCStreamer &Streamer,
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,