Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 20538e6

Browse files
committed
Work-around for LTO builds targeting android_arm64
1 parent 91c21b2 commit 20538e6

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

build/secondary/third_party/libcxx/BUILD.gn

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ source_set("libcxx") {
4444
"//third_party/libcxxabi",
4545
]
4646

47+
# TODO(goderbauer): remove when all sources build with LTO for android_arm64.
48+
if (is_android && current_cpu == "arm64") {
49+
sources -= [ "src/new.cpp" ]
50+
deps += [ ":libcxx_nolto" ]
51+
}
52+
4753
public_configs = [
4854
":libcxx_config",
4955
"//third_party/libcxxabi:libcxxabi_config",
@@ -54,10 +60,38 @@ source_set("libcxx") {
5460
"_LIBCPP_NO_RTTI",
5561
"_LIBCPP_BUILDING_LIBRARY",
5662
"LIBCXX_BUILDING_LIBCXXABI",
63+
"_LIBCPP_WEAK=",
5764
]
5865

5966
if (is_clang) {
6067
# shared_mutex.cpp and debug.cpp are purposefully in violation.
6168
cflags_cc = [ "-Wno-thread-safety-analysis" ]
6269
}
6370
}
71+
72+
source_set("libcxx_nolto") {
73+
visibility = [ ":*" ]
74+
75+
sources = [
76+
"src/new.cpp",
77+
]
78+
79+
cflags_cc = [ "-fno-lto" ]
80+
81+
deps = [
82+
"//third_party/libcxxabi",
83+
]
84+
85+
public_configs = [
86+
":libcxx_config",
87+
"//third_party/libcxxabi:libcxxabi_config",
88+
]
89+
90+
defines = [
91+
"_LIBCPP_NO_EXCEPTIONS",
92+
"_LIBCPP_NO_RTTI",
93+
"_LIBCPP_BUILDING_LIBRARY",
94+
"LIBCXX_BUILDING_LIBCXXABI",
95+
"_LIBCPP_WEAK=",
96+
]
97+
}

build/secondary/third_party/libcxxabi/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ config("libcxxabi_config") {
99
}
1010

1111
source_set("libcxxabi") {
12-
visibility = [ "../libcxx" ]
12+
visibility = [ "../libcxx:*" ]
1313

1414
sources = [
1515
"src/abort_message.cpp",

0 commit comments

Comments
 (0)