summaryrefslogtreecommitdiffstats
path: root/lib/MC/MCAsmStreamer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-25 18:30:45 +0000
committerChris Lattner <sabre@nondot.org>2010-01-25 18:30:45 +0000
commited0ab15170f0f8fc4269d58757378bc8726b56a1 (patch)
treed6797238ee053096ab9e9a6f09b8c25ca71f49cc /lib/MC/MCAsmStreamer.cpp
parent032742972f69c014dd5e985753c06a7fe3d08704 (diff)
downloadexternal_llvm-ed0ab15170f0f8fc4269d58757378bc8726b56a1.zip
external_llvm-ed0ab15170f0f8fc4269d58757378bc8726b56a1.tar.gz
external_llvm-ed0ab15170f0f8fc4269d58757378bc8726b56a1.tar.bz2
add symbol attribute support for the ELF .type directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94435 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAsmStreamer.cpp')
-rw-r--r--lib/MC/MCAsmStreamer.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index 6ce040e..f577ad4 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -227,7 +227,29 @@ void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) {
switch (Attribute) {
case MCSA_Invalid: assert(0 && "Invalid symbol attribute");
- case MCSA_Global: OS << MAI.getGlobalDirective(); break; // .globl
+ case MCSA_ELF_TypeFunction: /// .type _foo, STT_FUNC # aka @function
+ case MCSA_ELF_TypeIndFunction: /// .type _foo, STT_GNU_IFUNC
+ case MCSA_ELF_TypeObject: /// .type _foo, STT_OBJECT # aka @object
+ case MCSA_ELF_TypeTLS: /// .type _foo, STT_TLS # aka @tls_object
+ case MCSA_ELF_TypeCommon: /// .type _foo, STT_COMMON # aka @common
+ case MCSA_ELF_TypeNoType: /// .type _foo, STT_NOTYPE # aka @notype
+ assert(MAI.hasDotTypeDotSizeDirective() && "Symbol Attr not supported");
+ OS << ".type " << *Symbol << ','
+ << ((MAI.getCommentString()[0] != '@') ? '@' : '%');
+ switch (Attribute) {
+ default: assert(0 && "Unknown ELF .type");
+ case MCSA_ELF_TypeFunction: OS << "function"; break;
+ case MCSA_ELF_TypeIndFunction: OS << "gnu_indirect_function"; break;
+ case MCSA_ELF_TypeObject: OS << "object"; break;
+ case MCSA_ELF_TypeTLS: OS << "tls_object"; break;
+ case MCSA_ELF_TypeCommon: OS << "common"; break;
+ case MCSA_ELF_TypeNoType: OS << "no_type"; break;
+ }
+ EmitEOL();
+ return;
+ case MCSA_Global: // .globl/.global
+ OS << MAI.getGlobalDirective();
+ break;
case MCSA_Hidden: OS << ".hidden "; break;
case MCSA_IndirectSymbol: OS << ".indirect_symbol "; break;
case MCSA_Internal: OS << ".internal "; break;