Commit f002a96e authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Remove libcpp_is_static

This change makes libc++ a shared_library iff is_component_build=true, just like
all other components.  This has the advantage that the RPATH doesn't need to be
set in sanitizer (non-component) builds just so binaries can find libc++.so.
This CL also changes RPATH to be set iff is_component_build=true.

Needs buildtools CL:
https://chromium-review.googlesource.com/c/chromium/buildtools/+/1142370

TBR=dpranke,jochen
R=thakis
BUG=850682
CQ_INCLUDE_TRYBOTS=luci.chromium.try:linux_chromium_msan_rel_ng;master.tryserver.chromium.linux:linux_chromium_ubsan_rel_ng;luci.chromium.try:linux_chromium_asan_rel_ng;luci.chromium.try:linux_chromium_tsan_rel_ng

Change-Id: I96e74da6d907659b939a0f229693bbd2a6d9140a
Reviewed-on: https://chromium-review.googlesource.com/1119098
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarPeter Collingbourne <pcc@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578085}
parent 82d1bd2b
...@@ -121,7 +121,7 @@ vars = { ...@@ -121,7 +121,7 @@ vars = {
# Three lines of non-changing comments so that # Three lines of non-changing comments so that
# the commit queue can handle CLs rolling build tools # the commit queue can handle CLs rolling build tools
# and whatever else without interference from each other. # and whatever else without interference from each other.
'buildtools_revision': '0dd5c6f980d22be96b728155249df2da355989d9', 'buildtools_revision': '691bfec9d73bfefae30bad32e7a6496f2beceb9c',
# Three lines of non-changing comments so that # Three lines of non-changing comments so that
# the commit queue can handle CLs rolling SwiftShader # the commit queue can handle CLs rolling SwiftShader
# and whatever else without interference from each other. # and whatever else without interference from each other.
......
...@@ -277,7 +277,7 @@ config("default_libs") { ...@@ -277,7 +277,7 @@ config("default_libs") {
} }
# Only //build/config/BUILDCONFIG.gn should reference this. # Only //build/config/BUILDCONFIG.gn should reference this.
group("executable_and_loadable_module_and_shared_library_deps") { group("common_deps") {
public_deps = [] public_deps = []
if (using_sanitizer) { if (using_sanitizer) {
...@@ -301,6 +301,33 @@ group("executable_and_loadable_module_and_shared_library_deps") { ...@@ -301,6 +301,33 @@ group("executable_and_loadable_module_and_shared_library_deps") {
} }
} }
group("executable_deps") {
public_deps = [
":common_deps",
]
if (use_custom_libcxx && !is_component_build) {
public_deps += [ "//buildtools/third_party/libc++abi" ]
}
}
group("loadable_module_deps") {
public_deps = [
":common_deps",
]
if (use_custom_libcxx && !is_component_build && !(is_asan || is_ubsan_vptr)) {
public_deps += [ "//buildtools/third_party/libc++abi" ]
}
}
group("shared_library_deps") {
public_deps = [
":common_deps",
]
if (use_custom_libcxx && !is_component_build && !(is_asan || is_ubsan_vptr)) {
public_deps += [ "//buildtools/third_party/libc++abi" ]
}
}
# Executable configs ----------------------------------------------------------- # Executable configs -----------------------------------------------------------
# Windows linker setup for EXEs and DLLs. # Windows linker setup for EXEs and DLLs.
......
...@@ -650,20 +650,20 @@ set_defaults("loadable_module") { ...@@ -650,20 +650,20 @@ set_defaults("loadable_module") {
# #
# Variables # Variables
# no_default_deps: If true, no standard dependencies will be added. # no_default_deps: If true, no standard dependencies will be added.
foreach(target_type, foreach(_target_type,
[ [
"executable", "executable",
"loadable_module", "loadable_module",
"shared_library", "shared_library",
]) { ]) {
template(target_type) { template(_target_type) {
target(target_type, target_name) { target(_target_type, target_name) {
forward_variables_from(invoker, "*", [ "no_default_deps" ]) forward_variables_from(invoker, "*", [ "no_default_deps" ])
if (!defined(deps)) { if (!defined(deps)) {
deps = [] deps = []
} }
if (!defined(invoker.no_default_deps) || !invoker.no_default_deps) { if (!defined(invoker.no_default_deps) || !invoker.no_default_deps) {
deps += [ "//build/config:executable_and_loadable_module_and_shared_library_deps" ] deps += [ "//build/config:${_target_type}_deps" ]
} }
} }
} }
......
...@@ -22,16 +22,6 @@ declare_args() { ...@@ -22,16 +22,6 @@ declare_args() {
# expected usage is to set use_custom_libcxx=false and # expected usage is to set use_custom_libcxx=false and
# use_custom_libcxx_for_host=true in the passed in buildargs. # use_custom_libcxx_for_host=true in the passed in buildargs.
use_custom_libcxx_for_host = false use_custom_libcxx_for_host = false
# ASan, MSan and TSan builds need to override operator new, operator delete,
# and some exception handling symbols, so libc++ must be a shared library to
# prevent duplicate symbol errors when linking.
# Additionally, -fsanitize=vptr requires libc++ to be a shared library
# because the ubsan runtime library that implements -fsanitize=vptr calls
# dynamic_cast with the ABI type info classes, which won't return the right
# answer if each DSO has its own copy of the ABI classes.
libcpp_is_static = !is_component_build && !is_asan && !is_msan && !is_tsan &&
!is_ubsan && !is_ubsan_security && !is_ubsan_vptr
} }
use_custom_libcxx = use_custom_libcxx =
......
...@@ -110,8 +110,8 @@ config("executable_ldconfig") { ...@@ -110,8 +110,8 @@ config("executable_ldconfig") {
] ]
} else { } else {
# See the rpath_for... config above for why this is necessary for component # See the rpath_for... config above for why this is necessary for component
# builds. Sanitizers use a custom libc++ where this is also necessary. # builds.
if (is_component_build || using_sanitizer || !libcpp_is_static) { if (is_component_build) {
configs = [ ":rpath_for_built_shared_libraries" ] configs = [ ":rpath_for_built_shared_libraries" ]
} }
if (current_cpu == "mipsel" || current_cpu == "mips64el") { if (current_cpu == "mipsel" || current_cpu == "mips64el") {
......
...@@ -35,12 +35,12 @@ config("runtime_library") { ...@@ -35,12 +35,12 @@ config("runtime_library") {
libs = [] libs = []
if (use_custom_libcxx) { if (use_custom_libcxx) {
if (libcpp_is_static) { if (!is_component_build) {
# Don't leak any symbols on a static build. # Don't leak any symbols on a static build.
defines += [ defines += [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS", if (!is_asan && !is_ubsan_vptr) {
"_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", defines += [ "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" ]
] }
} }
if (!is_clang) { if (!is_clang) {
# Gcc has a built-in abs() definition with default visibility. # Gcc has a built-in abs() definition with default visibility.
......
...@@ -222,7 +222,7 @@ config("runtime_library") { ...@@ -222,7 +222,7 @@ config("runtime_library") {
if (use_custom_libcxx) { if (use_custom_libcxx) {
cflags_cc += cflags_cc +=
[ "-I" + rebase_path("$libcxx_prefix/include", root_build_dir) ] [ "-I" + rebase_path("$libcxx_prefix/include", root_build_dir) ]
if (libcpp_is_static) { if (!is_component_build) {
defines += [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ] defines += [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
} }
......
...@@ -53,10 +53,6 @@ if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) { ...@@ -53,10 +53,6 @@ if (is_chrome_branded && (current_cpu == "x86" || current_cpu == "x64")) {
[ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so" ] [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.so" ]
} }
if (!libcpp_is_static && use_custom_libcxx) {
packaging_files_shlibs += [ "$root_out_dir/libc++.so" ]
}
packaging_files_binaries = packaging_files_executables + packaging_files_shlibs packaging_files_binaries = packaging_files_executables + packaging_files_shlibs
# TODO(mmoss) Any convenient way to get all the relevant build files? # TODO(mmoss) Any convenient way to get all the relevant build files?
...@@ -373,10 +369,6 @@ group("installer_deps") { ...@@ -373,10 +369,6 @@ group("installer_deps") {
if (!is_chromeos) { if (!is_chromeos) {
public_deps += [ ":rpm_packaging_files" ] public_deps += [ ":rpm_packaging_files" ]
} }
if (!libcpp_is_static && use_custom_libcxx) {
public_deps += [ "//buildtools/third_party/libc++:libc++" ]
}
} }
# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages. # Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
......
...@@ -136,10 +136,6 @@ group("installer_deps") { ...@@ -136,10 +136,6 @@ group("installer_deps") {
"//ppapi/native_client:irt", "//ppapi/native_client:irt",
] ]
} }
if (!libcpp_is_static && use_custom_libcxx) {
public_deps += [ "//buildtools/third_party/libc++:libc++" ]
}
} }
# Creates .deb installer package. # Creates .deb installer package.
...@@ -166,10 +162,6 @@ template("linux_package") { ...@@ -166,10 +162,6 @@ template("linux_package") {
] ]
} }
if (!libcpp_is_static && use_custom_libcxx) {
packaging_files_binaries += [ "$root_out_dir/libc++.so" ]
}
deb_target_name = "${target_name}_deb" deb_target_name = "${target_name}_deb"
action(deb_target_name) { action(deb_target_name) {
visibility = [ ":*" ] visibility = [ ":*" ]
......
...@@ -62,10 +62,10 @@ if (enable_me2me_host) { ...@@ -62,10 +62,10 @@ if (enable_me2me_host) {
if (is_component_build) { if (is_component_build) {
sources += [ "$root_build_dir/libbase.so" ] sources += [ "$root_build_dir/libbase.so" ]
deps += [ "//base:base" ] deps += [ "//base:base" ]
} if (use_custom_libcxx) {
if (!libcpp_is_static && use_custom_libcxx) { sources += [ "$root_build_dir/libc++.so" ]
sources += [ "$root_build_dir/libc++.so" ] deps += [ "//buildtools/third_party/libc++" ]
deps += [ "//buildtools/third_party/libc++" ] }
} }
} }
......
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