Alexandre Julliard : winebuild: Don' t import standard C functions in Unix mode.
Alexandre Julliard
julliard at winehq.org
Mon Jun 17 15:54:19 CDT 2019
Module: wine
Branch: master
Commit: 450f0fa6967f35a888d24c9ad37585f4e4134a1b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=450f0fa6967f35a888d24c9ad37585f4e4134a1b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 17 09:24:45 2019 +0200
winebuild: Don't import standard C functions in Unix mode.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winebuild/build.h | 2 ++
tools/winebuild/import.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 382829c..ad6e2a8 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -38,6 +38,8 @@
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
typedef enum
{
TYPE_VARIABLE, /* variable */
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 6c68dbd..7cf0655 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -38,6 +38,93 @@
#include "wine/list.h"
#include "build.h"
+/* standard C functions that are also exported from ntdll */
+static const char *stdc_names[] =
+{
+ "abs",
+ "atan",
+ "atoi",
+ "atol",
+ "bsearch",
+ "ceil",
+ "cos",
+ "fabs",
+ "floor",
+ "isalnum",
+ "isalpha",
+ "iscntrl",
+ "isdigit",
+ "isgraph",
+ "islower",
+ "isprint",
+ "ispunct",
+ "isspace",
+ "isupper",
+ "iswalpha",
+ "iswctype",
+ "iswdigit",
+ "iswlower",
+ "iswspace",
+ "iswxdigit",
+ "isxdigit",
+ "labs",
+ "log",
+ "mbstowcs",
+ "memchr",
+ "memcmp",
+ "memcpy",
+ "memmove",
+ "memset",
+ "pow",
+ "qsort",
+ "sin",
+ "sprintf",
+ "sqrt",
+ "sscanf",
+ "strcat",
+ "strchr",
+ "strcmp",
+ "strcpy",
+ "strcspn",
+ "strlen",
+ "strncat",
+ "strncmp",
+ "strncpy",
+ "strnlen",
+ "strpbrk",
+ "strrchr",
+ "strspn",
+ "strstr",
+ "strtol",
+ "strtoul",
+ "swprintf",
+ "tan",
+ "tolower",
+ "toupper",
+ "towlower",
+ "towupper",
+ "vsprintf",
+ "wcscat",
+ "wcschr",
+ "wcscmp",
+ "wcscpy",
+ "wcscspn",
+ "wcslen",
+ "wcsncat",
+ "wcsncmp",
+ "wcsncpy",
+ "wcspbrk",
+ "wcsrchr",
+ "wcsspn",
+ "wcsstr",
+ "wcstok",
+ "wcstol",
+ "wcstombs",
+ "wcstoul"
+};
+
+static struct strarray stdc_functions = { stdc_names, ARRAY_SIZE(stdc_names), ARRAY_SIZE(stdc_names) };
+
struct import_func
{
const char *name;
@@ -566,7 +653,8 @@ void read_undef_symbols( DLLSPEC *spec, char **argv )
add_undef_import( p + strlen( import_func_prefix ), 0 );
else if (!strncmp( p, import_ord_prefix, strlen(import_ord_prefix) ))
add_undef_import( p + strlen( import_ord_prefix ), 1 );
- else strarray_add( &undef_symbols, xstrdup( p ), NULL );
+ else if (!unix_lib || !find_name( p, &stdc_functions ))
+ strarray_add( &undef_symbols, xstrdup( p ), NULL );
}
if ((err = pclose( f ))) warning( "%s failed with status %d\n", cmd, err );
free( cmd );
More information about the wine-cvs
mailing list