Commit d2452b57 authored by Alexandre Julliard's avatar Alexandre Julliard

include: Add asm helper macros to define import variables.

parent 79d8ed48
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <wine/asm.h>
#undef __iob_func #undef __iob_func
extern FILE * __cdecl __iob_func(void); extern FILE * __cdecl __iob_func(void);
...@@ -35,9 +36,4 @@ FILE * __cdecl __acrt_iob_func(unsigned idx) ...@@ -35,9 +36,4 @@ FILE * __cdecl __acrt_iob_func(unsigned idx)
{ {
return __iob_func() + idx; return __iob_func() + idx;
} }
__ASM_GLOBAL_IMPORT(__acrt_iob_func)
#ifdef __i386__
void *_imp____acrt_iob_func = __acrt_iob_func;
#else
void *__imp___acrt_iob_func = __acrt_iob_func;
#endif
...@@ -83,6 +83,28 @@ ...@@ -83,6 +83,28 @@
#define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_STDCALL(#name,args),code) #define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_STDCALL(#name,args),code)
#define __ASM_FASTCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_FASTCALL(#name,args),code) #define __ASM_FASTCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_FASTCALL(#name,args),code)
/* import variables */
#ifdef _WIN64
#define __ASM_DEFINE_IMPORT(name) \
__ASM_BLOCK_BEGIN(__LINE__) \
asm(".data\n\t.balign 8\n\t.globl __imp_" name "\n__imp_" name ":\n\t.quad " name "\n\t.text"); \
__ASM_BLOCK_END
#else
#define __ASM_DEFINE_IMPORT(name) \
__ASM_BLOCK_BEGIN(__LINE__) \
asm(".data\n\t.balign 4\n\t.globl __imp_" name "\n__imp_" name ":\n\t.long " name "\n\t.text"); \
__ASM_BLOCK_END
#endif
#ifdef _WIN32
#define __ASM_GLOBAL_IMPORT(name) __ASM_DEFINE_IMPORT(__ASM_NAME(#name))
#define __ASM_STDCALL_IMPORT(name,args) __ASM_DEFINE_IMPORT(__ASM_STDCALL(#name,args))
#else
#define __ASM_GLOBAL_IMPORT(name) /* nothing */
#define __ASM_STDCALL_IMPORT(name,args) /* nothing */
#endif
/* fastcall support */ /* fastcall support */
#if defined(__i386__) && !defined(_WIN32) #if defined(__i386__) && !defined(_WIN32)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment