this is (unfortunately) several changes mixed together:

1. Spell SectionFlags::Writeable as "Writable".
2. Add predicates for deriving SectionFlags from SectionKinds.
3. Sink ELF-specific getSectionPrefixForUniqueGlobal impl into
   ELFTargetAsmInfo.
4. Fix SectionFlagsForGlobal to know that BSS/ThreadBSS has the
   BSS bit set (the real fix for PR4619).
5. Fix isSuitableForBSS to not put globals with explicit sections
   set in BSS (which was the reason #4 wasn't fixed earlier).
6. Remove my previous hack for PR4619.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77085 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-07-25 18:57:34 +00:00
parent 4f05591e61
commit b4fc419d83
14 changed files with 100 additions and 89 deletions

View File

@@ -62,13 +62,35 @@ namespace llvm {
K == SectionKind::RODataMergeConst ||
K == SectionKind::RODataMergeStr);
}
static inline bool isBSS(Kind K) {
return K == BSS || K == ThreadBSS;
}
static inline bool isTLS(Kind K) {
return K == ThreadData || K == ThreadBSS;
}
static inline bool isCode(Kind K) {
return K == Text;
}
static inline bool isWritable(Kind K) {
return isTLS(K) ||
K == SectionKind::Data ||
K == SectionKind::DataRel ||
K == SectionKind::DataRelLocal ||
K == SectionKind::DataRelRO ||
K == SectionKind::DataRelROLocal ||
K == SectionKind::BSS;
}
}
namespace SectionFlags {
const unsigned Invalid = -1U;
const unsigned None = 0;
const unsigned Code = 1 << 0; ///< Section contains code
const unsigned Writeable = 1 << 1; ///< Section is writeable
const unsigned Writable = 1 << 1; ///< Section is writable
const unsigned BSS = 1 << 2; ///< Section contains only zeroes
const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data
const unsigned Strings = 1 << 4; ///< Section contains C-type strings
@@ -582,7 +604,9 @@ namespace llvm {
/// global. This is important for globals that need to be merged across
/// translation units.
virtual const char *
getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const;
getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const {
return 0;
}
/// getFlagsForNamedSection - If this target wants to be able to infer
/// section flags based on the name of the section specified for a global