X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmapi%2Fentry_x86_tls.h;h=bdaa97374ba6bc4a8715f60f499a2910d19256ff;hb=2840bc3065b9e991b2c5880a2ee02e2458a758c4;hp=b938679979236589128080e849054460c9272173;hpb=b2b8639d8e901008b4501e35957d27da170de042;p=mesa.git diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h index b9386799792..bdaa97374ba 100644 --- a/src/mapi/entry_x86_tls.h +++ b/src/mapi/entry_x86_tls.h @@ -27,13 +27,19 @@ #include +#ifdef __CET__ +#define ENDBR "endbr32\n\t" +#else +#define ENDBR +#endif + #ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY #define HIDDEN __attribute__((visibility("hidden"))) #else #define HIDDEN #endif -#define X86_ENTRY_SIZE 16 +#define X86_ENTRY_SIZE 32 __asm__(".text"); @@ -58,9 +64,14 @@ __asm__(".balign 16\n" ".balign 16\n" \ func ":" -#define STUB_ASM_CODE(slot) \ - "call x86_current_tls\n\t" \ - "movl %gs:(%eax), %eax\n\t" \ +#define STUB_ASM_CODE(slot) \ + ENDBR \ + "call 1f\n" \ + "1:\n\t" \ + "popl %eax\n\t" \ + "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \ + "movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t" \ + "movl %gs:(%eax), %eax\n\t" \ "jmp *(4 * " slot ")(%eax)" #define MAPI_TMP_STUB_ASM_GCC