summaryrefslogtreecommitdiff
path: root/thirdparty/freetype
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-06-08 13:58:50 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-06-08 13:59:13 +0300
commitefb5d7adf00df745e6eb0bfc5d5f4fa000f5135e (patch)
tree0029c7d4d03d574e1403abf0ccbc7af37e5e9c54 /thirdparty/freetype
parent43f05bd6a0f98181b1055a1bd81d4bc8c3eae4ff (diff)
Fix FreeType crashing in GCC + LTO builds.
Diffstat (limited to 'thirdparty/freetype')
-rw-r--r--thirdparty/freetype/patches/fix_gcc_lto_build.diff34
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.c9
2 files changed, 43 insertions, 0 deletions
diff --git a/thirdparty/freetype/patches/fix_gcc_lto_build.diff b/thirdparty/freetype/patches/fix_gcc_lto_build.diff
new file mode 100644
index 0000000000..3c22b464c2
--- /dev/null
+++ b/thirdparty/freetype/patches/fix_gcc_lto_build.diff
@@ -0,0 +1,34 @@
+diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
+index 622035aa79..5d9e1600b7 100644
+--- a/thirdparty/freetype/src/smooth/ftgrays.c
++++ b/thirdparty/freetype/src/smooth/ftgrays.c
+@@ -1907,6 +1907,9 @@ typedef ptrdiff_t FT_PtrDist;
+ 0 /* delta */
+ )
+
++// -- GODOT start --
++ static volatile int _lto_dummy = 0;
++// -- GODOT end --
+
+ static int
+ gray_convert_glyph_inner( RAS_ARG,
+@@ -1928,6 +1931,9 @@ typedef ptrdiff_t FT_PtrDist;
+ ras.max_ey,
+ ras.cell_null - ras.cell_free,
+ ras.cell_null - ras.cell_free == 1 ? "" : "s" ));
++// -- GODOT start --
++ _lto_dummy = error; // Prevents LTO from removing this branch.
++// -- GODOT end --
+ }
+ else
+ {
+@@ -1935,6 +1941,9 @@ typedef ptrdiff_t FT_PtrDist;
+
+ FT_TRACE7(( "band [%d..%d]: to be bisected\n",
+ ras.min_ey, ras.max_ey ));
++// -- GODOT start --
++ _lto_dummy = error; // Prevents LTO from removing this branch.
++// -- GODOT end --
+ }
+
+ return error;
diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
index 622035aa79..5d9e1600b7 100644
--- a/thirdparty/freetype/src/smooth/ftgrays.c
+++ b/thirdparty/freetype/src/smooth/ftgrays.c
@@ -1907,6 +1907,9 @@ typedef ptrdiff_t FT_PtrDist;
0 /* delta */
)
+// -- GODOT start --
+ static volatile int _lto_dummy = 0;
+// -- GODOT end --
static int
gray_convert_glyph_inner( RAS_ARG,
@@ -1928,6 +1931,9 @@ typedef ptrdiff_t FT_PtrDist;
ras.max_ey,
ras.cell_null - ras.cell_free,
ras.cell_null - ras.cell_free == 1 ? "" : "s" ));
+// -- GODOT start --
+ _lto_dummy = error; // Prevents LTO from removing this branch.
+// -- GODOT end --
}
else
{
@@ -1935,6 +1941,9 @@ typedef ptrdiff_t FT_PtrDist;
FT_TRACE7(( "band [%d..%d]: to be bisected\n",
ras.min_ey, ras.max_ey ));
+// -- GODOT start --
+ _lto_dummy = error; // Prevents LTO from removing this branch.
+// -- GODOT end --
}
return error;