Hello!
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/libntdll.dll.so: undefined reference to `SetLastError'
../dlls/libntdll.dll.so: undefined reference to `GetCurrentProcessId'
../dlls/libntdll.dll.so: 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/loader.c.
ChangeLog:
* 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().
--
Regards,
Pavel Roskin
--- 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 ) );
-#else
/* cannot use SetLastError, do it manually */
NtCurrentTeb()->last_error = RtlNtStatusToDosError( status );
-#endif
}
/* 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"
WINE_DEFAULT_DEBUG_CHANNEL(virtual);
WINE_DECLARE_DEBUG_CHANNEL(module);