This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[m68k]: how to specify PC-relative symbol?
- From: Peter Barada <peter at the-baradas dot com>
- To: binutils at sources dot redhat dot com
- Date: Sun, 24 Apr 2005 12:56:02 -0400 (EDT)
- Subject: [m68k]: how to specify PC-relative symbol?
Whie porting glibc-2.3.5 to ColdFire, I'm wrestling with how to
indicate tothe assembler that a symbol should be PC-relative. In
particular, on the m68020:
move.l _dl_skip_args(%pc), %d0
is valic and will generate an insruction that takes the 32-bit
PC-relative value of the symbol '_dl_skip_args', add it to %pc use
the restul as the address to load a 32-bit value into %d0.
On ColdFire 32 bit offsets are not allowed, so this has to be rewriten
as:
lea _dl_skip_args, %a0
move.l -6(%pc,%a0), %d0
Which loads the 32 bit value of the symbol _dl_skip_args into %a0,
then addes the %pc and an adjustment between the two instructions, and
then using the resultant address, load a 32-bit value into %d0.
My problem is that unless this code is linked to address 0 this won't
work.
How can I specify on the lea instructions that the value should be
PC-relative instead of absolute?
--
Peter Barada
peter@the-baradas.com