|
Greetings everyone!!!
It's us again, we asked for your help a few
days ago about a problem that we are having porting poplog to OS X. We now
have way more information in regards to what may be causing it and would
appreciate to pick your brain for some help since we've looked at this from
every possible angle.
We generate the symbolic assembler based on AIX for
PPC files and the code seems to work fine, the only problem is that when
the code tries to reach a tag address it fails because the offset value is
wrong.
As an example, in signal.a (generated from signals.p):
lwz
r6, -48(r15) ; L1B
In OS X assembler this is trying to load the register
r6 with the address of r15 - 48, which should correspond to tag L1B, but when
we disassembled that address, we found out that the tag referred is just at a
very close lower memory position (should point to -52 instead of -48). Often,
it points to
about 4 bytes too low from the address where it should, but in some other
cases,
it can point up to 60 bytes too low (happened in one case). This also only
happens
when the offset is negative, otherwise (offset is positive) the code gets
the right tag address.
I would like to find a generic way to fix this.
The fix is most probably within genproc.p. There is most probably a 2 pass
compilation in there. The first one that calculates the tag addresses, and
the second one that generates the assembler. We believe that problem may be
in the process that populates constref. Since constref populates these
relative addresses in the assembly, it is most probably involved in the
mess.
Also, byte alignment could be involved in the
problem. How does genproc.p
manages byte alignment? This is normally handled by
the assembly compiler
itself. Although the fact that the problem only
happens for cases where there
is a lower reference is a sign that it is most
probably not the case (if it were,
we would have a problem with forward references
also), but it still can stay on
our short list of suspects.
Could we
get some explanations on the compilation process that results in the
generation and handling of relative tags? This is critical for us to conclude
this port.
By the way, the more we work with poplog, the more we are
impressed with the way it works. This is an impressive product that we want
on OS X ASAP.
Thanks a lot for your help!!!
|