[PATCH] D15215: Emit function alias to data as a function symbol
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 3 16:05:02 PST 2015
pcc added a comment.
Eventually there should be a flag or attribute on the `GlobalAlias` that specifies the type of symbol to create. That can probably happen later though. For now the source of truth is the pointee type, and I am aware that we are using it elsewhere (e.g. in the COFF writer).
================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1192
@@ +1191,3 @@
+ // explicitly switch the symbol type to function.
+ if (Alias.getType()->isPointerTy() &&
+ Alias.getType()->getPointerElementType()->isFunctionTy() &&
----------------
This will always be true (`GlobalValue::getType` returns a `PointerType *`).
================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1194
@@ +1193,3 @@
+ Alias.getType()->getPointerElementType()->isFunctionTy() &&
+ !isa<Function>(Alias.getAliasee()))
+ OutStreamer->EmitSymbolAttribute(Name, MCSA_ELF_TypeFunction);
----------------
Is this check needed?
Repository:
rL LLVM
http://reviews.llvm.org/D15215
More information about the llvm-commits
mailing list