[PATCH] D117511: [AIX] add big archive magic to enable llvm tool for big archive

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 12:47:46 PST 2022


DiggerLin created this revision.
DiggerLin added reviewers: hubert.reinterpretcast, daltenty, jhenderson.
Herald added a subscriber: hiraditya.
DiggerLin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117511

Files:
  llvm/lib/BinaryFormat/Magic.cpp
  llvm/unittests/BinaryFormat/TestFileMagic.cpp


Index: llvm/unittests/BinaryFormat/TestFileMagic.cpp
===================================================================
--- llvm/unittests/BinaryFormat/TestFileMagic.cpp
+++ llvm/unittests/BinaryFormat/TestFileMagic.cpp
@@ -46,6 +46,7 @@
 };
 
 const char archive[] = "!<arch>\x0A";
+const char big_archive[] = "<bigaf>\x0A";
 const char bitcode[] = "\xde\xc0\x17\x0b";
 const char coff_object[] = "\x00\x00......";
 const char coff_bigobj[] =
@@ -96,6 +97,7 @@
   } types[] = {
 #define DEFINE(magic) {#magic, magic, sizeof(magic), file_magic::magic}
       DEFINE(archive),
+      {"big_archive", big_archive, sizeof(big_archive), file_magic::archive},
       DEFINE(bitcode),
       DEFINE(coff_object),
       {"coff_bigobj", coff_bigobj, sizeof(coff_bigobj),
Index: llvm/lib/BinaryFormat/Magic.cpp
===================================================================
--- llvm/lib/BinaryFormat/Magic.cpp
+++ llvm/lib/BinaryFormat/Magic.cpp
@@ -88,6 +88,10 @@
     if (startswith(Magic, "!<arch>\n") || startswith(Magic, "!<thin>\n"))
       return file_magic::archive;
     break;
+  case '<':
+    if (startswith(Magic, "<bigaf>\n"))
+      return file_magic::archive;
+    break;
   case '\177':
     if (startswith(Magic, "\177ELF") && Magic.size() >= 18) {
       bool Data2MSB = Magic[5] == 2;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117511.400622.patch
Type: text/x-patch
Size: 1303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220117/a28c2ec3/attachment.bin>


More information about the llvm-commits mailing list