Author: Jonas Devlieghere
Date: 2021-04-13T19:55:13-07:00
New Revision: e825effe9ba98c81c9c1799f58e3a7a43e887b38

URL: 
https://github.com/llvm/llvm-project/commit/e825effe9ba98c81c9c1799f58e3a7a43e887b38
DIFF: 
https://github.com/llvm/llvm-project/commit/e825effe9ba98c81c9c1799f58e3a7a43e887b38.diff

LOG: [lldb] Build debugserver 2-way fat on AS

When compiling for arm, build debugserver 2 way fat with an arm64 and
arm64e slice. You can only debug arm64e processes using an arm64e
debugserver.

Added: 
    

Modified: 
    lldb/tools/debugserver/source/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/lldb/tools/debugserver/source/CMakeLists.txt 
b/lldb/tools/debugserver/source/CMakeLists.txt
index 2e78896cf3c0..b2bf01d7774d 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -83,6 +83,30 @@ if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
 endif ()
 
+# When compiling for arm, build debugserver 2 way fat with an arm64 and arm64e
+# slice. You can only debug arm64e processes using an arm64e debugserver.
+include(CheckCSourceCompiles)
+check_c_source_compiles(
+    "
+    #include <TargetConditionals.h>
+    #if TARGET_CPU_ARM
+    #if TARGET_OS_OSX
+    #warning Building for macOS
+    #else
+    #error Not building for macOS
+    #endif
+    #else
+    #error Not building for ARM
+    #endif
+    int main() { return 0; }
+    "
+    BUILDING_FOR_ARM_OSX
+)
+
+if (BUILDING_FOR_ARM_OSX)
+  set(CMAKE_OSX_ARCHITECTURES "arm64;arm64e")
+endif ()
+
 check_library_exists(compression compression_encode_buffer "" 
HAVE_LIBCOMPRESSION)
 
 find_library(SECURITY_LIBRARY Security)


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to