File chromium-110-compiler.patch of Package chromium-ffmpeg-extra (Revision b30401c0254353da4e772a68807e8dc6)

Currently displaying revision b30401c0254353da4e772a68807e8dc6 , Show latest

254
 
1
From 307a0f63dd9b118f4b8470ed3d7567e81fdb7a6d Mon Sep 17 00:00:00 2001
2
From: Mike Gilbert <floppym@gentoo.org>
3
Date: Tue, 15 Nov 2022 10:27:58 +0000
4
Subject: [PATCH] Disable various compiler configs
5
6
---
7
 build/config/compiler/BUILD.gn | 134 +++++----------------------------
8
 1 file changed, 17 insertions(+), 117 deletions(-)
9
10
Index: chromium-114.0.5735.90/build/config/compiler/BUILD.gn
11
===================================================================
12
--- chromium-114.0.5735.90.orig/build/config/compiler/BUILD.gn
13
+++ chromium-114.0.5735.90/build/config/compiler/BUILD.gn
14
@@ -289,9 +289,7 @@ config("compiler") {
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
@@ -540,37 +538,6 @@ config("compiler") {
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
-    if (save_reproducers_on_lld_crash && use_lld) {
31
-      ldflags += [
32
-        "-fcrash-diagnostics=all",
33
-        "-fcrash-diagnostics-dir=" + clang_diagnostic_dir,
34
-      ]
35
-    }
36
-
37
-    # TODO(hans): Remove this once Clang generates better optimized debug info
38
-    # by default. https://crbug.com/765793
39
-    cflags += [
40
-      "-mllvm",
41
-      "-instcombine-lower-dbg-declare=0",
42
-    ]
43
-    if (!is_debug && use_thin_lto && is_a_target_toolchain) {
44
-      if (is_win) {
45
-        ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ]
46
-      } else {
47
-        ldflags += [ "-Wl,-mllvm,-instcombine-lower-dbg-declare=0" ]
48
-      }
49
-    }
50
-
51
-    # TODO(crbug.com/1235145): Investigate why/if this should be needed.
52
-    if (is_win) {
53
-      cflags += [ "/clang:-ffp-contract=off" ]
54
-    } else {
55
-      cflags += [ "-ffp-contract=off" ]
56
-    }
57
-  }
58
-
59
   # C11/C++11 compiler flags setup.
60
   # ---------------------------
61
   if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) ||
62
@@ -1346,46 +1313,6 @@ config("compiler_deterministic") {
63
     }
64
   }
65
 
66
-  # Makes builds independent of absolute file path.
67
-  if (is_clang && strip_absolute_paths_from_debug_symbols) {
68
-    # If debug option is given, clang includes $cwd in debug info by default.
69
-    # For such build, this flag generates reproducible obj files even we use
70
-    # different build directory like "out/feature_a" and "out/feature_b" if
71
-    # we build same files with same compile flag.
72
-    # Other paths are already given in relative, no need to normalize them.
73
-    if (is_nacl) {
74
-      # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
75
-      cflags += [
76
-        "-Xclang",
77
-        "-fdebug-compilation-dir",
78
-        "-Xclang",
79
-        ".",
80
-      ]
81
-    } else {
82
-      # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir=
83
-      # and -fcoverage-compilation-dir=.
84
-      cflags += [ "-ffile-compilation-dir=." ]
85
-      swiftflags += [ "-file-compilation-dir=." ]
86
-    }
87
-    if (!is_win) {
88
-      # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
89
-      asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
90
-    }
91
-
92
-    if (is_win && use_lld) {
93
-      if (symbol_level == 2 || (is_clang && using_sanitizer)) {
94
-        # Absolutize source file paths for PDB. Pass the real build directory
95
-        # if the pdb contains source-level debug information and if linker
96
-        # reproducibility is not critical.
97
-        ldflags += [ "/PDBSourcePath:" + rebase_path(root_build_dir) ]
98
-      } else {
99
-        # Use a fake fixed base directory for paths in the pdb to make the pdb
100
-        # output fully deterministic and independent of the build directory.
101
-        ldflags += [ "/PDBSourcePath:o:\fake\prefix" ]
102
-      }
103
-    }
104
-  }
105
-
106
   # Tells the compiler not to use absolute paths when passing the default
107
   # paths to the tools it invokes. We don't want this because we don't
108
   # really need it and it can mess up the goma cache entries.
109
@@ -1404,27 +1331,6 @@ config("compiler_deterministic") {
110
   }
111
 }
112
 
113
-config("clang_revision") {
114
-  if (is_clang && clang_base_path == default_clang_base_path) {
115
-    update_args = [
116
-      "--print-revision",
117
-      "--verify-version=$clang_version",
118
-    ]
119
-    if (llvm_force_head_revision) {
120
-      update_args += [ "--llvm-force-head-revision" ]
121
-    }
122
-    clang_revision = exec_script("//tools/clang/scripts/update.py",
123
-                                 update_args,
124
-                                 "trim string")
125
-
126
-    # This is here so that all files get recompiled after a clang roll and
127
-    # when turning clang on or off. (defines are passed via the command line,
128
-    # and build system rebuild things when their commandline changes). Nothing
129
-    # should ever read this define.
130
-    defines = [ "CR_CLANG_REVISION=\"$clang_revision\"" ]
131
-  }
132
-}
133
-
134
 config("rustc_revision") {
135
   if (rustc_revision != "") {
136
     # Similar to the above config, this is here so that all files get recompiled
137
@@ -1714,7 +1620,7 @@ config("chromium_code") {
138
       defines = [ "_HAS_NODISCARD" ]
139
     }
140
   } else {
141
-    cflags = [ "-Wall" ]
142
+    cflags = []
143
     if (treat_warnings_as_errors) {
144
       cflags += [ "-Werror" ]
145
 
146
@@ -1723,10 +1629,6 @@ config("chromium_code") {
147
       # well.
148
       ldflags = [ "-Werror" ]
149
     }
150
-    if (is_clang) {
151
-      # Enable extra warnings for chromium_code when we control the compiler.
152
-      cflags += [ "-Wextra" ]
153
-    }
154
 
155
     if (treat_warnings_as_errors) {
156
       # Turn rustc warnings into the "deny" lint level, which produce compiler
157
@@ -1744,16 +1646,6 @@ config("chromium_code") {
158
       "__STDC_FORMAT_MACROS",
159
     ]
160
 
161
-    if (!is_debug && !using_sanitizer && current_cpu != "s390x" &&
162
-        current_cpu != "s390" && current_cpu != "ppc64" &&
163
-        current_cpu != "mips" && current_cpu != "mips64" &&
164
-        current_cpu != "riscv64" && current_cpu != "loong64") {
165
-      # Non-chromium code is not guaranteed to compile cleanly with
166
-      # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
167
-      # disabled, so only do that for Release build.
168
-      defines += [ "_FORTIFY_SOURCE=2" ]
169
-    }
170
-
171
     if (is_apple) {
172
       cflags_objc = [ "-Wimplicit-retain-self" ]
173
       cflags_objcc = [ "-Wimplicit-retain-self" ]
174
@@ -2122,7 +2014,8 @@ config("default_stack_frames") {
175
 }
176
 
177
 # Default "optimization on" config.
178
-config("optimize") {
179
+config("optimize") { }
180
+config("xoptimize") {
181
   if (is_win) {
182
     if (chrome_pgo_phase != 2) {
183
       # Favor size over speed, /O1 must be before the common flags.
184
@@ -2181,7 +2074,8 @@ config("optimize") {
185
 }
186
 
187
 # Turn off optimizations.
188
-config("no_optimize") {
189
+config("no_optimize") { }
190
+config("xno_optimize") {
191
   if (is_win) {
192
     cflags = [
193
       "/Od",  # Disable optimization.
194
@@ -2221,7 +2115,8 @@ config("no_optimize") {
195
 # Turns up the optimization level. On Windows, this implies whole program
196
 # optimization and link-time code generation which is very expensive and should
197
 # be used sparingly.
198
-config("optimize_max") {
199
+config("optimize_max") { }
200
+config("xoptimize_max") {
201
   if (is_nacl && is_nacl_irt) {
202
     # The NaCl IRT is a special case and always wants its own config.
203
     # Various components do:
204
@@ -2254,7 +2149,8 @@ config("optimize_max") {
205
 #
206
 # TODO(crbug.com/621335) - rework how all of these configs are related
207
 # so that we don't need this disclaimer.
208
-config("optimize_speed") {
209
+config("optimize_speed") { }
210
+config("xoptimize_speed") {
211
   if (is_nacl && is_nacl_irt) {
212
     # The NaCl IRT is a special case and always wants its own config.
213
     # Various components do:
214
@@ -2280,7 +2176,8 @@ config("optimize_speed") {
215
   }
216
 }
217
 
218
-config("optimize_fuzzing") {
219
+config("optimize_fuzzing") { }
220
+config("xoptimize_fuzzing") {
221
   cflags = [ "-O1" ] + common_optimize_on_cflags
222
   rustflags = [ "-Copt-level=1" ]
223
   ldflags = common_optimize_on_ldflags
224
@@ -2405,7 +2302,8 @@ config("win_pdbaltpath") {
225
 }
226
 
227
 # Full symbols.
228
-config("symbols") {
229
+config("symbols") { }
230
+config("xsymbols") {
231
   rustflags = []
232
   if (is_win) {
233
     if (is_clang) {
234
@@ -2548,7 +2446,8 @@ config("symbols") {
235
 # Minimal symbols.
236
 # This config guarantees to hold symbol for stack trace which are shown to user
237
 # when crash happens in unittests running on buildbot.
238
-config("minimal_symbols") {
239
+config("minimal_symbols") { }
240
+config("xminimal_symbols") {
241
   if (is_win) {
242
     # Functions, files, and line tables only.
243
     cflags = []
244
@@ -2622,7 +2521,8 @@ config("minimal_symbols") {
245
 # This configuration contains function names only. That is, the compiler is
246
 # told to not generate debug information and the linker then just puts function
247
 # names in the final debug information.
248
-config("no_symbols") {
249
+config("no_symbols") { }
250
+config("xno_symbols") {
251
   if (is_win) {
252
     ldflags = [ "/DEBUG" ]
253
 
254