[llvm] [z/OS] Add z/OS archive reading support (PR #187110)

Uyiosa Iyekekpolor via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 19:24:49 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;
+    }
----------------
uyoyo0 wrote:

Ah right, that makes sense. Thanks, I've added the comment and used `cantFail`.

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


More information about the llvm-commits mailing list