-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlldb.patch
More file actions
270 lines (253 loc) · 11.7 KB
/
lldb.patch
File metadata and controls
270 lines (253 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
diff --git a/lldb/cmake/modules/FindPythonAndSwig.cmake b/lldb/cmake/modules/FindPythonAndSwig.cmake
index d62cced0d095..88b0da0d888c 100644
--- a/lldb/cmake/modules/FindPythonAndSwig.cmake
+++ b/lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -7,7 +7,7 @@
macro(FindPython3)
# Use PYTHON_HOME as a hint to find Python 3.
set(Python3_ROOT_DIR "${PYTHON_HOME}")
- find_package(Python3 COMPONENTS Interpreter Development)
+ find_package(Python3 COMPONENTS ${ARGV})
if(Python3_FOUND AND Python3_Interpreter_FOUND)
# The install name for the Python 3 framework in Xcode is relative to
@@ -34,11 +34,19 @@ macro(FindPython3)
endif()
endmacro()
-if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND LLDB_ENABLE_SWIG)
- set(PYTHONANDSWIG_FOUND TRUE)
+if(Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND LLDB_ENABLE_SWIG)
+ if(LLDB_SKIP_LINK_PYTHON)
+ set(PYTHONANDSWIG_FOUND TRUE)
+ elseif (Python3_LIBRARIES)
+ set(PYTHONANDSWIG_FOUND TRUE)
+ endif()
else()
if (LLDB_ENABLE_SWIG)
- FindPython3()
+ if (LLDB_SKIP_LINK_PYTHON)
+ FindPython3(Interpreter Development.Module)
+ else()
+ FindPython3(Interpreter Development)
+ endif()
else()
message(STATUS "SWIG 4 or later is required for Python support in LLDB but could not be found")
endif()
@@ -55,12 +63,13 @@ else()
endif()
include(FindPackageHandleStandardArgs)
+ set(PYTHON_REQUIRED_ARGS Python3_INCLUDE_DIRS Python3_EXECUTABLE LLDB_ENABLE_SWIG)
+ if (NOT LLDB_SKIP_LINK_PYTHON)
+ list(APPEND PYTHON_REQUIRED_ARGS Python3_LIBRARIES)
+ endif()
find_package_handle_standard_args(PythonAndSwig
FOUND_VAR
PYTHONANDSWIG_FOUND
REQUIRED_VARS
- Python3_LIBRARIES
- Python3_INCLUDE_DIRS
- Python3_EXECUTABLE
- LLDB_ENABLE_SWIG)
+ ${PYTHON_REQUIRED_ARGS})
endif()
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index a60921990cf7..8188985b5fb2 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -52,7 +52,7 @@ macro(add_optional_dependency variable description package found)
endmacro()
add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 4)
-add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
+add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" editline LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" LuaAndSwig LUAANDSWIG_FOUND)
@@ -69,6 +69,7 @@ option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when installing lldb."
option(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
"Fail to configure if certain requirements are not met for testing." OFF)
+option(LLDB_SKIP_LINK_PYTHON "Dont link to the Python library, so that liblldb can be used as a Python extension module" ON)
set(LLDB_GLOBAL_INIT_DIRECTORY "" CACHE STRING
"Path to the global lldbinit directory. Relative paths are resolved relative to the
directory containing the LLDB library.")
@@ -141,8 +142,8 @@ endif()
# Check if we libedit capable of handling wide characters (built with
# '--enable-widec').
if (LLDB_ENABLE_LIBEDIT)
- set(CMAKE_REQUIRED_LIBRARIES ${LibEdit_LIBRARIES})
- set(CMAKE_REQUIRED_INCLUDES ${LibEdit_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${editline_LIBRARIES})
+ set(CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS})
check_symbol_exists(el_winsertstr histedit.h LLDB_EDITLINE_USE_WCHAR)
set(CMAKE_EXTRA_INCLUDE_FILES histedit.h)
check_type_size(el_rfunc_t LLDB_EL_RFUNC_T_SIZE)
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index a32bc58507d8..494570c8d54f 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -153,7 +153,7 @@ if(LLDB_ENABLE_PYTHON AND (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB) AND UNIX A
set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
endif()
-if(Python3_RPATH)
+if(Python3_RPATH AND NOT LLDB_SKIP_LINK_PYTHON)
set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${Python3_RPATH}")
set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
endif()
@@ -173,10 +173,18 @@ if(LLDB_ENABLE_PYTHON)
set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
PROPERTY COMPILE_FLAGS " -Wno-unused-function")
endif()
- if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
- NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
- set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
- PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
+ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+ set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
+ PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
+ endif()
+ if (LLDB_SKIP_LINK_PYTHON)
+ if (APPLE)
+ target_link_options(liblldb PRIVATE "LINKER:-undefined,dynamic_lookup")
+ else()
+ target_link_options(liblldb PRIVATE "LINKER:--unresolved-symbols=ignore-all")
+ endif()
+ endif()
endif ()
endif()
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index dbc620b91b1e..0c3a454f498e 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
set(LLDB_LIBEDIT_LIBS)
if (LLDB_ENABLE_CURSES)
- list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+ list(APPEND LLDB_CURSES_LIBS ${Curses_LIBRARIES})
if (LLVM_BUILD_STATIC)
list(APPEND LLDB_CURSES_LIBS gpm)
endif()
@@ -105,5 +105,5 @@ add_dependencies(lldbCore
set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
if (LLDB_ENABLE_CURSES)
- target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIRS})
+ target_include_directories(lldbCore PRIVATE ${Curses_INCLUDE_DIRS})
endif()
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index c2e091ee8555..6584a3bfa55c 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -147,17 +147,17 @@ if (HAVE_LIBDL)
list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
endif()
if (LLDB_ENABLE_LIBEDIT)
- list(APPEND EXTRA_LIBS LibEdit::LibEdit)
+ list(APPEND EXTRA_LIBS editline::editline)
endif()
if (LLDB_ENABLE_LZMA)
- list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
+ list(APPEND EXTRA_LIBS ${LibLZMA_LIBRARIES})
endif()
if (WIN32)
list(APPEND LLDB_SYSTEM_LIBS psapi)
endif()
if (LLDB_ENABLE_LIBEDIT)
- list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
+ list(APPEND LLDB_LIBEDIT_LIBS editline::editline)
if (LLVM_BUILD_STATIC)
list(APPEND LLDB_SYSTEM_LIBS gpm)
endif()
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
index 7523d65abf0f..382222899a91 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -16,7 +16,7 @@ add_definitions(-DLLDB_PYTHON_EXE_RELATIVE_PATH="${LLDB_PYTHON_EXE_RELATIVE_PATH
if (LLDB_ENABLE_LIBEDIT)
- list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
+ list(APPEND LLDB_LIBEDIT_LIBS editline::editline)
endif()
add_subdirectory(Interfaces)
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt
index c60e4bb503a3..e3693bc21a14 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt
@@ -16,7 +16,7 @@ add_definitions(-DLLDB_PYTHON_EXE_RELATIVE_PATH="${LLDB_PYTHON_EXE_RELATIVE_PATH
if (LLDB_ENABLE_LIBEDIT)
- list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
+ list(APPEND LLDB_LIBEDIT_LIBS editline::editline)
endif()
add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 0aae13e30f2a..5481328c70c9 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -137,7 +137,7 @@ if(LLVM_ENABLE_ZLIB)
# library on a 64-bit system which would result in a link-time failure.
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS})
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
check_symbol_exists(compress2 zlib.h HAVE_ZLIB)
cmake_pop_check_state()
if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON AND NOT HAVE_ZLIB)
@@ -232,11 +232,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
# Skip libedit if using ASan as it contains memory leaks.
if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
if(LLVM_ENABLE_LIBEDIT STREQUAL FORCE_ON)
- find_package(LibEdit REQUIRED)
+ find_package(editline REQUIRED)
else()
- find_package(LibEdit)
+ find_package(editline)
endif()
- set(HAVE_LIBEDIT "${LibEdit_FOUND}")
+ set(HAVE_LIBEDIT "${editline}")
else()
set(HAVE_LIBEDIT 0)
endif()
diff --git a/llvm/lib/LineEditor/CMakeLists.txt b/llvm/lib/LineEditor/CMakeLists.txt
index c4cd91cbb0cd..b95d073d9725 100644
--- a/llvm/lib/LineEditor/CMakeLists.txt
+++ b/llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
if(HAVE_LIBEDIT)
- set(link_libs LibEdit::LibEdit)
+ set(link_libs editline::editline)
endif()
add_llvm_component_library(LLVMLineEditor
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index f653379e3033..8acb5754110e 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -303,8 +303,7 @@ set(llvm_system_libs ${system_libs})
if(LLVM_ENABLE_ZLIB)
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
if(CMAKE_BUILD_TYPE)
- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
- get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
+ set(zlib_library ${ZLIB_LIBRARIES})
endif()
if(NOT zlib_library)
get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
@@ -316,8 +315,7 @@ endif()
if(LLVM_ENABLE_ZSTD)
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
if(CMAKE_BUILD_TYPE)
- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
- get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION_${build_type})
+ set(zstd_library ${zstd_LIBRARIES})
endif()
if(NOT zstd_library)
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
diff --git a/llvm/lib/WindowsManifest/CMakeLists.txt b/llvm/lib/WindowsManifest/CMakeLists.txt
index 910132a4c7de..079c2e2819e6 100644
--- a/llvm/lib/WindowsManifest/CMakeLists.txt
+++ b/llvm/lib/WindowsManifest/CMakeLists.txt
@@ -23,8 +23,7 @@ add_llvm_component_library(LLVMWindowsManifest
if(LLVM_ENABLE_LIBXML2)
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
if(CMAKE_BUILD_TYPE)
- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type})
+ set(libxml2_library ${libxml2_LIBRARIES})
endif()
if(NOT libxml2_library)
get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION)