X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmapi%2Fentry_x86_tsd.h;h=1cf3ea2964eaa23f8b9e7d4f787686ff1716f70c;hb=a82889e53733ffe11bf3c7a8be5fe53e382d02aa;hp=c479c199e238a8f4778e71d83a6d814b2ddf8924;hpb=d5e9426b9605264608e0b1204ebf818103f1f011;p=mesa.git diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h index c479c199e23..1cf3ea2964e 100644 --- a/src/mapi/entry_x86_tsd.h +++ b/src/mapi/entry_x86_tsd.h @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.9 * * Copyright (C) 2010 LunarG Inc. * @@ -26,9 +25,19 @@ * Chia-I Wu */ -#include "u_macros.h" +#ifdef __CET__ +#define ENDBR "endbr32\n\t" +#else +#define ENDBR +#endif -#define X86_ENTRY_SIZE 32 +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY +#define HIDDEN __attribute__((visibility("hidden"))) +#else +#define HIDDEN +#endif + +#define X86_ENTRY_SIZE 64 __asm__(".text\n" ".balign 32\n" @@ -41,12 +50,20 @@ __asm__(".text\n" func ":" #define STUB_ASM_CODE(slot) \ - "movl " ENTRY_CURRENT_TABLE ", %eax\n\t" \ + ENDBR \ + "call 1f\n\t" \ + "1:\n\t" \ + "popl %ecx\n\t" \ + "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx\n\t" \ + "movl " ENTRY_CURRENT_TABLE "@GOT(%ecx), %eax\n\t" \ + "mov (%eax), %eax\n\t" \ "testl %eax, %eax\n\t" \ - "je 1f\n\t" \ - "jmp *(4 * " slot ")(%eax)\n" \ + "jne 1f\n\t" \ + "push %ebx\n\t" \ + "movl %ecx, %ebx\n\t" \ + "call " ENTRY_CURRENT_TABLE_GET "@PLT\n\t" \ + "popl %ebx\n\t" \ "1:\n\t" \ - "call " ENTRY_CURRENT_TABLE_GET "\n\t" \ "jmp *(4 * " slot ")(%eax)" #define MAPI_TMP_STUB_ASM_GCC @@ -60,8 +77,8 @@ __asm__(".balign 32\n" #include #include "u_execmem.h" -static const char x86_entry_start[]; -static const char x86_entry_end[]; +extern const char x86_entry_start[] HIDDEN; +extern const char x86_entry_end[] HIDDEN; void entry_patch_public(void)