Skip to content

[llvm][SystemZ] Set comment stream in SystemZDisassembler::getInstruction #148614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2025

Conversation

DavidSpickett
Copy link
Collaborator

This is done by other backends at the start of this function, for example AArch64Disassembler::getInstruction. Not setting it means you hit asserts in MCDisassembler::tryAddingSymbolicOperand and MCDisassembler::tryAddingPcLoadReferenceComment when there is a symbolizer set.

Which happened to me while debugging a SystemZ program using LLDB.

As the only good way to hit this path is from C++, I've copied X86's disassembler unit tests and added just enough to hit an assert if the comment stream is not set.

…tion

This is done by other backends at the start of this function, for example
AArch64Disassembler::getInstruction. Not setting it means you hit asserts
in MCDisassembler::tryAddingSymbolicOperand and MCDisassembler::tryAddingPcLoadReferenceComment
when there is a symbolizer set.

Which I found while debugging a SystemZ program using LLDB.

As the only good way to hit this path is from C++, I've copied
X86's disassembler unit tests and added just enough to hit
an assert, were it not for the changes in this PR.
@llvmbot llvmbot added backend:SystemZ mc Machine (object) code labels Jul 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 14, 2025

@llvm/pr-subscribers-backend-systemz

Author: David Spickett (DavidSpickett)

Changes

This is done by other backends at the start of this function, for example AArch64Disassembler::getInstruction. Not setting it means you hit asserts in MCDisassembler::tryAddingSymbolicOperand and MCDisassembler::tryAddingPcLoadReferenceComment when there is a symbolizer set.

Which happened to me while debugging a SystemZ program using LLDB.

As the only good way to hit this path is from C++, I've copied X86's disassembler unit tests and added just enough to hit an assert if the comment stream is not set.


Full diff: https://github.com/llvm/llvm-project/pull/148614.diff

3 Files Affected:

  • (modified) llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp (+2)
  • (modified) llvm/unittests/MC/SystemZ/CMakeLists.txt (+3-1)
  • (added) llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp (+103)
diff --git a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
index 6ae529e974186..31b4f1196392c 100644
--- a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
+++ b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
@@ -327,6 +327,8 @@ DecodeStatus SystemZDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
                                                  ArrayRef<uint8_t> Bytes,
                                                  uint64_t Address,
                                                  raw_ostream &CS) const {
+  CommentStream = &CS;
+
   // Get the first two bytes of the instruction.
   Size = 0;
   if (Bytes.size() < 2)
diff --git a/llvm/unittests/MC/SystemZ/CMakeLists.txt b/llvm/unittests/MC/SystemZ/CMakeLists.txt
index 3b7af4a3bbea3..a972ef27ddd8a 100644
--- a/llvm/unittests/MC/SystemZ/CMakeLists.txt
+++ b/llvm/unittests/MC/SystemZ/CMakeLists.txt
@@ -10,6 +10,8 @@ set(LLVM_LINK_COMPONENTS
   TargetParser
   )
 
-add_llvm_unittest(SystemZAsmLexerTests
+add_llvm_unittest(SystemZMCTests
   SystemZAsmLexerTest.cpp
+  SystemZMCDisassemblerTest.cpp
   )
+
diff --git a/llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp b/llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp
new file mode 100644
index 0000000000000..df59fcb402e21
--- /dev/null
+++ b/llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp
@@ -0,0 +1,103 @@
+//===- SystemZMCDisassemblerTest.cpp - Tests for SystemZ MCDisassembler ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCDisassembler/MCDisassembler.h"
+#include "llvm/MC/MCDisassembler/MCSymbolizer.h"
+#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/MC/MCTargetOptions.h"
+#include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+
+namespace {
+
+struct Context {
+  const char *TripleName = "systemz-unknown";
+  std::unique_ptr<MCRegisterInfo> MRI;
+  std::unique_ptr<MCAsmInfo> MAI;
+  std::unique_ptr<MCContext> Ctx;
+  std::unique_ptr<MCSubtargetInfo> STI;
+  std::unique_ptr<MCDisassembler> DisAsm;
+
+  Context() {
+    LLVMInitializeSystemZTargetInfo();
+    LLVMInitializeSystemZTargetMC();
+    LLVMInitializeSystemZDisassembler();
+
+    // If we didn't build SystemZ, do not run the test.
+    std::string Error;
+    const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
+    if (!TheTarget)
+      return;
+
+    MRI.reset(TheTarget->createMCRegInfo(TripleName));
+    MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
+    STI.reset(TheTarget->createMCSubtargetInfo(TripleName, "", ""));
+    Ctx = std::make_unique<MCContext>(Triple(TripleName), MAI.get(), MRI.get(),
+                                      STI.get());
+
+    DisAsm.reset(TheTarget->createMCDisassembler(*STI, *Ctx));
+  }
+
+  operator MCContext &() { return *Ctx; };
+};
+
+Context &getContext() {
+  static Context Ctxt;
+  return Ctxt;
+}
+
+class SystemZMCSymbolizerTest : public MCSymbolizer {
+public:
+  SystemZMCSymbolizerTest(MCContext &MC) : MCSymbolizer(MC, nullptr) {}
+  ~SystemZMCSymbolizerTest() {}
+
+  bool tryAddingSymbolicOperand([[maybe_unused]] MCInst &Inst,
+                                [[maybe_unused]] raw_ostream &CStream,
+                                [[maybe_unused]] int64_t Value,
+                                [[maybe_unused]] uint64_t Address,
+                                [[maybe_unused]] bool IsBranch,
+                                [[maybe_unused]] uint64_t Offset,
+                                [[maybe_unused]] uint64_t OpSize,
+                                [[maybe_unused]] uint64_t InstSize) override {
+    return true;
+  }
+
+  void
+  tryAddingPcLoadReferenceComment([[maybe_unused]] raw_ostream &cStream,
+                                  [[maybe_unused]] int64_t Value,
+                                  [[maybe_unused]] uint64_t Address) override {}
+};
+
+} // namespace
+
+TEST(SystemZDisassembler, SystemZMCSymbolizerTest) {
+  SystemZMCSymbolizerTest *TestSymbolizer =
+      new SystemZMCSymbolizerTest(getContext());
+  getContext().DisAsm->setSymbolizer(
+      std::unique_ptr<MCSymbolizer>(TestSymbolizer));
+
+  MCInst Inst;
+  uint64_t InstSize;
+
+  // Check that the SystemZ disassembler sets the comment stream before calling
+  // MCDisassembler::tryAddingSymbolicOperand. This will fail an assert if it
+  // does not do that.
+  MCDisassembler::DecodeStatus Status = getContext().DisAsm->getInstruction(
+      Inst, InstSize,
+      // lgrl   %r1, 0x1234
+      {0xc4, 0x18, 0x00, 0x00, 0x9a, 0x1a}, 0, nulls());
+  ASSERT_TRUE(Status == MCDisassembler::Success);
+  EXPECT_EQ(InstSize, uint64_t{6});
+}

@llvmbot
Copy link
Member

llvmbot commented Jul 14, 2025

@llvm/pr-subscribers-mc

Author: David Spickett (DavidSpickett)

Changes

This is done by other backends at the start of this function, for example AArch64Disassembler::getInstruction. Not setting it means you hit asserts in MCDisassembler::tryAddingSymbolicOperand and MCDisassembler::tryAddingPcLoadReferenceComment when there is a symbolizer set.

Which happened to me while debugging a SystemZ program using LLDB.

As the only good way to hit this path is from C++, I've copied X86's disassembler unit tests and added just enough to hit an assert if the comment stream is not set.


Full diff: https://github.com/llvm/llvm-project/pull/148614.diff

3 Files Affected:

  • (modified) llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp (+2)
  • (modified) llvm/unittests/MC/SystemZ/CMakeLists.txt (+3-1)
  • (added) llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp (+103)
diff --git a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
index 6ae529e974186..31b4f1196392c 100644
--- a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
+++ b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
@@ -327,6 +327,8 @@ DecodeStatus SystemZDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
                                                  ArrayRef<uint8_t> Bytes,
                                                  uint64_t Address,
                                                  raw_ostream &CS) const {
+  CommentStream = &CS;
+
   // Get the first two bytes of the instruction.
   Size = 0;
   if (Bytes.size() < 2)
diff --git a/llvm/unittests/MC/SystemZ/CMakeLists.txt b/llvm/unittests/MC/SystemZ/CMakeLists.txt
index 3b7af4a3bbea3..a972ef27ddd8a 100644
--- a/llvm/unittests/MC/SystemZ/CMakeLists.txt
+++ b/llvm/unittests/MC/SystemZ/CMakeLists.txt
@@ -10,6 +10,8 @@ set(LLVM_LINK_COMPONENTS
   TargetParser
   )
 
-add_llvm_unittest(SystemZAsmLexerTests
+add_llvm_unittest(SystemZMCTests
   SystemZAsmLexerTest.cpp
+  SystemZMCDisassemblerTest.cpp
   )
+
diff --git a/llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp b/llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp
new file mode 100644
index 0000000000000..df59fcb402e21
--- /dev/null
+++ b/llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp
@@ -0,0 +1,103 @@
+//===- SystemZMCDisassemblerTest.cpp - Tests for SystemZ MCDisassembler ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCDisassembler/MCDisassembler.h"
+#include "llvm/MC/MCDisassembler/MCSymbolizer.h"
+#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/MC/MCTargetOptions.h"
+#include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+
+namespace {
+
+struct Context {
+  const char *TripleName = "systemz-unknown";
+  std::unique_ptr<MCRegisterInfo> MRI;
+  std::unique_ptr<MCAsmInfo> MAI;
+  std::unique_ptr<MCContext> Ctx;
+  std::unique_ptr<MCSubtargetInfo> STI;
+  std::unique_ptr<MCDisassembler> DisAsm;
+
+  Context() {
+    LLVMInitializeSystemZTargetInfo();
+    LLVMInitializeSystemZTargetMC();
+    LLVMInitializeSystemZDisassembler();
+
+    // If we didn't build SystemZ, do not run the test.
+    std::string Error;
+    const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
+    if (!TheTarget)
+      return;
+
+    MRI.reset(TheTarget->createMCRegInfo(TripleName));
+    MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
+    STI.reset(TheTarget->createMCSubtargetInfo(TripleName, "", ""));
+    Ctx = std::make_unique<MCContext>(Triple(TripleName), MAI.get(), MRI.get(),
+                                      STI.get());
+
+    DisAsm.reset(TheTarget->createMCDisassembler(*STI, *Ctx));
+  }
+
+  operator MCContext &() { return *Ctx; };
+};
+
+Context &getContext() {
+  static Context Ctxt;
+  return Ctxt;
+}
+
+class SystemZMCSymbolizerTest : public MCSymbolizer {
+public:
+  SystemZMCSymbolizerTest(MCContext &MC) : MCSymbolizer(MC, nullptr) {}
+  ~SystemZMCSymbolizerTest() {}
+
+  bool tryAddingSymbolicOperand([[maybe_unused]] MCInst &Inst,
+                                [[maybe_unused]] raw_ostream &CStream,
+                                [[maybe_unused]] int64_t Value,
+                                [[maybe_unused]] uint64_t Address,
+                                [[maybe_unused]] bool IsBranch,
+                                [[maybe_unused]] uint64_t Offset,
+                                [[maybe_unused]] uint64_t OpSize,
+                                [[maybe_unused]] uint64_t InstSize) override {
+    return true;
+  }
+
+  void
+  tryAddingPcLoadReferenceComment([[maybe_unused]] raw_ostream &cStream,
+                                  [[maybe_unused]] int64_t Value,
+                                  [[maybe_unused]] uint64_t Address) override {}
+};
+
+} // namespace
+
+TEST(SystemZDisassembler, SystemZMCSymbolizerTest) {
+  SystemZMCSymbolizerTest *TestSymbolizer =
+      new SystemZMCSymbolizerTest(getContext());
+  getContext().DisAsm->setSymbolizer(
+      std::unique_ptr<MCSymbolizer>(TestSymbolizer));
+
+  MCInst Inst;
+  uint64_t InstSize;
+
+  // Check that the SystemZ disassembler sets the comment stream before calling
+  // MCDisassembler::tryAddingSymbolicOperand. This will fail an assert if it
+  // does not do that.
+  MCDisassembler::DecodeStatus Status = getContext().DisAsm->getInstruction(
+      Inst, InstSize,
+      // lgrl   %r1, 0x1234
+      {0xc4, 0x18, 0x00, 0x00, 0x9a, 0x1a}, 0, nulls());
+  ASSERT_TRUE(Status == MCDisassembler::Success);
+  EXPECT_EQ(InstSize, uint64_t{6});
+}

SystemZMCSymbolizerTest(MCContext &MC) : MCSymbolizer(MC, nullptr) {}
~SystemZMCSymbolizerTest() {}

bool tryAddingSymbolicOperand([[maybe_unused]] MCInst &Inst,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have left these parameters anonymous which saves some noise, but means the next person to extend this will have to go look up all the names again.

Copy link
Member

@uweigand uweigand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@DavidSpickett DavidSpickett merged commit b9ccc0c into llvm:main Jul 14, 2025
9 checks passed
@DavidSpickett DavidSpickett deleted the llvm-systemz branch July 14, 2025 13:36
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 14, 2025

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/37981

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
PASS: lld :: COFF/duplicate-cv.s (98547 of 101548)
PASS: lld :: COFF/default-alignment.test (98548 of 101548)
PASS: lld :: COFF/delayimports-armnt.yaml (98549 of 101548)
PASS: lld :: COFF/delayimports32.test (98550 of 101548)
PASS: lld :: COFF/duplicate.test (98551 of 101548)
PASS: lit :: discovery.py (98552 of 101548)
PASS: lld :: COFF/def-name.test (98553 of 101548)
PASS: lld :: COFF/dllexport-mingw.s (98554 of 101548)
PASS: lld :: COFF/duplicate-absolute.s (98555 of 101548)
TIMEOUT: MLIR :: Examples/standalone/test.toy (98556 of 101548)
******************** TEST 'MLIR :: Examples/standalone/test.toy' FAILED ********************
Exit Code: 1
Timeout: Reached timeout of 60 seconds

Command Output (stdout):
--
# RUN: at line 1
"/etc/cmake/bin/cmake" "/build/buildbot/premerge-monolithic-linux/llvm-project/mlir/examples/standalone" -G "Ninja"  -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang  -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir  -DLLVM_USE_LINKER=lld  -DPython3_EXECUTABLE="/usr/bin/python3.10"
# executed command: /etc/cmake/bin/cmake /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/examples/standalone -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir -DLLVM_USE_LINKER=lld -DPython3_EXECUTABLE=/usr/bin/python3.10
# .---command stdout------------
# | -- The CXX compiler identification is Clang 16.0.6
# | -- The C compiler identification is Clang 16.0.6
# | -- Detecting CXX compiler ABI info
# | -- Detecting CXX compiler ABI info - done
# | -- Check for working CXX compiler: /usr/bin/clang++ - skipped
# | -- Detecting CXX compile features
# | -- Detecting CXX compile features - done
# | -- Detecting C compiler ABI info
# | -- Detecting C compiler ABI info - done
# | -- Check for working C compiler: /usr/bin/clang - skipped
# | -- Detecting C compile features
# | -- Detecting C compile features - done
# | -- Looking for histedit.h
# | -- Looking for histedit.h - found
# | -- Found LibEdit: /usr/include (found version "2.11") 
# | -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
# | -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
# | -- Using MLIRConfig.cmake in: /build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir
# | -- Using LLVMConfig.cmake in: /build/buildbot/premerge-monolithic-linux/build/lib/cmake/llvm
# | -- Linker detection: unknown
# | -- Performing Test LLVM_LIBSTDCXX_MIN
# | -- Performing Test LLVM_LIBSTDCXX_MIN - Success
# | -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
# | -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
# | -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER
# | -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success
# | -- Performing Test C_SUPPORTS_FPIC
# | -- Performing Test C_SUPPORTS_FPIC - Success
# | -- Performing Test CXX_SUPPORTS_FPIC

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 14, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/11262

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:878:62: warning: parameter ‘FD’ set but not used [-Wunused-but-set-parameter]
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchersInternal.h: In instantiation of ‘bool clang::ast_matchers::internal::isDefaultedHelper(const T*) [with T = clang::ForStmt]’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchers.h:5800:70:   required from ‘bool clang::ast_matchers::internal::matcher_hasBody0Matcher<NodeType, ParamT>::matches(const NodeType&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const [with NodeType = clang::ForStmt; ParamT = clang::ast_matchers::internal::Matcher<clang::Stmt>]’
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchers.h:5795:1:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:878:62: warning: parameter ‘FD’ set but not used [-Wunused-but-set-parameter]
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchersInternal.h: In instantiation of ‘bool clang::ast_matchers::internal::isDefaultedHelper(const T*) [with T = clang::CoroutineBodyStmt]’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchers.h:5800:70:   required from ‘bool clang::ast_matchers::internal::matcher_hasBody0Matcher<NodeType, ParamT>::matches(const NodeType&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const [with NodeType = clang::CoroutineBodyStmt; ParamT = clang::ast_matchers::internal::Matcher<clang::Stmt>]’
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchers.h:5795:1:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:878:62: warning: parameter ‘FD’ set but not used [-Wunused-but-set-parameter]
[1141/1226] Linking CXX executable unittests/MC/SystemZ/SystemZMCTests
FAILED: unittests/MC/SystemZ/SystemZMCTests 
: && /usr/lib64/ccache/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -Wl,--gc-sections unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZAsmLexerTest.cpp.o unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o -o unittests/MC/SystemZ/SystemZMCTests  -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib  lib/libLLVMSystemZCodeGen.so.21.0git  lib/libLLVMSystemZAsmParser.so.21.0git  lib/libLLVMSystemZDisassembler.so.21.0git  -lpthread  lib/libllvm_gtest_main.so.21.0git  lib/libllvm_gtest.so.21.0git  -lpthread  lib/libLLVMMCParser.so.21.0git  lib/libLLVMSystemZDesc.so.21.0git  lib/libLLVMSystemZInfo.so.21.0git  lib/libLLVMMC.so.21.0git  lib/libLLVMTargetParser.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib && :
/usr/bin/ld: unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o: undefined reference to symbol '_ZN4llvm14MCDisassembler13setSymbolizerESt10unique_ptrINS_12MCSymbolizerESt14default_deleteIS2_EE'
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib/libLLVMMCDisassembler.so.21.0git: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[1169/1226] cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/bindings/python && /home/buildbots/llvm-external-buildbots/cmake-3.31.2/bin/cmake -E env CLANG_NO_DEFAULT_CONFIG=1 CLANG_LIBRARY_PATH=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib /home/buildbots/llvm-external-buildbots/workers/env/bin/python3.8 -m unittest discover
.....................................................................................................................................................................
----------------------------------------------------------------------
Ran 165 tests in 3.179s

OK
[1193/1226] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/TUSchedulerTests.cpp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::TUSchedulerTests_PublishWithStalePreamble_Test::TestBody()::BlockPreambleThread::onPreambleAST(clang::clangd::PathRef, llvm::StringRef, clang::clangd::CapturedASTCtx, std::shared_ptr<const clang::include_cleaner::PragmaIncludes>)’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp:1219:10: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
       if (BuildBefore)
          ^
[1217/1226] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/ParsedASTTests.cpp.o
ninja: build stopped: subcommand failed.
Step 11 (ninja check 2) failure: stage 2 checked (failure)
...
[77/85] Generating ScudoUnitTest-powerpc64le-Test
[78/85] Generating ASAN_NOINST_TEST_OBJECTS.gtest-all.cc.powerpc64le-inline.o
[79/85] Generating POWERPC64LELinuxConfig/Asan-powerpc64le-inline-Noinst-Test
[80/85] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64le-calls.o
[81/85] Generating POWERPC64LELinuxDynamicConfig/Asan-powerpc64le-calls-Dynamic-Test
[82/85] Generating POWERPC64LELinuxConfig/Asan-powerpc64le-calls-Test
[83/85] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64le-inline.o
[84/85] Generating POWERPC64LELinuxDynamicConfig/Asan-powerpc64le-inline-Dynamic-Test
[85/85] Generating POWERPC64LELinuxConfig/Asan-powerpc64le-inline-Test
[443/1226] Linking CXX executable unittests/MC/SystemZ/SystemZMCTests
FAILED: unittests/MC/SystemZ/SystemZMCTests 
: && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1.install/bin/clang++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -Wl,--gc-sections unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZAsmLexerTest.cpp.o unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o -o unittests/MC/SystemZ/SystemZMCTests  -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/lib  lib/libLLVMSystemZCodeGen.so.21.0git  lib/libLLVMSystemZAsmParser.so.21.0git  lib/libLLVMSystemZDisassembler.so.21.0git  -lpthread  lib/libllvm_gtest_main.so.21.0git  lib/libllvm_gtest.so.21.0git  -lpthread  lib/libLLVMMCParser.so.21.0git  lib/libLLVMSystemZDesc.so.21.0git  lib/libLLVMSystemZInfo.so.21.0git  lib/libLLVMMC.so.21.0git  lib/libLLVMTargetParser.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/lib && :
/usr/bin/ld: unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o: undefined reference to symbol '_ZN4llvm14MCDisassembler13setSymbolizerESt10unique_ptrINS_12MCSymbolizerESt14default_deleteIS2_EE'
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/lib/libLLVMMCDisassembler.so.21.0git: error adding symbols: DSO missing from command line
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[986/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o
[988/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SignAnalysisTest.cpp.o
[989/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Sema/HeuristicResolverTest.cpp.o
[990/1226] Building CXX object tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/TransformerClangTidyCheckTest.cpp.o
[991/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RangeSelectorTest.cpp.o
[992/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o
[993/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/SourceLocationTest.cpp.o
[994/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/StructuralEquivalenceTest.cpp.o
[995/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/ExprMutationAnalyzerTest.cpp.o
[996/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTTraverserTest.cpp.o
[997/1226] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/APFloatTest.cpp.o
[998/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp.o
[999/1226] Building CXX object unittests/Transforms/Scalar/CMakeFiles/ScalarTests.dir/LoopPassManagerTest.cpp.o
[1000/1226] Building CXX object tools/clang/tools/extra/include-cleaner/unittests/CMakeFiles/ClangIncludeCleanerTests.dir/LocateSymbolTest.cpp.o
[1001/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/RecursiveASTVisitorTest.cpp.o
[1002/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterVisibilityTest.cpp.o
[1003/1226] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/PassBuilderCallbacksTest.cpp.o
[1004/1226] Building CXX object tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/TokenAnnotatorTest.cpp.o
[1005/1226] Building CXX object unittests/Frontend/CMakeFiles/LLVMFrontendTests.dir/OpenMPDecompositionTest.cpp.o
[1006/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp.o
[1007/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/Attr.cpp.o
[1008/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp.o
[1009/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTestPostOrderVisitor.cpp.o
[1010/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/NoAlterCodeGenActionTest.cpp.o
[1011/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterGenericRedeclTest.cpp.o
[1012/1226] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o
[1013/1226] Building CXX object tools/clang/tools/extra/unittests/clang-doc/CMakeFiles/ClangDocTests.dir/SerializeTest.cpp.o
[1014/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterODRStrategiesTest.cpp.o
[1015/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/TransformerTest.cpp.o
[1016/1226] Building CXX object unittests/Frontend/CMakeFiles/LLVMFrontendTests.dir/OpenMPIRBuilderTest.cpp.o
[1017/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp.o
[1018/1226] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp.o
[1019/1226] Building CXX object tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTestComments.cpp.o
[1020/1226] Building CXX object tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/OverlappingReplacementsTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 14, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/8359

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
0.192 [1/3/2] Building CXX object compiler-rt/lib/ubsan/CMakeFiles/RTUbsan_dynamic_version_script_dummy.powerpc64le.dir/dummy.cpp.o
0.420 [0/3/3] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib/clang/21/lib/powerpc64le-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
0.447 [0/2/4] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib/clang/21/lib/powerpc64le-unknown-linux-gnu/libclang_rt.asan.so
1.105 [0/1/5] Generating /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/compile_commands.json
24.219 [4/2/1224] cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/runtimes/runtimes-bins && /home/buildbots/llvm-external-buildbots/cmake-3.31.2/bin/cmake --build /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/runtimes/runtimes-bins/ --target runtimes-test-depends --config Release
ninja: no work to do.
24.287 [3/2/1225] No install step for 'runtimes'
24.311 [2/2/1227] Completed 'runtimes'
25.726 [2/1/1228] Building CXX object unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o
25.773 [1/1/1229] Linking CXX executable unittests/MC/SystemZ/SystemZMCTests
FAILED: unittests/MC/SystemZ/SystemZMCTests 
: && /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -Wl,--color-diagnostics     -Wl,--gc-sections  -Xlinker --dependency-file=unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/link.d unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZAsmLexerTest.cpp.o unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o -o unittests/MC/SystemZ/SystemZMCTests  -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib  lib/libLLVMSystemZCodeGen.so.21.0git  lib/libLLVMSystemZAsmParser.so.21.0git  lib/libLLVMSystemZDisassembler.so.21.0git  lib/libllvm_gtest_main.so.21.0git  lib/libllvm_gtest.so.21.0git  -lpthread  lib/libLLVMMCParser.so.21.0git  lib/libLLVMSystemZDesc.so.21.0git  lib/libLLVMSystemZInfo.so.21.0git  lib/libLLVMMC.so.21.0git  lib/libLLVMTargetParser.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib && :
ld.lld: error: undefined symbol: llvm::MCDisassembler::setSymbolizer(std::unique_ptr<llvm::MCSymbolizer, std::default_delete<llvm::MCSymbolizer>>)
>>> referenced by SystemZMCDisassemblerTest.cpp
>>>               unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o:(SystemZDisassembler_SystemZMCSymbolizerTest_Test::TestBody())

ld.lld: error: undefined symbol: llvm::MCSymbolizer::~MCSymbolizer()
>>> referenced by SystemZMCDisassemblerTest.cpp
>>>               unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o:((anonymous namespace)::SystemZMCSymbolizerTest::~SystemZMCSymbolizerTest())
>>> referenced by SystemZMCDisassemblerTest.cpp
>>>               unittests/MC/SystemZ/CMakeFiles/SystemZMCTests.dir/SystemZMCDisassemblerTest.cpp.o:(vtable for (anonymous namespace)::SystemZMCSymbolizerTest)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 14, 2025

LLVM Buildbot has detected a new failure on builder clang-arm64-windows-msvc running on linaro-armv8-windows-msvc-04 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/161/builds/7045

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: 1200 seconds without output running [b'ninja', b'check-all'], attempting to kill
...
UNSUPPORTED: mlgo-utils :: corpus/extract_ir_script.test (84840 of 84850)
UNSUPPORTED: mlgo-utils :: corpus/extract_ir_test.py (84841 of 84850)
UNSUPPORTED: mlgo-utils :: corpus/make_corpus_script.test (84842 of 84850)
UNSUPPORTED: mlgo-utils :: corpus/make_corpus_test.py (84843 of 84850)
UNSUPPORTED: mlgo-utils :: pytype.test (84844 of 84850)
PASS: lld :: MachO/zippered.yaml (84845 of 84850)
PASS: lld :: MinGW/lib.test (84846 of 84850)
PASS: lld :: MachO/weak-reference.s (84847 of 84850)
PASS: lld :: MachO/weak-definition-direct-fetch.s (84848 of 84850)
PASS: lld :: MinGW/driver.test (84849 of 84850)
command timed out: 1200 seconds without output running [b'ninja', b'check-all'], attempting to kill
program finished with exit code 1
elapsedTime=5163.665196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:SystemZ mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants