-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules break with compiler optimisation greater than -O0 #1
Comments
There are some additional workarounds for GCC >=5.3.0 in ps2sdk: https://github.com/ps2dev/ps2sdk/blob/master/iop/Rules.make#L33 Additionally, you can use |
Oh, that’s great, @uyjulian! I fear that 100+ (or so) reboots are needed to find the error so anything that can cut that number down is very much welcome. A lot of stuff could have happened between GCC 5.3 and the presently used 10.2 too, but with a bit of guidance and luck, one might find it quickly. |
Offtopic, but at ps2dev / ps2sdk we've recently migrated the EE compiler to gcc 10.2. There's some interesting patches that might be usefull for you as well (one of them is even yours ;): Note that we found a bug in sqrt.s in binutils. It's claimed to be a standard MIPSII instruction, but it's not. This was also something that worked with -O0, becouse then the function sqrtf() is called. But any optimization level higher would cause gcc to replace it with a faulty sqrt.s instruction. |
Nice, the short loop bug fix by frno7 has a bit of background in the post MIPS: Fix GCC I’ve also made a write-up of the R5900 short loop erratum on the wiki, including porting the comment from the depracted GCC branch to GAS mainline (where it belongs), for handy reference in case anybody needs it explained. Likewise with the peculiarities of the R5900 floating point unit (FPU), etc. When I started out I found it difficult get information on this kind of stuff. GCC and Binutils have a couple of more patches that are somewhat more relevant for Linux, like the new Have you submitted the SQRT fix to Binutils? Incidentally, I fixed another instruction bug in m68k/Bintuils a week ago, in commit By the way, how’s it going with the R5900 MMI auto-vectorisation? |
If the issue occurs with Binary search is faster than going through each of them one by one. Best case scenario is that you only have to try 7 times (for a total of 94 flags to search through). |
Yes, I agree that’s a good plan, @uyjulian. :) |
Not yet, but I plan to.
Not much further than last time we spoke. I think I'll finish the MMI support by disabling MIPS-MSA. Rewriting both MIPS-MSA and R5900-MMI into a more generic form is too much for me to do alone, so I will not be submitting this to gcc. Back on topic: But iopmod does not seem to be using this. I've taken a closer look at how you're creating the import tables, and wow; it's an amazing piece of art. I can learn a thing or 2 from there. But as for the import tables, you seem to be using assembly only: |
Which specific |
@rickgaiser, I’m glad you found it inspirational! I made an effort to put as much logic as possible into the tooling, so that writing the actual IOP modules becomes effortless. This means that a module function declaration such as iopmod/include/iopmod/module/printk.h Line 17 in a5d2360
serves quadruple-duty: the I wrote a small C language lexer in The GNU linker option Lines 30 to 42 in a5d2360
which sets up the exports automatically, so modules don’t do that themselves. It then calls Line 305 in a5d2360
Modules that don’t initialise anything don’t need to declare a The iopmod/include/iopmod/module/irqrelay.h Lines 1 to 3 in a5d2360
is correspondingly simple, having only to declare the identification and the version of the module. |
@rickgaiser, one more thing: The Linux kernel itself also understands IRX file module export and import directives, which means that the Linux kernel automatically prelinks any IOP modules from ROM and from files, as necessary, without manual effort, when an IOP module is requested with
|
@rickgaiser, for the fun of it I ported your Hello world application in commit 149740e. It should work like your own, and with PS2DEV. Here’s what the
Notice that iopmod/include/iopmod/module/stdio.h Lines 6 to 7 in a5d2360
The disassembly with
|
iopmod/Makefile
Line 16 in 13732bf
It is presently unclear why IOP modules don’t quite work with the
-O2
compiler optimisation option.The text was updated successfully, but these errors were encountered: