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: Multiple relocation in ELF


> 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


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