diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl b/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl index db45fbe69f7f3c..096d847e8d58f6 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl +++ b/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl @@ -5961,7 +5961,7 @@ def _impl(ctx): "-Xlinker", "-bitcode_symbol_map", "-Xlinker", - "BITCODE_TOUCH_SYMBOL_MAP=%{bitcode_symbol_map_path}", + "%{bitcode_symbol_map_path}", ], ), ], diff --git a/tools/osx/crosstool/cc_toolchain_config.bzl b/tools/osx/crosstool/cc_toolchain_config.bzl index 73f585004384ee..f23eddb162e53e 100644 --- a/tools/osx/crosstool/cc_toolchain_config.bzl +++ b/tools/osx/crosstool/cc_toolchain_config.bzl @@ -6009,7 +6009,7 @@ def _impl(ctx): "-Xlinker", "-bitcode_symbol_map", "-Xlinker", - "BITCODE_TOUCH_SYMBOL_MAP=%{bitcode_symbol_map_path}", + "%{bitcode_symbol_map_path}", ], expand_if_available = "bitcode_symbol_map_path", ), diff --git a/tools/osx/crosstool/wrapped_clang.cc b/tools/osx/crosstool/wrapped_clang.cc index 2f2bbbed465b36..886cc12a3853fd 100644 --- a/tools/osx/crosstool/wrapped_clang.cc +++ b/tools/osx/crosstool/wrapped_clang.cc @@ -23,18 +23,6 @@ // "DSYM_HINT_LINKED_BINARY": Workspace-relative path to binary output of the // link action generating the dsym file. // "DSYM_HINT_DSYM_PATH": Workspace-relative path to dSYM dwarf file. -// -// Likewise, this wrapper also contains a workaround for a bug in ld that causes -// flaky builds when using Bitcode symbol maps. ld allows the -// -bitcode_symbol_map to be either a directory (into which the file will be -// written) or a file, but the return value of the call to ::stat is never -// checked so examining the S_ISDIR bit of the struct afterwards returns -// true/false randomly depending on what data happened to be in memory at the -// time it was called: -// https://github.com/michaelweiser/ld64/blob/9c3700b64ed03e2d55ba094176bf6a172bf2bc6b/src/ld/Options.cpp#L3261 -// To address this, we prepend a special "BITCODE_TOUCH_SYMBOL_MAP=" flag to the -// symbol map filename and touch it before passing it along to clang, forcing -// the file to exist. #include #include @@ -191,7 +179,7 @@ int main(int argc, char *argv[]) { std::vector processed_args = {"/usr/bin/xcrun", tool_name}; - std::string linked_binary, dsym_path, bitcode_symbol_map; + std::string linked_binary, dsym_path; std::string dest_dir; std::unique_ptr cwd{getcwd(nullptr, 0), @@ -211,12 +199,6 @@ int main(int argc, char *argv[]) { if (SetArgIfFlagPresent(arg, "DSYM_HINT_DSYM_PATH", &dsym_path)) { continue; } - if (SetArgIfFlagPresent(arg, "BITCODE_TOUCH_SYMBOL_MAP", - &bitcode_symbol_map)) { - // Touch bitcode_symbol_map. - std::ofstream bitcode_symbol_map_file(bitcode_symbol_map); - arg = bitcode_symbol_map; - } if (arg.compare("OSO_PREFIX_MAP_PWD") == 0) { arg = "-Wl,-oso_prefix," + std::string(cwd.get()) + "/"; }