MingW32...

Ryan C. Gordon icculus at clutteredmind.org
Thu Sep 22 00:25:33 EDT 2005


A couple of comments, brought about by the big-ass Mingw32 patch that
just showed up in Subversion unannounced...


There is this:

+    // The only difference is _ added to the C symbols. It seems mingw
+    // mangles all symbols this way, like linux gcc does when producing
+    // a.out instead of elf

In the GCC case, you should either use the
__attribute__((alias("_sym"))) format to make sure we find the right thing:

   http://www.ohse.de/uwe/articles/gcc-attributes.html#func-alias

Or just do this:

 __asm__("_doAsmCall:  \n\t"
         "doAsmCall:  \n\t"
	 "	movl (%%edi),%eax  \n\t"

"_doAsmCall" and "doAsmCall" will both be valid symbols in the binary
with the same address, so the linker can choose whichever it wants for
the platform and get the right thing. This tends to be cleaner and more
portable (as far as x86 goes). It also prevents a massive cut-and-paste
of error-prone asm code.


There are a couple of these around the codebase:

#if !( (defined __linux__ || __FreeBSD__ || __MINGW32__) && (defined
__i386__) && (!defined C_ONLY)) //

Can we replace all this nonsense with either a check for __GNUC__? This
is only going to get uglier with each new platform, and be error prone
for the ones that are missed.



"3. Find the following in DXSDK/Include/dinput.h..."

Ugh, we have to modify a system header?!

--ryan.





More information about the quake3 mailing list