Article View: gnu.utils.bug
Article #1008GAS problems for the 32x32
From: DALL
Date: Tue, 06 Oct 1992 21:35
Date: Tue, 06 Oct 1992 21:35
49 lines
2530 bytes
2530 bytes
I was adding some debugging code to the mach UX server and concluded that
the assembler doesn't handle pc relative addressing properly under
some circumstances. The following code
char *string;
main()
{
string = "The Quick Brown Fox";
printf("%s\n", string);
}
core dumps when compiled with gcc 2.2.2 (which generates pc relative
addressing by preference) and assembled with gas 1.38.1.
I have looked at gas and I think I can see what goes wrong. It doesn't
get the pcrel_adjust field correct in the second operand unless the
first operand displacement is known when frags get generated (in
convert_iif) or ends up 4 bytes big after all the relaxation etc.
This is difficult to fix because the pcrel_adjust is really a kludge
to try and make a 68020 assembler work for the 32x32 (which does its
displacements from the address of the instruction instead of the
address of the displacement)! The required value for pcrel_adjust is
essentially the size of the instruction so far. Unfortunately, the
size of the instruction so far is indeterminate at the time the
pcrel_adjust field is calculated and may be affected by the relax
phase. Further, the the pcrel_adjust field is also used in fix's
(which, I think, are required for relocation information).
The only way I can see (keeping the structure of gas the same) to fix
this is to keep track of when a new instruction starts (or the first
new frag after a new instruction starts) (needs an extra field in
frag), notice how much stretching happens within an instruction, and
adjust the pcrel adjustment by that amount. Also remember (in some
auxilary structure) which frags have had their adjustments adjusted
and by how much. Use this auxilliary info to fix the fix's. Maybe
fixes could just use the pcrel_adjust field in the frag instead of
their own pcrel_adjust field.
This is all a tangled mess. Maybe someone has fixed it?
If anyone can compile the above program with gcc 2 and gas for the 532
and run it, I would be very interested in whatever gas magic you are
using.
Ian
Technical Details
Message-ID:
<921006114742.246ca@hfrd.dsto.gov.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hfrd.dsto.gov.au!DALLShow Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hfrd.dsto.gov.au!DALL From: DALL@hfrd.dsto.gov.au Subject: GAS problems for the 32x32 Message-ID: <921006114742.246ca@hfrd.dsto.gov.au> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 6 Oct 1992 21:35:42 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 51