- enum Flags {
- None = 0,
- Code = 1 << 0, ///< Section contains code
- Writeable = 1 << 1, ///< Section is writeable
- BSS = 1 << 2, ///< Section contains only zeroes
- Mergeable = 1 << 3, ///< Section contains mergeable data
- Strings = 1 << 4, ///< Section contains null-terminated strings
- TLS = 1 << 5, ///< Section contains thread-local data
- Debug = 1 << 6, ///< Section contains debug data
- Linkonce = 1 << 7 ///< Section is linkonce
+ 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 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
+ const unsigned TLS = 1 << 5; ///< Section contains thread-local data
+ const unsigned Debug = 1 << 6; ///< Section contains debug data
+ const unsigned Linkonce = 1 << 7; ///< Section is linkonce
+ const unsigned Small = 1 << 8; ///< Section is small
+ const unsigned TypeFlags = 0xFF;
+ // Some gap for future flags
+ const unsigned Named = 1 << 23; ///< Section is named
+ const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
+
+ static inline unsigned getEntitySize(unsigned Flags) {
+ return (Flags >> 24) & 0xFF;
+ }
+
+ static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
+ return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24));
+ }
+
+ struct KeyInfo {
+ static inline unsigned getEmptyKey() { return Invalid; }
+ static inline unsigned getTombstoneKey() { return Invalid - 1; }
+ static unsigned getHashValue(const unsigned &Key) { return Key; }
+ static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
+ static bool isPod() { return true; }