Mindless ABI adherence
Florian Weimer
fw@deneb.enyo.de
Fri Oct 19 10:18:00 GMT 2001
Linus Torvalds <torvalds@transmeta.com> writes:
>>You can already do this using function attributes and/or command line
>>switches. Since the x86 has so few registers, it is not clear if
>>register passing is a win in all situations.
>
> You can _not_ do it in practice with command line switches.
>
> Why? Because that breaks horribly for precompiled object files, ie
> libraries. And the only projects I know of that don't use standard
> libraries are various OS kernels floating around.
There are libc implementations (or workalikes) which are so small that
you could bundle them with your application.
Header file tweaking could solve the problem (by redefining __TRHOW,
for example), but in most cases, it's certainly easier to do it the
other way round.
However, the stub approach is interesting.
> add:
> addl %edx,%eax
> ret;
>
> stub$add:
> movl 4(%esp),eax
> movl 8(%esp),edx
> jmp add;
I think you could even avoid the jump, just by reordering the code.
More information about the Gcc-bugs
mailing list