1 |
commit: 33f9ed07de27dc089a336b3bffbb80dd86e61615 |
2 |
Author: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 29 01:54:24 2022 +0000 |
4 |
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 29 01:54:24 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=33f9ed07 |
7 |
|
8 |
media-libs/mesa: Fix build for x86 users |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org> |
12 |
|
13 |
.../files/mesa-tls-3-fix-non-initial-exec.patch | 122 +++++++++++++++++++++ |
14 |
media-libs/mesa/mesa-21.3.4.ebuild | 1 + |
15 |
2 files changed, 123 insertions(+) |
16 |
|
17 |
diff --git a/media-libs/mesa/files/mesa-tls-3-fix-non-initial-exec.patch b/media-libs/mesa/files/mesa-tls-3-fix-non-initial-exec.patch |
18 |
new file mode 100644 |
19 |
index 00000000..4ae45ca0 |
20 |
--- /dev/null |
21 |
+++ b/media-libs/mesa/files/mesa-tls-3-fix-non-initial-exec.patch |
22 |
@@ -0,0 +1,122 @@ |
23 |
+From 3aab34171d464f907ed4488ab87c48270381ecde Mon Sep 17 00:00:00 2001 |
24 |
+From: "Alex Xu (Hello71)" <alex_y_xu@×××××.ca> |
25 |
+Date: Tue, 23 Nov 2021 15:24:38 -0500 |
26 |
+Subject: [PATCH] Fix TSD stubs for non-initial-exec case (fixes #5667). |
27 |
+ |
28 |
+ppc64le TSD disabled for now since I am insufficiently familiar with ppc |
29 |
+asm. x86 pthread stubs deleted because adding USE_ELF_TLS to the #if is |
30 |
+isn't worth the effort since it only saves a single function call on |
31 |
+initial entry (TSD stubs are not used for read-only text now). also |
32 |
+potentially fix non-pthread TSD builds (_glapi_Dispatch was undefined), |
33 |
+but untested (could still be broken). |
34 |
+ |
35 |
+Tested-by: Jesse Natalie <jenatali@×××××××××.com> |
36 |
+Tested-by: Jan Beich <jbeich@×××××××.org> |
37 |
+Signed-off-by: Alex Xu (Hello71) <alex_y_xu@×××××.ca> |
38 |
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13935> |
39 |
+--- |
40 |
+ src/mapi/entry.c | 5 ++--- |
41 |
+ src/mapi/entry_x86_tsd.h | 2 +- |
42 |
+ src/mapi/glapi/gen/gl_x86_asm.py | 28 +++------------------------- |
43 |
+ 3 files changed, 6 insertions(+), 29 deletions(-) |
44 |
+ |
45 |
+diff --git a/src/mapi/entry.c b/src/mapi/entry.c |
46 |
+index b120eae31a1..5ebd85011c6 100644 |
47 |
+--- a/src/mapi/entry.c |
48 |
++++ b/src/mapi/entry.c |
49 |
+@@ -47,8 +47,6 @@ |
50 |
+ #endif |
51 |
+ |
52 |
+ /* REALLY_INITIAL_EXEC implies USE_ELF_TLS and __GNUC__ */ |
53 |
+-/* Use TSD stubs for non-IE ELF TLS even though first access is slower because |
54 |
+- * future accesses will be patched */ |
55 |
+ #if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC) |
56 |
+ #include "entry_x86_tls.h" |
57 |
+ #elif defined(USE_X86_ASM) && !defined(GLX_X86_READONLY_TEXT) && defined(__GNUC__) |
58 |
+@@ -57,7 +55,8 @@ |
59 |
+ #include "entry_x86-64_tls.h" |
60 |
+ #elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC) |
61 |
+ #include "entry_ppc64le_tls.h" |
62 |
+-#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(__GNUC__) |
63 |
++/* ppc64le non-IE TSD stubs are possible but not currently implemented */ |
64 |
++#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && !defined(USE_ELF_TLS) && defined(__GNUC__) |
65 |
+ #include "entry_ppc64le_tsd.h" |
66 |
+ #else |
67 |
+ |
68 |
+diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h |
69 |
+index f5d9c41253f..2aa724a70f3 100644 |
70 |
+--- a/src/mapi/entry_x86_tsd.h |
71 |
++++ b/src/mapi/entry_x86_tsd.h |
72 |
+@@ -69,7 +69,7 @@ __asm__(".balign 32\n" |
73 |
+ "popl %ecx\n\t" \ |
74 |
+ "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx\n\t" \ |
75 |
+ LOC_END_SET_ECX \ |
76 |
+- "movl " ENTRY_CURRENT_TABLE "@GOT(%ecx), %eax\n\t" \ |
77 |
++ "movl _glapi_Dispatch@GOT(%ecx), %eax\n\t" \ |
78 |
+ "mov (%eax), %eax\n\t" \ |
79 |
+ "testl %eax, %eax\n\t" \ |
80 |
+ "jne 1f\n\t" \ |
81 |
+diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py |
82 |
+index 4b10db37d7f..057aa54ba3f 100644 |
83 |
+--- a/src/mapi/glapi/gen/gl_x86_asm.py |
84 |
++++ b/src/mapi/glapi/gen/gl_x86_asm.py |
85 |
+@@ -70,7 +70,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): |
86 |
+ print('#endif') |
87 |
+ print('') |
88 |
+ print('') |
89 |
+- print('#ifdef USE_ELF_TLS') |
90 |
++ print('#ifdef REALLY_INITIAL_EXEC') |
91 |
+ print('') |
92 |
+ print('#ifdef GLX_X86_READONLY_TEXT') |
93 |
+ print('# define CTX_INSNS MOV_L(GS:(EAX), EAX)') |
94 |
+@@ -86,17 +86,6 @@ class PrintGenericStubs(gl_XML.gl_print_base): |
95 |
+ print('\tCTX_INSNS ; \\') |
96 |
+ print('\tJMP(GL_OFFSET(off))') |
97 |
+ print('') |
98 |
+- print('#elif defined(HAVE_PTHREAD)') |
99 |
+- print('# define GL_STUB(fn,off,fn_alt)\t\t\t\\') |
100 |
+- print('ALIGNTEXT16;\t\t\t\t\t\t\\') |
101 |
+- print('GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\') |
102 |
+- print('GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\') |
103 |
+- print('\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\') |
104 |
+- print('\tTEST_L(EAX, EAX) ;\t\t\t\t\\') |
105 |
+- print('\tJE(1f) ;\t\t\t\t\t\\') |
106 |
+- print('\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\') |
107 |
+- print('1:\tCALL(_x86_get_dispatch) ;\t\t\t\\') |
108 |
+- print('\tJMP(GL_OFFSET(off))') |
109 |
+ print('#else') |
110 |
+ print('# define GL_STUB(fn,off,fn_alt)\t\t\t\\') |
111 |
+ print('ALIGNTEXT16;\t\t\t\t\t\t\\') |
112 |
+@@ -121,7 +110,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): |
113 |
+ print('') |
114 |
+ print('SEG_TEXT') |
115 |
+ print('') |
116 |
+- print('#ifdef USE_ELF_TLS') |
117 |
++ print('#ifdef REALLY_INITIAL_EXEC') |
118 |
+ print('') |
119 |
+ print('\tGLOBL\tGLNAME(_x86_get_dispatch)') |
120 |
+ print('\tHIDDEN(GLNAME(_x86_get_dispatch))') |
121 |
+@@ -133,19 +122,8 @@ class PrintGenericStubs(gl_XML.gl_print_base): |
122 |
+ print('\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax') |
123 |
+ print('\tret') |
124 |
+ print('') |
125 |
+- print('#elif defined(HAVE_PTHREAD)') |
126 |
+- print('EXTERN GLNAME(_glapi_Dispatch)') |
127 |
+- print('EXTERN GLNAME(_gl_DispatchTSD)') |
128 |
+- print('EXTERN GLNAME(pthread_getspecific)') |
129 |
+- print('') |
130 |
+- print('ALIGNTEXT16') |
131 |
+- print('GLNAME(_x86_get_dispatch):') |
132 |
+- print('\tSUB_L(CONST(24), ESP)') |
133 |
+- print('\tPUSH_L(GLNAME(_gl_DispatchTSD))') |
134 |
+- print('\tCALL(GLNAME(pthread_getspecific))') |
135 |
+- print('\tADD_L(CONST(28), ESP)') |
136 |
+- print('\tRET') |
137 |
+ print('#else') |
138 |
++ print('EXTERN GLNAME(_glapi_Dispatch)') |
139 |
+ print('EXTERN GLNAME(_glapi_get_dispatch)') |
140 |
+ print('#endif') |
141 |
+ print('') |
142 |
+-- |
143 |
+GitLab |
144 |
+ |
145 |
|
146 |
diff --git a/media-libs/mesa/mesa-21.3.4.ebuild b/media-libs/mesa/mesa-21.3.4.ebuild |
147 |
index ec0dad18..f9fd08f6 100644 |
148 |
--- a/media-libs/mesa/mesa-21.3.4.ebuild |
149 |
+++ b/media-libs/mesa/mesa-21.3.4.ebuild |
150 |
@@ -240,6 +240,7 @@ x86? ( |
151 |
PATCHES=( |
152 |
"${FILESDIR}"/mesa-tls.patch |
153 |
"${FILESDIR}"/mesa-tls-2.patch |
154 |
+ "${FILESDIR}"/mesa-tls-3-fix-non-initial-exec.patch |
155 |
) |
156 |
|
157 |
llvm_check_deps() { |