File chromium-103-compiler.patch of Package chromium-ffmpeg-extra (Revision acf13cd4d3b182c723d1231bb1ce7ca6)
Currently displaying revision acf13cd4d3b182c723d1231bb1ce7ca6 , Show latest
236
1
From 307a0f63dd9b118f4b8470ed3d7567e81fdb7a6d Mon Sep 17 00:00:00 2001
2
From: Mike Gilbert <floppym@gentoo.org>
3
Date: Tue, 3 May 2022 10:51:55 +0000
4
Subject: [PATCH] Disable various compiler configs
5
6
---
7
build/config/compiler/BUILD.gn | 114 +++++----------------------------
8
1 file changed, 17 insertions(+), 97 deletions(-)
9
10
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
11
index f378b95..cb2aeb3 100644
12
--- a/build/config/compiler/BUILD.gn
13
+++ b/build/config/compiler/BUILD.gn
14
15
16
configs += [
17
# See the definitions below.
18
- ":clang_revision",
19
":rustc_revision",
20
- ":compiler_cpu_abi",
21
":compiler_codegen",
22
":compiler_deterministic",
23
]
24
25
ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
26
}
27
28
- if (is_clang && !is_nacl && current_os != "zos") {
29
- cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
30
-
31
- # TODO(hans): Remove this once Clang generates better optimized debug info
32
- # by default. https://crbug.com/765793
33
- cflags += [
34
- "-mllvm",
35
- "-instcombine-lower-dbg-declare=0",
36
- ]
37
- if (!is_debug && use_thin_lto && is_a_target_toolchain) {
38
- if (is_win) {
39
- ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ]
40
- } else {
41
- ldflags += [ "-Wl,-mllvm,-instcombine-lower-dbg-declare=0" ]
42
- }
43
- }
44
-
45
- # TODO(crbug.com/1235145): Investigate why/if this should be needed.
46
- if (is_win) {
47
- cflags += [ "/clang:-ffp-contract=off" ]
48
- } else {
49
- cflags += [ "-ffp-contract=off" ]
50
- }
51
- }
52
-
53
# Rust compiler setup (for either clang or rustc).
54
if (enable_rust) {
55
defines += [ "RUST_ENABLED" ]
56
57
}
58
}
59
60
- # Makes builds independent of absolute file path.
61
- if (is_clang && strip_absolute_paths_from_debug_symbols) {
62
- # If debug option is given, clang includes $cwd in debug info by default.
63
- # For such build, this flag generates reproducible obj files even we use
64
- # different build directory like "out/feature_a" and "out/feature_b" if
65
- # we build same files with same compile flag.
66
- # Other paths are already given in relative, no need to normalize them.
67
- if (is_nacl) {
68
- # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
69
- cflags += [
70
- "-Xclang",
71
- "-fdebug-compilation-dir",
72
- "-Xclang",
73
- ".",
74
- ]
75
- } else {
76
- # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir=
77
- # and -fcoverage-compilation-dir=.
78
- cflags += [ "-ffile-compilation-dir=." ]
79
- }
80
- if (!is_win) {
81
- # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
82
- asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
83
- }
84
-
85
- if (is_win && use_lld) {
86
- if (symbol_level == 2 || (is_clang && using_sanitizer)) {
87
- # Absolutize source file paths for PDB. Pass the real build directory
88
- # if the pdb contains source-level debug information and if linker
89
- # reproducibility is not critical.
90
- ldflags += [ "/PDBSourcePath:" + rebase_path(root_build_dir) ]
91
- } else {
92
- # Use a fake fixed base directory for paths in the pdb to make the pdb
93
- # output fully deterministic and independent of the build directory.
94
- ldflags += [ "/PDBSourcePath:o:\fake\prefix" ]
95
- }
96
- }
97
- }
98
-
99
# Tells the compiler not to use absolute paths when passing the default
100
# paths to the tools it invokes. We don't want this because we don't
101
# really need it and it can mess up the goma cache entries.
102
103
cflags += [ "-Wno-unqualified-std-cast-call" ]
104
}
105
106
- if (!is_nacl && !(is_chromeos ||
107
- default_toolchain == "//build/toolchain/cros:target")) {
108
- # TODO(https://crbug.com/1316298): Re-enable once test failure is figured out
109
- cflags += [
110
- "-Xclang",
111
- "-no-opaque-pointers",
112
- ]
113
- }
114
-
115
if (is_fuchsia) {
116
# TODO(https://bugs.chromium.org/p/fuchsia/issues/detail?id=77383)
117
cflags += [ "-Wno-deprecated-copy" ]
118
119
defines = [ "_HAS_NODISCARD" ]
120
}
121
} else {
122
- cflags = [ "-Wall" ]
123
+ cflags = []
124
if (treat_warnings_as_errors) {
125
cflags += [ "-Werror" ]
126
127
128
# well.
129
ldflags = [ "-Werror" ]
130
}
131
- if (is_clang) {
132
- # Enable extra warnings for chromium_code when we control the compiler.
133
- cflags += [ "-Wextra" ]
134
- }
135
136
# In Chromium code, we define __STDC_foo_MACROS in order to get the
137
# C99 macros on Mac and Linux.
138
139
"__STDC_FORMAT_MACROS",
140
]
141
142
- if (!is_debug && !using_sanitizer && current_cpu != "s390x" &&
143
- current_cpu != "s390" && current_cpu != "ppc64" &&
144
- current_cpu != "mips" && current_cpu != "mips64") {
145
- # Non-chromium code is not guaranteed to compile cleanly with
146
- # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
147
- # disabled, so only do that for Release build.
148
- defines += [ "_FORTIFY_SOURCE=2" ]
149
- }
150
-
151
if (is_mac) {
152
cflags_objc = [ "-Wobjc-missing-property-synthesis" ]
153
cflags_objcc = [ "-Wobjc-missing-property-synthesis" ]
154
155
}
156
157
# Default "optimization on" config.
158
-config("optimize") {
159
+config("optimize") { }
160
+config("xoptimize") {
161
if (is_win) {
162
if (chrome_pgo_phase != 2) {
163
# Favor size over speed, /O1 must be before the common flags.
164
165
}
166
167
# Turn off optimizations.
168
-config("no_optimize") {
169
+config("no_optimize") { }
170
+config("xno_optimize") {
171
if (is_win) {
172
cflags = [
173
"/Od", # Disable optimization.
174
175
# Turns up the optimization level. On Windows, this implies whole program
176
# optimization and link-time code generation which is very expensive and should
177
# be used sparingly.
178
-config("optimize_max") {
179
+config("optimize_max") { }
180
+config("xoptimize_max") {
181
if (is_nacl && is_nacl_irt) {
182
# The NaCl IRT is a special case and always wants its own config.
183
# Various components do:
184
185
#
186
# TODO(crbug.com/621335) - rework how all of these configs are related
187
# so that we don't need this disclaimer.
188
-config("optimize_speed") {
189
+config("optimize_speed") { }
190
+config("xoptimize_speed") {
191
if (is_nacl && is_nacl_irt) {
192
# The NaCl IRT is a special case and always wants its own config.
193
# Various components do:
194
195
}
196
}
197
198
-config("optimize_fuzzing") {
199
+config("optimize_fuzzing") { }
200
+config("xoptimize_fuzzing") {
201
cflags = [ "-O1" ] + common_optimize_on_cflags
202
rustflags = [ "-Copt-level=1" ]
203
ldflags = common_optimize_on_ldflags
204
205
}
206
207
# Full symbols.
208
-config("symbols") {
209
+config("symbols") { }
210
+config("xsymbols") {
211
if (is_win) {
212
if (is_clang) {
213
cflags = [ "/Z7" ] # Debug information in the .obj files.
214
215
# Minimal symbols.
216
# This config guarantees to hold symbol for stack trace which are shown to user
217
# when crash happens in unittests running on buildbot.
218
-config("minimal_symbols") {
219
+config("minimal_symbols") { }
220
+config("xminimal_symbols") {
221
if (is_win) {
222
# Functions, files, and line tables only.
223
cflags = []
224
225
# This configuration contains function names only. That is, the compiler is
226
# told to not generate debug information and the linker then just puts function
227
# names in the final debug information.
228
-config("no_symbols") {
229
+config("no_symbols") { }
230
+config("xno_symbols") {
231
if (is_win) {
232
ldflags = [ "/DEBUG" ]
233
234
--
235
2.35.1
236