From a228e6551c34c45fad44eb2b130302f788315822 Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Sat, 4 Mar 2023 23:26:24 -0600 Subject: [PATCH] build.gn updates --- arm/android_ARM32_args.gn | 3 ++ arm/android_ARM64_args.gn | 3 ++ arm/build/config/compiler/BUILD.gn | 29 +-------------- arm/build/config/win/BUILD.gn | 6 ++-- other/AVX2/build/config/compiler/BUILD.gn | 35 +++++++++++++------ other/AVX2/build/config/win/BUILD.gn | 6 ++-- other/SSE3/build/config/win/BUILD.gn | 4 +-- other/WIN7/TODO.txt | 4 +++ other/i386/SSE2/build/config/win/BUILD.gn | 4 +-- src/build/config/compiler/BUILD.gn | 8 +++-- src/build/config/win/BUILD.gn | 6 ++-- .../ffmpeg/chromium/scripts/build_ffmpeg.py | 1 - 12 files changed, 50 insertions(+), 59 deletions(-) create mode 100644 other/WIN7/TODO.txt diff --git a/arm/android_ARM32_args.gn b/arm/android_ARM32_args.gn index a05412ab..5e04d544 100644 --- a/arm/android_ARM32_args.gn +++ b/arm/android_ARM32_args.gn @@ -12,6 +12,9 @@ arm_use_neon = false arm_optionally_use_neon = false arm_fpu = "vfpv3-d16" is_official_build = true +is_high_end_android = false +optimize_for_size = false +optimize_for_speed = true is_debug = false debuggable_apks = false is_cfi = true diff --git a/arm/android_ARM64_args.gn b/arm/android_ARM64_args.gn index a6f01b0d..f406bd34 100644 --- a/arm/android_ARM64_args.gn +++ b/arm/android_ARM64_args.gn @@ -12,6 +12,9 @@ arm_use_neon = true arm_optionally_use_neon = false arm_fpu = "neon" is_official_build = true +is_high_end_android = true +optimize_for_size = false +optimize_for_speed = true is_debug = false debuggable_apks = false is_cfi = true diff --git a/arm/build/config/compiler/BUILD.gn b/arm/build/config/compiler/BUILD.gn index bf33c7d5..d6451608 100644 --- a/arm/build/config/compiler/BUILD.gn +++ b/arm/build/config/compiler/BUILD.gn @@ -978,10 +978,9 @@ config("compiler_cpu_abi") { "-O3", "-mavx", "-maes", - "-mvaes", "-mpclmul", ] - ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-mvaes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=4", ] + ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=4", ] } else if (current_cpu == "x86") { cflags += [ "-m32" ] ldflags += [ "-m32", "-Wl,-O3", "-msse3", ] @@ -2029,38 +2028,12 @@ if (is_win) { } common_optimize_on_cflags += [ - "-mllvm", "-extra-vectorizer-passes", - "-mllvm", "-enable-cond-stores-vec", - "-mllvm", "-slp-vectorize-hor-store", - "-mllvm", "-enable-loopinterchange", - "-mllvm", "-enable-loop-distribute", - "-mllvm", "-enable-unroll-and-jam", - "-mllvm", "-enable-loop-flatten", - "-mllvm", "-interleave-small-loop-scalar-reduction", - "-mllvm", "-unroll-runtime-multi-exit", - "-mllvm", "-aggressive-ext-opt", - "-mllvm", "-enable-interleaved-mem-accesses", "/O2", "/clang:-O3", - "/clang:-mavx", - "/clang:-maes", - "/clang:-mvaes", - "/clang:-mpclmul", "-Xclang", "-O3", ] common_optimize_on_ldflags += [ - "-mllvm:-extra-vectorizer-passes", - "-mllvm:-enable-cond-stores-vec", - "-mllvm:-slp-vectorize-hor-store", - "-mllvm:-enable-loopinterchange", - "-mllvm:-enable-loop-distribute", - "-mllvm:-enable-unroll-and-jam", - "-mllvm:-enable-loop-flatten", - "-mllvm:-interleave-small-loop-scalar-reduction", - "-mllvm:-unroll-runtime-multi-exit", - "-mllvm:-aggressive-ext-opt", - "-mllvm:-enable-interleaved-mem-accesses", ] # /OPT:ICF is not desirable in Debug builds, since code-folding can result in diff --git a/arm/build/config/win/BUILD.gn b/arm/build/config/win/BUILD.gn index bd611857..0c17243d 100644 --- a/arm/build/config/win/BUILD.gn +++ b/arm/build/config/win/BUILD.gn @@ -135,12 +135,10 @@ config("compiler") { "/O2", "-mavx", "-maes", - "-mvaes", "-mpclmul", "/clang:-O3", "/clang:-mavx", "/clang:-maes", - "/clang:-mvaes", "/clang:-mpclmul", "-Xclang", "-O3", "-Wno-unused-command-line-argument", @@ -548,13 +546,13 @@ config("static_crt") { if (current_cpu == "x64") { # The number after the comma is the minimum required OS version. # 5.2 = Windows Server 2003. - subsystem_version_suffix = ",5.2" + subsystem_version_suffix = ",5.02" } else if (current_cpu == "arm64") { # Windows ARM64 requires Windows 10. subsystem_version_suffix = ",10.0" } else { # 5.1 = Windows XP. - subsystem_version_suffix = ",5.1" + subsystem_version_suffix = ",5.01" } config("console") { diff --git a/other/AVX2/build/config/compiler/BUILD.gn b/other/AVX2/build/config/compiler/BUILD.gn index eca001aa..ad2dcfe9 100644 --- a/other/AVX2/build/config/compiler/BUILD.gn +++ b/other/AVX2/build/config/compiler/BUILD.gn @@ -903,13 +903,12 @@ config("compiler") { # building with ThinLTO, no optimization is performed in the link step. config("thinlto_optimize_default") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { + lto_opt_level = 3 if (is_win) { - lto_opt_level = 2 ldflags = [ "/opt:lldlto=" + lto_opt_level ] ldflags += [ "-mllvm:-enable-pre=false", ] } else { - lto_opt_level = 3 ldflags = [ "-Wl,--lto-O" + lto_opt_level ] } } @@ -925,13 +924,16 @@ config("thinlto_optimize_default") { # use it on important targets such as the main browser executable or dll. config("thinlto_optimize_max") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { + if (thin_lto_enable_optimizations) { + lto_opt_level = 3 + } else { + lto_opt_level = 3 + } if (is_win) { - lto_opt_level = 2 ldflags = [ "/opt:lldlto=" + lto_opt_level ] ldflags += [ "-mllvm:-enable-pre=false", ] } else { - lto_opt_level = 3 ldflags = [ "-Wl,--lto-O" + lto_opt_level ] } } @@ -943,7 +945,7 @@ config("thinlto_optimize_max") { # tweak code generation for a particular CPU do not belong here! # See "compiler_codegen", below. config("compiler_cpu_abi") { - cflags = [] + cflags = [ "-O3", ] ldflags = [] defines = [] @@ -967,10 +969,10 @@ config("compiler_cpu_abi") { "-O3", "-march=x86-64-v3", "-mtune=generic", - "-mvaes", + "-maes", "-ffp-contract=fast", ] - ldflags += [ "-m64", "-Wl,-O3", "-Wl,-mllvm,-march=x86-64-v3", "-mvaes", "-Wl,-mllvm,-fp-contract=fast", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=4", ] + ldflags += [ "-m64", "-Wl,-O3", "-Wl,-mllvm,-march=x86-64-v3", "-maes", "-Wl,-mllvm,-fp-contract=fast", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=4", ] } else if (current_cpu == "x86") { cflags += [ "-m32" ] ldflags += [ "-m32", "-Wl,-O3", "-msse3", ] @@ -1992,8 +1994,8 @@ config("no_incompatible_pointer_warnings") { # Shared settings for both "optimize" and "optimize_max" configs. # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags. - common_optimize_on_cflags = [] - common_optimize_on_ldflags = [] + common_optimize_on_cflags = [ "-O3", ] + common_optimize_on_ldflags = [ "-Wl,-O3", ] if (is_win) { @@ -2035,6 +2037,14 @@ if (is_win) { "-mllvm", "-aggressive-ext-opt", "-mllvm", "-enable-interleaved-mem-accesses", "-mllvm", "-enable-masked-interleaved-mem-accesses", + "-mllvm", "-enable-gvn-hoist", + "/O2", + "/clang:-O3", + "/clang:-mavx", + "/clang:-mavx2", + "/clang:-maes", + "/clang:-mpclmul", + "-Xclang", "-O3", ] common_optimize_on_ldflags += [ @@ -2055,6 +2065,7 @@ if (is_win) { "-mllvm:-aggressive-ext-opt", "-mllvm:-enable-interleaved-mem-accesses", "-mllvm:-enable-masked-interleaved-mem-accesses", + "-mllvm:-enable-gvn-hoist", ] # /OPT:ICF is not desirable in Debug builds, since code-folding can result in @@ -2091,6 +2102,7 @@ if (is_win) { "-mllvm", "-aggressive-ext-opt", "-mllvm", "-enable-interleaved-mem-accesses", "-mllvm", "-enable-masked-interleaved-mem-accesses", + "-mllvm", "-enable-gvn-hoist", "-O3", ] @@ -2112,6 +2124,7 @@ if (is_win) { "-Wl,-mllvm,-aggressive-ext-opt", "-Wl,-mllvm,-enable-interleaved-mem-accesses", "-Wl,-mllvm,-enable-masked-interleaved-mem-accesses", + "-Wl,-mllvm,-enable-gvn-hoist", "-Wl,-O3", ] @@ -2304,7 +2317,7 @@ config("optimize_max") { if (is_win) { # Favor speed over size, /O2 must be before the common flags. # /O2 implies /Ot, /Oi, and /GF. - cflags = [ "/O2" ] + common_optimize_on_cflags + cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags } else if (optimize_for_fuzzing) { cflags = [ "-O3" ] + common_optimize_on_cflags } else { @@ -2337,7 +2350,7 @@ config("optimize_speed") { if (is_win) { # Favor speed over size, /O2 must be before the common flags. # /O2 implies /Ot, /Oi, and /GF. - cflags = [ "/O2" ] + common_optimize_on_cflags + cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags } else if (optimize_for_fuzzing) { cflags = [ "-O3" ] + common_optimize_on_cflags } else { diff --git a/other/AVX2/build/config/win/BUILD.gn b/other/AVX2/build/config/win/BUILD.gn index 623ad6cd..e6be05b6 100644 --- a/other/AVX2/build/config/win/BUILD.gn +++ b/other/AVX2/build/config/win/BUILD.gn @@ -133,9 +133,7 @@ config("compiler") { if (current_cpu == "x86" || current_cpu == "x64") { cflags += [ "/arch:AVX2", - "/fp:fast", "-maes", - "-mvaes", ] } @@ -538,13 +536,13 @@ config("static_crt") { if (current_cpu == "x64") { # The number after the comma is the minimum required OS version. # 5.2 = Windows Server 2003. - subsystem_version_suffix = ",5.2" + subsystem_version_suffix = ",5.02" } else if (current_cpu == "arm64") { # Windows ARM64 requires Windows 10. subsystem_version_suffix = ",10.0" } else { # 5.1 = Windows XP. - subsystem_version_suffix = ",5.1" + subsystem_version_suffix = ",5.01" } config("console") { diff --git a/other/SSE3/build/config/win/BUILD.gn b/other/SSE3/build/config/win/BUILD.gn index 99d50761..8cf50a5e 100644 --- a/other/SSE3/build/config/win/BUILD.gn +++ b/other/SSE3/build/config/win/BUILD.gn @@ -542,13 +542,13 @@ config("static_crt") { if (current_cpu == "x64") { # The number after the comma is the minimum required OS version. # 5.2 = Windows Server 2003. - subsystem_version_suffix = ",5.2" + subsystem_version_suffix = ",5.02" } else if (current_cpu == "arm64") { # Windows ARM64 requires Windows 10. subsystem_version_suffix = ",10.0" } else { # 5.1 = Windows XP. - subsystem_version_suffix = ",5.1" + subsystem_version_suffix = ",5.01" } config("console") { diff --git a/other/WIN7/TODO.txt b/other/WIN7/TODO.txt new file mode 100644 index 00000000..0671c654 --- /dev/null +++ b/other/WIN7/TODO.txt @@ -0,0 +1,4 @@ +Backport bookmarks bar, quiet notifications, and all flags patches. +Add AVX2 fix. +Use new logo for main and installer. +Use diff --git a/other/i386/SSE2/build/config/win/BUILD.gn b/other/i386/SSE2/build/config/win/BUILD.gn index 4271b4e3..32d61dfe 100644 --- a/other/i386/SSE2/build/config/win/BUILD.gn +++ b/other/i386/SSE2/build/config/win/BUILD.gn @@ -542,13 +542,13 @@ config("static_crt") { if (current_cpu == "x64") { # The number after the comma is the minimum required OS version. # 5.2 = Windows Server 2003. - subsystem_version_suffix = ",5.2" + subsystem_version_suffix = ",5.02" } else if (current_cpu == "arm64") { # Windows ARM64 requires Windows 10. subsystem_version_suffix = ",10.0" } else { # 5.1 = Windows XP. - subsystem_version_suffix = ",5.1" + subsystem_version_suffix = ",5.01" } config("console") { diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index bd013c8c..f293dbac 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -962,10 +962,9 @@ config("compiler_cpu_abi") { "-O3", "-mavx", "-maes", - "-mvaes", "-mpclmul", ] - ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-mvaes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=4", ] + ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=4", ] } else if (current_cpu == "x86") { cflags += [ "-m32" ] ldflags += [ "-m32", "-Wl,-O3", "-msse3", ] @@ -2030,11 +2029,11 @@ if (is_win) { "-mllvm", "-aggressive-ext-opt", "-mllvm", "-enable-interleaved-mem-accesses", "-mllvm", "-enable-masked-interleaved-mem-accesses", + "-mllvm", "-enable-gvn-hoist", "/O2", "/clang:-O3", "/clang:-mavx", "/clang:-maes", - "/clang:-mvaes", "/clang:-mpclmul", "-Xclang", "-O3", ] @@ -2057,6 +2056,7 @@ if (is_win) { "-mllvm:-aggressive-ext-opt", "-mllvm:-enable-interleaved-mem-accesses", "-mllvm:-enable-masked-interleaved-mem-accesses", + "-mllvm:-enable-gvn-hoist", ] # /OPT:ICF is not desirable in Debug builds, since code-folding can result in @@ -2093,6 +2093,7 @@ if (is_win) { "-mllvm", "-aggressive-ext-opt", "-mllvm", "-enable-interleaved-mem-accesses", "-mllvm", "-enable-masked-interleaved-mem-accesses", + "-mllvm", "-enable-gvn-hoist", "-O3", ] @@ -2114,6 +2115,7 @@ if (is_win) { "-Wl,-mllvm,-aggressive-ext-opt", "-Wl,-mllvm,-enable-interleaved-mem-accesses", "-Wl,-mllvm,-enable-masked-interleaved-mem-accesses", + "-Wl,-mllvm,-enable-gvn-hoist", "-Wl,-O3", ] diff --git a/src/build/config/win/BUILD.gn b/src/build/config/win/BUILD.gn index 4f91a32d..852ca674 100644 --- a/src/build/config/win/BUILD.gn +++ b/src/build/config/win/BUILD.gn @@ -135,12 +135,10 @@ config("compiler") { "/O2", "-mavx", "-maes", - "-mvaes", "-mpclmul", "/clang:-O3", "/clang:-mavx", "/clang:-maes", - "/clang:-mvaes", "/clang:-mpclmul", "-Xclang", "-O3", "-Wno-unused-command-line-argument", @@ -549,13 +547,13 @@ config("static_crt") { if (current_cpu == "x64") { # The number after the comma is the minimum required OS version. # 5.2 = Windows Server 2003. - subsystem_version_suffix = ",5.2" + subsystem_version_suffix = ",5.02" } else if (current_cpu == "arm64") { # Windows ARM64 requires Windows 10. subsystem_version_suffix = ",10.0" } else { # 5.1 = Windows XP. - subsystem_version_suffix = ",5.1" + subsystem_version_suffix = ",5.01" } config("console") { diff --git a/src/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py b/src/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py index c17f40e1..09463edc 100755 --- a/src/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py +++ b/src/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py @@ -734,7 +734,6 @@ def ConfigureAndBuild(target_arch, target_os, host_os, host_arch, parallel_jobs, '--extra-cflags=-O3', '--extra-cflags=-mavx', '--extra-cflags=-maes', - '--extra-cflags=-mvaes', '--extra-cflags=-mpclmul', '--enable-decoder=theora,vp8', '--enable-parser=vp3,vp8',