1 $NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.6 2022/03/13 15:50:05 tnn Exp $
3 NetBSD only supports zero-initialized initial-exec tls variables in conjuction
4 with dlopen(3) at the moment.
6 table_noop_array is only defined for shared-glapi.
7 es1api and es2api are not going to be patched for NetBSD.
9 --- src/mapi/entry_x86-64_tls.h.orig 2021-07-14 20:04:57.805030000 +0000
10 +++ src/mapi/entry_x86-64_tls.h
17 "x86_64_entry_start:");
19 #define STUB_ASM_ENTRY(func) \
21 ".type " func ", @function\n" \
28 +#if defined(__NetBSD__)
29 +#define STUB_ASM_CODE(slot) \
30 + "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
31 + "movq %fs:(%rax), %r11\n\t" \
32 + "testq %r11, %r11\n\t" \
34 + "jmp *(8 * " slot ")(%r11)\n\t" \
36 + "callq " ENTRY_CURRENT_TABLE_GET "@PLT\n\t" \
37 + "jmp *(8 * " slot ")(%rax)"
39 #define STUB_ASM_CODE(slot) \
41 "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
42 "movq %fs:(%rax), %r11\n\t" \
43 "jmp *(8 * " slot ")(%r11)"
48 @@ -85,7 +97,7 @@ x86_64_entry_start[] HIDDEN;
50 entry_get_public(int slot)
52 - return (mapi_func) (x86_64_entry_start + slot * 32);
53 + return (mapi_func) (x86_64_entry_start + slot * 64);