diff options
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 436076f33b9..b3aa8c6e634 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -271,6 +271,19 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer, } } + if (NamedMDNode *DependentLibraries = M.getNamedMetadata("llvm.dependent-libraries")) { + auto *S = C.getELFSection(".deplibs", ELF::SHT_LLVM_DEPENDENT_LIBRARIES, + ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, ""); + + Streamer.SwitchSection(S); + + for (const auto &Operand : DependentLibraries->operands()) { + Streamer.EmitBytes( + cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString()); + Streamer.EmitIntValue(0, 1); + } + } + unsigned Version = 0; unsigned Flags = 0; StringRef Section; |