[llvm] r239552 - Generalize emitAbsoluteSymbolDiff.

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Jun 16 12:00:01 PDT 2015


> On 2015-Jun-16, at 11:44, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> 
>> 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.

Which one?  emitLabelDifference() or emitSectionOffset()?  Both?

> 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).

IIUC, the reason we don't need a relocation on Mach-O is that
emitLabelDifference() is only used for DWARF.

> * 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.




More information about the llvm-commits mailing list