Changing the code model most likely changes the ABI,
It does not, it only restricts what pointer values are legal, it
doesn't change calling convention or struct layout or the like.
so it's no wonder
it does not work anymore.
The same thing happens if your gcc is compiled with a different
"regparm" setting than your code.
No, that is a bug, and specific to x86.
This was generally reported to the gcc folks last year
but I think
nothing has happened since then:
The mad rush for 4.5 is over, maybe some poking is in order. You do
realise this isn't a very high priority bug for most people, right.
So until then the GCC folks' answer is: If your
code uses compile time
options that change the ABI of your compiler, you need to compile a
compiler (well, libgcc) with those options, too.
No, that is not the party line.
So the simplest way is
just not assuming any ABI details if possible and not using CFLAGS that
change the default ABI.
Sure, but then you have to build a compiler that defaults to the ABI you
want. Note that this anyway doesn't solve the regparm model, and also
not the Sparc -mcmodel problem AFAICS.
The "simplest way" to fix it would be first to figure out exactly what
is actually wrong, and go from there.