This is the mail archive of the
mailing list for the binutils project.
[Gold] how to do relax in Gold ?
- From: Shawn <shaolin dot xie at ia dot ac dot cn>
- To: binutils at sourceware dot org
- Cc: Triple Yang <triple dot yang at gmail dot com>
- Date: Wed, 16 Jan 2013 14:02:51 +0800
- Subject: [Gold] how to do relax in Gold ?
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 ?