Emit function alias to data as a function symbol.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / AsmPrinter.cpp
index 2cfea650872a5cb8f75532caa1c593540d1610e9..b8604240b5d9c33d7103a53a9cb2bdd8e259a07f 100644 (file)
@@ -1187,6 +1187,11 @@ bool AsmPrinter::doFinalization(Module &M) {
     else
       assert(Alias.hasLocalLinkage() && "Invalid alias linkage");
 
+    // Set the symbol type to function if the alias has a function type.
+    // This affects codegen when the aliasee is not a function.
+    if (Alias.getType()->getPointerElementType()->isFunctionTy())
+      OutStreamer->EmitSymbolAttribute(Name, MCSA_ELF_TypeFunction);
+
     EmitVisibility(Name, Alias.getVisibility());
 
     // Emit the directives as assignments aka .set: