Serious PPC stdarg problem with 2.95.2
Gunther Nikl
gnikl@informatik.uni-rostock.de
Fri Mar 10 10:46:00 GMT 2000
Hello Franz!
On 01-Mär-00, Franz Sirl wrote:
> At 19:20 27.02.00, Gunther Nikl wrote:
>> I knew should write the bit count ;-) Yes, the compiler mentioned
>> included a change that aligns structure elements on a 16 bit boundary
>> only. That may violate the PPC SYSV ABI and may cause a speed penalty.
>
> Not "may" violate, it IS violating the SYSV/EABI ABI.
Ok. I agree but it was done for good purpose even it thats hard to
believe.
>>> This is an ABI change and if you do that YOU have to make sure all the
>>> corresponding places in the compiler are changed as well.
>>
>> I have to disagree with you on this topic. The compilers behavoiur was
>> changed through a *well defined* and *documented* way namely with
>> ADJUST_FIELD_ALIGN. I think using hooks provided in the GCC sources
>> to alter the compiler behavoir is legal and GCC should respect this.
>
> Well, but the passing of varargs is ABI specific and building of va_list
> is handled in the backend (look at expand_builtin_saveregs in rs6000.c).
Now I know :-) BTW, expand_builtin_saveregs() is a strange name for
doing this stuff.
> And since that's the backend, we only care about the supported ABI's.
> Being generic here just unnecessarily expands codesize and complexity.
I understand why the things were done the way they are done. If GCC
would have been generic at this point it would have save me some trouble.
On the other hand it had something good - I learned more about GCCs
inner working and about "our" port.
>> > A lot of routines in the backend are tailored to a specific ABI
>> > convention.
>>
>> Well, that is certainly true but in this particular case this doesn't
>> apply. Structure layout does not belong to the backend, thats why its
>> done in stor-layout.c and in the developer sources rs6000.c no longer
>> carves the structure itself.
>
> But it is an ABI defined structure and it is perfectly legal to handle
> that in the backend. In fact in current gcc-2.96 va-ppc.h is gone and
> _everything_ related to that structure is handled in the backend (and your
> problem wouldn't show up here I assume).
I suppose with that the problem is gone with the new varargs handling.
I compiled a simple test case but since I didn't had an ppc available
and I do not fully understand PPC asm I can't tell whether the handling
avoids our problem. I think it does since now stor-layout layouts the
structure.
>> For our particular environment it didn't work because GCC took a shortcut.
>
> No, you took a shortcut and didn't change expand_builtin_saveregs()
> according to your ABI :-).
Its hard to argue with you about that stuff since I don't know what the
compiler is supposed to do and how things should be done. I wasn't
familar with the rs6000 backend thus I fell into this "trap". Now I know
better.
Gunther
More information about the Gcc-bugs
mailing list