Skip to content

Commit 362c295

Browse files
BtbNcharles-lunarg
authored andcommitted
Fix stdcall assembly symbol naming on win32
1 parent 022c002 commit 362c295

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

loader/unknown_ext_chain_gas_x86.S

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,16 @@ vkdev_ext\num:
8888
.else
8989

9090
.macro PhysDevExtTramp num
91+
#if defined(_WIN32)
92+
.global "_vkPhysDevExtTramp\num\()@4"
93+
"_vkPhysDevExtTramp\num\()@4":
94+
#else
9195
.global vkPhysDevExtTramp\num
9296
#if defined(__ELF__)
9397
.hidden vkPhysDevExtTramp\num
9498
#endif
9599
vkPhysDevExtTramp\num:
100+
#endif
96101
_CET_ENDBR
97102
mov eax, [esp + 4] # Load the wrapped VkPhysicalDevice into eax
98103
mov ecx, [eax + PHYS_DEV_OFFSET_PHYS_DEV_TRAMP] # Load the unwrapped VkPhysicalDevice into ecx
@@ -102,11 +107,16 @@ vkPhysDevExtTramp\num:
102107
.endm
103108

104109
.macro PhysDevExtTermin num
110+
#if defined(_WIN32)
111+
.global "_vkPhysDevExtTermin\num\()@4"
112+
"_vkPhysDevExtTermin\num\()@4":
113+
#else
105114
.global vkPhysDevExtTermin\num
106115
#if defined(__ELF__)
107116
.hidden vkPhysDevExtTermin\num
108117
#endif
109118
vkPhysDevExtTermin\num:
119+
#endif
110120
_CET_ENDBR
111121
mov ecx, [esp + 4] # Move the wrapped VkPhysicalDevice into ecx
112122
mov eax, [ecx + ICD_TERM_OFFSET_PHYS_DEV_TERM] # Store the loader_icd_term* in eax
@@ -121,18 +131,27 @@ terminError\num:
121131
push 0 # Push zero (third arg)
122132
push VULKAN_LOADER_ERROR_BIT # Push the error logging bit (second arg)
123133
push eax # Push the loader_instance (first arg)
134+
#if defined(_WIN32)
135+
call _loader_log_asm_function_not_supported # Log the error message before we crash
136+
#else
124137
call loader_log_asm_function_not_supported # Log the error message before we crash
138+
#endif
125139
add esp, 20 # Clean up the args
126140
mov eax, 0
127141
jmp eax # Crash intentionally by jumping to address zero
128142
.endm
129143

130144
.macro DevExtTramp num
145+
#if defined(_WIN32)
146+
.global "_vkdev_ext\num\()@4"
147+
"_vkdev_ext\num\()@4":
148+
#else
131149
.global vkdev_ext\num
132150
#if defined(__ELF__)
133151
.hidden vkdev_ext\num
134152
#endif
135153
vkdev_ext\num:
154+
#endif
136155
_CET_ENDBR
137156
mov eax, dword ptr [esp + 4] # Dereference the handle to get the dispatch table
138157
mov eax, dword ptr [eax] # Dereference the chain_device to get the loader_dispatch

0 commit comments

Comments
 (0)