From ded251b4713370bc4fcd16de13d8702270ae9f4f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 12 Jan 2023 07:14:55 -0800 Subject: [PATCH] Add -dead_strip in default opt link flags for darwin This is similar to the `--gc-sections` addition here. `-dead_strip` is supported on all versions of ld64 we care about. Closes #16770. PiperOrigin-RevId: 501557438 Change-Id: Ia5e1e94305361f10f1b20654d83edb76126b3056 --- tools/cpp/unix_cc_configure.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl index 1a4bb4ff8f5b9e..a960434cddd532 100644 --- a/tools/cpp/unix_cc_configure.bzl +++ b/tools/cpp/unix_cc_configure.bzl @@ -633,7 +633,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools): ], ), "%{opt_link_flags}": get_starlark_list( - [] if darwin else _add_linker_option_if_supported( + ["-Wl,-dead_strip"] if darwin else _add_linker_option_if_supported( repository_ctx, cc, "-Wl,--gc-sections",