[llvm] [llvm-symbolizer] Recognize AIX big archive (PR #150401)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 01:47:31 PST 2025


================
@@ -0,0 +1,108 @@
+# Test big archive recognition with same-named members (XCOFF format).
+## Big archives can contain multiple members with the same name but different
+## architectures. This test verifies llvm-symbolizer can disambiguate using
+## architecture specification.
+
+# RUN: yaml2obj --docnum=1 %s -o %t-32.o
+# RUN: yaml2obj --docnum=2 %s -o %t-64.o
+
+# RUN: rm -f %t.a
+# RUN: cp %t-32.o %t.o
+# RUN: llvm-ar %if system-aix %{-X32%} crv %t.a %t.o
+# RUN: cp %t-64.o %t.o
+# RUN: llvm-ar %if system-aix %{-X64 rv%} %else %{qv%} %t.a %t.o
+
+## Verify archive contains two members with same name.
+# RUN: llvm-ar tv %if system-aix %{-X32_64%} %t.a | FileCheck %s --check-prefix=CHECK-ARCHIVE
+# CHECK-ARCHIVE: {{.*}}symbolize-big-archive-xcoff.test.tmp.o{{$}}
+# CHECK-ARCHIVE: {{.*}}symbolize-big-archive-xcoff.test.tmp.o{{$}}
+
+## Test symbolization disambiguates between 32-bit and 64-bit members
+## using architecture specified via --default-arch flag.
+# RUN: llvm-symbolizer --default-arch=ppc --obj="%t.a(%{t:stem}.tmp.o)" 0x0 | FileCheck %s --check-prefix=CHECK-32
+# RUN: llvm-symbolizer --default-arch=ppc64 --obj="%t.a(%{t:stem}.tmp.o)" 0x0 | FileCheck %s --check-prefix=CHECK-64
+
+## Test architecture specified via :arch suffix notation.
+# RUN: llvm-symbolizer --obj="%t.a(%{t:stem}.tmp.o):ppc" 0x0 | FileCheck %s --check-prefix=CHECK-32
+# RUN: llvm-symbolizer --obj="%t.a(%{t:stem}.tmp.o):ppc64" 0x0 | FileCheck %s --check-prefix=CHECK-64
+
+# CHECK-32: foo32
+# CHECK-64: foo64
+
+## Test error cases.
+# RUN: not llvm-symbolizer --obj="%t.a(nonexistent.o)" 0x1000 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
+# CHECK-ERROR: error: {{.*}}no matching member{{.*}}
+
+# RUN: not llvm-symbolizer --obj="%t.o(%{t:stem}.tmp.o)" 0x1000 2>&1 | FileCheck %s --check-prefix=CHECK-NOTARCHIVE
+# CHECK-NOTARCHIVE: error: '{{.*}}' is not a valid archive
+
+# RUN: not llvm-symbolizer --obj="%t.a()" 0x1000 2>&1 | FileCheck %s --check-prefix=CHECK-NOSYMBOL
+# CHECK-NOSYMBOL: {{.*}}no matching member{{.*}}
+
+## 32-bit XCOFF object
+--- !XCOFF
+FileHeader:
+  MagicNumber: 0x1DF
+Sections:
+  - Name:        .text
+    Flags:       [ STYP_TEXT ]
+    SectionData: 4E800020
+Symbols:
+  - Name:                .file
+    Section:             N_DEBUG
+    StorageClass:        C_FILE
+    NumberOfAuxEntries:  1
+    AuxEntries:
+      - Type:            AUX_FILE
+        FileNameOrString: foo.c
+        FileStringType:  XFT_FN
+  - Name:                .foo32
+    Section:             .text
+    StorageClass:        C_EXT
+    NumberOfAuxEntries:  1
+    AuxEntries:
+      - Type:                   AUX_CSECT
+        SymbolType:              XTY_LD
+        StorageMappingClass:     XMC_PR
+  - Name:                foo32
+    Section:             .text
+    StorageClass:        C_EXT
+    NumberOfAuxEntries:  1
+    AuxEntries:
+      - Type:                   AUX_CSECT
+        SymbolType:              XTY_SD
+        StorageMappingClass:     XMC_PR
+
+## 64-bit XCOFF object
----------------
jh7370 wrote:

```suggestion
## 64-bit XCOFF object.
```

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


More information about the llvm-commits mailing list