[llvm] [SystemZ][z/OS] Implement executePostLayoutBinding for GOFFObjectWriter (PR #67868)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 11:14:47 PDT 2023


================
@@ -18,10 +18,50 @@
 namespace llvm {
 
 class MCSymbolGOFF : public MCSymbol {
+  Align Alignment;
+  enum SymbolFlags : uint16_t {
+    SF_NoRent = 0x01, // Symbol is no-reentrant.
+    SF_Alias = 0x02,  // Symbol is alias.
+    SF_Hidden = 0x04, // Symbol is hidden, aka not exported.
+    SF_Weak = 0x08,   // Symbol is weak.
+  };
+
+  enum {
+    // Shift value for GOFF::ESDExecutable. 3 possible values. 2 bits.
+    GOFF_Executable_Shift = 6,
+    GOFF_Executable_Bitmask = 0x3,
+  };
+
 public:
   MCSymbolGOFF(const StringMapEntry<bool> *Name, bool IsTemporary)
       : MCSymbol(SymbolKindGOFF, Name, IsTemporary) {}
   static bool classof(const MCSymbol *S) { return S->isGOFF(); }
+
+  void setAlignment(Align Value) { Alignment = Value; }
+  Align getAlignment() const { return Alignment; }
+
+  void setExecutable(GOFF::ESDExecutable Value) const {
+    modifyFlags(Value << GOFF_Executable_Shift,
+                GOFF_Executable_Bitmask << GOFF_Executable_Shift);
+  }
+  GOFF::ESDExecutable getExecutable() const {
+    return static_cast<GOFF::ESDExecutable>(
+        (getFlags() >> GOFF_Executable_Shift) & GOFF_Executable_Bitmask);
+  }
+
+  void setHidden(bool Value = true) {
+    modifyFlags(Value ? SF_Hidden : 0, SF_Hidden);
+  }
+  bool isHidden() const { return getFlags() & SF_Hidden; }
+  bool isExported() const { return !isHidden(); }
+
+  void setWeak(bool Value = true) { modifyFlags(Value ? SF_Weak : 0, SF_Weak); }
----------------
diggerlin wrote:

there is in MCSymbol.h
` /// This symbol is weak external.
  mutable unsigned IsWeakExternal : 1;`
  
  It looks unreasonal  to add a new SF_Weak here ?

https://github.com/llvm/llvm-project/pull/67868


More information about the llvm-commits mailing list