[llvm] r239552 - Generalize emitAbsoluteSymbolDiff.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jun 16 11:44:47 PDT 2015


>  1. It's only used when emitting DWARF.  (I have an out-of-tree patch
>     to rename it to emitDwarfLabelDifference()... I'll commit that soon
>     I hope.)
>  2. emitSectionOffset(), which calls into this function only on Mach-O,
>     is only used to describe DWARF sections.  (The same patch fixes its
>     name.)

I don't think it should be renamed. As far as I can tell it is a fully
general optimization:

* We want to output a-b on non-macho and "t = a - b; t" on MachO.
* If a-b doesn't need a relocation, this will just produce a number in
all cases.
* By definition we don't need a relocation on MachO (the temp
assignment is there to avoid it).
* If a and b are in the same section, them we don't need a relocation
in ELF/COFF.
* If a and b are in the same fragment, they are in the same section.

Cheers,
Rafael



More information about the llvm-commits mailing list