[llvm-branch-commits] [llvm] release/23.x: [llvm-ar][GOFF] Implement symbol attributes for GOFF archives (#214528) (PR #226705)

James Henderson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 28 00:52:48 PDT 2026


================
@@ -0,0 +1,81 @@
+## Test that llvm-ar correctly writes z/OS archive symbol attribute bits.
+##
+## The three attribute bits come from GOFF ESD record fields:
+##   bit 2 (0x4): 64-bit  - AMODE == ESD_AMODE_64
+##   bit 1 (0x2): XPLink  - LinkageType == ESD_LT_XPLink
+##   bit 0 (0x1): WSA     - NameSpaceId == ESD_NS_Parts
+##
+## GOFF objects are produced by compiling embedded .ll files with llc.
+
+# REQUIRES: systemz-registered-target
+
+# RUN: rm -rf %t.dir && mkdir -p %t.dir
+# RUN: split-file %s %t.dir
+
+## Compile each .ll file into a GOFF object.
+# RUN: llc -mtriple=s390x-ibm-zos -filetype=obj %t.dir/func.ll -o %t.dir/func.o
+# RUN: llc -mtriple=s390x-ibm-zos -filetype=obj %t.dir/data.ll -o %t.dir/data.o
+
+## Build a z/OS archive containing both objects.
+# RUN: llvm-ar rcD --format=zos %t.dir/test.a %t.dir/func.o %t.dir/data.o
+
+## 1. Check the attribute words written into the archive symbol table.
+##    s_func: 0x6 (64-bit=0x4 + XPLink=0x2)
+##    s_data: 0x3 (XPLink=0x2 + WSA=0x1)
+# RUN: %python -c " \
+# RUN:   d = open(r'%t.dir/test.a', 'rb').read(); \
+# RUN:   print(hex(int.from_bytes(d[76:80], 'big'))); \
+# RUN:   print(hex(int.from_bytes(d[84:88], 'big'))) \
+# RUN: " | FileCheck %s --check-prefix=ATTRS
----------------
jh7370 wrote:

As this python script is the same in the first and third cases, barring the input file, let's move it into another file with the other split-file files (taking the input file as an argument). This should also make it easier to fix the indentation error being reported on Windows.

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


More information about the llvm-branch-commits mailing list