From: Brandon Mercer Subject: Re: llvm-20.1.8 aarch64 fix To: Sebastien Marie Cc: Robert Nagy , ports@openbsd.org Date: Fri, 5 Sep 2025 12:17:54 -0400 On Fri, Sep 05, 2025 at 04:30:07PM +0200, Sebastien Marie wrote: > The diff makes sense to me. > > ok semarie@ > > I assume we might want to port it to llvm/21 too. I've blindly applied the diff to the existing llvm-21 patch and I'm compiling now. Assuming that works, here is the update to 21 as well. bmercer@ Index: devel/llvm/21/patches/patch-lldb_source_Plugins_Process_OpenBSD_NativeRegisterContextOpenBSD_arm64_cpp =================================================================== RCS file: /cvs/ports/devel/llvm/21/patches/patch-lldb_source_Plugins_Process_OpenBSD_NativeRegisterContextOpenBSD_arm64_cpp,v diff -u -p -u -r1.1.1.1 patch-lldb_source_Plugins_Process_OpenBSD_NativeRegisterContextOpenBSD_arm64_cpp --- devel/llvm/21/patches/patch-lldb_source_Plugins_Process_OpenBSD_NativeRegisterContextOpenBSD_arm64_cpp 4 Sep 2025 12:32:32 -0000 1.1.1.1 +++ devel/llvm/21/patches/patch-lldb_source_Plugins_Process_OpenBSD_NativeRegisterContextOpenBSD_arm64_cpp 5 Sep 2025 16:12:59 -0000 @@ -109,7 +109,7 @@ Index: lldb/source/Plugins/Process/OpenB + Log *log = GetLog(POSIXLog::Registers); + + if (!reg_info) { -+ error.SetErrorString("reg_info NULL"); ++ error.FromErrorString("reg_info NULL"); + return error; + } + @@ -117,7 +117,7 @@ Index: lldb/source/Plugins/Process/OpenB + if (reg == LLDB_INVALID_REGNUM) { + // This is likely an internal register for lldb use only and should not be + // directly queried. -+ error.SetErrorStringWithFormat("register \"%s\" is an internal-only lldb " ++ error.FromErrorStringWithFormat("register \"%s\" is an internal-only lldb " + "register, cannot read directly", + reg_info->name); + return error; @@ -127,7 +127,7 @@ Index: lldb/source/Plugins/Process/OpenB + if (set == -1) { + // This is likely an internal register for lldb use only and should not be + // directly queried. -+ error.SetErrorStringWithFormat("register \"%s\" is in unrecognized set", ++ error.FromErrorStringWithFormat("register \"%s\" is in unrecognized set", + reg_info->name); + return error; + } @@ -135,7 +135,7 @@ Index: lldb/source/Plugins/Process/OpenB + if (ReadRegisterSet(set) != 0) { + // This is likely an internal register for lldb use only and should not be + // directly queried. -+ error.SetErrorStringWithFormat( ++ error.FromErrorStringWithFormat( + "reading register set for register \"%s\" failed", reg_info->name); + return error; + } @@ -258,7 +258,7 @@ Index: lldb/source/Plugins/Process/OpenB + Log *log = GetLog(POSIXLog::Registers); + + if (!reg_info) { -+ error.SetErrorString("reg_info NULL"); ++ error.FromErrorString("reg_info NULL"); + return error; + } + @@ -266,7 +266,7 @@ Index: lldb/source/Plugins/Process/OpenB + if (reg == LLDB_INVALID_REGNUM) { + // This is likely an internal register for lldb use only and should not be + // directly queried. -+ error.SetErrorStringWithFormat("register \"%s\" is an internal-only lldb " ++ error.FromErrorStringWithFormat("register \"%s\" is an internal-only lldb " + "register, cannot read directly", + reg_info->name); + return error; @@ -276,7 +276,7 @@ Index: lldb/source/Plugins/Process/OpenB + if (set == -1) { + // This is likely an internal register for lldb use only and should not be + // directly queried. -+ error.SetErrorStringWithFormat("register \"%s\" is in unrecognized set", ++ error.FromErrorStringWithFormat("register \"%s\" is in unrecognized set", + reg_info->name); + return error; + } @@ -284,7 +284,7 @@ Index: lldb/source/Plugins/Process/OpenB + if (ReadRegisterSet(set) != 0) { + // This is likely an internal register for lldb use only and should not be + // directly queried. -+ error.SetErrorStringWithFormat( ++ error.FromErrorStringWithFormat( + "reading register set for register \"%s\" failed", reg_info->name); + return error; + } @@ -383,7 +383,7 @@ Index: lldb/source/Plugins/Process/OpenB + } + + if (WriteRegisterSet(set) != 0) -+ error.SetErrorStringWithFormat("failed to write register set"); ++ error.FromErrorStringWithFormat("failed to write register set"); + + return error; +} @@ -394,7 +394,7 @@ Index: lldb/source/Plugins/Process/OpenB + + data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); + if (!data_sp) { -+ error.SetErrorStringWithFormat( ++ error.FromErrorStringWithFormat( + "failed to allocate DataBufferHeap instance of size %zu", + REG_CONTEXT_SIZE); + return error; @@ -410,7 +410,7 @@ Index: lldb/source/Plugins/Process/OpenB + + uint8_t *dst = data_sp->GetBytes(); + if (dst == nullptr) { -+ error.SetErrorStringWithFormat("DataBufferHeap instance of size %zu" ++ error.FromErrorStringWithFormat("DataBufferHeap instance of size %zu" + " returned a null pointer", + REG_CONTEXT_SIZE); + return error; @@ -430,14 +430,14 @@ Index: lldb/source/Plugins/Process/OpenB + Status error; + + if (!data_sp) { -+ error.SetErrorStringWithFormat( ++ error.FromErrorStringWithFormat( + "NativeRegisterContextOpenBSD_arm64::%s invalid data_sp provided", + __FUNCTION__); + return error; + } + + if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) { -+ error.SetErrorStringWithFormat( ++ error.FromErrorStringWithFormat( + "NativeRegisterContextOpenBSD_arm64::%s data_sp contained mismatched " + "data size, expected %zu, actual %llu", + __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize()); @@ -446,7 +446,7 @@ Index: lldb/source/Plugins/Process/OpenB + + const uint8_t *src = data_sp->GetBytes(); + if (src == nullptr) { -+ error.SetErrorStringWithFormat("NativeRegisterContextOpenBSD_arm64::%s " ++ error.FromErrorStringWithFormat("NativeRegisterContextOpenBSD_arm64::%s " + "DataBuffer::GetBytes() returned a null " + "pointer", + __FUNCTION__);