[GCC] Attribute ifunc support in llvm

This patch add support for GCC attribute((ifunc("resolver"))) for
targets that use ELF as object file format. In general ifunc is a
special kind of function alias with type @gnu_indirect_function. Patch
for Clang http://reviews.llvm.org/D15524

Differential Revision: http://reviews.llvm.org/D15525

llvm-svn: 265667
This commit is contained in:
Dmitry Polukhin
2016-04-07 12:32:19 +00:00
parent 79cb643b20
commit a1feff7024
24 changed files with 369 additions and 22 deletions

View File

@@ -41,6 +41,7 @@ using namespace llvm;
template class llvm::SymbolTableListTraits<Function>;
template class llvm::SymbolTableListTraits<GlobalVariable>;
template class llvm::SymbolTableListTraits<GlobalAlias>;
template class llvm::SymbolTableListTraits<GlobalIFunc>;
//===----------------------------------------------------------------------===//
// Primitive Module methods.
@@ -59,6 +60,7 @@ Module::~Module() {
GlobalList.clear();
FunctionList.clear();
AliasList.clear();
IFuncList.clear();
NamedMDList.clear();
delete ValSymTab;
delete static_cast<StringMap<NamedMDNode *> *>(NamedMDSymTab);
@@ -250,6 +252,10 @@ GlobalAlias *Module::getNamedAlias(StringRef Name) const {
return dyn_cast_or_null<GlobalAlias>(getNamedValue(Name));
}
GlobalIFunc *Module::getNamedIFunc(StringRef Name) const {
return dyn_cast_or_null<GlobalIFunc>(getNamedValue(Name));
}
/// getNamedMetadata - Return the first NamedMDNode in the module with the
/// specified name. This method returns null if a NamedMDNode with the
/// specified name is not found.
@@ -438,6 +444,9 @@ void Module::dropAllReferences() {
for (GlobalAlias &GA : aliases())
GA.dropAllReferences();
for (GlobalIFunc &GIF : ifuncs())
GIF.dropAllReferences();
}
unsigned Module::getDwarfVersion() const {