Skip to content

Commit 147c159

Browse files
authored
Revert "[tools] Use mold linker on Linux Noble debug builds (#22951)"
This reverts commit 22cbc53.
1 parent 22cbc53 commit 147c159

File tree

4 files changed

+3
-61
lines changed

4 files changed

+3
-61
lines changed

setup/ubuntu/source_distribution/packages-noble-test-only.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
curl
22
libstdc++6-10-dbg
3-
mold
43
python3-dateutil
54
python3-dbg
65
python3-flask

tools/cc_toolchain/BUILD.bazel

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
load("@bazel_skylib//lib:selects.bzl", "selects")
2-
load(
3-
"@bazel_skylib//rules:common_settings.bzl",
4-
"bool_flag",
5-
"int_flag",
6-
"string_flag",
7-
)
2+
load("@bazel_skylib//rules:common_settings.bzl", "int_flag", "string_flag")
83
load("//tools/lint:lint.bzl", "add_lint_tests")
94
load("//tools/skylark:sh.bzl", "sh_binary")
105

@@ -156,33 +151,6 @@ config_setting(
156151
values = {"compilation_mode": "dbg"},
157152
)
158153

159-
# (Internal use only.) When this is set to True, some Drake builds may use the
160-
# mold linker, primarily for its improved handling of DWARF debug
161-
# information. It should be False (the default) for all builds initiated via
162-
# Drake's CMake wrappers. See the other "mold_linker" settings below and issue
163-
# #21836.
164-
bool_flag(
165-
name = "allow_mold_linker",
166-
build_setting_default = False,
167-
)
168-
169-
config_setting(
170-
name = "mold_linker_allowed",
171-
flag_values = {":allow_mold_linker": "True"},
172-
)
173-
174-
selects.config_setting_group(
175-
name = "use_mold_linker",
176-
match_all = [
177-
# TODO(rpoyner-tri): consider removing the "noble" requirement when
178-
# Drake's support of "jammy" ends. Jammy is excluded because its
179-
# version of the mold linker is too old.
180-
"//tools:ubuntu_noble",
181-
":debug",
182-
":mold_linker_allowed",
183-
],
184-
)
185-
186154
config_setting(
187155
name = "compiler_major_13",
188156
flag_values = {":compiler_major": "13"},

tools/cc_toolchain/bazel.rc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ build --action_env=CCACHE_DISABLE=1
99
# command line, or promote *any* warnings even from externals to errors via
1010
# --copt=-Werror.
1111
#
12-
# When compiling Drake as an external package, this rcfile is not loaded and we
12+
# When compiilng Drake as an external package, this rcfile is not loaded and we
1313
# won't promote warnings to errors by default.
1414
build --@drake//tools/cc_toolchain:error_severity=error
15-
16-
# Similarly, only allow using the mold linker when Drake is the main
17-
# module. Other conditions will be checked as well; see
18-
# //tools/cc_toolchain:use_mold_linker for more details.
19-
build --@drake//tools/cc_toolchain:allow_mold_linker=true

tools/skylark/drake_cc.bzl

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,6 @@ def _platform_copts(rule_copts, rule_gcc_copts, rule_clang_copts, cc_test = 0):
129129
"//conditions:default": [],
130130
})
131131

132-
# The BASE_LINKOPTS are used for all drake_cc_{binary,library,test} rules.
133-
BASE_LINKOPTS = select({
134-
"@drake//tools/cc_toolchain:use_mold_linker": [
135-
"-fuse-ld=mold",
136-
"-Wl,--compress-debug-sections=zlib",
137-
"-Wl,--thread-count=2",
138-
],
139-
"//conditions:default": [],
140-
})
141-
142132
def _check_library_deps_blacklist(name, deps):
143133
"""Report an error if a library should not use something from deps."""
144134
if not deps:
@@ -606,7 +596,6 @@ def drake_cc_library(
606596
copts = [],
607597
clang_copts = [],
608598
gcc_copts = [],
609-
linkopts = [],
610599
linkstatic = 1,
611600
internal = False,
612601
compile_once_per_scalar = False,
@@ -660,7 +649,6 @@ def drake_cc_library(
660649
should be surrounded with `#if DRAKE_ONCE_PER_SCALAR_PHASE == 0`.
661650
"""
662651
new_copts = _platform_copts(copts, gcc_copts, clang_copts)
663-
new_linkopts = BASE_LINKOPTS + linkopts
664652
new_tags = kwargs.pop("tags", None) or []
665653
if internal:
666654
if install_hdrs_exclude != []:
@@ -702,7 +690,6 @@ def drake_cc_library(
702690
deps = deps + add_deps,
703691
implementation_deps = implementation_deps,
704692
copts = new_copts,
705-
linkopts = new_linkopts,
706693
linkstatic = linkstatic,
707694
declare_installed_headers = declare_installed_headers,
708695
install_hdrs_exclude = install_hdrs_exclude,
@@ -796,13 +783,11 @@ def drake_cc_binary(
796783
defaults using test_rule_args=["-f", "--bar=42"] or test_rule_size="baz".
797784
"""
798785
new_copts = _platform_copts(copts, gcc_copts, clang_copts)
799-
new_linkopts = BASE_LINKOPTS + linkopts
800786
new_srcs, add_deps = _maybe_add_pruned_private_hdrs_dep(
801787
base_name = name,
802788
srcs = srcs,
803789
deps = deps,
804790
copts = new_copts,
805-
linkopts = new_linkopts,
806791
testonly = testonly,
807792
**kwargs
808793
)
@@ -816,7 +801,7 @@ def drake_cc_binary(
816801
testonly = testonly,
817802
linkshared = linkshared,
818803
linkstatic = linkstatic,
819-
linkopts = new_linkopts,
804+
linkopts = linkopts,
820805
features = [
821806
# We should deduplicate symbols while linking (for a ~6% reduction
822807
# in disk use), to conserve space in CI; see #18545 for details.
@@ -835,7 +820,6 @@ def drake_cc_binary(
835820
data = data + test_rule_data,
836821
deps = deps + add_deps,
837822
copts = copts,
838-
linkopts = new_linkopts,
839823
gcc_copts = gcc_copts,
840824
size = test_rule_size,
841825
timeout = test_rule_timeout,
@@ -855,7 +839,6 @@ def drake_cc_test(
855839
copts = [],
856840
gcc_copts = [],
857841
clang_copts = [],
858-
linkopts = [],
859842
allow_network = None,
860843
display = False,
861844
num_threads = None,
@@ -885,13 +868,11 @@ def drake_cc_test(
885868
kwargs = incorporate_display(kwargs, display = display)
886869
kwargs = incorporate_num_threads(kwargs, num_threads = num_threads)
887870
new_copts = _platform_copts(copts, gcc_copts, clang_copts, cc_test = 1)
888-
new_linkopts = BASE_LINKOPTS + linkopts
889871
new_srcs, add_deps = _maybe_add_pruned_private_hdrs_dep(
890872
base_name = name,
891873
srcs = srcs,
892874
deps = deps,
893875
copts = new_copts,
894-
linkopts = new_linkopts,
895876
**kwargs
896877
)
897878
cc_test(
@@ -901,7 +882,6 @@ def drake_cc_test(
901882
args = args,
902883
deps = deps + add_deps,
903884
copts = new_copts,
904-
linkopts = new_linkopts,
905885
features = [
906886
# We should deduplicate symbols while linking (for a ~6% reduction
907887
# in disk use), to conserve space in CI; see #18545 for details.

0 commit comments

Comments
 (0)