From 18de1db0cfbfbbf12d16338923b43077a87dce18 Mon Sep 17 00:00:00 2001 From: Dhruv Srivastava Date: Thu, 9 Jan 2025 09:38:25 +0530 Subject: [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (#120979) This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 Added some base #if _AIX changes for minimal lldb build. Added a PR for clang-format changes separately, to rebase this on later: - https://github.com/llvm/llvm-project/pull/120978 Review Request: @labath @DavidSpickett --- lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp | 12 +++++++++++- lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 2 +- .../BSD-Archive/ObjectContainerBSDArchive.cpp | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index ab4ddbf..0ed2016 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -730,9 +730,19 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile( struct termios options; ::tcgetattr(fd, &options); - // Set port speed to maximum + // Set port speed to the available maximum +#ifdef B115200 ::cfsetospeed(&options, B115200); ::cfsetispeed(&options, B115200); +#elif B57600 + ::cfsetospeed(&options, B57600); + ::cfsetispeed(&options, B57600); +#elif B38400 + ::cfsetospeed(&options, B38400); + ::cfsetispeed(&options, B38400); +#else +#error "Maximum Baud rate is Unknown" +#endif // Raw input, disable echo and signals options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index b35e27a..1d79edb 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -1226,7 +1226,7 @@ bool lldb_private::formatters::ObjCSELSummaryProvider( time_t lldb_private::formatters::GetOSXEpoch() { static time_t epoch = 0; if (!epoch) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_AIX) tzset(); tm tm_epoch; tm_epoch.tm_sec = 0; diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index 3835f2b..b202898 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -8,7 +8,7 @@ #include "ObjectContainerBSDArchive.h" -#if defined(_WIN32) || defined(__ANDROID__) +#if defined(_WIN32) || defined(__ANDROID__) || defined(_AIX) // Defines from ar, missing on Windows #define SARMAG 8 #define ARFMAG "`\n" -- cgit v1.1