mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
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
This commit is contained in:
@@ -53,8 +53,9 @@ namespace llvm {
|
|||||||
TLS = 1 << 5, ///< Section contains thread-local data
|
TLS = 1 << 5, ///< Section contains thread-local data
|
||||||
Debug = 1 << 6, ///< Section contains debug data
|
Debug = 1 << 6, ///< Section contains debug data
|
||||||
Linkonce = 1 << 7, ///< Section is linkonce
|
Linkonce = 1 << 7, ///< Section is linkonce
|
||||||
Named = 1 << 8, ///< Section is named
|
TypeFlags = 0xFF,
|
||||||
// Some gap for future flags
|
// Some gap for future flags
|
||||||
|
Named = 1 << 23, ///< Section is named
|
||||||
EntitySize = 0xFF << 24 ///< Entity size for mergeable sections
|
EntitySize = 0xFF << 24 ///< Entity size for mergeable sections
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -323,8 +323,10 @@ X86DarwinTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
|
|||||||
Type = C->getType();
|
Type = C->getType();
|
||||||
|
|
||||||
unsigned Size = TD->getABITypeSize(Type);
|
unsigned Size = TD->getABITypeSize(Type);
|
||||||
if (Size > 16) {
|
if (Size > 16 ||
|
||||||
// Too big for mergeable
|
!(Flags & SectionFlags::Strings ||
|
||||||
|
(Size == 4 || Size == 8 || Size == 16))) {
|
||||||
|
// Not suitable for mergeable
|
||||||
Size = 0;
|
Size = 0;
|
||||||
Flags &= ~SectionFlags::Mergeable;
|
Flags &= ~SectionFlags::Mergeable;
|
||||||
}
|
}
|
||||||
@@ -516,8 +518,12 @@ X86ELFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
|
|||||||
Type = C->getType();
|
Type = C->getType();
|
||||||
|
|
||||||
unsigned Size = TD->getABITypeSize(Type);
|
unsigned Size = TD->getABITypeSize(Type);
|
||||||
if (Size > 16) {
|
// FIXME: size check here ugly, and will hopefully have gone, when we will
|
||||||
// Too big for mergeable
|
// 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;
|
Size = 0;
|
||||||
Flags &= ~SectionFlags::Mergeable;
|
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
|
// Mark section as named, when needed (so, we we will need .section directive
|
||||||
// to switch into it).
|
// to switch into it).
|
||||||
if (Flags & (SectionFlags::Mergeable |
|
unsigned TypeFlags = Flags & SectionFlags::TypeFlags;
|
||||||
|
if (!TypeFlags /* Read-only section */ ||
|
||||||
|
(TypeFlags & (SectionFlags::Mergeable |
|
||||||
SectionFlags::TLS |
|
SectionFlags::TLS |
|
||||||
SectionFlags::Linkonce))
|
SectionFlags::Linkonce)))
|
||||||
Flags |= SectionFlags::Named;
|
Flags |= SectionFlags::Named;
|
||||||
|
|
||||||
return Flags;
|
return Flags;
|
||||||
@@ -668,9 +676,11 @@ X86COFFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
|
|||||||
|
|
||||||
// Mark section as named, when needed (so, we we will need .section directive
|
// Mark section as named, when needed (so, we we will need .section directive
|
||||||
// to switch into it).
|
// to switch into it).
|
||||||
if (Flags & (SectionFlags::Mergeable ||
|
unsigned TypeFlags = Flags & SectionFlags::TypeFlags;
|
||||||
SectionFlags::TLS ||
|
if (!TypeFlags /* Read-only section */ ||
|
||||||
SectionFlags::Linkonce))
|
(TypeFlags & (SectionFlags::Mergeable |
|
||||||
|
SectionFlags::TLS |
|
||||||
|
SectionFlags::Linkonce)))
|
||||||
Flags |= SectionFlags::Named;
|
Flags |= SectionFlags::Named;
|
||||||
|
|
||||||
return Flags;
|
return Flags;
|
||||||
|
Reference in New Issue
Block a user