diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-07-09 13:26:52 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-07-09 13:26:52 +0000 |
commit | 7e7fc82cf3adfab1af673ebef4a671238f9c9bbb (patch) | |
tree | 47dbf7b771a7e0b0a4c60b4883a810768dde77c7 /lib/Target/X86/X86TargetAsmInfo.cpp | |
parent | 1290ecf5b978535386360573c4921dc7138264c7 (diff) | |
download | llvm-7e7fc82cf3adfab1af673ebef4a671238f9c9bbb.tar.gz llvm-7e7fc82cf3adfab1af673ebef4a671238f9c9bbb.tar.bz2 llvm-7e7fc82cf3adfab1af673ebef4a671238f9c9bbb.tar.xz |
Another bunch of hacks for named sections support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetAsmInfo.cpp')
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index a53f4a1183..0fdc0eefba 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -323,8 +323,10 @@ X86DarwinTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, Type = C->getType(); unsigned Size = TD->getABITypeSize(Type); - if (Size > 16) { - // Too big for mergeable + if (Size > 16 || + !(Flags & SectionFlags::Strings || + (Size == 4 || Size == 8 || Size == 16))) { + // Not suitable for mergeable Size = 0; Flags &= ~SectionFlags::Mergeable; } @@ -516,8 +518,12 @@ X86ELFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, Type = C->getType(); unsigned Size = TD->getABITypeSize(Type); - if (Size > 16) { - // Too big for mergeable + // FIXME: size check here ugly, and will hopefully have gone, when we will + // have sane interface for attaching flags to sections. + if (Size > 16 || + !(Flags & SectionFlags::Strings || + (Size == 4 || Size == 8 || Size == 16))) { + // Not suitable for mergeable Size = 0; Flags &= ~SectionFlags::Mergeable; } @@ -529,9 +535,11 @@ X86ELFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, // 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)) + unsigned TypeFlags = Flags & SectionFlags::TypeFlags; + if (!TypeFlags /* Read-only section */ || + (TypeFlags & (SectionFlags::Mergeable | + SectionFlags::TLS | + SectionFlags::Linkonce))) Flags |= SectionFlags::Named; return Flags; @@ -668,9 +676,11 @@ X86COFFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, // 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)) + unsigned TypeFlags = Flags & SectionFlags::TypeFlags; + if (!TypeFlags /* Read-only section */ || + (TypeFlags & (SectionFlags::Mergeable | + SectionFlags::TLS | + SectionFlags::Linkonce))) Flags |= SectionFlags::Named; return Flags; |