The error log is as follows:
Compiling unistd_getopt.c [large_data_020:c]
/tmp/ccrQcqYy.s: Assembler messages:
/tmp/ccrQcqYy.s:36: Error: parse error -- statement cmpl (sp.0),d0' ignored
/tmp/ccrQcqYy.s:58: Error: parse error -- statementmovel (sp.0),a0' ignored
/tmp/ccrQcqYy.s:86: Error: parse error -- statement addql #1,(sp.0)' ignored
/tmp/ccrQcqYy.s:89: Error: parse error -- statementmovel (sp.0),a0' ignored
/tmp/ccrQcqYy.s:94: Error: parse error -- statement movel d0,(sp.0)' ignored
/tmp/ccrQcqYy.s:104: Error: parse error -- statementaddl (sp.0),a0' ignored
/tmp/ccrQcqYy.s:129: Error: parse error -- statement movel d0,(sp.0)' ignored
/tmp/ccrQcqYy.s:139: Error: parse error -- statementmovel d0,(sp.0)' ignored
/tmp/ccrQcqYy.s:143: Error: parse error -- statement addql #1,(sp.0)' ignored
/tmp/ccrQcqYy.s:146: Error: parse error -- statementmovel (sp.0),a0' ignored
/tmp/ccrQcqYy.s:150: Error: parse error -- statement `movel d0,(sp.0)' ignored
make[2]: *** [large_data_020/libc_objs/unistd_getopt.o] Error 1
This can be fixed by changing the name of the variable "sp" in that file to something else (I used spp).
It appears this version of gcc gets confused with static variables that are named the same as registers.
Wow! Thank you for getting to the bottom of this. This is the strangest bug I’ve become aware of in years. Is it really only this particular file, or are other files affected as well? The name of a variable should not affect the assembly language code at all. What did you change the name of the variable to? Does the problem appear only if it’s called “sp”, or might it be the length of the name which triggers this problem?
I haven’t compiled the library for a 68k target using a more modern GCC version. I’m still stuck with the GCC v2 which I built natively using clib2 itself. Where can I find the compiler version you used, so that I might reproduce the problem after fixing it?
Hi Olaf
It's only that one file as far as I can tell. I suspect it might be a bug in gcc3.4 causing it, as I can build with later versions without it complaining (although I don't have sufficient patches for later versions to get any working 68k binaries). I changed the variable to "spp", I haven't tried any other names, but it looks like it is getting confused between variable and register names. Fredrik Wikstrom advises me it happens only with local static variables.
gcc3.4.6 is downloaded straight from the gcc.org website -http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2 - with the patches here applied: http://git.netsurf-browser.org/toolchains.git/tree/m68k-unknown-amigaos/recipes/patches/gcc and files added: http://git.netsurf-browser.org/toolchains.git/tree/m68k-unknown-amigaos/recipes/files/gcc/gcc
This is the patch I used for clib2: http://git.netsurf-browser.org/toolchains.git/tree/m68k-unknown-amigaos/recipes/patches/clib2/clib2.unistd_getopt.c.p
I'm not sure if this one is required too as I'm uncertain what is meant by "modern gcc": http://git.netsurf-browser.org/toolchains.git/tree/m68k-unknown-amigaos/recipes/patches/clib2/clib2.modern_gcc.p
I haven’t compiled the library for a 68k target using a more modern GCC version. I’m still stuck with the GCC v2 which I built natively using clib2 itself. Where can I find the compiler version you used, so that I might reproduce the problem after fixing it?
--
Home: Olaf Barthel, Gneisenaustrasse 43, D-31275 Lehrte
Net: obarthel@gmx.net
Related
Bugs: #55