diff --git a/tools/osx/crosstool/cc_toolchain_config.bzl b/tools/osx/crosstool/cc_toolchain_config.bzl index 0d541bf1011f32..d90b4a85850626 100644 --- a/tools/osx/crosstool/cc_toolchain_config.bzl +++ b/tools/osx/crosstool/cc_toolchain_config.bzl @@ -5400,7 +5400,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 + "/"; }