Skip to content

Commit 1b87418

Browse files
authored
[bazel] Improve liblldb building (#89095)
On Linux using --version-script doesn't force loading of the underlying archives that contain the symbols. By setting alwayslink=True on the API cc_library we virtually get this behavior. This also allows downstream users to use the exports files used by cmake. We could build more configurability into this but there are also a lot of possible variations users might want.
1 parent 9435edf commit 1b87418

File tree

2 files changed

+26
-36
lines changed

2 files changed

+26
-36
lines changed

utils/bazel/llvm-project-overlay/lldb/BUILD.bazel

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ package(
1616

1717
licenses(["notice"])
1818

19-
exports_files(["LICENSE.TXT"])
19+
exports_files([
20+
"LICENSE.TXT",
21+
"source/API/liblldb-private.exports",
22+
"source/API/liblldb.exports",
23+
])
2024

2125
bool_flag(
2226
name = "enable_curses",
@@ -203,13 +207,29 @@ cc_library(
203207
":TargetHeaders",
204208
":Utility",
205209
":Version",
210+
"//lldb/source/Plugins:PluginExpressionParserClang",
206211
"//lldb/source/Plugins:PluginExpressionParserClangHeaders",
207212
"//lldb/source/Plugins:PluginsConfig",
213+
"//llvm:AllTargetsDisassemblers",
208214
"//llvm:ExecutionEngine",
209215
"//llvm:MCJIT",
210216
"//llvm:Support",
211217
"//llvm:config",
212-
],
218+
] + [
219+
"//lldb/source/Plugins:Plugin{}".format(x)
220+
for x in DEFAULT_PLUGINS + DEFAULT_SCRIPT_PLUGINS
221+
] + select({
222+
"@platforms//os:macos": [
223+
"//lldb/source/Plugins:PluginProcessMacOSXKernel",
224+
"//lldb/source/Plugins:PluginSymbolLocatorDebugSymbols",
225+
"//lldb/source/Plugins:PluginSymbolVendorMacOSX",
226+
],
227+
"@platforms//os:linux": [
228+
"//lldb/source/Plugins:PluginProcessLinux",
229+
],
230+
"//conditions:default": [],
231+
}),
232+
alwayslink = True,
213233
)
214234

215235
cc_library(
@@ -690,23 +710,8 @@ cc_library(
690710
name = "liblldb.static",
691711
deps = [
692712
":API",
693-
":Host",
694713
":Interpreter",
695-
"//llvm:AllTargetsDisassemblers",
696-
] + [
697-
"//lldb/source/Plugins:Plugin{}".format(x)
698-
for x in DEFAULT_PLUGINS + DEFAULT_SCRIPT_PLUGINS
699-
] + select({
700-
"@platforms//os:macos": [
701-
"//lldb/source/Plugins:PluginProcessMacOSXKernel",
702-
"//lldb/source/Plugins:PluginSymbolLocatorDebugSymbols",
703-
"//lldb/source/Plugins:PluginSymbolVendorMacOSX",
704-
],
705-
"@platforms//os:linux": [
706-
"//lldb/source/Plugins:PluginProcessLinux",
707-
],
708-
"//conditions:default": [],
709-
}),
714+
],
710715
)
711716

712717
cc_shared_library(
@@ -889,6 +894,7 @@ cc_binary(
889894
deps = [
890895
":Host",
891896
":Initialization",
897+
":Interpreter",
892898
":Utility",
893899
":Version",
894900
":lldb_server_opts_gen",

utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ cc_library(
557557
"//lldb:Breakpoint",
558558
"//lldb:Core",
559559
"//lldb:Host",
560-
"//lldb:Interpreter",
561560
"//lldb:InterpreterHeaders",
562561
"//lldb:Target",
563562
"//lldb:TargetHeaders",
@@ -591,7 +590,6 @@ cc_library(
591590
"//lldb:Core",
592591
"//lldb:Expression",
593592
"//lldb:Host",
594-
"//lldb:Interpreter",
595593
"//lldb:InterpreterHeaders",
596594
"//lldb:Target",
597595
"//lldb:TargetHeaders",
@@ -664,7 +662,7 @@ cc_library(
664662
"//lldb:Breakpoint",
665663
"//lldb:Core",
666664
"//lldb:Host",
667-
"//lldb:Interpreter",
665+
"//lldb:InterpreterHeaders",
668666
"//lldb:SymbolHeaders",
669667
"//lldb:Target",
670668
"//lldb:TargetHeaders",
@@ -1264,7 +1262,6 @@ cc_library(
12641262
"//lldb:Breakpoint",
12651263
"//lldb:Core",
12661264
"//lldb:Host",
1267-
"//lldb:Interpreter",
12681265
"//lldb:InterpreterHeaders",
12691266
"//lldb:Symbol",
12701267
"//lldb:SymbolHeaders",
@@ -1422,7 +1419,6 @@ cc_library(
14221419
deps = [
14231420
":PluginProcessUtility",
14241421
"//lldb:Core",
1425-
"//lldb:Interpreter",
14261422
"//lldb:InterpreterHeaders",
14271423
"//lldb:Symbol",
14281424
"//lldb:SymbolHeaders",
@@ -1438,7 +1434,6 @@ cc_library(
14381434
deps = [
14391435
":PluginProcessUtility",
14401436
"//lldb:Core",
1441-
"//lldb:Interpreter",
14421437
"//lldb:InterpreterHeaders",
14431438
"//lldb:Symbol",
14441439
"//lldb:SymbolHeaders",
@@ -1475,7 +1470,6 @@ cc_library(
14751470
":PluginProcessUtility",
14761471
"//lldb:Core",
14771472
"//lldb:Host",
1478-
"//lldb:Interpreter",
14791473
"//lldb:InterpreterHeaders",
14801474
"//lldb:Symbol",
14811475
"//lldb:SymbolHeaders",
@@ -1495,7 +1489,6 @@ cc_library(
14951489
":PluginProcessUtility",
14961490
"//lldb:Core",
14971491
"//lldb:Host",
1498-
"//lldb:Interpreter",
14991492
"//lldb:InterpreterHeaders",
15001493
"//lldb:Symbol",
15011494
"//lldb:SymbolHeaders",
@@ -1515,7 +1508,6 @@ cc_library(
15151508
deps = [
15161509
":PluginProcessUtility",
15171510
"//lldb:Core",
1518-
"//lldb:Interpreter",
15191511
"//lldb:InterpreterHeaders",
15201512
"//lldb:Symbol",
15211513
"//lldb:SymbolHeaders",
@@ -1532,7 +1524,6 @@ cc_library(
15321524
deps = [
15331525
":PluginProcessUtility",
15341526
"//lldb:Core",
1535-
"//lldb:Interpreter",
15361527
"//lldb:InterpreterHeaders",
15371528
"//lldb:Symbol",
15381529
"//lldb:SymbolHeaders",
@@ -1570,7 +1561,6 @@ cc_library(
15701561
"//lldb:Expression",
15711562
"//lldb:Headers",
15721563
"//lldb:Host",
1573-
"//lldb:Interpreter",
15741564
"//lldb:InterpreterHeaders",
15751565
"//lldb:Symbol",
15761566
"//lldb:SymbolHeaders",
@@ -1608,7 +1598,7 @@ cc_library(
16081598
"//lldb:Core",
16091599
"//lldb:Expression",
16101600
"//lldb:Headers",
1611-
"//lldb:Interpreter",
1601+
"//lldb:InterpreterHeaders",
16121602
"//lldb:Symbol",
16131603
"//lldb:SymbolHeaders",
16141604
"//lldb:Target",
@@ -1629,7 +1619,6 @@ cc_library(
16291619
"//lldb:Expression",
16301620
"//lldb:Headers",
16311621
"//lldb:Host",
1632-
"//lldb:Interpreter",
16331622
"//lldb:InterpreterHeaders",
16341623
"//lldb:Symbol",
16351624
"//lldb:SymbolHeaders",
@@ -1682,7 +1671,6 @@ cc_library(
16821671
":PluginObjectFileMachO",
16831672
"//lldb:Breakpoint",
16841673
"//lldb:Core",
1685-
"//lldb:Interpreter",
16861674
"//lldb:InterpreterHeaders",
16871675
"//lldb:Symbol",
16881676
"//lldb:SymbolHeaders",
@@ -1838,7 +1826,6 @@ cc_library(
18381826
include_prefix = "Plugins",
18391827
deps = [
18401828
"//lldb:Core",
1841-
"//lldb:Interpreter",
18421829
"//lldb:InterpreterHeaders",
18431830
"//lldb:Utility",
18441831
"//llvm:Support",
@@ -2215,7 +2202,6 @@ cc_library(
22152202
"//lldb:Core",
22162203
"//lldb:Headers",
22172204
"//lldb:Host",
2218-
"//lldb:Interpreter",
22192205
"//lldb:InterpreterHeaders",
22202206
"//lldb:Symbol",
22212207
"//lldb:SymbolHeaders",
@@ -2262,7 +2248,6 @@ cc_library(
22622248
"//lldb:DataFormattersHeaders",
22632249
"//lldb:ExpressionHeaders",
22642250
"//lldb:Headers",
2265-
"//lldb:Interpreter",
22662251
"//lldb:InterpreterHeaders",
22672252
"//lldb:Symbol",
22682253
"//lldb:SymbolHeaders",
@@ -2287,7 +2272,6 @@ cc_library(
22872272
"//lldb:Expression",
22882273
"//lldb:Headers",
22892274
"//lldb:Host",
2290-
"//lldb:Interpreter",
22912275
"//lldb:Symbol",
22922276
"//lldb:Target",
22932277
"//lldb:TargetHeaders",

0 commit comments

Comments
 (0)