[llvm] [z/OS] Add z/OS archive reading support (PR #187110)
Uyiosa Iyekekpolor via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 10:49:08 PDT 2026
================
@@ -434,6 +472,18 @@ class BigArchive : public Archive {
bool has64BitGlobalSymtab() { return Has64BitGlobalSymtab; }
};
+class ZOSArchive : public Archive {
+public:
+ // Fixed-Length header.
+ struct FixLenHdr {
+ char Magic[sizeof(ZOSArchiveMagic) - 1]; ///< ZOS archive magic string.
+ };
+
+ ZOSArchive(MemoryBufferRef Source, Error &Err);
+
+private:
+ std::string SymbolTableBuf; // __.SYMDEF strings converted to ASCII.
----------------
uyoyo0 wrote:
Its pretty much just used for memory management.
In the constructor, after we convert the EBCDIC names to ASCII, we append them to SymbolTableBuf which is a std::string. We then set the base class's SymbolTable to point to it:
```
SymbolTable = StringRef(SymbolTableBuf.data(), SymbolTableBuf.size());
```
Because `Archive::SymbolTable` is just a `StringRef`, it doesn't own the memory. Therefore, `SymbolTableBuf` needs to be a class member so that the backing buffer stays alive for the entire lifetime of the `ZOSArchive` object.
https://github.com/llvm/llvm-project/pull/187110
More information about the llvm-commits
mailing list