Commit fc2ebc41 authored by Johnny(Jianning) Ding's avatar Johnny(Jianning) Ding Committed by Commit Bot

Add a argument to control whether enabling text section splitting in the final binary.

Change-Id: Id47f14bdcac8fc8357ecd4fb5d15b2e028e9558d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132677Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Johnny (Jianning) Ding <jnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756512}
parent ce784fe5
...@@ -139,6 +139,15 @@ declare_args() { ...@@ -139,6 +139,15 @@ declare_args() {
# 'use_xcode_clang' may call old clang. # 'use_xcode_clang' may call old clang.
init_stack_vars = init_stack_vars =
!is_android && !use_xcode_clang && (!is_official_build || is_linux) !is_android && !use_xcode_clang && (!is_official_build || is_linux)
# This argument is to control whether enabling text section splitting in the
# final binary. When enabled, the separated text sections with prefix
# '.text.hot', '.text.unlikely', '.text.startup' and '.text.exit' will not be
# merged to '.text' section. This allows us to identify the hot code section
# ('.text.hot') in the binary which may be mlocked or mapped to huge page to
# reduce TLB misses which gives performance improvement on cpu usage.
# The gold linker by default has text section splitting enabled.
use_text_section_splitting = false
} }
declare_args() { declare_args() {
...@@ -485,6 +494,12 @@ config("compiler") { ...@@ -485,6 +494,12 @@ config("compiler") {
} }
} }
# Enable text section splitting only on linux when using lld for now. Other
# platforms can be added later if needed.
if (is_linux && use_lld && use_text_section_splitting) {
ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
}
if (is_clang && !is_nacl && !use_xcode_clang) { if (is_clang && !is_nacl && !use_xcode_clang) {
cflags += [ "-fcrash-diagnostics-dir=" + cflags += [ "-fcrash-diagnostics-dir=" +
rebase_path("//tools/clang/crashreports", root_build_dir) ] rebase_path("//tools/clang/crashreports", root_build_dir) ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment