Skip to content

Commit dddc71a

Browse files
committed
It looks like the reported issue is probably related to the ios toolchain in use, rather than our general toolchain flag propagation.
1 parent 830f5c0 commit dddc71a

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

cargo/private/cargo_build_script.bzl

+4-29
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,6 @@ load("//rust/private:utils.bzl", "dedent", "expand_dict_value_locations", "find_
1717
# Reexport for cargo_build_script_wrapper.bzl
1818
name_to_crate_name = _name_to_crate_name
1919

20-
def strip_target(elems):
21-
"""Remove '-target xxx' from C(XX)FLAGS.
22-
23-
The cpp toolchain adds '-target xxx' and '-isysroot xxx' to CFLAGS. If it is not stripped out before
24-
the CFLAGS are provided to build scripts, it can cause the build to take on the host architecture
25-
instead of the target architecture.
26-
27-
Args:
28-
elems (list): A list of args
29-
30-
Returns:
31-
list: the modified args
32-
"""
33-
skip_next = False
34-
out_elems = []
35-
for elem in elems:
36-
if skip_next:
37-
skip_next = False
38-
continue
39-
if elem == "-target" or elem == "-isysroot":
40-
skip_next = True
41-
continue
42-
out_elems.append(elem)
43-
return out_elems
44-
4520
def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
4621
"""Gather cc environment variables from the given `cc_toolchain`
4722
@@ -59,16 +34,16 @@ def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
5934
feature_configuration = feature_configuration,
6035
cc_toolchain = cc_toolchain,
6136
)
62-
cc_c_args = strip_target(cc_common.get_memory_inefficient_command_line(
37+
cc_c_args = cc_common.get_memory_inefficient_command_line(
6338
feature_configuration = feature_configuration,
6439
action_name = C_COMPILE_ACTION_NAME,
6540
variables = compile_variables,
66-
))
67-
cc_cxx_args = strip_target(cc_common.get_memory_inefficient_command_line(
41+
)
42+
cc_cxx_args = cc_common.get_memory_inefficient_command_line(
6843
feature_configuration = feature_configuration,
6944
action_name = CPP_COMPILE_ACTION_NAME,
7045
variables = compile_variables,
71-
))
46+
)
7247
cc_env = cc_common.get_environment_variables(
7348
feature_configuration = feature_configuration,
7449
action_name = C_COMPILE_ACTION_NAME,

0 commit comments

Comments
 (0)