[llvm-branch-commits] [llvm] [llvm-ar][GOFF] Implement symbol attributes for GOFF archives (PR #214528)
David Tenty via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 10 16:46:09 PDT 2026
================
@@ -375,6 +375,41 @@ GOFFObjectFile::getSymbolSection(DataRefImpl Symb) const {
std::to_string(SymEdId));
}
+uint32_t GOFFObjectFile::getZOSSymbolArchiveAttributes(DataRefImpl Symb) const {
+ const uint8_t *SymRecord = getSymbolEsdRecord(Symb);
+ uint32_t Attrs = 0;
+
+ // Bit 2 (0x4): 64-bit — AMODE is only defined for LD/ER records.
+ GOFF::ESDSymbolType SymType;
+ ESDRecord::getSymbolType(SymRecord, SymType);
+ if (SymType != GOFF::ESD_ST_PartReference) {
+ GOFF::ESDAmode Amode;
+ ESDRecord::getAmode(SymRecord, Amode);
+ if (Amode == GOFF::ESD_AMODE_64)
+ Attrs |= 0x4;
+ }
+
+ // Bit 1 (0x2): XPLink — LinkageType is ESD_LT_XPLink.
+ GOFF::ESDLinkageType LinkageType;
+ ESDRecord::getLinkageType(SymRecord, LinkageType);
+ if (LinkageType == GOFF::ESD_LT_XPLink)
+ Attrs |= 0x2;
+
+ // Bit 0 (0x1): Writable Static Area — the symbol's parent ED has NameSpace
+ // ESD_NS_Parts.
----------------
daltenty wrote:
There's a note in the doc:
```
The Name Space assigned to a LD or PR item must match that of the ED to which it belongs.
```
https://www.ibm.com/docs/en/zos/3.2.0?topic=record-elements-specifiable-esd-records
That seems to indicate we shouldn't need to walk to the parent, so I'm wondering about this.
https://github.com/llvm/llvm-project/pull/214528
More information about the llvm-branch-commits
mailing list