Multiple relocation in ELF
Paul Brook
paul@codesourcery.com
Tue Jul 25 14:07:00 GMT 2006
> Note that you can always do a jump table using a PC relative
> relocation against a single symbol, plus an addend.
Not always. You may want to put the table itself in .rodata (to reduce code
size for better constant pool placement), and have the values in the table be
relative to the branch instruction. Especially with hot/cold partitioning
there's no guarantee that both the jump and the target will be in the same
section. eg:
.section rodata
table:
.word label1 - label2
.section text.hot
label2:
branch (pc + load(table + reg))
.section text.cold
label1:
code
Paul
More information about the Binutils
mailing list