Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oso_prefix_is_pwd macOS feature #11671

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tools/osx/crosstool/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5451,6 +5451,17 @@ def _impl(ctx):
requires = [feature_set(features = ["opt"])],
)

oso_prefix_feature = feature(
name = "oso_prefix_is_pwd",
flag_sets = [
flag_set(
actions = all_link_actions +
["objc-executable", "objc++-executable"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this flag apply to executables without any objc as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flag_groups = [flag_group(flags = ["OSO_PREFIX_MAP_PWD"])],
),
],
)

generate_dsym_file_feature = feature(
name = "generate_dsym_file",
flag_sets = [
Expand Down Expand Up @@ -5782,6 +5793,7 @@ def _impl(ctx):
default_compile_flags_feature,
debug_prefix_map_pwd_is_dot_feature,
generate_dsym_file_feature,
oso_prefix_feature,
contains_objc_source_feature,
objc_actions_feature,
strip_debug_symbols_feature,
Expand Down Expand Up @@ -5853,6 +5865,7 @@ def _impl(ctx):
default_compile_flags_feature,
debug_prefix_map_pwd_is_dot_feature,
generate_dsym_file_feature,
oso_prefix_feature,
contains_objc_source_feature,
objc_actions_feature,
strip_debug_symbols_feature,
Expand Down Expand Up @@ -5926,6 +5939,7 @@ def _impl(ctx):
default_compile_flags_feature,
debug_prefix_map_pwd_is_dot_feature,
generate_dsym_file_feature,
oso_prefix_feature,
contains_objc_source_feature,
objc_actions_feature,
strip_debug_symbols_feature,
Expand Down
3 changes: 3 additions & 0 deletions tools/osx/crosstool/wrapped_clang.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ int main(int argc, char *argv[]) {
if (SetArgIfFlagPresent(arg, "DEBUG_PREFIX_MAP_PWD", &dest_dir)) {
arg = "-fdebug-prefix-map=" + std::string(cwd.get()) + "=" + dest_dir;
}
if (arg.compare("OSO_PREFIX_MAP_PWD") == 0) {
arg = "-Wl,-oso_prefix," + std::string(cwd.get()) + "/";
}
FindAndReplace("__BAZEL_XCODE_DEVELOPER_DIR__", developer_dir, &arg);
FindAndReplace("__BAZEL_XCODE_SDKROOT__", sdk_root, &arg);

Expand Down