[llvm-commits] [patch] Correctly detect which symbols go in the ELF symbol table

Rafael Espindola espindola at google.com
Thu Sep 30 13:31:54 PDT 2010


One annoying thing in ELF is that the list of symbols to go in the
symbol table depends on which symbols are used on a relocation. The
relocations also depend on the symbol number, so this has to be
computed in two phases.

The way this patch implements this is by moving the symbol table
computation for ELF from ExecutePostLayoutBinding to WriteObject. With
this change the symbol indexes are not known when RecordRelocation
runs, so it remembers the full symbol and that is used to find the
index when writing the relocation.

One of the problems with this way is that WriteObject now takes as a
non-const MCAssembler. Some ways to avoid this:

*) Add a ExecutePostRelocationsBinding callback and compute the symbol
table in there.
*) Replace ExecutePostLayoutBinding with
ExecutePostRelocationsBinding. This would make other file formats
implementations a bit more awkward, but avoid having a second
callback.

Opinions?

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: symbols.patch
Type: text/x-patch
Size: 16683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100930/b80665e1/attachment.bin>


More information about the llvm-commits mailing list