@@ -17,31 +17,6 @@ load("//rust/private:utils.bzl", "dedent", "expand_dict_value_locations", "find_
17
17
# Reexport for cargo_build_script_wrapper.bzl
18
18
name_to_crate_name = _name_to_crate_name
19
19
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
-
45
20
def get_cc_compile_args_and_env (cc_toolchain , feature_configuration ):
46
21
"""Gather cc environment variables from the given `cc_toolchain`
47
22
@@ -59,16 +34,16 @@ def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
59
34
feature_configuration = feature_configuration ,
60
35
cc_toolchain = cc_toolchain ,
61
36
)
62
- cc_c_args = strip_target ( cc_common .get_memory_inefficient_command_line (
37
+ cc_c_args = cc_common .get_memory_inefficient_command_line (
63
38
feature_configuration = feature_configuration ,
64
39
action_name = C_COMPILE_ACTION_NAME ,
65
40
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 (
68
43
feature_configuration = feature_configuration ,
69
44
action_name = CPP_COMPILE_ACTION_NAME ,
70
45
variables = compile_variables ,
71
- ))
46
+ )
72
47
cc_env = cc_common .get_environment_variables (
73
48
feature_configuration = feature_configuration ,
74
49
action_name = C_COMPILE_ACTION_NAME ,
0 commit comments