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

Fix libc++ pretty-printing on lldb

BUG=None
R=thakis
CC=rsesek

Change-Id: Ia94b81592164307aa55a910953909b0b25a82b37
Reviewed-on: https://chromium-review.googlesource.com/c/1444136
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628519}
parent b47045ad
......@@ -14,6 +14,25 @@ import("//buildtools/deps_revisions.gni")
# This build configuration is used by both Fuchsia and POSIX systems.
assert(is_posix || is_fuchsia)
declare_args() {
# lldb pretty printing only works when libc++ is built in the __1 (or __ndk1)
# namespaces. For pretty printing to work out-of-the-box on Mac (where lldb
# is primarily used), this flag is set to false to build with the __1
# namespace (to maintain ABI compatibility, this implies building without
# _LIBCPP_ABI_UNSTABLE). This is not necessary on non-component builds
# because we leave the ABI version set to __1 in that case because libc++
# symbols are not exported.
# TODO(thomasanderson): Set this to true by default once rL352899 is available
# in MacOS's lldb.
libcxx_abi_unstable = !(is_mac && is_debug && is_component_build)
}
# TODO(xiaohuic): https://crbug/917533 Crashes on internal ChromeOS build.
# Do unconditionally once the underlying problem is fixed.
if (is_chromeos && is_chrome_branded) {
libcxx_abi_unstable = false
}
group("posix") {
visibility = [ "//:optimize_gn_gen" ]
}
......@@ -35,12 +54,18 @@ config("runtime_library") {
libs = []
if (use_custom_libcxx) {
if (libcxx_abi_unstable) {
defines += [ "_LIBCPP_ABI_UNSTABLE" ]
}
if (is_component_build) {
# In component builds, symbols from libc++.so are exported for all DSOs to
# use. If the system libc++ gets loaded (indirectly through a system
# library), then it will conflict with our libc++.so. Add a custom ABI
# version to avoid conflicts.
defines += [ "_LIBCPP_ABI_VERSION=Cr" ]
# version if we're building with _LIBCPP_ABI_UNSTABLE to avoid conflicts.
if (libcxx_abi_unstable) {
defines += [ "_LIBCPP_ABI_VERSION=Cr" ]
}
} else {
# Don't leak any symbols on a static build.
defines += [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
......@@ -59,12 +84,6 @@ config("runtime_library") {
"_LIBCPP_ENABLE_NODISCARD",
]
# TODO(xiaohuic): https://crbug/917533 Crashes on internal ChromeOS build.
# Do unconditionally once the underlying problem is fixed.
if (!(is_chromeos && is_chrome_branded)) {
defines += [ "_LIBCPP_ABI_UNSTABLE" ]
}
# Make sure we don't link against libc++ or libstdc++.
if (is_clang) {
# //build/config/android:runtime_library adds -nostdlib, which suppresses
......
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