Author: tkreuzer Date: Fri Mar 26 09:58:45 2010 New Revision: 46460
URL: http://svn.reactos.org/svn/reactos?rev=46460&view=rev Log: Looks like ld doesn't like specifying "-fno-leading-underscore" for anything else then shared modules (aka dlls). Therefore specify "-shared" for apps, too (Should hopefully not make a difference), making them link again. Since we have switched to non-prefixed symbols, we need to deal with 2 kinds of symbols that the compiler doesn't handle for us. 1.) __image_base__ is still defined the same way by ld, but since gcc doesn't give us an underscore anymore, we need to specify it on our own. 2.) __MINGW_IMP_SYMBOL, which is a hacky way of declaring a symbol dllimport, by prefixing it with __imp_ also needs special treatment. Fix these issues by adding appropriate macros to _mingw.h and removing the broken and duplicate definitions from multiple .c files.
Modified: branches/ros-amd64-bringup/reactos/ReactOS-amd64.rbuild branches/ros-amd64-bringup/reactos/include/crt/_mingw.h branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crt_handler.c branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pesect.c branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c
Modified: branches/ros-amd64-bringup/reactos/ReactOS-amd64.rbuild URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ReactO... ============================================================================== --- branches/ros-amd64-bringup/reactos/ReactOS-amd64.rbuild [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ReactOS-amd64.rbuild [iso-8859-1] Fri Mar 26 09:58:45 2010 @@ -28,6 +28,7 @@ <compilerflag>-ftracer</compilerflag> <compilerflag>-momit-leaf-frame-pointer</compilerflag> </if> + <compilerflag>-fms-extensions</compilerflag> <compilerflag>-mpreferred-stack-boundary=4</compilerflag> <compilerflag compiler="midl">-m64 --win64</compilerflag> <!-- compilerflag compiler="cc,cxx">-gstabs+</compilerflag --> @@ -44,6 +45,7 @@ <linkerflag>--unique=.eh_frame</linkerflag> <linkerflag>-static</linkerflag> <linkerflag>-fno-leading-underscore</linkerflag> + <linkerflag>-shared</linkerflag> <linkerflag>--exclude-all-symbols</linkerflag> </group>
Modified: branches/ros-amd64-bringup/reactos/include/crt/_mingw.h URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/includ... ============================================================================== --- branches/ros-amd64-bringup/reactos/include/crt/_mingw.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/crt/_mingw.h [iso-8859-1] Fri Mar 26 09:58:45 2010 @@ -197,15 +197,33 @@ #define _CRT_UNUSED(x) (void)x #endif
+#if defined(__x86__) #define __MINGW_USE_UNDERSCORE_PREFIX 1 +#else +#define __MINGW_USE_UNDERSCORE_PREFIX 0 +#endif
#if __MINGW_USE_UNDERSCORE_PREFIX == 0 -#define __MINGW_IMP_SYMBOL(sym) _imp_##sym +#define __MINGW_IMP_SYMBOL(sym) __imp_##sym #define __MINGW_USYMBOL(sym) sym #else #define __MINGW_IMP_SYMBOL(sym) _imp__##sym #define __MINGW_USYMBOL(sym) _##sym #endif
+#if defined(__x86__) +/* Hack, for bug in ld. Will be removed soon. */ +#define __ImageBase _image_base__ +/* This symbol is defined by the linker. */ +extern char __ImageBase; +#elif defined(__x86_64__) +/* Hack, for bug in ld. Will be removed soon. */ +#define __ImageBase __image_base__ +/* This symbol is defined by the linker. */ +extern char __ImageBase; +#else +#error FIXME: Unsupported __ImageBase implementation. +#endif + #endif /* !_INC_MINGW */
Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crt_handler.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3r... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crt_handler.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crt_handler.c [iso-8859-1] Fri Mar 26 09:58:45 2010 @@ -12,14 +12,6 @@ #include <memory.h> #include <signal.h> #include <stdio.h> - -#if defined (_WIN64) && defined (__ia64__) -#error FIXME: Unsupported __ImageBase implementation. -#else -#define __ImageBase _image_base__ -/* This symbol is defined by the linker. */ -extern IMAGE_DOS_HEADER __ImageBase; -#endif
#pragma pack(push,1) typedef struct _UNWIND_INFO {
Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3r... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] Fri Mar 26 09:58:45 2010 @@ -31,11 +31,6 @@ extern char *** __MINGW_IMP_SYMBOL(__initenv); #define __initenv (* __MINGW_IMP_SYMBOL(__initenv)) #endif - -/* Hack, for bug in ld. Will be removed soon. */ -#define __ImageBase _image_base__ -/* This symbol is defined by ld. */ -extern IMAGE_DOS_HEADER __ImageBase;
extern void _fpreset (void); #define SPACECHAR _T(' ')
Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pesect.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3r... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pesect.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pesect.c [iso-8859-1] Fri Mar 26 09:58:45 2010 @@ -6,15 +6,6 @@
#include <windows.h> #include <string.h> - -#if defined (_WIN64) && defined (__ia64__) -#error FIXME: Unsupported __ImageBase implementation. -#else -/* Hack, for bug in ld. Will be removed soon. */ -#define __ImageBase _image_base__ -/* This symbol is defined by the linker. */ -extern IMAGE_DOS_HEADER __ImageBase; -#endif
BOOL _ValidateImageBase (PBYTE);
Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3r... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] Fri Mar 26 09:58:45 2010 @@ -16,7 +16,6 @@
extern char __RUNTIME_PSEUDO_RELOC_LIST__; extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; -extern char _image_base__;
typedef struct { DWORD addend; @@ -162,5 +161,5 @@ if (was_init) return; ++was_init; - do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,&__RUNTIME_PSEUDO_RELOC_LIST_END__,&_image_base__); + do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,&__RUNTIME_PSEUDO_RELOC_LIST_END__,&__ImageBase); }