| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
| index 6bad05bf7e..7938626865 100644 |
| --- a/build/config/compiler/BUILD.gn |
| +++ b/build/config/compiler/BUILD.gn |
| @@ -842,6 +842,13 @@ config("compiler") { |
| cflags += [ "-Xclang", "-fembed-bitcode=all" ] |
| } |
| |
| + if (use_lld && use_thin_lto && lld_emit_index) { |
| + ldflags += [ |
| + "-Wl,--save-temps=import", |
| + "-Wl,--thinlto-emit-index-files" |
| + ] |
| + } |
| + |
| # Pass the same C/C++ flags to the objective C/C++ compiler. |
| cflags_objc += cflags_c |
| cflags_objcc += cflags_cc |
| diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni |
| index 4738ee80d3..57355e2098 100644 |
| --- a/build/config/compiler/compiler.gni |
| +++ b/build/config/compiler/compiler.gni |
| @@ -140,6 +140,11 @@ declare_args() { |
| # Currently the ML inliner is only supported on linux hosts |
| use_ml_inliner = host_os == "linux" && is_android |
| |
| + # Set to true to enable output of ThinLTO index files used for training |
| + # ML models that can enhance characteristics of clang generated native |
| + # code. |
| + lld_emit_index = false |
| + |
| # Set to true to use the android unwinder V2 implementation. |
| use_android_unwinder_v2 = true |
| |