Skip to content

Commit 994c6c0

Browse files
authored
Revert "Reland "Upgrade compiler to Clang 10." (#327)" (flutter#329)
This reverts commit b35cf60.
1 parent 64a1218 commit 994c6c0

7 files changed

Lines changed: 45 additions & 110 deletions

File tree

build/config/BUILDCONFIG.gn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
283283
is_clang = true
284284
}
285285

286-
use_flutter_cxx = is_clang && (is_linux || is_android)
287-
288286
if (is_msan && !is_linux) {
289287
assert(false, "Memory sanitizer is only available on Linux.")
290288
}
@@ -531,7 +529,7 @@ if (custom_toolchain != "") {
531529
#
532530
# Variables
533531
# no_default_deps: If true, no standard dependencies will be added.
534-
if (use_flutter_cxx) {
532+
if (is_android || (is_linux && current_cpu != "x86")) {
535533
foreach(_target_type,
536534
[
537535
"executable",

build/config/compiler/BUILD.gn

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ config("compiler") {
163163
common_mac_flags += [
164164
"-arch",
165165
"x86_64",
166+
"-march=core2",
166167
]
167168
} else if (current_cpu == "x86") {
168169
common_mac_flags += [
@@ -209,6 +210,10 @@ config("compiler") {
209210
ldflags += [ "-m32" ]
210211
if (is_clang) {
211212
cflags += [
213+
# Else building libyuv gives clang's register allocator issues,
214+
# see llvm.org/PR15798 / crbug.com/233709
215+
"-momit-leaf-frame-pointer",
216+
212217
# Align the stack on 16-byte boundaries, http://crbug.com/418554.
213218
"-mstack-alignment=16",
214219
"-mstackrealign",
@@ -495,7 +500,6 @@ config("compiler_arm_fpu") {
495500
config("runtime_library") {
496501
cflags = []
497502
cflags_cc = []
498-
cflags_objcc = []
499503
defines = []
500504
ldflags = []
501505
lib_dirs = []
@@ -517,20 +521,6 @@ config("runtime_library") {
517521
]
518522
}
519523

520-
if (use_flutter_cxx) {
521-
cflags_cc += [ "-nostdinc++" ]
522-
cflags_objcc += [ "-nostdinc++" ]
523-
524-
# Unwind seemes to be in these libraries in Linux.
525-
if (!is_linux) {
526-
ldflags += [ "-nostdlib++" ]
527-
}
528-
include_dirs = [
529-
"//third_party/libcxx/include",
530-
"//third_party/libcxxabi/include",
531-
]
532-
}
533-
534524
# Android standard library setup.
535525
if (is_android) {
536526
if (is_clang) {
@@ -541,6 +531,8 @@ config("runtime_library") {
541531
]
542532
}
543533

534+
defines += [ "__GNU_SOURCE=1" ] # Necessary for clone().
535+
544536
# TODO(jdduke) Re-enable on mips after resolving linking
545537
# issues with libc++ (crbug.com/456380).
546538
if (current_cpu != "mipsel" && current_cpu != "mips64el") {
@@ -564,6 +556,11 @@ config("runtime_library") {
564556
"-D__ANDROID_API__=$android_api_level",
565557
]
566558

559+
include_dirs = [
560+
"//third_party/libcxx/include",
561+
"//third_party/libcxxabi/include",
562+
]
563+
567564
# libunwind and libandroid_support also live in $android_libcpp_root.
568565
lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ]
569566

@@ -592,7 +589,13 @@ config("runtime_library") {
592589
# We compile our own libc++ on all Linux targets except i386 (for
593590
# gen_snapshot) where this is not supported.
594591
if (is_linux) {
595-
if (!use_flutter_cxx) {
592+
if (current_cpu != "x86") {
593+
cflags_cc += [ "-nostdinc++" ]
594+
include_dirs = [
595+
"//third_party/libcxx/include",
596+
"//third_party/libcxxabi/include",
597+
]
598+
} else {
596599
cflags_cc += [ "-stdlib=libstdc++" ]
597600
ldflags += [ "-stdlib=libstdc++" ]
598601
libs += [ "gcc" ]
@@ -635,9 +638,6 @@ if (is_win) {
635638
# Disables.
636639
"-Wno-missing-field-initializers", # "struct foo f = {0};"
637640
"-Wno-unused-parameter", # Unused function parameters.
638-
"-Wno-implicit-int-float-conversion",
639-
"-Wno-reorder-init-list",
640-
"-Wno-c99-designator",
641641
]
642642

643643
if (is_mac || is_ios) {

build/config/ios/BUILD.gn

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,12 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5-
import("//build/config/ios/ios_sdk.gni")
65
import("//build/config/sysroot.gni")
6+
import("//build/config/ios/ios_sdk.gni")
77

88
config("sdk") {
99
common_flags = [ "-stdlib=libc++" ]
1010

1111
cflags = common_flags
1212
ldflags = common_flags
13-
14-
common_ccflags = [
15-
"-nostdinc++",
16-
"-isystem",
17-
"$xcode_toolchain/usr/include/c++/v1",
18-
]
19-
20-
cflags_cc = common_ccflags
21-
cflags_objcc = common_ccflags
2213
}

build/config/mac/BUILD.gn

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ config("sdk") {
99

1010
cflags = common_flags
1111
ldflags = common_flags
12-
13-
common_ccflags = [
14-
"-nostdinc++",
15-
"-isystem",
16-
"$xcode_toolchain/usr/include/c++/v1",
17-
]
18-
19-
cflags_cc = common_ccflags
20-
cflags_objcc = common_ccflags
2112
}
2213

2314
# On Mac, this is used for everything except static libraries.

build/config/mac/xcode_toolchain.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

build/config/sysroot.gni

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ declare_args() {
99
# The absolute path of the sysroot that is applied when compiling using
1010
# the target toolchain.
1111
target_sysroot = ""
12-
13-
# The absolute path to the Xcode toolchain. This is used to look for headers
14-
# that usually ship with the toolchain like c++/v1.
15-
xcode_toolchain = ""
1612
}
1713

1814
if (current_toolchain == default_toolchain && target_sysroot != "") {
@@ -35,10 +31,3 @@ if (current_toolchain == default_toolchain && target_sysroot != "") {
3531
} else {
3632
sysroot = ""
3733
}
38-
39-
if ((is_mac || is_ios) && xcode_toolchain == "") {
40-
xcode_toolchain = exec_script("//build/config/mac/xcode_toolchain.py",
41-
[],
42-
"trim string",
43-
[])
44-
}

build/secondary/third_party/libcxxabi/BUILD.gn

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,21 @@
55
import("$flutter_root/common/config.gni")
66

77
config("libcxxabi_config") {
8-
common_cc_flags = [ "-nostdinc++" ]
9-
10-
cflags_cc = common_cc_flags
11-
cflags_objcc = common_cc_flags
12-
138
include_dirs = [ "include" ]
149
}
1510

1611
source_set("libcxxabi") {
1712
visibility = [ "../libcxx:*" ]
1813

19-
public_configs = [ ":libcxxabi_config" ]
20-
21-
defines = [
22-
"_LIBCXXABI_NO_EXCEPTIONS",
23-
"_LIBCXXABI_BUILDING_LIBRARY",
24-
"LIBCXXABI_SILENT_TERMINATE",
25-
]
26-
27-
sources = []
28-
29-
# Compile libcxx ABI using C++11. This replicates the rule in the
30-
# CMakeLists on the "cxx_abiobjects" target.
31-
configs -= [ "//build/config/compiler:cxx_version_default" ]
32-
configs += [ "//build/config/compiler:cxx_version_11" ]
33-
34-
configs += [ "../libcxx:libcxx_config" ]
35-
36-
# No translation units in the engine are built with exceptions. But, using
37-
# Objective-C exceptions requires some infrastructure setup for exceptions.
38-
# Build support for the same in cxxabi on Darwin.
39-
if (is_mac || is_ios) {
40-
configs -= [ "//build/config/gcc:no_exceptions" ]
41-
sources += [
42-
"src/cxa_exception.cpp",
43-
"src/cxa_personality.cpp",
44-
]
45-
} else {
46-
sources += [ "src/cxa_noexception.cpp" ]
47-
}
48-
49-
# Third party dependencies may depend on RTTI. Add support for the same in
50-
# cxxabi.
51-
configs -= [ "//build/config/compiler:no_rtti" ]
52-
configs += [ "//build/config/compiler:rtti" ]
53-
54-
sources += [
14+
sources = [
5515
"src/abort_message.cpp",
5616
"src/cxa_aux_runtime.cpp",
5717
"src/cxa_default_handlers.cpp",
5818
"src/cxa_demangle.cpp",
5919
"src/cxa_exception_storage.cpp",
6020
"src/cxa_guard.cpp",
6121
"src/cxa_handlers.cpp",
22+
"src/cxa_noexception.cpp",
6223
"src/cxa_unexpected.cpp",
6324
"src/cxa_vector.cpp",
6425
"src/cxa_virtual.cpp",
@@ -68,4 +29,26 @@ source_set("libcxxabi") {
6829
"src/stdlib_stdexcept.cpp",
6930
"src/stdlib_typeinfo.cpp",
7031
]
32+
33+
public_configs = [ ":libcxxabi_config" ]
34+
35+
defines = [
36+
"_LIBCXXABI_NO_EXCEPTIONS",
37+
"_LIBCXXABI_BUILDING_LIBRARY",
38+
"LIBCXXABI_SILENT_TERMINATE",
39+
]
40+
41+
# ICU uses RTTI, so we need to build libcxxabi with support for it,
42+
# https://github.com/flutter/flutter/issues/24535.
43+
configs -= [ "//build/config/compiler:no_rtti" ]
44+
45+
# Compile libcxx ABI using an older standard. This replicates the rule in the
46+
# CMakeLists on the "cxx_abiobjects" target.
47+
configs -= [ "//build/config/compiler:cxx_version_default" ]
48+
configs += [ "//build/config/compiler:cxx_version_11" ]
49+
50+
configs += [
51+
"//build/config/compiler:rtti",
52+
"//third_party/libcxx:libcxx_config",
53+
]
7154
}

0 commit comments

Comments
 (0)