summaryrefslogtreecommitdiff
path: root/newmoon/UXP-Enable-LTO-to-work.patch
blob: 15f806c4337f3d9dbb8e93d954a872b6cea2bb80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This patch was created by Gordon N. Squash.
#
# When applied, this patch makes some minor adjustments to some assembly
# language routines in UXP for the x86 architecture.  Once these adjustments
# are made, UXP can be compiled with LTO (link-time optimization), given a
# proper 'mozconfig' file.
#
# The author discovered that you need to use the following extra lines in your
# mozconfig file in order for LTO to work on the x86 architecture (replace all
# instances of `[n]` with the number of parallel LTO jobs you want -- it's
# generally safe to use the same number here that you use in
# `MAKEOPTS="-j[n]"`):
#
# ```
# export CFLAGS="${CFLAGS} -flto=[n]"
# export CXXFLAGS="${CXXFLAGS} -flto=[n]"
# export LDFLAGS="${LDFLAGS} -Wl,-z,norelro"
# ac_add_options --disable-elf-hack
# ac_add_options --disable-gold
# ```
# You may also want to add "${CFLAGS}" to the `--enable-optimize` option, if
# you want to ensure everything gets LTO-optimized.
#
#===============================================================================
#
# This patch *appears to be* stable.  It does not seem to adversely affect
# UXP, though the author stresses that this patch needs to be tested more widely
# before any conclusions can be drawn about its stability.
#
# WARNING!  This is not an official patch in any way, shape or form!  Do not
#           contact the original authors of UXP for support of this patch!
#
diff -uprN palemoon-29.4.1-original/platform/gfx/ycbcr/yuv_row_posix.cpp palemoon-29.4.1-patched/platform/gfx/ycbcr/yuv_row_posix.cpp
--- palemoon-29.4.1-original/platform/gfx/ycbcr/yuv_row_posix.cpp	2021-09-12 04:41:57.000000000 -0400
+++ palemoon-29.4.1-patched/platform/gfx/ycbcr/yuv_row_posix.cpp	2021-11-08 16:02:31.236354000 -0500
@@ -572,6 +572,8 @@ void PICConvertYUVToRGB32Row_SSE(const u
 
   asm(
   ".text\n"
+  ".globl PICConvertYUVToRGB32Row_SSE\n"
+  ".type PICConvertYUVToRGB32Row_SSE,@function\n"
   "PICConvertYUVToRGB32Row_SSE:\n"
   "pusha\n"
   "mov    0x24(%esp),%edx\n"
@@ -649,6 +651,8 @@ void PICScaleYUVToRGB32Row_SSE(const uin
 
   asm(
   ".text\n"
+  ".globl PICScaleYUVToRGB32Row_SSE\n"
+  ".type PICScaleYUVToRGB32Row_SSE,@function\n"
   "PICScaleYUVToRGB32Row_SSE:\n"
   "pusha\n"
   "mov    0x24(%esp),%edx\n"
@@ -741,6 +745,8 @@ void PICLinearScaleYUVToRGB32Row_SSE(con
 
   asm(
   ".text\n"
+  ".globl PICLinearScaleYUVToRGB32Row_SSE\n"
+  ".type PICLinearScaleYUVToRGB32Row_SSE,@function\n"
   "PICLinearScaleYUVToRGB32Row_SSE:\n"
   "pusha\n"
   "mov    0x24(%esp),%edx\n"
diff -uprN palemoon-29.4.1-original/platform/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp palemoon-29.4.1-patched/platform/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp
--- palemoon-29.4.1-original/platform/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp	2021-09-12 04:42:29.000000000 -0400
+++ palemoon-29.4.1-patched/platform/xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp	2021-11-08 15:50:33.268324000 -0500
@@ -9,7 +9,7 @@
 #include "xptc_gcc_x86_unix.h"
 
 extern "C" {
-static void ATTRIBUTE_USED __attribute__ ((regparm(3)))
+void ATTRIBUTE_USED __attribute__ ((regparm(3)))
 invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d)
 {
     for(uint32_t i = paramCount; i >0; i--, d++, s++)
diff -uprN palemoon-29.4.1-original/platform/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp palemoon-29.4.1-patched/platform/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp
--- palemoon-29.4.1-original/platform/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp	2021-09-12 04:42:29.000000000 -0400
+++ palemoon-29.4.1-patched/platform/xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp	2021-11-08 15:51:36.440327000 -0500
@@ -10,7 +10,7 @@
 #include "xptc_gcc_x86_unix.h"
 
 extern "C" {
-static nsresult ATTRIBUTE_USED
+nsresult ATTRIBUTE_USED
 __attribute__ ((regparm (3)))
 PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args)
 {
bgstack15