Option conflict with GCC and AS
Posted: Thu Oct 28, 2004 8:16 pm
I recently installed the Win32 PS2dev setup by 'Loser', as found on this site. It came with PS2LIB, which I have kept for backwards compatibility. I've then installed PS2SDK, also as found on this site. (Naturally I keep those libs in separate folders to avoid conflicts.) Thereafter I have compiled some projects for each of those lib collections to verify that the basic installation of all this was successful. So far so good. The basic installation is OK.
However, as I proceeded to test various projects I found several problems, most of which are due to deprecated and conflicting compilation options. For example, I have major problems in trying to compile the 'Boredom' demo (as found on this site). Some of this I can solve myself, but I can't solve it all without some help, so I'll describe the details below, in the hope that some of you can recognize what I need to do.
'makefile.native' contains three variables to control the options sent to the compilation tools, ASFLAGS, CFLAGS, LDFLAGS, for assembler, compiler and loader, respectively. The last of them is not a problem (yet ;) ), but the first two are. Both contain an option '-mcpu' although this is differently defined for gas and gcc. For gas, I changed it from "-mcpu=5900" to "-cpu-type=r5900" which I HOPE (but don't know) is the right thing to do now that the '-mcpu' option of gas is deprecated. Assemblies do seem to work with that anyway. For gcc I keep this option unchanged as "-mcpu=r5900" as that remains valid, and that too works fine for 'pure' C code, but I kept getting more errors.
One error which confused the issue was due to the gcc flag "-fnonnull-objects" for which I found conflicting info on the net. Some docs don't mention it at all, but instead mention an option "-fno-nonnull-objects" with the opposite effect, so apparently different compiler versions have different default behaviour. This issue is further confused by the fact that many sites refer to that option as deprecated, but never say this about the first option, even though it certainly seems to be deprecated in our version of gcc (unrecognized option). Whatever, my only recourse here is to simply remove that option, at risk of decreasing code efficiency by some redundant NULL checks. Doing this did eliminate those errors anyway, but now as I got past those I found a much worse problem.
"main.c" contains some inline assembly code, which had been entered as one long quoted string, which is a deprecated format. Fortunately that was easy to fix by removing the existing quotes and inserting '"' at the start of each asm line and adding '/n"' at the end of each such line. But even though this eliminated that error, another error persisted. I'm quoting this error on the line below, as it is the one thing I have NO cure for.
"/cygdrive/e/PS2_Dev/gcc/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/bin/as: unrecognized option '-mcpu=r5900'"
This looks a bit confusing, but it simply means that the gas version stored as "/cygdrive/e/PS2_Dev/gcc/ee/ee/bin/as" has been invoked with that option, even though I already changed the ASFLAGS variable to avoid that. This is logical too, considering that the 'make' tool isn't really involved in the automatic invocation of the assembler to deal with inline assembly, but that raises the question of where the heck this FAULTY option is defined, as that component must be modified now that this option is deprecated.
I have no definite answer to that question myself, and even if I did there isn't much I could do about it... I strongly suspect it's gcc itself that contains this option, hardcoded into the routine that invokes gas.
I hope someone else can come up with a more definite answer, and (better yet) a remedy.
Best regards: dlanor
However, as I proceeded to test various projects I found several problems, most of which are due to deprecated and conflicting compilation options. For example, I have major problems in trying to compile the 'Boredom' demo (as found on this site). Some of this I can solve myself, but I can't solve it all without some help, so I'll describe the details below, in the hope that some of you can recognize what I need to do.
'makefile.native' contains three variables to control the options sent to the compilation tools, ASFLAGS, CFLAGS, LDFLAGS, for assembler, compiler and loader, respectively. The last of them is not a problem (yet ;) ), but the first two are. Both contain an option '-mcpu' although this is differently defined for gas and gcc. For gas, I changed it from "-mcpu=5900" to "-cpu-type=r5900" which I HOPE (but don't know) is the right thing to do now that the '-mcpu' option of gas is deprecated. Assemblies do seem to work with that anyway. For gcc I keep this option unchanged as "-mcpu=r5900" as that remains valid, and that too works fine for 'pure' C code, but I kept getting more errors.
One error which confused the issue was due to the gcc flag "-fnonnull-objects" for which I found conflicting info on the net. Some docs don't mention it at all, but instead mention an option "-fno-nonnull-objects" with the opposite effect, so apparently different compiler versions have different default behaviour. This issue is further confused by the fact that many sites refer to that option as deprecated, but never say this about the first option, even though it certainly seems to be deprecated in our version of gcc (unrecognized option). Whatever, my only recourse here is to simply remove that option, at risk of decreasing code efficiency by some redundant NULL checks. Doing this did eliminate those errors anyway, but now as I got past those I found a much worse problem.
"main.c" contains some inline assembly code, which had been entered as one long quoted string, which is a deprecated format. Fortunately that was easy to fix by removing the existing quotes and inserting '"' at the start of each asm line and adding '/n"' at the end of each such line. But even though this eliminated that error, another error persisted. I'm quoting this error on the line below, as it is the one thing I have NO cure for.
"/cygdrive/e/PS2_Dev/gcc/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/bin/as: unrecognized option '-mcpu=r5900'"
This looks a bit confusing, but it simply means that the gas version stored as "/cygdrive/e/PS2_Dev/gcc/ee/ee/bin/as" has been invoked with that option, even though I already changed the ASFLAGS variable to avoid that. This is logical too, considering that the 'make' tool isn't really involved in the automatic invocation of the assembler to deal with inline assembly, but that raises the question of where the heck this FAULTY option is defined, as that component must be modified now that this option is deprecated.
I have no definite answer to that question myself, and even if I did there isn't much I could do about it... I strongly suspect it's gcc itself that contains this option, hardcoded into the routine that invokes gas.
I hope someone else can come up with a more definite answer, and (better yet) a remedy.
Best regards: dlanor