[llvm] [z/OS] Add z/OS archive reading support (PR #187110)
Uyiosa Iyekekpolor via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 19:52:59 PDT 2026
================
@@ -1448,3 +1602,73 @@ BigArchive::BigArchive(MemoryBufferRef Source, Error &Err)
setFirstRegular(*I);
Err = Error::success();
}
+
+ZOSArchive::ZOSArchive(MemoryBufferRef Source, Error &Err)
+ : Archive(Source, Err) {
+ ErrorAsOutParameter ErrAsOutParam(&Err);
+
+ // Get the special members.
+ child_iterator I = child_begin(Err, false);
+ if (Err)
+ return;
+ child_iterator E = child_end();
+
+ // See if this is a valid empty archive and if so return.
+ if (I == E) {
+ Err = Error::success();
+ return;
+ }
+ const Child *C = &*I;
+
+ Expected<StringRef> NameOrErr = C->getRawName();
+ if (!NameOrErr) {
+ Err = NameOrErr.takeError();
+ return;
+ }
+ StringRef Name = NameOrErr.get();
+
+ if (Name == "__.SYMDEF") {
+ Expected<StringRef> BufOrErr = C->getBuffer();
+ if (!BufOrErr) {
+ Err = BufOrErr.takeError();
+ return;
+ }
+
+ // Copy symbol table converting embedded EBCDIC names to ASCII.
+ StringRef EbcdicSymbolTable = BufOrErr.get();
+ if (EbcdicSymbolTable.size() < sizeof(uint32_t)) {
+ Err = malformedError(
+ "z/OS symbol table is too small to read the symbol count");
----------------
uyoyo0 wrote:
Done, thanks
https://github.com/llvm/llvm-project/pull/187110
More information about the llvm-commits
mailing list