Symbol values in memory word units

Oleg Volf ykvolf@yahoo.com
Tue Dec 2 17:31:00 GMT 2008




> >> linker expects section's vma and lma in byte units
> >
> > See bfd_arch_mach_octets_per_byte and OCTETS_PER_BYTE.
> 
> But in practice these are poorly defined and it is really hard to use
> these successfully.  What I've done in the past is keep symbol values
> and relocation addresses in bytes, and adjust in the relocation
> routines.  This means that nm, objdump, readelf print the wrong
> values, but it's not a difficult mental adjustment.

The problem, actually, is more complicated. Our architecture has non-unified memory.  Different  memories have different memory word sizes. When assembler sees instruction like this:
ld $r1, label + 5
it does not know in which section symbol is defined (section corresponds to memory type) and creates "generic" data relocation. In this  implementation  I suppose  that both addend  and  relocation address are  in  words.
I, probably, can implement this approach with with modified bfd_arch_mach_octets_per_byte() if "current" section is available. Does linker have interface to access "current" section?

Thanks,
  Oleg



      



More information about the Binutils mailing list