[Mesa-dev] [PATCH] Fix symbol 'x86_64_entry_start' is alreadydefined when building with LLVM/clang
Marc Dietrich
marvin24 at gmx.de
Tue May 19 04:12:50 PDT 2015
Am Montag, 18. Mai 2015, 13:35:48 schrieb Tomasz Gajc:
> Hello,
> my patch is based on that LLVM bug. Mesa with that patch was tested only
> with clang by me, and I haven't found any issues when running my system
> with mesa with that patch applied.
we had this discussion in the past already, see
http://lists.freedesktop.org/archives/mesa-dev/2015-February/076979.html
IMHO, we should just add a pointer to the head of the dispatch table (e.g., by
using an autogenerated define). The patch below should work for most cases
though (when glapi is compiled in), but is not a generic solution.
Marc
diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h
index 5c03b04..f61acdf 100644
--- a/src/mapi/entry_x86-64_tls.h
+++ b/src/mapi/entry_x86-64_tls.h
@@ -26,9 +26,7 @@
*/
-__asm__(".text\n"
- ".balign 32\n"
- "x86_64_entry_start:");
+extern void shared_dispatch_stub_0();
#define STUB_ASM_ENTRY(func) \
".globl " func "\n" \
@@ -61,13 +59,10 @@ entry_patch_public(void)
{
}
-static char
-x86_64_entry_start[];
-
mapi_func
entry_get_public(int slot)
{
- return (mapi_func) (x86_64_entry_start + slot * 32);
+ return (mapi_func) ((char *)shared_dispatch_stub_0 + slot * 32);
}
void
diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h
index 46d2ece..974fc0a 100644
--- a/src/mapi/entry_x86_tls.h
+++ b/src/mapi/entry_x86_tls.h
@@ -41,8 +41,7 @@ __asm__("x86_current_tls:\n\t"
__asm__(".section wtext, \"awx\", @progbits");
#endif /* GLX_X86_READONLY_TEXT */
-__asm__(".balign 16\n"
- "x86_entry_start:");
+extern void shared_glapi_dispatch_stub_0();
#define STUB_ASM_ENTRY(func) \
".globl " func "\n" \
@@ -71,7 +70,6 @@ __asm__(".text");
extern unsigned long
x86_current_tls();
-static char x86_entry_start[];
static char x86_entry_end[];
void
@@ -86,7 +84,7 @@ entry_patch_public(void)
*((unsigned long *) (patch + 2)) = x86_current_tls();
- for (entry = x86_entry_start; entry < x86_entry_end; entry += 16)
+ for (entry = shared_glapi_dispatch_stub_0; entry < x86_entry_end; entry +=
16)
memcpy(entry, patch, sizeof(patch));
#endif
}
@@ -94,7 +92,7 @@ entry_patch_public(void)
mapi_func
entry_get_public(int slot)
{
- return (mapi_func) (x86_entry_start + slot * 16);
+ return (mapi_func) (&shared_glapi_dispatch_stub_0 + slot * 16);
}
void
diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h
index ea7bacb..021d1aa 100644
--- a/src/mapi/entry_x86_tsd.h
+++ b/src/mapi/entry_x86_tsd.h
@@ -28,9 +28,7 @@
#define X86_ENTRY_SIZE 32
-__asm__(".text\n"
- ".balign 32\n"
- "x86_entry_start:");
+extern void shared_dispatch_stub_0();
#define STUB_ASM_ENTRY(func) \
".globl " func "\n" \
@@ -58,7 +56,6 @@ __asm__(".balign 32\n"
#include <string.h>
#include "u_execmem.h"
-static const char x86_entry_start[];
static const char x86_entry_end[];
void
@@ -69,7 +66,7 @@ entry_patch_public(void)
mapi_func
entry_get_public(int slot)
{
- return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE);
+ return (mapi_func) (shared_dispatch_stub_0 + slot * X86_ENTRY_SIZE);
}
void
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150519/596cdccc/attachment-0001.sig>
More information about the mesa-dev
mailing list