This is the mail archive of the binutils@sources.redhat.com 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: How to add 'relaxing' to loader for m68k



>> Ok, noted.  Anything else?
>
>I suggest marking object files in some way to indicate they are
>candidates for linker relaxation (ie. have all the necessary relocs).
>You could do this using e_flags, sh_flags, or by the presence of a
>special reloc, named section, or note.  Too many options. :)

Good idea about marking the object for relaxation.  I don't want to
inflate the relocation information so much that it makes dynamically
linked library balloon in size.  I think I'll have to add a special
reloc type that indicates the instruction is a 'move', 'pea', or 'bsr'
as well as mark pc-relative reloaction on everthing that can enclose
one of these relaxable types.  Perhaps I'll have to add a pass that
determines if a relocation record can be removed since there are no
relaxable reloc records between what the label the relocation refers
to and the location to relocate: 

L1:   jbsr  <foo>
      tst.l %d0
      bne L1

In this case the bne instruction needs a relocation record to indicate
that the target of the branch is L1, pc-relative and can be shrunk if
L1 is in range after the jbsr instruction is relaxed. If the jbsr insn
was replaced with an instruction that wasn not relaxable, then the
offset of the bne can be calculated in the assembler alone and the
relocation record is not needed.

>Don't be tempted to scan .text to look for places to relax.  There's
>too much chance of confusion with tables etc. looking like instructions.

I know that I can't just scan the .text segment since it has case
tables in it, as well as any readonly structures that the user marked
with '__attribute__ section (".text")', as well as FP constants(well,
it will when I make loading FP constants PC-relative).

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)


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