mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
add symbol attribute support for the ELF .type directive.
llvm-svn: 94435
This commit is contained in:
parent
1882fba746
commit
7a5c8c15bd
@ -20,19 +20,25 @@ enum MCSymbolAttr {
|
||||
MCSA_Invalid = 0, /// Not a valid directive.
|
||||
|
||||
// Various directives in alphabetical order.
|
||||
MCSA_Global, /// .globl
|
||||
MCSA_Hidden, /// .hidden (ELF)
|
||||
MCSA_IndirectSymbol, /// .indirect_symbol (MachO)
|
||||
MCSA_Internal, /// .internal (ELF)
|
||||
MCSA_LazyReference, /// .lazy_reference (MachO)
|
||||
MCSA_Local, /// .local (ELF)
|
||||
MCSA_NoDeadStrip, /// .no_dead_strip (MachO)
|
||||
MCSA_PrivateExtern, /// .private_extern (MachO)
|
||||
MCSA_Protected, /// .protected (ELF)
|
||||
MCSA_Reference, /// .reference (MachO)
|
||||
MCSA_Weak, /// .weak
|
||||
MCSA_WeakDefinition, /// .weak_definition (MachO)
|
||||
MCSA_WeakReference /// .weak_reference (MachO)
|
||||
MCSA_ELF_TypeFunction, /// .type _foo, STT_FUNC # aka @function
|
||||
MCSA_ELF_TypeIndFunction, /// .type _foo, STT_GNU_IFUNC
|
||||
MCSA_ELF_TypeObject, /// .type _foo, STT_OBJECT # aka @object
|
||||
MCSA_ELF_TypeTLS, /// .type _foo, STT_TLS # aka @tls_object
|
||||
MCSA_ELF_TypeCommon, /// .type _foo, STT_COMMON # aka @common
|
||||
MCSA_ELF_TypeNoType, /// .type _foo, STT_NOTYPE # aka @notype
|
||||
MCSA_Global, /// .globl
|
||||
MCSA_Hidden, /// .hidden (ELF)
|
||||
MCSA_IndirectSymbol, /// .indirect_symbol (MachO)
|
||||
MCSA_Internal, /// .internal (ELF)
|
||||
MCSA_LazyReference, /// .lazy_reference (MachO)
|
||||
MCSA_Local, /// .local (ELF)
|
||||
MCSA_NoDeadStrip, /// .no_dead_strip (MachO)
|
||||
MCSA_PrivateExtern, /// .private_extern (MachO)
|
||||
MCSA_Protected, /// .protected (ELF)
|
||||
MCSA_Reference, /// .reference (MachO)
|
||||
MCSA_Weak, /// .weak
|
||||
MCSA_WeakDefinition, /// .weak_definition (MachO)
|
||||
MCSA_WeakReference /// .weak_reference (MachO)
|
||||
};
|
||||
|
||||
enum MCAssemblerFlag {
|
||||
|
@ -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;
|
||||
|
@ -223,6 +223,12 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
||||
// defined.
|
||||
switch (Attribute) {
|
||||
case MCSA_Invalid:
|
||||
case MCSA_ELF_TypeFunction:
|
||||
case MCSA_ELF_TypeIndFunction:
|
||||
case MCSA_ELF_TypeObject:
|
||||
case MCSA_ELF_TypeTLS:
|
||||
case MCSA_ELF_TypeCommon:
|
||||
case MCSA_ELF_TypeNoType:
|
||||
case MCSA_IndirectSymbol:
|
||||
case MCSA_Hidden:
|
||||
case MCSA_Internal:
|
||||
|
Loading…
Reference in New Issue
Block a user