diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-07-09 13:25:26 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-07-09 13:25:26 +0000 |
commit | b20015b621aa4b0c30ffa75ef8917841183a22af (patch) | |
tree | 774bf163d22c376270df209b1421f3192c8b36a8 /lib/Target/X86/X86TargetAsmInfo.cpp | |
parent | 5248670096be98aecacca62e590324caae40a2b6 (diff) | |
download | llvm-b20015b621aa4b0c30ffa75ef8917841183a22af.tar.gz llvm-b20015b621aa4b0c30ffa75ef8917841183a22af.tar.bz2 llvm-b20015b621aa4b0c30ffa75ef8917841183a22af.tar.xz |
Add hacky way to distinguish named and named sections. This will be generalized in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetAsmInfo.cpp')
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index e03b3a28cd..6a3bdfa654 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -335,11 +335,11 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM): X86TargetAsmInfo(TM) { bool is64Bit = X86TM->getSubtarget<X86Subtarget>().is64Bit(); - ReadOnlySection = "\t.section\t.rodata"; - FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4"; - EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8"; - SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16"; - CStringSection = "\t.section\t.rodata.str1.1,\"aMS\",@progbits,1"; + ReadOnlySection = ".rodata"; + FourByteConstantSection = ".rodata.cst"; + EightByteConstantSection = ".rodata.cst"; + SixteenByteConstantSection = ".rodata.cst"; + CStringSection = ".rodata.str"; PrivateGlobalPrefix = ".L"; WeakRefDirective = "\t.weak\t"; SetDirective = "\t.set\t"; @@ -520,6 +520,16 @@ X86ELFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, Flags = SectionFlags::setEntitySize(Flags, Size); } + // FIXME: This is hacky and will be removed when switching from std::string + // sections into 'general' ones + + // Mark section as named, when needed (so, we we will need .section directive + // to switch into it). + if (Flags & (SectionFlags::Mergeable || + SectionFlags::TLS || + SectionFlags::Linkonce)) + Flags |= SectionFlags::Named; + return Flags; } @@ -645,6 +655,23 @@ X86COFFTargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV, } } +unsigned +X86COFFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, + const char* name) const { + unsigned Flags = + TargetAsmInfo::SectionFlagsForGlobal(GV, + GV->getSection().c_str()); + + // Mark section as named, when needed (so, we we will need .section directive + // to switch into it). + if (Flags & (SectionFlags::Mergeable || + SectionFlags::TLS || + SectionFlags::Linkonce)) + Flags |= SectionFlags::Named; + + return Flags; +} + std::string X86COFFTargetAsmInfo::PrintSectionFlags(unsigned flags) const { std::string Flags = ",\""; |