Use CDECL_NO_CONV for va_list thunks; remove .globl

This commit is contained in:
2025-11-02 22:02:24 -07:00
parent 6f4808401b
commit 8c39e06cca
5 changed files with 10 additions and 11 deletions

View File

@@ -302,14 +302,14 @@ void *CDECL __acrt_iob_func(unsigned int index) {
return nullptr;
}
int CDECL __stdio_common_vfprintf(unsigned long long options, FILE *stream, const char *format, void *locale,
int CDECL_NO_CONV __stdio_common_vfprintf(unsigned long long options, FILE *stream, const char *format, void *locale,
va_list args) {
HOST_CONTEXT_GUARD();
DEBUG_LOG("__stdio_common_vfprintf(%llu, %p, %s, %p, %p)\n", options, stream, format, locale, args);
return vfprintf(stream, format, args);
}
int CDECL __stdio_common_vsprintf(unsigned long long options, char *buffer, SIZE_T len, const char *format,
int CDECL_NO_CONV __stdio_common_vsprintf(unsigned long long options, char *buffer, SIZE_T len, const char *format,
void *locale, va_list args) {
HOST_CONTEXT_GUARD();
DEBUG_LOG("__stdio_common_vsprintf(%llu, %p, %zu, %s, %p, ...)\n", options, buffer, len, format, locale);

View File

@@ -66,9 +66,9 @@ void CDECL _exit(int status);
void CDECL abort();
signal_handler CDECL signal(int signum, signal_handler handler);
void *CDECL __acrt_iob_func(unsigned int index);
int CDECL __stdio_common_vfprintf(unsigned long long options, FILE *stream, const char *format, void *locale,
int CDECL_NO_CONV __stdio_common_vfprintf(unsigned long long options, FILE *stream, const char *format, void *locale,
va_list args);
int CDECL __stdio_common_vsprintf(unsigned long long options, char *buffer, SIZE_T len, const char *format,
int CDECL_NO_CONV __stdio_common_vsprintf(unsigned long long options, char *buffer, SIZE_T len, const char *format,
void *locale, va_list args);
void CDECL qsort(void *base, SIZE_T num, SIZE_T size, sort_compare compare);
int CDECL puts(const char *str);

View File

@@ -1071,7 +1071,7 @@ namespace msvcrt {
return 0;
}
int CDECL _vsnprintf(char *buffer, SIZE_T count, const char *format, va_list args) {
int CDECL_NO_CONV _vsnprintf(char *buffer, SIZE_T count, const char *format, va_list args) {
HOST_CONTEXT_GUARD();
DEBUG_LOG("_vsnprintf(%p, %zu, %s, %p)\n", buffer, count, format, args);
if (!buffer || !format) {
@@ -1818,7 +1818,7 @@ namespace msvcrt {
return std::fflush(host);
}
int CDECL vfwprintf(FILE *stream, const uint16_t *format, va_list args) {
int CDECL_NO_CONV vfwprintf(FILE *stream, const uint16_t *format, va_list args) {
HOST_CONTEXT_GUARD();
DEBUG_LOG("vfwprintf(%p, %s, ...)\n", stream, wideStringToString(format).c_str());
FILE *host = mapToHostFile(stream ? stream : stdout);
@@ -2217,7 +2217,7 @@ namespace msvcrt {
return mapToHostFile(stream);
}
int CDECL vfprintf(FILE *stream, const char *format, va_list args) {
int CDECL_NO_CONV vfprintf(FILE *stream, const char *format, va_list args) {
HOST_CONTEXT_GUARD();
DEBUG_LOG("vfprintf(stream=%p, format=%s, args=%p)\n", stream, format, args);
if (!format || !stream) {

View File

@@ -88,7 +88,7 @@ int CDECL _ismbcdigit(unsigned int ch);
int CDECL _stricmp(const char *lhs, const char *rhs);
int CDECL _strnicmp(const char *lhs, const char *rhs, SIZE_T count);
int CDECL _memicmp(const void *lhs, const void *rhs, SIZE_T count);
int CDECL _vsnprintf(char *buffer, SIZE_T count, const char *format, va_list args);
int CDECL_NO_CONV _vsnprintf(char *buffer, SIZE_T count, const char *format, va_list args);
int CDECL_NO_CONV _snprintf(char *buffer, SIZE_T count, const char *format, ...);
int CDECL_NO_CONV sprintf(char *buffer, const char *format, ...);
int CDECL_NO_CONV printf(const char *format, ...);
@@ -147,7 +147,7 @@ void *CDECL memmove(void *dest, const void *src, SIZE_T count);
int CDECL memcmp(const void *lhs, const void *rhs, SIZE_T count);
void CDECL qsort(void *base, SIZE_T num, SIZE_T size, int (*compar)(const void *, const void *));
int CDECL fflush(FILE *stream);
int CDECL vfwprintf(FILE *stream, const uint16_t *format, va_list args);
int CDECL_NO_CONV vfwprintf(FILE *stream, const uint16_t *format, va_list args);
FILE *CDECL fopen(const char *filename, const char *mode);
int CDECL _dup2(int fd1, int fd2);
int CDECL _isatty(int fd);
@@ -176,7 +176,7 @@ int CDECL _crt_debugger_hook(int value);
int CDECL _configthreadlocale(int mode);
void CDECL __setusermatherr(void *handler);
void CDECL _cexit();
int CDECL vfprintf(FILE *stream, const char *format, va_list args);
int CDECL_NO_CONV vfprintf(FILE *stream, const char *format, va_list args);
int CDECL_NO_CONV fprintf(FILE *stream, const char *format, ...);
int CDECL fputc(int ch, FILE *stream);
SIZE_T CDECL fwrite(const void *buffer, SIZE_T size, SIZE_T count, FILE *stream);

View File

@@ -535,7 +535,6 @@ def emit_host_to_guest_thunks(
lines.append(
f"\t# Arg {i} (slot_size={arg.slot_size}, primitive={arg.primitive}, sign_extended={arg.sign_extended})"
)
lines.append(f".globl {thunk}")
lines.append(f".weak {thunk}")
lines.append(f".type {thunk}, @function")
lines.append(f"{thunk}:")