diff --git a/tools/osx/crosstool/cc_toolchain_config.bzl b/tools/osx/crosstool/cc_toolchain_config.bzl index 21eac5aa09ac4a..d3c6176eadecfc 100644 --- a/tools/osx/crosstool/cc_toolchain_config.bzl +++ b/tools/osx/crosstool/cc_toolchain_config.bzl @@ -5368,7 +5368,7 @@ def _impl(ctx): ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile, ], - flag_groups = [flag_group(flags = ["-fdebug-compilation-dir", "."])], + flag_groups = [flag_group(flags = ["DEBUG_PREFIX_MAP_PWD=."])], ), ], ) diff --git a/tools/osx/crosstool/wrapped_clang.cc b/tools/osx/crosstool/wrapped_clang.cc index febf3cb246cbec..403528707b7bb5 100644 --- a/tools/osx/crosstool/wrapped_clang.cc +++ b/tools/osx/crosstool/wrapped_clang.cc @@ -318,6 +318,9 @@ void ProcessArgument(const std::string arg, const std::string developer_dir, } std::string dest_dir, bitcode_symbol_map; + if (SetArgIfFlagPresent(arg, "DEBUG_PREFIX_MAP_PWD", &dest_dir)) { + new_arg = "-fdebug-prefix-map=" + cwd + "=" + dest_dir; + } if (arg.compare("OSO_PREFIX_MAP_PWD") == 0) { new_arg = "-Wl,-oso_prefix," + cwd + "/"; }