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.

svn path=/branches/ros-amd64-bringup/; revision=46460
This commit is contained in:
Timo Kreuzer 2010-03-26 08:58:45 +00:00
parent 518b7b47b4
commit cb29f7174b
6 changed files with 22 additions and 25 deletions

View file

@ -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>

View file

@ -197,15 +197,33 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
#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 */

View file

@ -13,14 +13,6 @@
#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;

View file

@ -32,11 +32,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(' ')
#define DQUOTECHAR _T('\"')

View file

@ -7,15 +7,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);
BOOL

View file

@ -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 @@ _pei386_runtime_relocator (void)
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);
}