[Lldb-commits] [lldb] [lldb][AIX] GetOpt support in AIX (PR #120574)

Dhruv Srivastava via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 19 05:16:50 PST 2024


https://github.com/DhruvSrivastavaX created https://github.com/llvm/llvm-project/pull/120574

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

Adding changes for minimal build for lldb binary on AIX. 
getopt.h is missing in AIX, so instead relying on LLDB's getopt functions.

Review Request: @labath @DavidSpickett

>From 2e328ca914c1e511eb12c13cc3431098bb583469 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava <dhruv.srivastava at ibm.com>
Date: Thu, 19 Dec 2024 07:10:50 -0600
Subject: [PATCH] GetOpt support

---
 lldb/include/lldb/Host/HostGetOpt.h       | 2 +-
 lldb/include/lldb/Host/common/GetOptInc.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h
index 52cfdf4dbb89c2..b2b436e64a692f 100644
--- a/lldb/include/lldb/Host/HostGetOpt.h
+++ b/lldb/include/lldb/Host/HostGetOpt.h
@@ -9,7 +9,7 @@
 #ifndef LLDB_HOST_HOSTGETOPT_H
 #define LLDB_HOST_HOSTGETOPT_H
 
-#if !defined(_MSC_VER) && !defined(__NetBSD__)
+#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(_AIX)
 
 #include <getopt.h>
 #include <unistd.h>
diff --git a/lldb/include/lldb/Host/common/GetOptInc.h b/lldb/include/lldb/Host/common/GetOptInc.h
index 3fb9add4795417..c9c9e2496d5f96 100644
--- a/lldb/include/lldb/Host/common/GetOptInc.h
+++ b/lldb/include/lldb/Host/common/GetOptInc.h
@@ -11,11 +11,11 @@
 
 #include "lldb/lldb-defines.h"
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(_AIX)
 #define REPLACE_GETOPT
 #define REPLACE_GETOPT_LONG
 #endif
-#if defined(_MSC_VER) || defined(__NetBSD__)
+#if defined(_MSC_VER) || defined(__NetBSD__) || defined(_AIX)
 #define REPLACE_GETOPT_LONG_ONLY
 #endif
 



More information about the lldb-commits mailing list