Skip to content

[SystemZ][XRay] XRay runtime support for SystemZ #113252

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 1 commit into from
Nov 5, 2024

Conversation

redstar
Copy link
Member

@redstar redstar commented Oct 22, 2024

Adds the runtime support routines for XRay on SystemZ. Only function entry/exit is implemented.

@llvmbot
Copy link
Member

llvmbot commented Oct 22, 2024

@llvm/pr-subscribers-xray

@llvm/pr-subscribers-backend-systemz

Author: Kai Nacke (redstar)

Changes

Adds the runtime support routines for XRay on SystemZ. Only function entry/exit is implemented.


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

6 Files Affected:

  • (modified) compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake (+1-1)
  • (modified) compiler-rt/lib/xray/CMakeLists.txt (+7)
  • (modified) compiler-rt/lib/xray/xray_interface.cpp (+2)
  • (added) compiler-rt/lib/xray/xray_s390x.cpp (+90)
  • (added) compiler-rt/lib/xray/xray_trampoline_s390x.S (+111)
  • (modified) compiler-rt/lib/xray/xray_tsc.h (+22)
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index 809e9277156912..bd51db766faab9 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -102,7 +102,7 @@ if(APPLE)
 set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM64})
 else()
 set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64}
-		powerpc64le ${HEXAGON} ${LOONGARCH64})
+		powerpc64le ${HEXAGON} ${LOONGARCH64} ${S390X})
 endif()
 set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64})
 
diff --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt
index cf7b5062aae32d..8e1ef2db2873a8 100644
--- a/compiler-rt/lib/xray/CMakeLists.txt
+++ b/compiler-rt/lib/xray/CMakeLists.txt
@@ -83,6 +83,11 @@ set(hexagon_SOURCES
   xray_trampoline_hexagon.S
   )
 
+set(s390x_SOURCES
+  xray_s390x.cpp
+  xray_trampoline_s390x.S
+  )
+
 set(XRAY_SOURCE_ARCHS
   arm
   armhf
@@ -93,6 +98,7 @@ set(XRAY_SOURCE_ARCHS
   mips64
   mips64el
   powerpc64le
+  s390x
   x86_64
   )
 
@@ -141,6 +147,7 @@ set(XRAY_ALL_SOURCE_FILES
   ${mips64_SOURCES}
   ${mips64el_SOURCES}
   ${powerpc64le_SOURCES}
+  ${s390x_SOURCES}
   ${XRAY_IMPL_HEADERS}
   )
 list(REMOVE_DUPLICATES XRAY_ALL_SOURCE_FILES)
diff --git a/compiler-rt/lib/xray/xray_interface.cpp b/compiler-rt/lib/xray/xray_interface.cpp
index 5839043fcb93a8..fee7dccf695ca0 100644
--- a/compiler-rt/lib/xray/xray_interface.cpp
+++ b/compiler-rt/lib/xray/xray_interface.cpp
@@ -56,6 +56,8 @@ static const int16_t cSledLength = 64;
 static const int16_t cSledLength = 8;
 #elif defined(__hexagon__)
 static const int16_t cSledLength = 20;
+#elif defined(__s390x__)
+static const int16_t cSledLength = 18;
 #else
 #error "Unsupported CPU Architecture"
 #endif /* CPU architecture */
diff --git a/compiler-rt/lib/xray/xray_s390x.cpp b/compiler-rt/lib/xray/xray_s390x.cpp
new file mode 100644
index 00000000000000..135994e54a2d7a
--- /dev/null
+++ b/compiler-rt/lib/xray/xray_s390x.cpp
@@ -0,0 +1,90 @@
+//===-- xray_s390x.cpp ------------------------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of XRay, a dynamic runtime instrumentation system.
+//
+// Implementation of s390x routines.
+//
+//===----------------------------------------------------------------------===//
+#include "sanitizer_common/sanitizer_common.h"
+#include "xray_defs.h"
+#include "xray_interface_internal.h"
+#include <cassert>
+#include <cstring>
+
+namespace __xray {
+
+bool patchFunctionEntry(const bool Enable, uint32_t FuncId,
+                        const XRaySledEntry &Sled,
+                        void (*Trampoline)()) XRAY_NEVER_INSTRUMENT {
+  const uint64_t Address = Sled.address();
+  if (Enable) {
+    // The resulting code is:
+    //   stmg    %r2, %r15, 16(%r15)
+    //   llilf   %2, FuncID
+    //   brasl   %r14, __xray_FunctionEntry@GOT
+    // The FuncId and the stmg instruction must be written.
+
+    // Write FuncId into llilf.
+    reinterpret_cast<uint32_t *>(Address)[2] = FuncId;
+    // Write last part of stmg.
+    reinterpret_cast<uint16_t *>(Address)[2] = 0x24;
+    // Write first part of stmg.
+    reinterpret_cast<uint32_t *>(Address)[0] = 0xeb2ff010;
+  } else {
+    // j +16 instructions.
+    *reinterpret_cast<uint32_t *>(Address) = 0xa7f4000b;
+  }
+  return true;
+}
+
+bool patchFunctionExit(const bool Enable, uint32_t FuncId,
+                       const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
+  const uint64_t Address = Sled.address();
+  if (Enable) {
+    // The resulting code is:
+    //   stmg    %r2, %r15, 24(%r15)
+    //   llilf   %2,FuncID
+    //   j       __xray_FunctionEntry@GOT
+    // The FuncId and the stmg instruction must be written.
+
+    // Write FuncId into llilf.
+    reinterpret_cast<uint32_t *>(Address)[2] = FuncId;
+    // Write last part of of stmg.
+    reinterpret_cast<uint16_t *>(Address)[2] = 0x24;
+    // Write first part of stmg.
+    reinterpret_cast<uint32_t *>(Address)[0] = 0xeb2ff010;
+  } else {
+    // br %14 instruction.
+    *reinterpret_cast<uint16_t *>(Address) = 0x07fe;
+  }
+  return true;
+}
+
+bool patchFunctionTailExit(const bool Enable, const uint32_t FuncId,
+                           const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
+  return patchFunctionExit(Enable, FuncId, Sled);
+}
+
+bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
+                      const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
+  // FIXME: Implement.
+  return false;
+}
+
+bool patchTypedEvent(const bool Enable, const uint32_t FuncId,
+                     const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
+  // FIXME: Implement.
+  return false;
+}
+
+} // namespace __xray
+
+extern "C" void __xray_ArgLoggerEntry() XRAY_NEVER_INSTRUMENT {
+  // FIXME: this will have to be implemented in the trampoline assembly file.
+}
diff --git a/compiler-rt/lib/xray/xray_trampoline_s390x.S b/compiler-rt/lib/xray/xray_trampoline_s390x.S
new file mode 100644
index 00000000000000..49a290ceb11f0a
--- /dev/null
+++ b/compiler-rt/lib/xray/xray_trampoline_s390x.S
@@ -0,0 +1,111 @@
+//===-- xray_trampoline_s390x.s ---------------------------------*- ASM -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of XRay, a dynamic runtime instrumentation system.
+//
+// This implements the s390x-specific assembler for the trampolines.
+//
+//===----------------------------------------------------------------------===//
+
+    .text
+
+#if __VX__
+// Minimal stack frame size (160) plus space for 8 vector registers a 16 bytes.
+#define STACKSZ  288
+#else
+// Minimal stack frame size
+#define STACKSZ  160
+#endif
+
+//===----------------------------------------------------------------------===//
+
+    .globl  __xray_FunctionEntry
+    .p2align    4
+    .type   __xray_FunctionEntry,@function
+__xray_FunctionEntry:
+    # The registers r2-15 of the instrumented function are already saved in the
+    # stack frame. On entry, r2 contains the function id, and %r14 the address
+    # of the first instruction of the instrumented function.
+    # Register r14 will be stored in the slot reserved for compiler use.
+    stg     %r14, 8(%r15)
+    std     %f0, 128(%r15)
+    std     %f2, 136(%r15)
+    std     %f4, 144(%r15)
+    std     %f6, 152(%r15)
+    aghi    %r15, -STACKSZ
+#if __VX__
+    vstm    %v24, %v31, 160(%r15)
+#endif
+
+    lgrl    %r1, _ZN6__xray19XRayPatchedFunctionE@GOT
+    ltg     %r1, 0(%r1)
+    je      .Lrestore1
+
+    # Set r3 to XRayEntryType::ENTRY = 0.
+    # The FuncId is still stored in r2.
+    lghi    %r3, 0
+    basr    %r14, %r1
+
+.Lrestore1:
+#if __VX__
+    vlm     %v24, %v31, 160(%r15)
+#endif
+    ld      %f6, STACKSZ+152(%r15)
+    ld      %f4, STACKSZ+144(%r15)
+    ld      %f2, STACKSZ+136(%r15)
+    ld      %f0, STACKSZ+128(%r15)
+    lmg     %r1, %r15, STACKSZ+8(%r15)
+    br      %r1
+.Lfunc_end0:
+    .size    __xray_FunctionEntry, .Lfunc_end0-__xray_FunctionEntry
+
+//===----------------------------------------------------------------------===//
+
+    .globl  __xray_FunctionExit
+    .p2align    4
+    .type   __xray_FunctionExit,@function
+__xray_FunctionExit:
+    # The registers r2-15 of the instrumented function are already saved in the
+    # stack frame. On entry, the register r2 contains the function id.
+    # At the end, the function jumps to the address saved in the slot for r14,
+    # which contains the return address into the caller of the instrumented
+    # function.
+    std     %f0, 128(%r15)
+    std     %f2, 136(%r15)
+    std     %f4, 144(%r15)
+    std     %f6, 152(%r15)
+    aghi    %r15, -STACKSZ
+#if __VX__
+    vstm    %v24, %v31, 160(%r15)
+#endif
+
+    lgrl    %r1, _ZN6__xray19XRayPatchedFunctionE@GOT
+    ltg     %r1, 0(%r1)
+    je      .Lrestore2
+
+    # Set r3 to XRayEntryType::EXIT = 1.
+    # The FuncId is still stored in r2.
+    lghi    %r3, 1
+    basr    %r14, %r1
+
+.Lrestore2:
+#if __VX__
+    vlm     %v24, %v31, 160(%r15)
+#endif
+    ld      %f6, STACKSZ+152(%r15)
+    ld      %f4, STACKSZ+144(%r15)
+    ld      %f2, STACKSZ+136(%r15)
+    ld      %f0, STACKSZ+128(%r15)
+    lmg     %r2, %r15, STACKSZ+16(%r15)
+    br      %r14
+.Lfunc_end1:
+    .size    __xray_FunctionExit, .Lfunc_end1-__xray_FunctionExit
+
+//===----------------------------------------------------------------------===//
+
+    .section    ".note.GNU-stack","",@progbits
diff --git a/compiler-rt/lib/xray/xray_tsc.h b/compiler-rt/lib/xray/xray_tsc.h
index e1cafe1bf11d2d..5b2ba49b85f5d6 100644
--- a/compiler-rt/lib/xray/xray_tsc.h
+++ b/compiler-rt/lib/xray/xray_tsc.h
@@ -83,6 +83,28 @@ inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
 
 } // namespace __xray
 
+#elif defined(__s390x__)
+#include "sanitizer_common/sanitizer_common.h"
+#include "sanitizer_common/sanitizer_internal_defs.h"
+#include "xray_defs.h"
+#include <cerrno>
+#include <cstdint>
+#include <time.h>
+
+namespace __xray {
+
+inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT { return true; }
+
+ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
+  return __builtin_readcyclecounter();
+}
+
+inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
+  return NanosecondsPerSecond;
+}
+
+} // namespace __xray
+
 #else
 #error Target architecture is not supported.
 #endif // CPU architecture

return false;
}

} // namespace __xray
Copy link
Member

Choose a reason for hiding this comment

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

TODO instead of FIXME

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed.


namespace __xray {

bool patchFunctionEntry(const bool Enable, uint32_t FuncId,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed.

bool __xray::patchFunctionEntry(const bool Enable, uint32_t FuncId,
const XRaySledEntry &Sled,
void (*Trampoline)()) XRAY_NEVER_INSTRUMENT {
const uint64_t Address = Sled.address();
Copy link
Member

Choose a reason for hiding this comment

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

Easier to cast Address to uint32_t * here to avoid reinterpret_cast below

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed, thanks!

std %f4, 144(%r15)
std %f6, 152(%r15)
aghi %r15, -STACKSZ
#if __VX__
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit concerned about this #if. As I understand, the vector argument registers need to be saved if they're live during the call (i.e. caller and callee were built with vector support, and at least one of the arguments is of vector type), and the XRay library routine being called below might clobber the vector registers - this can happen if either itself or a routine it calls are built with vector support.

The #if here checks whether this trampoline is built with vector support. This may not match whether or not caller and callee are built with vector support. While it would typically match whether the XRay library routine is built with vector support (generally, the whole support library is built with the same flags), it might not necessarily match all routines called by the support library - e.g. they might call memcpy from a glibc that is built for vector support and uses vector registers.

I'm not sure if there is some way to ensure the called support routine never uses vector registers. Maybe an alternative would be to provide two copies of the trampoline, one that saves VRs and one that does not, and then emit calls to the version that matches how the instrumented code is being compiled?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good point. Spontaneously I think the decision must depend at runtime on the availability of the vector extension. A decision at application build time does not help if e.g. glibc is build with different settings.
Is there somewhere a flag to check for the vector extension?

Copy link
Member

Choose a reason for hiding this comment

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

Runtime check would be possible, but I'd try to avoid this. As I mentioned, if the function call that is being intercepted was compiled to use the vector feature (i.e. actually passes arguments in vector registers), then we can assume that the vector feature must be available at runtime, or else the call would have already crashed. So if we know at instrumentation time that this call uses the vector feature, the instrumentation can choose to use the variant of the trampoline that saves and restores vector registers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I'll put in a 2nd set of trampoline functions, and change #113253 accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a 2nd, vector-enabled version of the functions.

Copy link
Member

Choose a reason for hiding this comment

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

Did you try building this with a host compiler that supports z10 by default? I'm afraid the vstm / vlm instructions would cause a compile error there. It might be best to either force -march=z13 when compiling this file, or hard-code the instructions via .insn or the like ...

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise this all LGTM now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I tried. I added the -mvx option to the assembly file, to make sure it compiles. See the change in the CMake file.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, excellent. Sorry I missed that. All LGTM now.

@redstar redstar force-pushed the knacke/systemzxrayruntime branch from 6d21673 to e9b6161 Compare November 5, 2024 19:13
Adds the runtime support routines for XRay on SystemZ.
Only function entry/exit is implemented.
@redstar redstar force-pushed the knacke/systemzxrayruntime branch from e9b6161 to 6359fba Compare November 5, 2024 20:36
@redstar redstar merged commit db1882e into llvm:main Nov 5, 2024
3 of 5 checks passed
sylvestre added a commit that referenced this pull request Nov 6, 2024
@sylvestre
Copy link
Collaborator

sorry, i had to revert it for causing:
#115129

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 6, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building compiler-rt at step 4 "build stage 1".

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

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja -j4' (failure)
...
[420/489] Building C object compiler-rt/lib/profile/CMakeFiles/clang_rt.profile-s390x.dir/InstrProfilingUtil.c.o
[421/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_flags.cpp.o
[422/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-s390x.dir/tsan_mman.cpp.o
[423/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_interface_atomic.cpp.o
[424/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_init.cpp.o
[425/489] Building ASM object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_trampoline_s390x.S.o
[426/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayFDR.s390x.dir/xray_fdr_flags.cpp.o
[427/489] Generating exported symbols for clang_rt.ubsan_minimal-s390x
[428/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayBASIC.s390x.dir/xray_basic_flags.cpp.o
[429/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o
FAILED: compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o 
/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang++ --target=s390x-unknown-linux-gnu -DSANITIZER_COMMON_NO_REDEFINE_BUILTINS -DXRAY_HAS_EXCEPTIONS=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/.. -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/../../include -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 -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 -Wall -Wno-unused-parameter -O3 -DNDEBUG -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -Wno-format -fno-rtti -std=c++17 -MD -MT compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o -MF compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o.d -o compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o -c /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/xray_s390x.cpp
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/xray_s390x.cpp:20:14: error: out-of-line definition of 'patchFunctionEntry' does not match any declaration in namespace '__xray'
   20 | bool __xray::patchFunctionEntry(const bool Enable, uint32_t FuncId,
      |              ^~~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/xray_s390x.cpp:44:14: error: out-of-line definition of 'patchFunctionExit' does not match any declaration in namespace '__xray'
   44 | bool __xray::patchFunctionExit(const bool Enable, uint32_t FuncId,
      |              ^~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/xray_s390x.cpp:68:14: error: out-of-line definition of 'patchFunctionTailExit' does not match any declaration in namespace '__xray'
   68 | bool __xray::patchFunctionTailExit(const bool Enable, const uint32_t FuncId,
      |              ^~~~~~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/xray_s390x.cpp:71:10: error: no matching function for call to 'patchFunctionExit'
   71 |   return patchFunctionExit(Enable, FuncId, Sled);
      |          ^~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/xray/xray_interface_internal.h:144:6: note: candidate function not viable: requires 4 arguments, but 3 were provided
  144 | bool patchFunctionExit(bool Enable, uint32_t FuncId, const XRaySledEntry &Sled,
      |      ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  145 |                        const XRayTrampolines &Trampolines);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
[430/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtFunctionsDlsym.cpp.o
[431/489] Linking CXX static library /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/lib/clang/20/lib/s390x-unknown-linux-gnu/libclang_rt.profile.a
[432/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtFunctionsWindows.cpp.o
[433/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtraCounters.cpp.o
[434/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_buffer_queue.cpp.o
[435/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtraCountersDarwin.cpp.o
[436/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.s390x.dir/xray_profiling_flags.cpp.o
[437/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtraCountersWindows.cpp.o
[438/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayBASIC.s390x.dir/xray_basic_logging.cpp.o
[439/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtFunctionsWeak.cpp.o
[440/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_interface.cpp.o
[441/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.s390x.dir/xray_profiling.cpp.o
[442/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_rtl_access.cpp.o
[443/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.s390x.dir/xray_profile_collector.cpp.o
[444/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayFDR.s390x.dir/xray_fdr_logging.cpp.o
[445/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerCrossOver.cpp.o
[446/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerIO.cpp.o
[447/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerDataFlowTrace.cpp.o
[448/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerFork.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 6, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-lnt running on systemz-1 while building compiler-rt at step 6 "build stage 1".

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

Here is the relevant piece of the build log for the reference
Step 6 (build stage 1) failure: 'ninja -j4' (failure)
...
[415/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_platform_linux.cpp.o
[416/489] Building C object compiler-rt/lib/profile/CMakeFiles/clang_rt.profile-s390x.dir/InstrProfilingValue.c.o
[417/489] Building C object compiler-rt/lib/profile/CMakeFiles/clang_rt.profile-s390x.dir/InstrProfilingFile.c.o
[418/489] Building C object compiler-rt/lib/profile/CMakeFiles/clang_rt.profile-s390x.dir/InstrProfilingUtil.c.o
[419/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_sync.cpp.o
[420/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_flags.cpp.o
[421/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayFDR.s390x.dir/xray_fdr_flags.cpp.o
[422/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayBASIC.s390x.dir/xray_basic_flags.cpp.o
[423/489] Linking CXX static library /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/lib/clang/20/lib/s390x-unknown-linux-gnu/libclang_rt.profile.a
[424/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o
FAILED: compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o 
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/./bin/clang++ --target=s390x-unknown-linux-gnu -DSANITIZER_COMMON_NO_REDEFINE_BUILTINS -DXRAY_HAS_EXCEPTIONS=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/.. -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/../../include -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 -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 -Wall -Wno-unused-parameter -O3 -DNDEBUG -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -Wno-format -fno-rtti -std=c++17 -MD -MT compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o -MF compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o.d -o compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_s390x.cpp.o -c /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/xray_s390x.cpp
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/xray_s390x.cpp:20:14: error: out-of-line definition of 'patchFunctionEntry' does not match any declaration in namespace '__xray'
   20 | bool __xray::patchFunctionEntry(const bool Enable, uint32_t FuncId,
      |              ^~~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/xray_s390x.cpp:44:14: error: out-of-line definition of 'patchFunctionExit' does not match any declaration in namespace '__xray'
   44 | bool __xray::patchFunctionExit(const bool Enable, uint32_t FuncId,
      |              ^~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/xray_s390x.cpp:68:14: error: out-of-line definition of 'patchFunctionTailExit' does not match any declaration in namespace '__xray'
   68 | bool __xray::patchFunctionTailExit(const bool Enable, const uint32_t FuncId,
      |              ^~~~~~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/xray_s390x.cpp:71:10: error: no matching function for call to 'patchFunctionExit'
   71 |   return patchFunctionExit(Enable, FuncId, Sled);
      |          ^~~~~~~~~~~~~~~~~
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/compiler-rt/lib/xray/xray_interface_internal.h:144:6: note: candidate function not viable: requires 4 arguments, but 3 were provided
  144 | bool patchFunctionExit(bool Enable, uint32_t FuncId, const XRaySledEntry &Sled,
      |      ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  145 |                        const XRayTrampolines &Trampolines);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
[425/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_init.cpp.o
[426/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.s390x.dir/xray_profiling_flags.cpp.o
[427/489] Building ASM object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_trampoline_s390x.S.o
[428/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtFunctionsDlsym.cpp.o
[429/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_buffer_queue.cpp.o
[430/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_interface_atomic.cpp.o
[431/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtFunctionsWindows.cpp.o
[432/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_rtl_report.cpp.o
[433/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-s390x.dir/tsan_rtl_access.cpp.o
[434/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayBASIC.s390x.dir/xray_basic_logging.cpp.o
[435/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.s390x.dir/xray_profiling.cpp.o
[436/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXray.s390x.dir/xray_interface.cpp.o
[437/489] Building CXX object compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan-dynamic-s390x.dir/tsan_rtl_access.cpp.o
[438/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerExtFunctionsWeak.cpp.o
[439/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerCrossOver.cpp.o
[440/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayFDR.s390x.dir/xray_fdr_logging.cpp.o
[441/489] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.s390x.dir/xray_profile_collector.cpp.o
[442/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerDataFlowTrace.cpp.o
[443/489] Building CXX object compiler-rt/lib/fuzzer/CMakeFiles/RTfuzzer.s390x.dir/FuzzerDriver.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 6, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building compiler-rt at step 3 "clean-build-dir".

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

Here is the relevant piece of the build log for the reference
Step 3 (clean-build-dir) failure: Delete failed. (failure) (timed out)
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: ClangScanDeps/verbose.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
+ rm -rf /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
RUN: at line 2: split-file /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
+ split-file /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
RUN: at line 3: sed -e "s|DIR|/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp|g" /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json.in > /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json
+ sed -e 's|DIR|/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp|g' /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json.in
RUN: at line 5: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/clang-scan-deps -compilation-database /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json -v -o /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/result.json 2>&1 | /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/clang-scan-deps -compilation-database /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json -v -o /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/result.json
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test:6:11: error: CHECK: expected string not found in input
// CHECK: *** Virtual File System Stats:
          ^
<stdin>:1:1: note: scanning from here
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
^
<stdin>:1:8: note: possible intended match here
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
       ^

Input file: <stdin>
Check file: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. 
check:6'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:6'1            ?                                                                                                     possible intended match
>>>>>>

--

********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants