summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBob Haarman <llvm@inglorion.net>2017-02-02 23:10:22 +0000
committerBob Haarman <llvm@inglorion.net>2017-02-02 23:10:22 +0000
commite4062dfd47d1817da8d4ea667df15c8bb5ab7b0e (patch)
treed7d7cc4f435759942438cadd38b9a50b8ea97588 /llvm
parentc1f8a82491dbdc1431e136b3e30c1a4f37c33836 (diff)
downloadbcm5719-llvm-e4062dfd47d1817da8d4ea667df15c8bb5ab7b0e.tar.gz
bcm5719-llvm-e4062dfd47d1817da8d4ea667df15c8bb5ab7b0e.zip
[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 llvm-svn: 293960
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/LTO/LTO.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 5886ed99171..c346ec522df 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -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; }
OpenPOWER on IntegriCloud