[llvm] [llvm-nm][GOFF] Display archive attributes in GOFF archives through --print-armap (PR #214527)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 01:37:12 PDT 2026
================
@@ -2045,9 +2045,40 @@ static bool checkMachOAndArchFlags(SymbolicFile *O, StringRef Filename) {
return true;
}
-static void printArchiveMap(iterator_range<Archive::symbol_iterator> &map,
- StringRef Filename) {
- for (auto I : map) {
+/// Decode the low 3 bits of a z/OS archive symbol attribute word into a
+/// human-readable string, e.g. "[64-bit + XPLink]".
+/// Any bits above the known 3-bit mask produce a trailing "?" flag.
+static std::string decodeZOSAttributes(uint32_t Attrs) {
+ bool Unknown = (Attrs & ~Archive::Symbol::ZOSKnownAttrMask) != 0;
+ bool Is64Bit = (Attrs & Archive::Symbol::ZOSAttr64Bit) != 0;
+ bool IsXPLink = (Attrs & Archive::Symbol::ZOSAttrXPLink) != 0;
+ bool IsWSA = (Attrs & Archive::Symbol::ZOSAttrWSA) != 0;
+
+ std::string Result = "[";
----------------
jh7370 wrote:
Rather than create a local `std::string` that is repeatedly modified (causing additional memory allocations etc), pass in the output stream you are writing to and stream to that directly.
https://github.com/llvm/llvm-project/pull/214527
More information about the llvm-commits
mailing list