Skip to content

[libunwind][Haiku] Fix signal frame unwinding #135367

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
May 29, 2025

Conversation

trungnt2910
Copy link
Contributor

The current unwinding implementation on Haiku is messy and broken.

  1. It searches weird paths for private headers, which is breaking builds in consuming projects, such as dotnet/runtime.
  2. It does not even work, due to relying on incorrect private offsets.

This commit strips all references to private headers and ports a working signal frame implementation. It has been tested against tests/signal_unwind.pass.cpp and can go pass the signal frame.

@trungnt2910 trungnt2910 requested a review from a team as a code owner April 11, 2025 13:33
@llvmbot
Copy link
Member

llvmbot commented Apr 11, 2025

@llvm/pr-subscribers-libunwind

Author: Trung Nguyen (trungnt2910)

Changes

The current unwinding implementation on Haiku is messy and broken.

  1. It searches weird paths for private headers, which is breaking builds in consuming projects, such as dotnet/runtime.
  2. It does not even work, due to relying on incorrect private offsets.

This commit strips all references to private headers and ports a working signal frame implementation. It has been tested against tests/signal_unwind.pass.cpp and can go pass the signal frame.


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

2 Files Affected:

  • (modified) libunwind/src/CMakeLists.txt (-16)
  • (modified) libunwind/src/UnwindCursor.hpp (+163-60)
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index d69013e5dace1..70bd3a017cda7 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -118,22 +118,6 @@ if (HAIKU)
 
   add_compile_flags("-D_DEFAULT_SOURCE")
   add_compile_flags("-DPT_GNU_EH_FRAME=PT_EH_FRAME")
-
-  find_path(LIBUNWIND_HAIKU_PRIVATE_HEADERS
-            "commpage_defs.h"
-            PATHS ${CMAKE_SYSTEM_INCLUDE_PATH}
-            PATH_SUFFIXES "/private/system"
-            NO_DEFAULT_PATH
-            REQUIRED)
-
-  include_directories(SYSTEM "${LIBUNWIND_HAIKU_PRIVATE_HEADERS}")
-  if (LIBUNWIND_TARGET_TRIPLE)
-    if (${LIBUNWIND_TARGET_TRIPLE} MATCHES "^x86_64")
-      include_directories(SYSTEM "${LIBUNWIND_HAIKU_PRIVATE_HEADERS}/arch/x86_64")
-    endif()
-  else()
-    include_directories(SYSTEM "${LIBUNWIND_HAIKU_PRIVATE_HEADERS}/arch/${CMAKE_SYSTEM_PROCESSOR}")
-  endif()
 endif ()
 
 string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index ca9927edc9990..fc1f8e91724b2 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -41,6 +41,14 @@
 #define _LIBUNWIND_CHECK_LINUX_SIGRETURN 1
 #endif
 
+#if defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
+#include <elf.h>
+#include <image.h>
+#include <signal.h>
+#include <OS.h>
+#define _LIBUNWIND_CHECK_HAIKU_SIGRETURN 1
+#endif
+
 #include "AddressSpace.hpp"
 #include "CompactUnwinder.hpp"
 #include "config.h"
@@ -1015,7 +1023,7 @@ class UnwindCursor : public AbstractUnwindCursor{
   template <typename Registers> int stepThroughSigReturn(Registers &) {
     return UNW_STEP_END;
   }
-#elif defined(_LIBUNWIND_TARGET_HAIKU)
+#elif defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
   bool setInfoForSigReturn();
   int stepThroughSigReturn();
 #endif
@@ -2559,7 +2567,7 @@ int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
 template <typename A, typename R>
 void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
 #if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) ||                               \
-    defined(_LIBUNWIND_TARGET_HAIKU)
+    defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
   _isSigReturn = false;
 #endif
 
@@ -2684,7 +2692,7 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
 #endif // #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
 
 #if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) ||                               \
-    defined(_LIBUNWIND_TARGET_HAIKU)
+    defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
   if (setInfoForSigReturn())
     return;
 #endif
@@ -2760,63 +2768,6 @@ int UnwindCursor<A, R>::stepThroughSigReturn(Registers_arm64 &) {
   _isSignalFrame = true;
   return UNW_STEP_SUCCESS;
 }
-
-#elif defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
-#include <commpage_defs.h>
-#include <signal.h>
-
-extern "C" {
-extern void *__gCommPageAddress;
-}
-
-template <typename A, typename R>
-bool UnwindCursor<A, R>::setInfoForSigReturn() {
-#if defined(_LIBUNWIND_TARGET_X86_64)
-  addr_t signal_handler =
-      (((addr_t *)__gCommPageAddress)[COMMPAGE_ENTRY_X86_SIGNAL_HANDLER] +
-       (addr_t)__gCommPageAddress);
-  addr_t signal_handler_ret = signal_handler + 45;
-#endif
-  pint_t pc = static_cast<pint_t>(this->getReg(UNW_REG_IP));
-  if (pc == signal_handler_ret) {
-    _info = {};
-    _info.start_ip = signal_handler;
-    _info.end_ip = signal_handler_ret;
-    _isSigReturn = true;
-    return true;
-  }
-  return false;
-}
-
-template <typename A, typename R>
-int UnwindCursor<A, R>::stepThroughSigReturn() {
-  _isSignalFrame = true;
-  pint_t sp = _registers.getSP();
-#if defined(_LIBUNWIND_TARGET_X86_64)
-  vregs *regs = (vregs *)(sp + 0x70);
-
-  _registers.setRegister(UNW_REG_IP, regs->rip);
-  _registers.setRegister(UNW_REG_SP, regs->rsp);
-  _registers.setRegister(UNW_X86_64_RAX, regs->rax);
-  _registers.setRegister(UNW_X86_64_RDX, regs->rdx);
-  _registers.setRegister(UNW_X86_64_RCX, regs->rcx);
-  _registers.setRegister(UNW_X86_64_RBX, regs->rbx);
-  _registers.setRegister(UNW_X86_64_RSI, regs->rsi);
-  _registers.setRegister(UNW_X86_64_RDI, regs->rdi);
-  _registers.setRegister(UNW_X86_64_RBP, regs->rbp);
-  _registers.setRegister(UNW_X86_64_R8, regs->r8);
-  _registers.setRegister(UNW_X86_64_R9, regs->r9);
-  _registers.setRegister(UNW_X86_64_R10, regs->r10);
-  _registers.setRegister(UNW_X86_64_R11, regs->r11);
-  _registers.setRegister(UNW_X86_64_R12, regs->r12);
-  _registers.setRegister(UNW_X86_64_R13, regs->r13);
-  _registers.setRegister(UNW_X86_64_R14, regs->r14);
-  _registers.setRegister(UNW_X86_64_R15, regs->r15);
-  // TODO: XMM
-#endif
-
-  return UNW_STEP_SUCCESS;
-}
 #endif // defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) &&
        // defined(_LIBUNWIND_TARGET_AARCH64)
 
@@ -3032,6 +2983,158 @@ int UnwindCursor<A, R>::stepThroughSigReturn(Registers_s390x &) {
 #endif // defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) &&
        // defined(_LIBUNWIND_TARGET_S390X)
 
+#if defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
+
+#if defined(B_HAIKU_32_BIT)
+typedef Elf32_Sym elf_sym;
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#elif defined(B_HAIKU_64_BIT)
+typedef Elf64_Sym elf_sym;
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
+
+// Private syscall declared as a weak symbol to prevent ABI breaks.
+extern "C" status_t __attribute__((weak))
+_kern_read_kernel_image_symbols(image_id id, elf_sym* symbolTable, int32* _symbolCount,
+                                char* stringTable, size_t* _stringTableSize, addr_t* _imageDelta);
+
+static addr_t signalHandlerBegin = 0;
+static addr_t signalHandlerEnd = 0;
+
+template <typename A, typename R>
+bool UnwindCursor<A, R>::setInfoForSigReturn() {
+  if (signalHandlerBegin == 0) {
+    // If we do not have the addresses yet, find them now.
+
+    // Determine if the private function is there and usable.
+    if (_kern_read_kernel_image_symbols == nullptr) {
+      signalHandlerBegin = (addr_t)-1;
+      return false;
+    }
+
+    // Get the system commpage and enumerate its symbols.
+    image_id commpageImage = -1;
+    image_info info;
+    int32 cookie = 0;
+    while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &info) == B_OK) {
+      if (strcmp(info.name, "commpage") == 0) {
+        commpageImage = info.id;
+        break;
+      }
+    }
+    if (commpageImage == -1) {
+      signalHandlerBegin = (addr_t)-1;
+      return false;
+    }
+
+    // Separate loop to get the process commpage,
+    // which is in a different address from the system commpage.
+    addr_t commpageAddress = -1;
+    cookie = 0;
+    while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
+      if (strcmp(info.name, "commpage") == 0) {
+        commpageAddress = (addr_t)info.text;
+        break;
+      }
+    }
+
+    // The signal handler function address is defined in the system commpage symbols.
+
+    // First call to get the memory required.
+    int32 symbolCount = 0;
+    size_t stringTableSize = 0;
+    if (_kern_read_kernel_image_symbols(commpageImage, nullptr, &symbolCount,
+                                        nullptr, &stringTableSize, nullptr) < B_OK) {
+      signalHandlerBegin = (addr_t)-1;
+      return false;
+    }
+
+    size_t memorySize = symbolCount * sizeof(elf_sym) + stringTableSize + 1;
+    void* buffer = malloc(memorySize);
+    if (buffer == nullptr) {
+      // No more memory. This is a temporary failure, we can try again later.
+      return false;
+    }
+    memset(buffer, 0, memorySize);
+
+    elf_sym* symbols = (elf_sym*)buffer;
+    char* stringTable = (char*)buffer + symbolCount * sizeof(elf_sym);
+    if (_kern_read_kernel_image_symbols(commpageImage, symbols, &symbolCount,
+                                        stringTable, &stringTableSize, nullptr) < B_OK) {
+      free(buffer);
+      signalHandlerBegin = (addr_t)-1;
+      return false;
+    }
+
+    for (int32 i = 0; i < symbolCount; ++i) {
+      char* name = stringTable + symbols[i].st_name;
+      if (strcmp(name, "commpage_signal_handler") == 0) {
+        signalHandlerBegin = commpageAddress + symbols[i].st_value;
+        signalHandlerEnd = signalHandlerBegin + symbols[i].st_size;
+        break;
+      }
+    }
+    free(buffer);
+
+    if (signalHandlerBegin == 0) {
+      signalHandlerBegin = (addr_t)-1;
+      return false;
+    }
+  } else if (signalHandlerBegin == (addr_t)-1) {
+    // We have found, and failed.
+    return false;
+  }
+  pint_t pc = static_cast<pint_t>(this->getReg(UNW_REG_IP));
+  if (pc >= (pint_t)signalHandlerBegin && pc < (pint_t)signalHandlerEnd) {
+    _info = {};
+    _info.start_ip = signalHandlerBegin;
+    _info.end_ip = signalHandlerEnd;
+    _isSigReturn = true;
+    return true;
+  }
+  return false;
+}
+
+template <typename A, typename R>
+int UnwindCursor<A, R>::stepThroughSigReturn() {
+  _isSignalFrame = true;
+
+#if defined(_LIBUNWIND_TARGET_X86_64)
+  // Layout of the stack before function call:
+  // - signal_frame_data
+  //   + siginfo_t    (public struct, fairly stable)
+  //   + ucontext_t   (public struct, fairly stable)
+  //     - mcontext_t -> Offset 0x70, this is what we want.
+  // - frame->ip (8 bytes)
+  // - frame->bp (8 bytes). Not written by the kernel,
+  //   but the signal handler has a "push %rbp" instruction.
+  pint_t bp = this->getReg(UNW_X86_64_RBP);
+  vregs* regs = (vregs*)(bp + 0x70);
+
+  _registers.setRegister(UNW_REG_IP, regs->rip);
+  _registers.setRegister(UNW_REG_SP, regs->rsp);
+  _registers.setRegister(UNW_X86_64_RAX, regs->rax);
+  _registers.setRegister(UNW_X86_64_RDX, regs->rdx);
+  _registers.setRegister(UNW_X86_64_RCX, regs->rcx);
+  _registers.setRegister(UNW_X86_64_RBX, regs->rbx);
+  _registers.setRegister(UNW_X86_64_RSI, regs->rsi);
+  _registers.setRegister(UNW_X86_64_RDI, regs->rdi);
+  _registers.setRegister(UNW_X86_64_RBP, regs->rbp);
+  _registers.setRegister(UNW_X86_64_R8, regs->r8);
+  _registers.setRegister(UNW_X86_64_R9, regs->r9);
+  _registers.setRegister(UNW_X86_64_R10, regs->r10);
+  _registers.setRegister(UNW_X86_64_R11, regs->r11);
+  _registers.setRegister(UNW_X86_64_R12, regs->r12);
+  _registers.setRegister(UNW_X86_64_R13, regs->r13);
+  _registers.setRegister(UNW_X86_64_R14, regs->r14);
+  _registers.setRegister(UNW_X86_64_R15, regs->r15);
+  // TODO: XMM
+#endif // defined(_LIBUNWIND_TARGET_X86_64)
+
+  return UNW_STEP_SUCCESS;
+}
+#endif // defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
+
 template <typename A, typename R> int UnwindCursor<A, R>::step(bool stage2) {
   (void)stage2;
   // Bottom of stack is defined is when unwind info cannot be found.

Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

Copy link

github-actions bot commented Apr 11, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/libunwind branch 5 times, most recently from 06e16ff to 116b60a Compare April 11, 2025 13:53
@brad0
Copy link
Contributor

brad0 commented Apr 12, 2025

cc @korli @X547

@brad0 brad0 changed the title Fix signal frame unwinding [libunwind] Fix Haiku signal frame unwinding Apr 12, 2025
@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/libunwind branch from 116b60a to bc84623 Compare April 12, 2025 13:27
@trungnt2910 trungnt2910 changed the title [libunwind] Fix Haiku signal frame unwinding [libunwind][Haiku] Fix signal frame unwinding Apr 12, 2025
@trungnt2910
Copy link
Contributor Author

Apologize for the confusing naming, somehow the tag prefixes were missing when I applied the patch from my test repo to the LLVM monorepo.

@korli
Copy link
Contributor

korli commented Apr 12, 2025

Tested on x86_64?

@trungnt2910
Copy link
Contributor Author

Yes, tested on x86_64 and only x86_64 (though support for other archs can be added by as easy as defining a few offsets and registers). Requires Haiku hrev58811 to fully work with tests/signal_unwind.pass.cpp.

This is also the same implementation used in my debugger ports for Haiku.

@korli
Copy link
Contributor

korli commented Apr 12, 2025

Yes, tested on x86_64 and only x86_64 (though support for other archs can be added by as easy as defining a few offsets and registers). Requires Haiku hrev58811 to fully work with tests/signal_unwind.pass.cpp.

This is also the same implementation used in my debugger ports for Haiku.

Does it build on r1beta5?

@trungnt2910
Copy link
Contributor Author

trungnt2910 commented Apr 12, 2025

Does it build on r1beta5?

Theoretically yes, since I did not require any new Haiku nightly feature for the implementation.

The unwinding might not fully work due to missing CFE information in libroot, in this case for _kern_send_signal.

@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/libunwind branch from bc84623 to 0ce9ca6 Compare April 23, 2025 05:11
@trungnt2910
Copy link
Contributor Author

Submitted a new implementation that uses Haiku's recent special handling of the commpage in dladdr to detect the signal handler function.

This removes the need for both private headers and re-declarations of private symbols.

@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/libunwind branch from 0ce9ca6 to 755d699 Compare April 23, 2025 08:32
@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/libunwind branch from 755d699 to 464d992 Compare April 24, 2025 09:01
@brad0 brad0 requested a review from MaskRay April 25, 2025 22:59
@brad0
Copy link
Contributor

brad0 commented May 4, 2025

cc @MaskRay

@brad0
Copy link
Contributor

brad0 commented May 26, 2025

@trungnt2910 It would be good to also fix i386 while you're at it.

haikuports/haikuports@7d537e1

@trungnt2910
Copy link
Contributor Author

You mean adding support for i386?

From what I understand about the linked issue, x86 is failing due to some signal frame unwinding function prototypes got leaked to general Haiku code, _LIBUNWIND_TARGET_HAIKU, but the implementation part got an additional _LIBUNWIND_TARGET_X86_64 check.

This PR guards both under _LIBUNWIND_CHECK_HAIKU_SIGRETURN, which has both the OS and architecture checks, effectively "fixing" i386.

@brad0
Copy link
Contributor

brad0 commented May 26, 2025

You mean adding support for i386?

Yes.

From what I understand about the linked issue, x86 is failing due to some signal frame unwinding function prototypes got leaked to general Haiku code, _LIBUNWIND_TARGET_HAIKU, but the implementation part got an additional _LIBUNWIND_TARGET_X86_64 check.

This PR guards both under _LIBUNWIND_CHECK_HAIKU_SIGRETURN, which has both the OS and architecture checks, effectively "fixing" i386.

I wasn't sure if that was the case or not. That's what it looks like, but I wasn't sure if it built on i386 and whether it has been build tested to ensure that is the case. At least building is still a step forward from not being able to build, which AFAIK, that is the case out of the box on i386 at the moment.

The current unwinding implementation on Haiku is messy and broken.
1. It searches weird paths for private headers, which is breaking builds
in consuming projects, such as dotnet/runtime.
2. It does not even work, due to relying on incorrect private offsets.

This commit strips all references to private headers and ports a
working signal frame implementation. It has been tested against
`tests/signal_unwind.pass.cpp` and can go pass the signal frame.
@trungnt2910 trungnt2910 force-pushed the dev/trungnt2910/libunwind branch from 464d992 to 7d36309 Compare May 26, 2025 03:27
@trungnt2910
Copy link
Contributor Author

The latest commit is known to build well on i386. Signal frame unwinding is still not supported, but I believe this is out of scope for this PR.

@brad0
Copy link
Contributor

brad0 commented May 26, 2025

Yes, that is fine. Thanks.

@brad0
Copy link
Contributor

brad0 commented May 26, 2025

cc @MaskRay

@trungnt2910
Copy link
Contributor Author

Tried to give x86 unwinding a shot. The general idea is correct, but it is currently impossible to unwind past a syscall due to the system relying on another magic commpage function without saving the context.

@brad0 brad0 merged commit 1d9ef82 into llvm:main May 29, 2025
35 of 42 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 29, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-win-x-armv7l running on as-builder-1 while building libunwind at step 15 "test-check-cxx-armv7-unknown-linux-gnueabihf".

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

Here is the relevant piece of the build log for the reference
Step 15 (test-check-cxx-armv7-unknown-linux-gnueabihf) failure: Test just built components: check-cxx-armv7-unknown-linux-gnueabihf completed (failure)
******************** TEST 'llvm-libc++-static.cfg.in :: std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_one.pass.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# COMPILED WITH
C:/buildbot/as-builder-1/x-armv7l/build/./bin/clang++.exe C:\buildbot\as-builder-1\x-armv7l\llvm-project\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\atomic_notify_one.pass.cpp -pthread --target=armv7-unknown-linux-gnueabihf -nostdinc++ -I C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libcxx/test-suite-install/include/c++/v1 -I C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libcxx/test-suite-install/include/armv7-unknown-linux-gnueabihf/c++/v1 -I C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Werror=thread-safety -Wuser-defined-warnings  -lc++experimental -nostdlib++ -L C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libcxx/test-suite-install/lib/armv7-unknown-linux-gnueabihf -lc++ -lc++abi -latomic -o C:\buildbot\as-builder-1\x-armv7l\build\runtimes\runtimes-armv7-unknown-linux-gnueabihf-bins\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\Output\atomic_notify_one.pass.cpp.dir\t.tmp.exe
# executed command: C:/buildbot/as-builder-1/x-armv7l/build/./bin/clang++.exe 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\atomic_notify_one.pass.cpp' -pthread --target=armv7-unknown-linux-gnueabihf -nostdinc++ -I C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libcxx/test-suite-install/include/c++/v1 -I C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libcxx/test-suite-install/include/armv7-unknown-linux-gnueabihf/c++/v1 -I C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L C:/buildbot/as-builder-1/x-armv7l/build/runtimes/runtimes-armv7-unknown-linux-gnueabihf-bins/libcxx/test-suite-install/lib/armv7-unknown-linux-gnueabihf -lc++ -lc++abi -latomic -o 'C:\buildbot\as-builder-1\x-armv7l\build\runtimes\runtimes-armv7-unknown-linux-gnueabihf-bins\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\Output\atomic_notify_one.pass.cpp.dir\t.tmp.exe'
# EXECUTED AS
"C:/Python310/python.exe" "C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxx/utils/ssh.py" --host=ubuntu@jetson6.lab.llvm.org --execdir C:\buildbot\as-builder-1\x-armv7l\build\runtimes\runtimes-armv7-unknown-linux-gnueabihf-bins\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\Output\atomic_notify_one.pass.cpp.dir --  C:\buildbot\as-builder-1\x-armv7l\build\runtimes\runtimes-armv7-unknown-linux-gnueabihf-bins\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\Output\atomic_notify_one.pass.cpp.dir\t.tmp.exe
# executed command: C:/Python310/python.exe C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxx/utils/ssh.py --host=ubuntu@jetson6.lab.llvm.org --execdir 'C:\buildbot\as-builder-1\x-armv7l\build\runtimes\runtimes-armv7-unknown-linux-gnueabihf-bins\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\Output\atomic_notify_one.pass.cpp.dir' -- 'C:\buildbot\as-builder-1\x-armv7l\build\runtimes\runtimes-armv7-unknown-linux-gnueabihf-bins\libcxx\test\std\atomics\atomics.types.operations\atomics.types.operations.wait\Output\atomic_notify_one.pass.cpp.dir\t.tmp.exe'
# .---command stderr------------
# | kex_exchange_identification: read: Software caused connection abort
# | banner exchange: Connection to 10.1.1.144 port 22: Software caused connection abort
# | Traceback (most recent call last):
# |   File "C:\buildbot\as-builder-1\x-armv7l\llvm-project\libcxx\utils\ssh.py", line 145, in <module>
# |     exit(main())
# |   File "C:\buildbot\as-builder-1\x-armv7l\llvm-project\libcxx\utils\ssh.py", line 141, in main
# |     runCommand(ssh("rm -r {}".format(tmp)), check=True)
# |   File "C:\buildbot\as-builder-1\x-armv7l\llvm-project\libcxx\utils\ssh.py", line 57, in runCommand
# |     return subprocess.run(command, *args_, **kwargs)
# |   File "c:\python310\lib\subprocess.py", line 524, in run
# |     raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['ssh', '-oBatchMode=yes', 'ubuntu@jetson6.lab.llvm.org', 'rm -r /tmp/libcxx.H1PggNanVY']' returned non-zero exit status 255.
# `-----------------------------
# error: command failed with exit status: 1

--

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


svkeerthy pushed a commit that referenced this pull request May 29, 2025
The current unwinding implementation on Haiku is messy and broken.
1. It searches weird paths for private headers, which is breaking builds
in consuming projects, such as dotnet/runtime.
2. It does not even work, due to relying on incorrect private offsets.

This commit strips all references to private headers and ports a working
signal frame implementation. It has been tested against
`tests/signal_unwind.pass.cpp` and can go pass the signal frame.
google-yfyang pushed a commit to google-yfyang/llvm-project that referenced this pull request May 29, 2025
The current unwinding implementation on Haiku is messy and broken.
1. It searches weird paths for private headers, which is breaking builds
in consuming projects, such as dotnet/runtime.
2. It does not even work, due to relying on incorrect private offsets.

This commit strips all references to private headers and ports a working
signal frame implementation. It has been tested against
`tests/signal_unwind.pass.cpp` and can go pass the signal frame.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
The current unwinding implementation on Haiku is messy and broken.
1. It searches weird paths for private headers, which is breaking builds
in consuming projects, such as dotnet/runtime.
2. It does not even work, due to relying on incorrect private offsets.

This commit strips all references to private headers and ports a working
signal frame implementation. It has been tested against
`tests/signal_unwind.pass.cpp` and can go pass the signal frame.
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.

7 participants