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.
svn path=/branches/ros-amd64-bringup/; revision=46460
<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 -->
<linkerflag>--unique=.eh_frame</linkerflag>
<linkerflag>-static</linkerflag>
<linkerflag>-fno-leading-underscore</linkerflag>
+ <linkerflag>-shared</linkerflag>
<linkerflag>--exclude-all-symbols</linkerflag>
</group>
#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 */
#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 {
BYTE VersionAndFlags;
#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(' ')
#define DQUOTECHAR _T('\"')
#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);
BOOL
extern char __RUNTIME_PSEUDO_RELOC_LIST__;
extern char __RUNTIME_PSEUDO_RELOC_LIST_END__;
-extern char _image_base__;
typedef struct {
DWORD addend;
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);
}