Skip to content

Commit

Permalink
Add generate_linkmap feature to Apple CROSSTOOL.
Browse files Browse the repository at this point in the history
This adds `generate_linkmap` feature to Apple CROSSTOOL. To generate a
link map, add the `--objc_generate_linkmap` flag to a `bazel build`. By
default, only the top level linkmap file is built. If you want the
linkmap file of the top level target dependencies, add the
`--output_groups=+linkmaps` flag.

Fixes #9153.

Closes #12016.

PiperOrigin-RevId: 330049354
  • Loading branch information
thii authored and copybara-github committed Sep 4, 2020
1 parent 240bdea commit fa1740d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/osx/crosstool/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6001,6 +6001,28 @@ def _impl(ctx):
bitcode_embedded_markers_feature = feature(name = "bitcode_embedded_markers")
bitcode_embedded_feature = feature(name = "bitcode_embedded")

generate_linkmap_feature = feature(
name = "generate_linkmap",
flag_sets = [
flag_set(
actions = [
ACTION_NAMES.objc_executable,
ACTION_NAMES.objcpp_executable,
],
flag_groups = [
flag_group(
flags = [
"-Xlinker",
"-map",
"-Xlinker",
"%{linkmap_exec_path}",
],
),
],
),
],
)

if (ctx.attr.cpu == "ios_arm64" or
ctx.attr.cpu == "ios_arm64e" or
ctx.attr.cpu == "ios_armv7" or
Expand All @@ -6025,6 +6047,7 @@ def _impl(ctx):
default_compile_flags_feature,
debug_prefix_map_pwd_is_dot_feature,
generate_dsym_file_feature,
generate_linkmap_feature,
oso_prefix_feature,
contains_objc_source_feature,
objc_actions_feature,
Expand Down Expand Up @@ -6099,6 +6122,7 @@ def _impl(ctx):
default_compile_flags_feature,
debug_prefix_map_pwd_is_dot_feature,
generate_dsym_file_feature,
generate_linkmap_feature,
oso_prefix_feature,
contains_objc_source_feature,
objc_actions_feature,
Expand Down Expand Up @@ -6173,6 +6197,7 @@ def _impl(ctx):
default_compile_flags_feature,
debug_prefix_map_pwd_is_dot_feature,
generate_dsym_file_feature,
generate_linkmap_feature,
oso_prefix_feature,
contains_objc_source_feature,
objc_actions_feature,
Expand Down

0 comments on commit fa1740d

Please sign in to comment.