[llvm] 7484206 - [gn build] Make lldb build on Windows
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 9 05:13:55 PDT 2021
Author: Nico Weber
Date: 2021-09-09T08:13:50-04:00
New Revision: 7484206cfd9d43416b7f5d64fcb7e9cae56625d6
URL: https://github.com/llvm/llvm-project/commit/7484206cfd9d43416b7f5d64fcb7e9cae56625d6
DIFF: https://github.com/llvm/llvm-project/commit/7484206cfd9d43416b7f5d64fcb7e9cae56625d6.diff
LOG: [gn build] Make lldb build on Windows
Differential Revision: https://reviews.llvm.org/D109478
Added:
llvm/utils/gn/secondary/lldb/source/Plugins/DynamicLoader/Windows-DYLD/BUILD.gn
llvm/utils/gn/secondary/lldb/source/Plugins/Process/Windows/Common/BUILD.gn
Modified:
llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn
llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn
llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn
llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/Mach-O/BUILD.gn
llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/PECOFF/BUILD.gn
llvm/utils/gn/secondary/lldb/source/Utility/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn
index de93cc567b2a2..c63b3e431f8f1 100644
--- a/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn
@@ -5,13 +5,13 @@ static_library("Initialization") {
"//lldb/source/Core",
"//lldb/source/Host",
"//lldb/source/Plugins/Process/gdb-remote",
-
- # XXX:
- # lldbPluginProcessWindowsCommon on win
"//llvm/lib/Support",
]
+
if (current_os == "linux" || current_os == "android") {
deps += [ "//lldb/source/Plugins/Process/POSIX" ]
+ } else if (current_os == "win") {
+ deps += [ "//lldb/source/Plugins/Process/Windows/Common" ]
}
# SystemInitializerCommon.cpp includes headers from Plugins/Process/....
diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn
index 594be6170363a..38e4d309de64b 100644
--- a/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn
@@ -40,6 +40,10 @@ lldb_plugins += [
"//lldb/source/Plugins/DynamicLoader/Static",
"DynamicLoaderStatic",
],
+ [
+ "//lldb/source/Plugins/DynamicLoader/Windows-DYLD",
+ "DynamicLoaderWindowsDYLD",
+ ],
[
"//lldb/source/Plugins/Instruction/ARM",
"InstructionARM",
@@ -211,7 +215,7 @@ write_cmake_config("Plugins.def") {
# These are in separate variables to make sure ProcessWindowsCommon is
# initalized after all plugins, but before ProcessGDBRemote.
if (current_os == "win") {
- values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=LLDB_PLUGIN(XXX)" ]
+ values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=LLDB_PLUGIN(ProcessWindowsCommon)" ]
} else {
values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=" ]
}
diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/DynamicLoader/Windows-DYLD/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/DynamicLoader/Windows-DYLD/BUILD.gn
new file mode 100644
index 0000000000000..56f11a28b7b14
--- /dev/null
+++ b/llvm/utils/gn/secondary/lldb/source/Plugins/DynamicLoader/Windows-DYLD/BUILD.gn
@@ -0,0 +1,13 @@
+static_library("Windows-DYLD") {
+ output_name = "lldbPluginDynamicLoaderWindowsDYLD"
+ configs += [ "//llvm/utils/gn/build:lldb_code" ]
+ deps = [
+ "//lldb/source/Core",
+ "//lldb/source/Target",
+ "//llvm/lib/Support",
+ ]
+
+ # Uses source-relative includes for own headers.
+ include_dirs = [ "//lldb/source" ]
+ sources = [ "DynamicLoaderWindowsDYLD.cpp" ]
+}
diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn
index 4e5357aa9f10d..735d15d82dc1a 100644
--- a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn
@@ -9,7 +9,7 @@ static_library("JIT") {
#"//lldb/source/Target", # 2-hop dependency cycle.
"//llvm/lib/Support",
]
- sources = [ "ObjectFileJIT.cpp" ]
# For Utility/UuidCompatibility.h.
include_dirs = [ "//lldb/source" ]
+ sources = [ "ObjectFileJIT.cpp" ]
}
diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/Mach-O/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/Mach-O/BUILD.gn
index 39fd4a9ca07d3..e0df9b2d6a2be 100644
--- a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/Mach-O/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/Mach-O/BUILD.gn
@@ -11,6 +11,10 @@ static_library("Mach-O") {
"//llvm/lib/Support",
]
+ if (current_os == "win") {
+ defines = [ "_ENABLE_EXTENDED_ALIGNED_STORAGE" ]
+ }
+
# Reaches into Plugins/Process/Utility.
include_dirs = [ "//lldb/source" ]
sources = [ "ObjectFileMachO.cpp" ]
diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/PECOFF/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/PECOFF/BUILD.gn
index 52b530f9b5e7a..84bb4d69e1b64 100644
--- a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/PECOFF/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/PECOFF/BUILD.gn
@@ -20,6 +20,6 @@ static_library("PECOFF") {
if (current_os == "win") {
# Dbghelp is used on windows for writing minidump files.
- libs = [ "dbghelp" ]
+ libs = [ "dbghelp.lib" ]
}
}
diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/Process/Windows/Common/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/Process/Windows/Common/BUILD.gn
new file mode 100644
index 0000000000000..4184085476743
--- /dev/null
+++ b/llvm/utils/gn/secondary/lldb/source/Plugins/Process/Windows/Common/BUILD.gn
@@ -0,0 +1,48 @@
+static_library("Common") {
+ output_name = "lldbPluginProcessWindowsCommon"
+ configs += [ "//llvm/utils/gn/build:lldb_code" ]
+ deps = [
+ "//lldb/source/Core",
+ "//lldb/source/Host",
+ "//lldb/source/Interpreter",
+ "//lldb/source/Plugins/DynamicLoader/Windows-DYLD",
+ "//lldb/source/Symbol",
+ "//lldb/source/Target",
+ "//llvm/lib/Support",
+ ]
+ libs = [
+ "psapi.lib",
+ "rpcrt4.lib",
+ "ws2_32.lib",
+ ]
+
+ include_dirs = [
+ # ../Process/Windows/Common/x64/RegisterContextWindows_x64.h uses an
+ # unqualified include for "RegisterContextWindows.h".
+ ".",
+
+ # Reaches into Plugins/Process/Utility.
+ "//lldb/source",
+ ]
+ sources = [
+ "DebuggerThread.cpp",
+ "LocalDebugDelegate.cpp",
+ "NativeProcessWindows.cpp",
+ "NativeRegisterContextWindows.cpp",
+ "NativeRegisterContextWindows_WoW64.cpp",
+ "NativeRegisterContextWindows_arm.cpp",
+ "NativeRegisterContextWindows_arm64.cpp",
+ "NativeRegisterContextWindows_i386.cpp",
+ "NativeRegisterContextWindows_x86_64.cpp",
+ "NativeThreadWindows.cpp",
+ "ProcessDebugger.cpp",
+ "ProcessWindows.cpp",
+ "ProcessWindowsLog.cpp",
+ "RegisterContextWindows.cpp",
+ "TargetThreadWindows.cpp",
+ "arm/RegisterContextWindows_arm.cpp",
+ "arm64/RegisterContextWindows_arm64.cpp",
+ "x64/RegisterContextWindows_x64.cpp",
+ "x86/RegisterContextWindows_x86.cpp",
+ ]
+}
diff --git a/llvm/utils/gn/secondary/lldb/source/Utility/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Utility/BUILD.gn
index 242111b5b2d2f..15c1262f53ae3 100644
--- a/llvm/utils/gn/secondary/lldb/source/Utility/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Utility/BUILD.gn
@@ -59,6 +59,13 @@ static_library("Utility") {
"XcodeSDK.cpp",
]
+ if (current_os == "win") {
+ libs = [
+ "rpcrt4.lib",
+ "ws2_32.lib",
+ ]
+ }
+
# FIXME:
# if (APPLE)
# list(APPEND LLDB_SYSTEM_LIBS
@@ -75,10 +82,6 @@ static_library("Utility") {
#
# list(APPEND LLDB_SYSTEM_LIBS ${CMAKE_DL_LIBS})
#
- # if (CMAKE_SYSTEM_NAME MATCHES "Windows")
- # list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4)
- # endif ()
- #
# if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
# list(APPEND LLDB_SYSTEM_LIBS atomic)
# endif()
More information about the llvm-commits
mailing list