[llvm] [llvm-otool] Add -a option to print archive headers (PR #189411)

Daniel Rodríguez Troitiño via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 17:52:04 PDT 2026


================
@@ -5,6 +5,18 @@ RUN: | FileCheck %s -check-prefix=OFFSETS
 RUN: llvm-objdump %p/Inputs/macho-universal-archive.x86_64.i386 --macho --archive-headers --arch all --non-verbose \
 RUN: | FileCheck %s -check-prefix=NON-VERBOSE
 
+# llvm-otool -a shows all architectures by default.
+RUN: llvm-otool -a %p/Inputs/macho-universal-archive.x86_64.i386 \
+RUN: | FileCheck %s -check-prefix=NON-VERBOSE
+
+# llvm-otool -a -arch filters to one slice.
+RUN: llvm-otool -a -arch x86_64 %p/Inputs/macho-universal-archive.x86_64.i386 \
+RUN: | FileCheck %s -check-prefix=OTOOL-ARCH
+OTOOL-ARCH:     Archive : {{.*}}macho-universal-archive.x86_64.i386
+OTOOL-ARCH:     0100644 124/11     44
+OTOOL-ARCH:     0100644 124/0     860
+OTOOL-ARCH-NOT: (architecture i386)
----------------
drodriguez wrote:

Not sure about the FileCheck specifics here, but since this `(architecture i386)` happens in the "Archive :" line above, I think `OTOOL-ARCH: Archive: ..." might match partially there, then find the lines "0100644 124/11     44" and "0100644 124/0     860", and then not find anything beyond those lines that have "(archive i386)". I think this `OTOOL-ARCH-NOT` might want to go directly below the first `OTOOL-ARCH`.

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


More information about the llvm-commits mailing list