[llvm] r293960 - [lto] added getCOFFWeakExternalFallback
Bob Haarman via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 2 15:10:23 PST 2017
Author: inglorion
Date: Thu Feb 2 17:10:22 2017
New Revision: 293960
URL: http://llvm.org/viewvc/llvm-project?rev=293960&view=rev
Log:
[lto] added getCOFFWeakExternalFallback
Summary: This allows clients of the LTO API to determine the name of the fallback symbol for COFF weak externals.
Reviewers: pcc
Reviewed By: pcc
Subscribers: mehdi_amini
Differential Revision: https://reviews.llvm.org/D29365
Modified:
llvm/trunk/include/llvm/LTO/LTO.h
Modified: llvm/trunk/include/llvm/LTO/LTO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/LTO.h?rev=293960&r1=293959&r2=293960&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/LTO.h (original)
+++ llvm/trunk/include/llvm/LTO/LTO.h Thu Feb 2 17:10:22 2017
@@ -152,6 +152,22 @@ public:
skip();
}
+ /// For COFF weak externals, returns the name of the symbol that is used
+ /// as a fallback if the weak external remains undefined.
+ std::string getCOFFWeakExternalFallback() const {
+ assert((Flags & object::BasicSymbolRef::SF_Weak) &&
+ (Flags & object::BasicSymbolRef::SF_Indirect) &&
+ "symbol is not a weak external");
+ std::string Name;
+ raw_string_ostream OS(Name);
+ SymTab.printSymbolName(
+ OS,
+ cast<GlobalValue>(
+ cast<GlobalAlias>(getGV())->getAliasee()->stripPointerCasts()));
+ OS.flush();
+ return Name;
+ }
+
/// Returns the mangled name of the global.
StringRef getName() const { return Name; }
More information about the llvm-commits
mailing list