about relocation of split symbols

Alan Modra amodra@gmail.com
Fri Jul 1 00:29:00 GMT 2011
On Thu, Jun 30, 2011 at 03:58:06PM +0200, Aurelien Buhrig wrote:
> My guess is that some instructions (such as "la" instruction) are
> transformed by the assembly into 2 instructions loading both 16-bit
> parts of the 32-bit address (or more for 64-bit addresses). Right?

Yes, except that you should think long and hard before implementing
magic transformations in the assembler.  It's probably better to keep
the assembler simple, ie. just provide the underlying hardware
instructions.

> So 2 additional HOWTOs must be defined for LD to know how to relocate
> both parts, right ?

Yes.  See powerpc R_PPC_ADDR16_LO, R_PPC_ADDR16_HI, R_PPC_ADDR16_HA
and many more like these.  The difference between the HI and HA relocs
is that the former is used in code that ors in the low part of the
address, the latter is used when you add the low part with an
instruction that treats its 16-bit immediate as signed.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list