This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fwd: Re: [linker] relaxation question]


Hi Nick,

Thank you very much for details.
I will work on to add the below design changes in cr16 port.

Thanks
Swami
Nick Clifton wrote:
Hi Swami,

Any hint to get the relocs for .uleb128 also ?

These are much harder to handle. (Which is probably why the mn10300 port does not do anything special for them at the moment).


The problem is that LEB128 values are variable in length. In theory the correct thing to do is:

   * If linker relaxation is not enabled then emit the LEB128 value
     as normal.

   * If the expression does not involve any symbols then emit the
     LEB128 value as normal.

   * If the expression is the difference of two symbols which are
     in the same section and this sections will not be relaxed then
     emit the LEB128 value as normal.

   * Otherwise emit a LEB128 value which is the maximum possible
     length for the target architecture.  (Ie: 16-bit, 32-bit or
     64-bit).  Then also emit one or two relocations to indicate
     that an LEB128 value needs to be handled at this location.
     (You will probably have to create new relocations for this).
     Emit one relocation if there is only one symbol in the original
     expression.  Emit two relocations if the original expression
     is the difference of two symbols.

   * In the linker you must make sure that in addition to relaxing
     the normal sections you also relax any section that contains
     any of the LEB128 relocations.  Ie you relax the LEB128 values.

   * Finally in the linker, when you are processing relocations
     you must add code to handle these LEB128 values and compute
     the correct value to be placed into the binary.  (You may
     actually choose to do this computation and insertion at the
     same time as you relax the LEB128 relocations, but
     conceptually there are two separate operations).

Cheers
   Nick







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]