Skip to content

Commit

Permalink
angleproject: fix building on arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
raedrizqie authored and lazka committed Sep 3, 2024
1 parent 7d97b01 commit dff1117
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 35 deletions.
70 changes: 37 additions & 33 deletions mingw-w64-angleproject/001-add-mingw-toolchain.patch
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ index 8fd6760f3..0dae22f48 100644
if (clang_use_chrome_plugins) {
cflags = []
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
index 4e6708bdd..e36ecefa3 100644
index 4e6708bdd..ac5a3c120 100644
--- a/config/compiler/BUILD.gn
+++ b/config/compiler/BUILD.gn
@@ -317,13 +317,13 @@ config("compiler") {
Expand Down Expand Up @@ -400,7 +400,7 @@ index 4e6708bdd..e36ecefa3 100644
if (treat_warnings_as_errors) {
cflags += [ "/WX" ]
}
@@ -1603,10 +1603,31 @@ config("default_warnings") {
@@ -1603,10 +1603,33 @@ config("default_warnings") {
# files.
cflags += [ "-Wno-packed-not-aligned" ]
}
Expand All @@ -415,13 +415,15 @@ index 4e6708bdd..e36ecefa3 100644
+ if (!is_clang) {
+ cflags += [
+ "-Wno-array-bounds",
+ "-Wno-conversion-null",
+ "-Wno-dangling-pointer",
+ "-Wno-shift-count-overflow",
+ "-Wno-sign-compare",
+ "-Wno-stringop-overflow", # False positive overflow error on gcc 10
+ "-Wno-stringop-truncation",
+ "-Wno-unused-but-set-variable",
+ "-Wno-stringop-overflow", # False positive overflow error on gcc 10
+ ]
+ cflags_cc += [
+ "-Wno-conversion-null",
+ ]
+ }
+ }
Expand All @@ -433,7 +435,7 @@ index 4e6708bdd..e36ecefa3 100644
cflags += [
# Disables.
"-Wno-missing-field-initializers", # "struct foo f = {0};"
@@ -1711,7 +1732,7 @@ config("prevent_unsafe_narrowing") {
@@ -1711,7 +1734,7 @@ config("prevent_unsafe_narrowing") {
# part of Chromium.

config("chromium_code") {
Expand All @@ -442,7 +444,7 @@ index 4e6708bdd..e36ecefa3 100644
if (is_clang) {
cflags = [ "/W4" ] # Warning level 4.

@@ -1798,7 +1819,7 @@ config("no_chromium_code") {
@@ -1798,7 +1821,7 @@ config("no_chromium_code") {
cflags_cc = []
defines = []

Expand All @@ -451,7 +453,7 @@ index 4e6708bdd..e36ecefa3 100644
if (is_clang) {
cflags += [ "/W3" ] # Warning level 3.
}
@@ -1865,7 +1886,7 @@ config("noshadowing") {
@@ -1865,7 +1888,7 @@ config("noshadowing") {
# Allows turning Run-Time Type Identification on or off.

config("rtti") {
Expand All @@ -460,7 +462,7 @@ index 4e6708bdd..e36ecefa3 100644
cflags_cc = [ "/GR" ]
} else {
cflags_cc = [ "-frtti" ]
@@ -1875,7 +1896,7 @@ config("rtti") {
@@ -1875,7 +1898,7 @@ config("rtti") {
config("no_rtti") {
# Some sanitizer configs may require RTTI to be left enabled globally
if (!use_rtti) {
Expand All @@ -469,7 +471,7 @@ index 4e6708bdd..e36ecefa3 100644
cflags_cc = [ "/GR-" ]
} else {
cflags_cc = [ "-fno-rtti" ]
@@ -1919,7 +1940,7 @@ config("thin_archive") {
@@ -1919,7 +1942,7 @@ config("thin_archive") {
# confuses lldb.
if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) {
arflags = [ "-T" ]
Expand All @@ -478,7 +480,7 @@ index 4e6708bdd..e36ecefa3 100644
arflags = [ "/llvmlibthin" ]
}
}
@@ -1930,7 +1951,7 @@ config("thin_archive") {
@@ -1930,7 +1953,7 @@ config("thin_archive") {
# Note: exceptions are disallowed in Google code.

config("exceptions") {
Expand All @@ -487,7 +489,7 @@ index 4e6708bdd..e36ecefa3 100644
# Enables exceptions in the STL.
if (!use_custom_libcxx) {
defines = [ "_HAS_EXCEPTIONS=1" ]
@@ -1943,7 +1964,7 @@ config("exceptions") {
@@ -1943,7 +1966,7 @@ config("exceptions") {
}

config("no_exceptions") {
Expand All @@ -496,7 +498,7 @@ index 4e6708bdd..e36ecefa3 100644
# Disables exceptions in the STL.
# libc++ uses the __has_feature macro to control whether to use exceptions,
# so defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also
@@ -2009,7 +2030,7 @@ config("no_incompatible_pointer_warnings") {
@@ -2009,7 +2032,7 @@ 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.
Expand All @@ -505,7 +507,7 @@ index 4e6708bdd..e36ecefa3 100644
common_optimize_on_cflags = [
"/Ob2", # Both explicit and auto inlining.
"/Oy-", # Disable omitting frame pointers, must be after /O2.
@@ -2088,7 +2109,7 @@ if (is_win) {
@@ -2088,7 +2111,7 @@ if (is_win) {
}

config("default_stack_frames") {
Expand All @@ -514,7 +516,7 @@ index 4e6708bdd..e36ecefa3 100644
if (enable_frame_pointers) {
cflags = [ "-fno-omit-frame-pointer" ]

@@ -2115,7 +2136,7 @@ config("default_stack_frames") {
@@ -2115,7 +2138,7 @@ config("default_stack_frames") {

# Default "optimization on" config.
config("optimize") {
Expand All @@ -523,7 +525,7 @@ index 4e6708bdd..e36ecefa3 100644
if (chrome_pgo_phase != 2) {
# Favor size over speed, /O1 must be before the common flags.
# /O1 implies /Os and /GF.
@@ -2174,7 +2195,7 @@ config("optimize") {
@@ -2174,7 +2197,7 @@ config("optimize") {

# Turn off optimizations.
config("no_optimize") {
Expand All @@ -532,7 +534,7 @@ index 4e6708bdd..e36ecefa3 100644
cflags = [
"/Od", # Disable optimization.
"/Ob0", # Disable all inlining (on by default).
@@ -2226,7 +2247,7 @@ config("optimize_max") {
@@ -2226,7 +2249,7 @@ config("optimize_max") {
configs = [ "//build/config/nacl:irt_optimize" ]
} else {
ldflags = common_optimize_on_ldflags
Expand All @@ -541,7 +543,7 @@ index 4e6708bdd..e36ecefa3 100644
# Favor speed over size, /O2 must be before the common flags.
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
@@ -2259,7 +2280,7 @@ config("optimize_speed") {
@@ -2259,7 +2282,7 @@ config("optimize_speed") {
configs = [ "//build/config/nacl:irt_optimize" ]
} else {
ldflags = common_optimize_on_ldflags
Expand All @@ -550,7 +552,7 @@ index 4e6708bdd..e36ecefa3 100644
# Favor speed over size, /O2 must be before the common flags.
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
@@ -2396,7 +2417,7 @@ config("win_pdbaltpath") {
@@ -2396,7 +2419,7 @@ config("win_pdbaltpath") {

# Full symbols.
config("symbols") {
Expand All @@ -559,7 +561,7 @@ index 4e6708bdd..e36ecefa3 100644
if (is_clang) {
cflags = [
# Debug information in the .obj files.
@@ -2485,7 +2506,7 @@ config("symbols") {
@@ -2485,7 +2508,7 @@ config("symbols") {
# DWARF info may be corrupt; offsets in a range list entry are in different
# sections" there. Maybe just a bug in nacl_switch_32.S.
_enable_gdb_index =
Expand All @@ -568,7 +570,7 @@ index 4e6708bdd..e36ecefa3 100644
current_os != "zos" && (use_gold || use_lld) &&
# Disable on non-fission 32-bit Android because it pushes
# libcomponents_unittests over the 4gb size limit.
@@ -2536,7 +2557,7 @@ config("symbols") {
@@ -2536,7 +2559,7 @@ config("symbols") {
# This config guarantees to hold symbol for stack trace which are shown to user
# when crash happens in unittests running on buildbot.
config("minimal_symbols") {
Expand All @@ -577,7 +579,7 @@ index 4e6708bdd..e36ecefa3 100644
# Functions, files, and line tables only.
cflags = []

@@ -2610,7 +2631,7 @@ config("minimal_symbols") {
@@ -2610,7 +2633,7 @@ config("minimal_symbols") {
# told to not generate debug information and the linker then just puts function
# names in the final debug information.
config("no_symbols") {
Expand All @@ -586,7 +588,7 @@ index 4e6708bdd..e36ecefa3 100644
ldflags = [ "/DEBUG" ]

# All configs using /DEBUG should include this:
@@ -2710,6 +2731,11 @@ buildflag_header("compiler_buildflags") {
@@ -2710,6 +2733,11 @@ buildflag_header("compiler_buildflags") {
config("cet_shadow_stack") {
if (enable_cet_shadow_stack && is_win) {
assert(target_cpu == "x64")
Expand Down Expand Up @@ -764,7 +766,7 @@ index 35b7ba7aa..710b8c2df 100644
"/Oy-",
"/Ob0",
diff --git a/config/win/BUILD.gn b/config/win/BUILD.gn
index 692e7adf5..a7856c68b 100644
index 692e7adf5..c16c471df 100644
--- a/config/win/BUILD.gn
+++ b/config/win/BUILD.gn
@@ -50,6 +50,7 @@ declare_args() {
Expand All @@ -775,12 +777,14 @@ index 692e7adf5..a7856c68b 100644
if (current_cpu == "x86") {
asmflags = [
# When /safeseh is specified, the linker will only produce an image if it
@@ -215,6 +216,17 @@ config("compiler") {
@@ -215,6 +216,19 @@ config("compiler") {
# the source file is a no-op.
"/ignore:4221",
]
+ } else {
+ cflags = [ "-msse3" ]
+ if (current_cpu == "x86" || current_cpu == "x64") {
+ cflags = [ "-msse3" ]
+ }
+ if (current_cpu == "x86") {
+ ldflags = [ "-m32" ]
+ if (!is_clang) {
Expand All @@ -793,7 +797,7 @@ index 692e7adf5..a7856c68b 100644
}

# This is included by reference in the //build/config/compiler:runtime_library
@@ -315,19 +327,27 @@ config("sdk_link") {
@@ -315,19 +329,27 @@ config("sdk_link") {
# targets who want different library configurations can remove this and specify
# their own.
config("common_linker_setup") {
Expand Down Expand Up @@ -833,7 +837,7 @@ index 692e7adf5..a7856c68b 100644
}
}

@@ -336,7 +356,7 @@ config("default_cfg_compiler") {
@@ -336,7 +358,7 @@ config("default_cfg_compiler") {
# This is needed to allow functions to be called by code that is built
# with CFG enabled, such as system libraries.
# The CFG guards are only emitted if |win_enable_cfg_guards| is enabled.
Expand All @@ -842,7 +846,7 @@ index 692e7adf5..a7856c68b 100644
if (win_enable_cfg_guards) {
cflags = [ "/guard:cf" ]
} else {
@@ -351,7 +371,7 @@ config("disable_guards_cfg_compiler") {
@@ -351,7 +373,7 @@ config("disable_guards_cfg_compiler") {
# Emit table of address-taken functions for Control-Flow Guard (CFG).
# This is needed to allow functions to be called by code that is built
# with CFG enabled, such as system libraries.
Expand All @@ -851,15 +855,15 @@ index 692e7adf5..a7856c68b 100644
cflags = [ "/guard:cf,nochecks" ]
}
}
@@ -478,6 +498,7 @@ config("default_crt") {
@@ -478,6 +500,7 @@ config("default_crt") {
# when the debug CRT is part of the bottleneck. This also avoids *implicitly*
# defining _DEBUG.
config("release_crt") {
+if (is_msvs) {
if (is_component_build) {
cflags = [ "/MD" ]

@@ -493,8 +514,10 @@ config("release_crt") {
@@ -493,8 +516,10 @@ config("release_crt") {
}
}
}
Expand All @@ -870,7 +874,7 @@ index 692e7adf5..a7856c68b 100644
if (is_debug) {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
@@ -508,8 +531,10 @@ config("dynamic_crt") {
@@ -508,8 +533,10 @@ config("dynamic_crt") {
}
}
}
Expand All @@ -881,7 +885,7 @@ index 692e7adf5..a7856c68b 100644
if (is_debug) {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
@@ -523,27 +548,34 @@ config("static_crt") {
@@ -523,27 +550,34 @@ config("static_crt") {
}
}
}
Expand Down Expand Up @@ -928,7 +932,7 @@ index 692e7adf5..a7856c68b 100644
}

# Incremental linking ----------------------------------------------------------
@@ -609,3 +641,20 @@ config("pdb_larger_than_4gb") {
@@ -609,3 +643,20 @@ config("pdb_larger_than_4gb") {
}
ldflags += [ "/pdbpagesize:8192" ]
}
Expand Down
4 changes: 2 additions & 2 deletions mingw-w64-angleproject/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _realname=angleproject
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.r21358.2e285bb5
pkgrel=6
pkgrel=7
pkgdesc='A conformant OpenGL ES implementation for Windows, Mac, Linux, iOS and Android (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
Expand Down Expand Up @@ -65,7 +65,7 @@ sha256sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'16db1feedcb5d2e8e1a9b20ac96f0be2f56d2419001de99cfd3d4508a2ec4242'
'573a9e12727926e2ddddf0863bed926ef3764ec64ab75d27e3ec48648849786d'
'c7fc66c1c0b154eb61c666f845720b576187984d139f64ef452467d5efff4509'
'04bcb05dc2f349639bf4e62ee92d758b756e56532ceb9184c2d7dca01e67a38e'
'c3ee4b4194c041db225bcf3f699bf1042ddc0c845b1da142ca07a8bf1f7f80f8'
Expand Down

0 comments on commit dff1117

Please sign in to comment.