Added patch to pass '-read_only_relocs suppress' to the linker on OSX and enable patchset to use Nt* function wrappers.

This commit is contained in:
Sebastian Lackner 2015-10-30 23:48:00 +01:00
parent 7e1bf8aca0
commit d2f012b3d1
7 changed files with 69 additions and 35 deletions

2
debian/changelog vendored
View File

@ -10,6 +10,8 @@ wine-staging (1.7.54) UNRELEASED; urgency=low
* Added patches for memory allocation cleanup in gdiplus functions.
* Added patch to implement hal.KeQueryPerformanceCounter.
* Added patch to fix build failure (introduced by makefile rewrite).
* Added patch to pass '-read_only_relocs suppress' to the linker on OSX and
enable patchset to use Nt* function wrappers.
* Removed patch to implement kernel32.GetPhysicallyInstalledSystemMemory
(accepted upstream).
* Partially removed patches for ws2_32 TransmitFile (accepted upstream).

View File

@ -0,0 +1,30 @@
From d6feff32b27e0661406b4f24ec7932f919a9628a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 30 Oct 2015 23:43:02 +0100
Subject: winegcc: Pass '-read_only_relocs suppress' to the linker on OSX.
---
tools/winegcc/winegcc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index ad139f5..220784b 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -377,7 +377,12 @@ static const strarray* get_lddllflags( const struct options *opts, const strarra
strarray_add( flags, "-bundle" );
strarray_add( flags, "-multiply_defined" );
strarray_add( flags, "suppress" );
- if (opts->target_cpu == CPU_POWERPC)
+ if (opts->target_cpu == CPU_x86)
+ {
+ strarray_add( flags, "-read_only_relocs" );
+ strarray_add( flags, "suppress" );
+ }
+ else if (opts->target_cpu == CPU_POWERPC)
{
strarray_add( flags, "-read_only_relocs" );
strarray_add( flags, "warning" );
--
2.6.1

View File

@ -1,4 +1,4 @@
From 127b83239a2d762d974fcbf6b14a6298c659b7cc Mon Sep 17 00:00:00 2001
From 446c222f1cda30dd0cc4c36a2feb4256537dec7d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Oct 2015 02:32:58 +0200
Subject: ntdll: Use wrapper functions for syscalls.
@ -141,7 +141,7 @@ index 5c42010..12b2995 100644
HARDERROR_RESPONSE_OPTION ResponseOption, PHARDERROR_RESPONSE Response )
{
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 8f89ba5..f75463a 100644
index 1027b54..1cde19c 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -298,7 +298,8 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
@ -224,7 +224,7 @@ index 8f89ba5..f75463a 100644
PVOID apc_context, PIO_STATUS_BLOCK io, ULONG code,
PVOID in_buffer, ULONG in_size, PVOID out_buffer, ULONG out_size)
{
@@ -1908,7 +1916,8 @@ static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb,
@@ -1913,7 +1921,8 @@ static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb,
/******************************************************************************
* NtNotifyChangeDirectoryFile [NTDLL.@]
*/
@ -234,7 +234,7 @@ index 8f89ba5..f75463a 100644
void *apc_context, PIO_STATUS_BLOCK iosb, void *buffer,
ULONG buffer_size, ULONG filter, BOOLEAN subtree )
{
@@ -1967,7 +1976,8 @@ NTSTATUS WINAPI NtNotifyChangeDirectoryFile( HANDLE handle, HANDLE event, PIO_AP
@@ -1972,7 +1981,8 @@ NTSTATUS WINAPI NtNotifyChangeDirectoryFile( HANDLE handle, HANDLE event, PIO_AP
* Success: 0. IoStatusBlock is updated.
* Failure: An NTSTATUS error code describing the error.
*/
@ -244,7 +244,7 @@ index 8f89ba5..f75463a 100644
IN HANDLE FileHandle,
PIO_STATUS_BLOCK IoStatusBlock,
PVOID FsInformation,
@@ -2272,7 +2282,8 @@ static NTSTATUS fill_name_info( const ANSI_STRING *unix_name, FILE_NAME_INFORMAT
@@ -2277,7 +2287,8 @@ static NTSTATUS fill_name_info( const ANSI_STRING *unix_name, FILE_NAME_INFORMAT
* Success: 0. IoStatusBlock and FileInformation are updated.
* Failure: An NTSTATUS error code describing the error.
*/
@ -254,7 +254,7 @@ index 8f89ba5..f75463a 100644
PVOID ptr, LONG len, FILE_INFORMATION_CLASS class )
{
static const size_t info_sizes[] =
@@ -2598,7 +2609,8 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
@@ -2603,7 +2614,8 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
* Success: 0. io is updated.
* Failure: An NTSTATUS error code describing the error.
*/
@ -264,7 +264,7 @@ index 8f89ba5..f75463a 100644
PVOID ptr, ULONG len, FILE_INFORMATION_CLASS class)
{
int fd, needs_close;
@@ -2895,7 +2907,8 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
@@ -2900,7 +2912,8 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
/******************************************************************************
* NtQueryFullAttributesFile (NTDLL.@)
*/
@ -274,7 +274,7 @@ index 8f89ba5..f75463a 100644
FILE_NETWORK_OPEN_INFORMATION *info )
{
ANSI_STRING unix_name;
@@ -2939,7 +2952,8 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
@@ -2944,7 +2957,8 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
* NtQueryAttributesFile (NTDLL.@)
* ZwQueryAttributesFile (NTDLL.@)
*/
@ -284,7 +284,7 @@ index 8f89ba5..f75463a 100644
{
ANSI_STRING unix_name;
NTSTATUS status;
@@ -3160,7 +3174,8 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info )
@@ -3165,7 +3179,8 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info )
* Success: 0. io and buffer are updated.
* Failure: An NTSTATUS error code describing the error.
*/
@ -294,7 +294,7 @@ index 8f89ba5..f75463a 100644
PVOID buffer, ULONG length,
FS_INFORMATION_CLASS info_class )
{
@@ -3308,7 +3323,8 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
@@ -3313,7 +3328,8 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
* Success: 0. Atrributes read into buffer
* Failure: An NTSTATUS error code describing the error.
*/
@ -304,7 +304,7 @@ index 8f89ba5..f75463a 100644
BOOLEAN single_entry, PVOID ea_list, ULONG ea_list_len,
PULONG ea_index, BOOLEAN restart )
{
@@ -3334,7 +3350,8 @@ NTSTATUS WINAPI NtQueryEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer
@@ -3339,7 +3355,8 @@ NTSTATUS WINAPI NtQueryEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer
* Success: 0. Attributes are updated
* Failure: An NTSTATUS error code describing the error.
*/
@ -314,7 +314,7 @@ index 8f89ba5..f75463a 100644
{
FIXME("(%p,%p,%p,%d) stub\n", hFile, iosb, buffer, length);
return STATUS_ACCESS_DENIED;
@@ -3354,7 +3371,8 @@ NTSTATUS WINAPI NtSetEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer,
@@ -3359,7 +3376,8 @@ NTSTATUS WINAPI NtSetEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer,
* Success: 0. IoStatusBlock is updated.
* Failure: An NTSTATUS error code describing the error.
*/
@ -324,7 +324,7 @@ index 8f89ba5..f75463a 100644
{
NTSTATUS ret;
HANDLE hEvent = NULL;
@@ -3396,7 +3414,8 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock
@@ -3401,7 +3419,8 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock
*
*
*/
@ -334,7 +334,7 @@ index 8f89ba5..f75463a 100644
PIO_APC_ROUTINE apc, void* apc_user,
PIO_STATUS_BLOCK io_status, PLARGE_INTEGER offset,
PLARGE_INTEGER count, ULONG* key, BOOLEAN dont_wait,
@@ -3468,7 +3487,8 @@ NTSTATUS WINAPI NtLockFile( HANDLE hFile, HANDLE lock_granted_event,
@@ -3473,7 +3492,8 @@ NTSTATUS WINAPI NtLockFile( HANDLE hFile, HANDLE lock_granted_event,
*
*
*/
@ -344,7 +344,7 @@ index 8f89ba5..f75463a 100644
PLARGE_INTEGER offset, PLARGE_INTEGER count,
PULONG key )
{
@@ -3499,7 +3519,8 @@ NTSTATUS WINAPI NtUnlockFile( HANDLE hFile, PIO_STATUS_BLOCK io_status,
@@ -3504,7 +3524,8 @@ NTSTATUS WINAPI NtUnlockFile( HANDLE hFile, PIO_STATUS_BLOCK io_status,
*
*
*/
@ -354,7 +354,7 @@ index 8f89ba5..f75463a 100644
POBJECT_ATTRIBUTES attr, PIO_STATUS_BLOCK iosb,
ULONG sharing, ULONG dispo, ULONG options,
ULONG pipe_type, ULONG read_mode,
@@ -3558,7 +3579,8 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
@@ -3563,7 +3584,8 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
*
*
*/
@ -364,7 +364,7 @@ index 8f89ba5..f75463a 100644
{
NTSTATUS status;
HANDLE hFile;
@@ -3578,7 +3600,8 @@ NTSTATUS WINAPI NtDeleteFile( POBJECT_ATTRIBUTES ObjectAttributes )
@@ -3583,7 +3605,8 @@ NTSTATUS WINAPI NtDeleteFile( POBJECT_ATTRIBUTES ObjectAttributes )
*
*
*/
@ -374,7 +374,7 @@ index 8f89ba5..f75463a 100644
{
TRACE("%p %p %p\n", hFile, iosb, io_status );
@@ -3599,7 +3622,8 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATU
@@ -3604,7 +3627,8 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATU
*
*
*/
@ -384,7 +384,7 @@ index 8f89ba5..f75463a 100644
{
TRACE("%p %p\n", hFile, io_status );
@@ -3632,7 +3656,8 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
@@ -3637,7 +3661,8 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
* RETURNS
* An NT status code
*/
@ -419,7 +419,7 @@ index 831f049..ecbc885 100644
FIXME("(%p), stub!\n",DriverServiceName);
return STATUS_NOT_IMPLEMENTED;
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 2acaa83..e48e6d4 100644
index 8ea1ddd..19d5b6e 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -74,7 +74,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
@ -733,14 +733,14 @@ index 2acaa83..e48e6d4 100644
{
FIXME("(%d, %p, %d, %p, %d, %p), stub\n", command, inbuffer, inbuflength, outbuffer, outbuflength, retlength);
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index cbd19db..0f9534a 100644
index cbd19db..e3f902f 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -262,6 +262,23 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
"ret $(4*" #args ")" ) /* fake ret to make copy protections happy */
#endif
+#if defined(__i386__) && defined(__linux__)
+#if defined(__i386__)
+
+#define SYSCALL( name ) __syscall_ ## name
+#define DEFINE_SYSCALL_ENTRYPOINT( name, args ) \
@ -750,12 +750,12 @@ index cbd19db..0f9534a 100644
+ "call *%edx\n\t" \
+ "ret $(4*" #args ")" )
+
+#else /* defined(__i386__) && defined(__linux__) */
+#else /* defined(__i386__) */
+
+#define SYSCALL( name ) name
+#define DEFINE_SYSCALL_ENTRYPOINT( name, args ) /* nothing */
+
+#endif /* defined(__i386__) && defined(__linux__) */
+#endif /* defined(__i386__) */
+
#define HASH_STRING_ALGORITHM_DEFAULT 0
#define HASH_STRING_ALGORITHM_X65599 1
@ -1311,10 +1311,10 @@ index 886da86..9ec38f5 100644
NTSTATUS status = raise_exception( rec, context, first_chance );
if (status == STATUS_SUCCESS) NtSetContextThread( GetCurrentThread(), context );
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 575a770..b4d4122 100644
index 524de68..574b086 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -3558,7 +3558,8 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
@@ -3617,7 +3617,8 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
/*******************************************************************
* NtRaiseException (NTDLL.@)
*/

View File

@ -1,4 +1,4 @@
From 34347e0af48ce1fb1343b5d975d7fd9faf6ba1ab Mon Sep 17 00:00:00 2001
From 4e541d44f6cf1e1003bdc4203e50a4c2fe45fcc0 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Oct 2015 05:17:26 +0200
Subject: ntdll: APCs should call the implementation instead of the syscall
@ -10,7 +10,7 @@ Subject: ntdll: APCs should call the implementation instead of the syscall
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 0f9534a..620cae8 100644
index e3f902f..5566080 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -272,6 +272,19 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
@ -30,11 +30,11 @@ index 0f9534a..620cae8 100644
+DECLARE_SYSCALL_ENTRYPOINT( NtUnlockVirtualMemory );
+DECLARE_SYSCALL_ENTRYPOINT( NtUnmapViewOfSection );
+
#else /* defined(__i386__) && defined(__linux__) */
#else /* defined(__i386__) */
#define SYSCALL( name ) name
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 95111ad..d2b15cb 100644
index 356d631..5d7be34 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -424,7 +424,7 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )

View File

@ -3888,14 +3888,16 @@ fi
# | dlls/ntdll/nt.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/om.c, dlls/ntdll/process.c, dlls/ntdll/reg.c,
# | dlls/ntdll/resource.c, dlls/ntdll/sec.c, dlls/ntdll/server.c, dlls/ntdll/signal_arm.c, dlls/ntdll/signal_arm64.c,
# | dlls/ntdll/signal_i386.c, dlls/ntdll/signal_powerpc.c, dlls/ntdll/signal_x86_64.c, dlls/ntdll/sync.c,
# | dlls/ntdll/thread.c, dlls/ntdll/time.c, dlls/ntdll/virtual.c
# | dlls/ntdll/thread.c, dlls/ntdll/time.c, dlls/ntdll/virtual.c, tools/winegcc/winegcc.c
# |
if test "$enable_ntdll_Syscall_Wrappers" -eq 1; then
patch_apply ntdll-Syscall_Wrappers/0001-ntdll-Use-wrapper-functions-for-syscalls.patch
patch_apply ntdll-Syscall_Wrappers/0002-ntdll-APCs-should-call-the-implementation-instead-of.patch
patch_apply ntdll-Syscall_Wrappers/0003-ntdll-Syscalls-should-not-call-Nt-Ex-thunk-wrappers.patch
patch_apply ntdll-Syscall_Wrappers/0004-ntdll-Run-directory-initialization-function-early-du.patch
patch_apply ntdll-Syscall_Wrappers/0001-winegcc-Pass-read_only_relocs-suppress-to-the-linker.patch
patch_apply ntdll-Syscall_Wrappers/0002-ntdll-Use-wrapper-functions-for-syscalls.patch
patch_apply ntdll-Syscall_Wrappers/0003-ntdll-APCs-should-call-the-implementation-instead-of.patch
patch_apply ntdll-Syscall_Wrappers/0004-ntdll-Syscalls-should-not-call-Nt-Ex-thunk-wrappers.patch
patch_apply ntdll-Syscall_Wrappers/0005-ntdll-Run-directory-initialization-function-early-du.patch
(
echo '+ { "Sebastian Lackner", "winegcc: Pass '\''-read_only_relocs suppress'\'' to the linker on OSX.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Use wrapper functions for syscalls.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: APCs should call the implementation instead of the syscall thunk.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Syscalls should not call Nt*Ex thunk wrappers.", 1 },';