Build without optimization is broken again

Pavel Roskin proski at
Wed Oct 8 12:49:54 CDT 2003


Sorry, I sent it to wine-devel by error :-(
Build without optimization is broken again in CVS:

gcc -o wine -Wl,--section-start,.interp=0x3c000100 main.o  -L../dlls
-lntdll.dll -L../libs/wine -lwine -L../libs/unicode -lwine_unicode
-L../libs/port -lwine_port
../dlls/ undefined reference to `SetLastError'
../dlls/ undefined reference to `GetCurrentProcessId'
../dlls/ undefined reference to `GetCurrentThreadId'

GetCurrentProcessId() and GetCurrentThreadId() are referenced by
dlls/ntdll/virtual.c and dlls/ntdll/server.c respectively because they
don't include ntdll_misc.h header that has replacement includes.

SetLastError() is used by the set_status() wrapper in dlls/ntdll/heap.c.
I believe NtCurrentTeb()->last_error is valid even for gcc x86 builds.
At least it's used unconditionally in LdrInitializeThunk(), file

        * dlls/ntdll/server.c, dlls/ntdll/virtual.c:
        Include ntdll_misc.h to suppress wrong dependencies
        when building Wine without optimization.
        * dlls/ntdll/heap.c:
        Define set_error unconditionally to eliminate dependency
        on SetLastError().

Pavel Roskin
-------------- next part --------------
--- dlls/ntdll/heap.c
+++ dlls/ntdll/heap.c
@@ -135,13 +135,8 @@ static BOOL HEAP_IsRealArena( HEAP *heap
 /* SetLastError for ntdll */
 inline static void set_status( NTSTATUS status )
-#if defined(__i386__) && defined(__GNUC__)
-    /* in this case SetLastError is an inline function so we can use it */
-    SetLastError( RtlNtStatusToDosError( status ) );
     /* cannot use SetLastError, do it manually */
     NtCurrentTeb()->last_error = RtlNtStatusToDosError( status );
 /* set the process main heap */
--- dlls/ntdll/server.c
+++ dlls/ntdll/server.c
@@ -55,6 +55,7 @@
 #include "wine/library.h"
 #include "wine/server.h"
 #include "winerror.h"
+#include "ntdll_misc.h"
 /* Some versions of glibc don't define this */
 #ifndef SCM_RIGHTS
--- dlls/ntdll/virtual.c
+++ dlls/ntdll/virtual.c
@@ -47,6 +47,7 @@
 #include "wine/library.h"
 #include "wine/server.h"
 #include "wine/debug.h"
+#include "ntdll_misc.h"

More information about the wine-patches mailing list