 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Sun Jul 22, 2007 7:03 am Post subject: |
|
|
I have the archlinux distro installed on my other harddrive, so I could just go into that if it becomes necessary.
The Ogre3D MinGW Toolkit didn't work when compiling the toolchain, either. I'll go digging around.
I managed to grab a log of all the warning messages when building gcc. Perhaps something in there will lead to the answer. I haven't built a toolchain on cygwin in forever, but I don't remember getting those Assembler messages, so maybe the problem lies in gas in binutils? I get those Assembler messages while building FCEUltra as well on the MinGW toolchain but not on the Cygwin toolchain.
http://www.nopaste.com/p/aS6aNJ42V
I tried changing 1 in the GIF_TAG to 1UL, but the shift was still ignored. |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Mon Jul 23, 2007 7:56 pm Post subject: |
|
|
This really only confirms what has already been said but with this program: | Code: | #include <stdio.h>
int main(int argc, char* argv[])
{
u64 st = (((u64)(1)) << 32);
printf("test = 0x%016lX\n", st);
return 0;
} |
I get this output from cygwin: | Code: | 00000000 <main>:
0: 3c040000 lui a0,0x0
4: 27bdfff0 addiu sp,sp,-16
8: 34058000 li a1,0x8000
c: 00052c78 dsll a1,a1,0x11
10: ffbf0000 sd ra,0(sp)
14: 0c000000 jal 0 <main>
18: 24840000 addiu a0,a0,0
1c: dfbf0000 ld ra,0(sp)
20: 0000102d move v0,zero
24: 03e00008 jr ra
28: 27bd0010 addiu sp,sp,16
2c: 00000000 nop |
And this output from mingw: | Code: | 00000000 <main>:
0: 3c040000 lui a0,0x0
4: 27bdfff0 addiu sp,sp,-16
8: 24050000 li a1,0
c: ffbf0000 sd ra,0(sp)
10: 0c000000 jal 0 <main>
14: 24840000 addiu a0,a0,0
18: dfbf0000 ld ra,0(sp)
1c: 0000102d move v0,zero
20: 03e00008 jr ra
24: 27bd0010 addiu sp,sp,16 |
Interestingly though this program gives the correct output in both compilers: | Code: | #include <stdio.h>
int main(int argc, char* argv[])
{
int i;
u64 u;
for (i = 0; i < 64; ++i)
{
u = ((u64) (1) << i);
printf("0x%016lX\n", u);
}
return 0;
} |
So it appears that it is only shifts expanded by the compiler to a constant which causes the problem. |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Tue Jul 24, 2007 6:59 pm Post subject: |
|
|
I've found the parts in gcc where it starts type checking the operands, type conversion, and etc. I've started adding warning messages inside the conditional statements to see how exactly the left shift expression is evaluated. I'll post the relevant files/lines I think are interesting in case someone else wants to go through it themselves. I'm pretty sure the assembly generated is correct depending on what operands gcc gives out, so I don't think the problem lies in mips.md or etc.
mips.c line 2680
mips_move_2words is what I believe gcc calls when moving the bits for the shift
c-typeck.c line 2139
This is where gcc typechecks the operands prior to compiling the leftshift.
convert.c line 228
I'm not exactly sure here, as the code relies heavily on tree nodes and such, but I think this is where it optimizes/truncates leftshifts. I'm pretty sure 32 passes the first if statement. I haven't gone through after that.
Edit:
op1 passes the typecheck, but I'm not sure if it's actually describing 32 or another number, like 0. Nothing triggered under the LSHIFT_EXPR case in convert.c. I forgot to check about integer constants though.
Doc on gcc internals:
http://gcc.gnu.org/onlinedocs/gccint/index.html |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Wed Jul 25, 2007 10:24 am Post subject: |
|
|
Not sure how relevant this is but this program:
| Code: | #include <stdio.h>
typedef unsigned long long u64;
int main(int argc, char* argv[])
{
u64 st = (((u64)(1)) << 32);
printf("test = 0x%016lX\n", st);
return 0;
} |
fails under mingw itself (nothing to do with ps2 stuff). It did give a warning for the printf - is that format string correct? |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Wed Jul 25, 2007 2:48 pm Post subject: |
|
|
| Code: |
#include <stdio.h>
typedef unsigned long long u64;
int main(int argc, char* argv[])
{
u64 st = (((u64)(1)) << 32);
//printf("test = %ulld\n", st);
printf("%I64u\n",st);
return 0;
}
|
%llu which is normally used to print long long unsigned (64-bit) integers on unix/posix systems prints out 0. MingW uses the msvcrt.dll printf() which uses %I64u to print 64-bit unsigned integers. The shift is still occurring, though. I'm pretty sure that this wouldn't have an effect when compiling a cross-compiler though... unless for some odd reason, there was a test or conversion or something that relied on a msvcrt function or the msvcrt string format modifier for 64-bit integers...
http://www.mingw.org/MinGWiki/index.php/long%20long
Edit:
It is pretty strange that the problem of %llu simulates what we're getting from the shift, 0. I notice a lot of strings used for outputting the assembly, with format modifiers like %M %H %L, which I'll have to look up to see if these have a problem. Since, we're compiling the compiler as a windows runtime, I'm pretty sure these format modifiers would get compiled using the msvcrt format, though I'm not sure if just any string does. I'm going to look at the file that defines format modifiers for the host of a cross compiler to see if it has %ll defined somewhere.
Edit2:
Just found this, which explains the above, I believe.
http://www.gnu.org/software/gettext/manual/html_node/gcc_002dinternal_002dformat.html#gcc_002dinternal_002dformat
Edit3:
I'm going to try to define the msvcrt format modifiers to the mingw32 host file: gcc-3.2.2\gcc\config\i386\xm-mingw32.h, and see if it works...
Edit4:
Ok, I've compiled gcc with the new format modifiers, but the shift still doesn't happen. I didn't start from scratch, so I'll see if binutils needs fixing for mingw32, then add the changes to gcc and compile again.
Edit5:
Here's my modified hwint.h: http://rafb.net/p/xypRNP40.html
It would probably be easier defining them in xm-mingw32.h but this works as well. I've gotten to the newlib stage, and installed it. Compiled the val64.c program with the ps2sdk from cygwin, and it's shifting correctly. I take this as a good sign.
Edit6:
Sorry for all the edits, but the mingw toolchain is now working correctly. Thanks, radad ^_^, I wouldn't have guessed a gnu toolchain would use non-ISO format modifiers. Anything long long would return 0 inside a string like for code inside an object file or assembly but since 0 is an integer it wouldn't look wrong. All you need to do is plugin hwint.h above, or define the macros with "%I64" with HOST_WIDEST_INT __int64; in gcc/config/xm-mingw32.h. After doing that, configuring gcc noticeably took a little longer. In binutils-2.14, I also added two lines in _doprnt.c after line 291 to check %I64d. I don't think it changed anything in binutils, though.
Last edited by ragnarok2040 on Wed Jul 25, 2007 10:01 pm; edited 1 time in total |
|
| Back to top |
|
 |
Lukasz

Joined: 19 Jan 2004 Posts: 248 Location: Denmark
|
Posted: Wed Jul 25, 2007 9:57 pm Post subject: |
|
|
ragnarok2040 & radad: Good work figuring this out and providing a solution!
ragnarok2040: You mention something about patching the gcc source (xm-mingw.h) in order to build the toolchains in mingw correctly. Could you supply a full patch for gcc? Then we could add this to the existing ps2 gcc patch and avoid having additional instructions for building the toolchains in MinGW. _________________ Lukasz.dk |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Wed Jul 25, 2007 10:06 pm Post subject: |
|
|
Ok, I will, shouldn't take that long. Be back in a few.
Edit:
Here it is: http://nopaste.de/p/aL0jnueIB
Did you want me to submit just the patch for xm-mingw32.h? I posted the whole thing :S.
Oh yeah, before I forget, adding those definitions made configure act a little weird, like it was adding fastjar and gcc/f (the fortran frontend) to the build. After configuring again, it stopped, so maybe I left a dash or something out somewhere. Fixinc might work again... I saw it build during the stage2 build, anyways.
Edit:
http://jul25b.imghost.us/MTrI.bmp
^_^ |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Thu Jul 26, 2007 2:04 am Post subject: |
|
|
Nice work, but I'm having troubles with the patch. I don't like to replace the entire patch with a new one like this and it isn't applying cleanly anyway.
Can you generate a patch against gcc that's already had the ps2dev patch applied? It is a lot easier to see what's changed. |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Thu Jul 26, 2007 6:14 am Post subject: |
|
|
Hrmm, somehow a copy of the rev1.patch got placed in the newer source folder and diff added it to the patch. Here's the patch just comparing the old ps2dev patched gcc vs. gcc patched + my changes.
| Code: |
diff -burN gcc-3.2.2/gcc/config/i386/xm-mingw32.h gcc-3.2.2-ps2/gcc/config/i386/xm-mingw32.h
--- gcc-3.2.2/gcc/config/i386/xm-mingw32.h Thu Jan 10 17:21:39 2002
+++ gcc-3.2.2-ps2/gcc/config/i386/xm-mingw32.h Wed Jul 25 08:20:51 2007
@@ -31,3 +31,8 @@
#undef PATH_SEPARATOR
#define PATH_SEPARATOR ';'
+
+#define HOST_WIDEST_INT __int64
+#define HOST_WIDEST_INT_PRINT_DEC "%I64d"
+#define HOST_WIDEST_INT_PRINT_UNSIGNED "%I64u"
+#define HOST_WIDEST_INT_PRINT_HEX "0x%I64x"
|
http://rafb.net/p/Fg99OW72.html
Here's the whole thing again, this time making sure that a patch wasn't hiding somewhere in it. This doesn't fix long doubles, but I don't think the PS2 can use them. I remember reading that somewhere.
Binaries of the tools, doesn't include ps2sdk's crt0.o:
http://www.usaupload.net/d/t057vv6aukn |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Thu Jul 26, 2007 10:09 am Post subject: |
|
|
| Great work guys. |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Thu Jul 26, 2007 5:03 pm Post subject: |
|
|
| Code: | gcc-3.2.2$ cat /tmp/patch.txt | patch -p1 --dry-run
patching file README.PS2
patching file config.sub
patching file configure
patching file configure.in
patching file gcc/Makefile.in
patching file gcc/c-common.c
patching file gcc/caller-save.c
patching file gcc/config/i386/xm-mingw32.h
patching file gcc/config/mips/core-mmi.h
patching file gcc/config/mips/core-vumm.h
patching file gcc/config/mips/crti5900.asm
patching file gcc/config/mips/crtn5900.asm
patching file gcc/config/mips/mips-protos.h
patching file gcc/config/mips/mips.c
Hunk #10 succeeded at 518 with fuzz 2.
Hunk #36 FAILED at 6535.
1 out of 58 hunks FAILED -- saving rejects to file gcc/config/mips/mips.c.rej
patching file gcc/config/mips/mips.h
Hunk #37 succeeded at 4397 with fuzz 2 (offset 339 lines).
Hunk #38 FAILED at 4446.
Hunk #39 FAILED at 4602.
Hunk #40 FAILED at 4620.
3 out of 45 hunks FAILED -- saving rejects to file gcc/config/mips/mips.h.rej
patching file gcc/config/mips/mips.md
Hunk #15 FAILED at 510.
Hunk #49 succeeded at 4471 with fuzz 2 (offset 1186 lines).
Hunk #50 FAILED at 4522.
Hunk #51 FAILED at 4576.
Hunk #52 FAILED at 4594.
Hunk #53 FAILED at 4648.
Hunk #54 succeeded at 4768 with fuzz 2 (offset 1170 lines).
Hunk #55 FAILED at 4895.
Hunk #56 FAILED at 4997.
Hunk #57 FAILED at 5122.
Hunk #58 FAILED at 5174.
Hunk #59 FAILED at 5627.
Hunk #60 FAILED at 5853.
11 out of 88 hunks FAILED -- saving rejects to file gcc/config/mips/mips.md.rej
patching file gcc/config/mips/r5900.h
patching file gcc/config/mips/t-irx
patching file gcc/config/mips/t-r5900
patching file gcc/config.gcc
patching file gcc/cp/decl.c
patching file gcc/fixinc/gnu-regex.c
patching file gcc/fixinc/mkfixinc.sh
patching file gcc/glimits.h
patching file gcc/integrate.c
patching file gcc/libgcc2-timode.c
patching file gcc/mklibgcc.in
patching file gcc/toplev.c
patching file include/obstack.h
patching file libstdc++-v3/configure.target
patching file libstdc++-v3/libsupc++/pure.cc |
Playing with it, I get this:
| Code: | diff -burN ps2dev.gcc-3.2.2/gcc/config/i386/xm-mingw32.h gcc-3.2.2/gcc/config/i386/xm-mingw32.h
--- ps2dev.gcc-3.2.2/gcc/config/i386/xm-mingw32.h 2002-01-10 18:21:39.000000000 -0400
+++ gcc-3.2.2/gcc/config/i386/xm-mingw32.h 2007-07-26 03:59:05.000000000 -0300
@@ -31,3 +31,8 @@
#undef PATH_SEPARATOR
#define PATH_SEPARATOR ';'
+
+#define HOST_WIDEST_INT __int64
+#define HOST_WIDEST_INT_PRINT_DEC "%I64d"
+#define HOST_WIDEST_INT_PRINT_UNSIGNED "%I64u"
+#define HOST_WIDEST_INT_PRINT_HEX "0x%I64x" |
I don't suppose this a valid description of your changes? |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Thu Jul 26, 2007 5:19 pm Post subject: |
|
|
The site on which I pasted the patch must be messing up something or maybe windows clipboard is doing it.
Ack, I forgot to define HOST_BITS_PER_WIDEST_INT as well, so the build errors out. It didn't need to be defined in hwint.h as HOST_WIDEST_INT hadn't been defined yet, but it's needed in xm-mingw32.h.
I'll have to make a new patch and test again.
Edit:
I ran into the shift bug again. Replacing hwint.h with the one I posted above fixes it. I think I see the problem...
| Code: |
/* Use long long on the host if the target has a wider long type than
the host. */
|
Since the code after that would be true, then I probably have to define the HOST_WIDE_INT stuff the same as HOST_WIDEST_INT...
Edit2:
I just compiled gcc with xm-mingw32.h with HOST_WIDE_INT stuff defined plus the normal hwint.h and it's working again. I should've read the comments in hwint.h more closely.
Includes just the xm-mingw32.h patch as well as the full gcc-3.2.2-PS2+xm-mingw32.h patch.
Edit3:
Sorry about all the trouble with the patches. My first time submitting one, heh. I'm 99.9% sure I've #defined everything correctly. Migrating the changes was more convoluted than I thought it would be.
Edit4:
That .1% hit me. Just realized that those macros would affect the iop toolchain. I added some checks, but now it's not shifting correctly again. I'm going to just paste the code from hwint.h into xm-mingw32 and recompile again to see if that will work.
| Code: |
diff -burN orig.gcc-3.2.2/gcc/config/i386/xm-mingw32.h gcc-3.2.2/gcc/config/i386/xm-mingw32.h
--- orig.gcc-3.2.2/gcc/config/i386/xm-mingw32.h Thu Jan 10 17:21:39 2002
+++ gcc-3.2.2/gcc/config/i386/xm-mingw32.h Thu Jul 26 10:00:22 2007
@@ -31,3 +31,143 @@
#undef PATH_SEPARATOR
#define PATH_SEPARATOR ';'
+
+/* This describes the machine the compiler is hosted on. */
+#define HOST_BITS_PER_CHAR CHAR_BIT
+#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
+#define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT)
+#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
+
+#ifdef HAVE_LONG_LONG
+# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG)
+#else
+#ifdef HAVE___INT64
+# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF___INT64)
+#else
+/* If we're here and we're GCC, assume this is stage 2+ of a bootstrap
+ and 'long long' has the width of the *target*'s long long. */
+# if GCC_VERSION > 3000
+# define HOST_BITS_PER_LONGLONG LONG_LONG_TYPE_SIZE
+# endif /* gcc */
+#endif
+#endif /* no long long */
+
+/* Find the largest host integer type and set its size and type. */
+
+/* Use long long on the host if the target has a wider long type than
+ the host. */
+
+#if ! defined HOST_BITS_PER_WIDE_INT \
+ && defined HOST_BITS_PER_LONGLONG \
+ && (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) \
+ && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) \
+ || defined (LLONG_MAX) || defined (__GNUC__))
+
+# ifdef MAX_LONG_TYPE_SIZE
+# if MAX_LONG_TYPE_SIZE > HOST_BITS_PER_LONG
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDE_INT long long
+# endif
+# else
+# if LONG_TYPE_SIZE > HOST_BITS_PER_LONG
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDE_INT long long
+# endif
+# endif
+
+#endif
+
+#ifndef HOST_BITS_PER_WIDE_INT
+
+# if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
+# define HOST_WIDE_INT long
+# else
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
+# define HOST_WIDE_INT int
+# endif
+
+#endif /* ! HOST_BITS_PER_WIDE_INT */
+
+/* Provide defaults for the way to print a HOST_WIDE_INT
+ in various manners. */
+
+#ifndef HOST_WIDE_INT_PRINT_DEC
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_DEC "%d"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_DEC "%ld"
+# else
+# define HOST_WIDE_INT_PRINT_DEC "%I64d"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_DEC */
+
+#ifndef HOST_WIDE_INT_PRINT_UNSIGNED
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
+# else
+# define HOST_WIDE_INT_PRINT_UNSIGNED "%I64u"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */
+
+#ifndef HOST_WIDE_INT_PRINT_HEX
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_HEX "0x%x"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_HEX "0x%lx"
+# else
+# define HOST_WIDE_INT_PRINT_HEX "0x%I64x"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_HEX */
+
+#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
+# if HOST_BITS_PER_WIDE_INT == 64
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
+# else
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
+# endif
+# endif
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
+# else
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
+# endif
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */
+
+/* Find HOST_WIDEST_INT and set its bit size, type and print macros.
+ It will be the largest integer mode supported by the host which may
+ (or may not) be larger than HOST_WIDE_INT. */
+
+#ifndef HOST_WIDEST_INT
+#if defined HOST_BITS_PER_LONGLONG && HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG
+# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDEST_INT __int64
+# define HOST_WIDEST_INT_PRINT_DEC "%I64d"
+# define HOST_WIDEST_INT_PRINT_UNSIGNED "%I64u"
+# define HOST_WIDEST_INT_PRINT_HEX "0x%I64x"
+# else
+# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG
+# define HOST_WIDEST_INT long
+# define HOST_WIDEST_INT_PRINT_DEC "%ld"
+# define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu"
+# define HOST_WIDEST_INT_PRINT_HEX "0x%lx"
+# endif /* long long wider than long */
+#endif /* ! HOST_WIDEST_INT */
|
It worked. I made sure. I uploaded the final version:
http://www.usaupload.net/d/koupz4obi6o |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Fri Jul 27, 2007 2:26 am Post subject: |
|
|
The patch applied cleanly and has been added to the repository:
| Code: | Sending patches/gcc-3.2.2-PS2.patch
Transmitting file data .
Committed revision 1428. |
For the curious, here's what has changed:
| Code: | diff -burN ps2dev.gcc-3.2.2/gcc/config/i386/xm-mingw32.h gcc-3.2.2/gcc/config/i386/xm-mingw32.h
--- ps2dev.gcc-3.2.2/gcc/config/i386/xm-mingw32.h 2002-01-10 18:21:39.000000000 -0400
+++ gcc-3.2.2/gcc/config/i386/xm-mingw32.h 2007-07-26 13:02:44.000000000 -0300
@@ -31,3 +31,143 @@
#undef PATH_SEPARATOR
#define PATH_SEPARATOR ';'
+
+/* This describes the machine the compiler is hosted on. */
+#define HOST_BITS_PER_CHAR CHAR_BIT
+#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
+#define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT)
+#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
+
+#ifdef HAVE_LONG_LONG
+# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG)
+#else
+#ifdef HAVE___INT64
+# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF___INT64)
+#else
+/* If we're here and we're GCC, assume this is stage 2+ of a bootstrap
+ and 'long long' has the width of the *target*'s long long. */
+# if GCC_VERSION > 3000
+# define HOST_BITS_PER_LONGLONG LONG_LONG_TYPE_SIZE
+# endif /* gcc */
+#endif
+#endif /* no long long */
+
+/* Find the largest host integer type and set its size and type. */
+
+/* Use long long on the host if the target has a wider long type than
+ the host. */
+
+#if ! defined HOST_BITS_PER_WIDE_INT \
+ && defined HOST_BITS_PER_LONGLONG \
+ && (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) \
+ && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) \
+ || defined (LLONG_MAX) || defined (__GNUC__))
+
+# ifdef MAX_LONG_TYPE_SIZE
+# if MAX_LONG_TYPE_SIZE > HOST_BITS_PER_LONG
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDE_INT long long
+# endif
+# else
+# if LONG_TYPE_SIZE > HOST_BITS_PER_LONG
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDE_INT long long
+# endif
+# endif
+
+#endif
+
+#ifndef HOST_BITS_PER_WIDE_INT
+
+# if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
+# define HOST_WIDE_INT long
+# else
+# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
+# define HOST_WIDE_INT int
+# endif
+
+#endif /* ! HOST_BITS_PER_WIDE_INT */
+
+/* Provide defaults for the way to print a HOST_WIDE_INT
+ in various manners. */
+
+#ifndef HOST_WIDE_INT_PRINT_DEC
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_DEC "%d"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_DEC "%ld"
+# else
+# define HOST_WIDE_INT_PRINT_DEC "%I64d"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_DEC */
+
+#ifndef HOST_WIDE_INT_PRINT_UNSIGNED
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
+# else
+# define HOST_WIDE_INT_PRINT_UNSIGNED "%I64u"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */
+
+#ifndef HOST_WIDE_INT_PRINT_HEX
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_HEX "0x%x"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_HEX "0x%lx"
+# else
+# define HOST_WIDE_INT_PRINT_HEX "0x%I64x"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_HEX */
+
+#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
+# if HOST_BITS_PER_WIDE_INT == 64
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
+# else
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
+# endif
+# endif
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
+# else
+# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
+# endif
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */
+
+/* Find HOST_WIDEST_INT and set its bit size, type and print macros.
+ It will be the largest integer mode supported by the host which may
+ (or may not) be larger than HOST_WIDE_INT. */
+
+#ifndef HOST_WIDEST_INT
+#if defined HOST_BITS_PER_LONGLONG && HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG
+# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDEST_INT __int64
+# define HOST_WIDEST_INT_PRINT_DEC "%I64d"
+# define HOST_WIDEST_INT_PRINT_UNSIGNED "%I64u"
+# define HOST_WIDEST_INT_PRINT_HEX "0x%I64x"
+# else
+# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG
+# define HOST_WIDEST_INT long
+# define HOST_WIDEST_INT_PRINT_DEC "%ld"
+# define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu"
+# define HOST_WIDEST_INT_PRINT_HEX "0x%lx"
+# endif /* long long wider than long */
+#endif /* ! HOST_WIDEST_INT */ |
Keep up the good work, dudes. |
|
| Back to top |
|
 |
Lukasz

Joined: 19 Jan 2004 Posts: 248 Location: Denmark
|
Posted: Sat Jul 28, 2007 8:17 pm Post subject: |
|
|
I built the MinGW toolchains today and tested gsKit and the shift bug is gone! Good work ragnarok2040! I've uploaded the new toolchain binaries and linked them from the MinGW tutorial. I've taken the Vista binaries down, since they are bugged :-) _________________ Lukasz.dk |
|
| Back to top |
|
 |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Sat Jul 28, 2007 9:34 pm Post subject: |
|
|
Nice, :D.
On another note, I've noticed a bug in ltconfig when building stdc++v3, I think. It tries to call c:\ps2dev\ee\ee\nm.exe, but instead it comes out as c:ps2deveeeenm.exe. I'm not sure where it gets the dos-based path. Would redefining the variable for the nm executable in config.cache to /c/ps2dev/ee/ee/nm.exe fix that? It's not a serious problem, I don't think, but I'm not that familiar with building libraries. I have no idea if it affects the ps2dev toolchain scripts since they use /usr/local/ps2dev |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|