This is the mail archive of the
mailing list for the binutils project.
Re: [Gold] how to do relax in Gold ?
- From: Ian Lance Taylor <iant at google dot com>
- To: Shawn <shaolin dot xie at ia dot ac dot cn>
- Cc: binutils at sourceware dot org, Triple Yang <triple dot yang at gmail dot com>
- Date: Tue, 15 Jan 2013 22:09:53 -0800
- Subject: Re: [Gold] how to do relax in Gold ?
- References: <50F6428B.firstname.lastname@example.org>
On Tue, Jan 15, 2013 at 10:02 PM, Shawn <email@example.com> wrote:
> Hi All:
> I'am porting Gold to our processor right now ,everything is fine except
> the label whose value is big. For Example, the following instruction assign
> a LABEL value to register R0:
> R0 = LABEL_0;
> 1. Our Objects
> Our instruction is encoded in 32bit, if the value of "LABLE_0" is too
> big, for example 0x40000, there is not enough space to encode the
> instruction into a 32bit instruction, we have to expand "R0 = LABEL_0" into
> a 64bit instruction automatically.
> Because the value of "LABEL_0" is not known until link-time, we hope
> "Gold" can handle this .
> 2. My plan & Question:
> I found the function related to our object is the "Target::do_relax"
> function, but only arm.cc & powerpc.cc has overwritten it. The "do_relax" in
> arm.cc & powerpc.cc is too complicate to analyze. I hope to get a clean
> implementation of Our Objects.
> a) Scan relocation info in all input objects, find the relocations that
> may need relaxation ( read & compare the symbol value )
> How can I read the relocation info ?
> How can I reany advice ad the symbol value ? Is the value read
> from the Symbol_table represent the value after layout ?
> b) for each relocation that need relaxation, insert a 32bit stub in the
> VIEW, and update the value of the symbol which is located after the
> relocation site.
> And is there any other example related to relaxation except arm.cc &
> powerpc.cc ? or any document ?
I think one approach would be to record the possible relaxation points
in your scan_relocs routine. You will have all the relocation
information available there. That will let you detect out of range
relocations where you can insert stubs.