* Chia-I Wu <olv@lunarg.com>
*/
-#ifdef HAVE_FUNC_ATTRIBUTE_VISIBIITY
+#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 32
+#define X86_ENTRY_SIZE 64
__asm__(".text\n"
".balign 32\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