[lld] r249340 - Create R_X86_64_RELATIVE when needed.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 14:30:04 PDT 2015


> I am wondering, for example, whether the .TOC.-relative relocations should be in this list? They're relative, in the sense that they don't require a getRelativeReloc() to be generated.

Probably yes (not familiar with TOC). I guess another way of saying it
is that these are input relocations that don't require a "full"
dynamic relocation. If nothing else requires it, we end up with a
getRelativeReloc(). Returning false will force a dynamic relocation to
be created.

>>
>> > Is it true that, for -shared and any relocation for which
>> > isRelRelative returns false, getRelativeReloc() is generated? If
>> > not, what other conditions affect when getRelativeReloc() is
>> > generated?
>>
>> I don't think the mapping is that direct.
>
> Maybe the thing that needs to be commented is this mapping. It clearly seems to have something to do with the return from isRelRelative, but it is more complicated? getRelativeReloc() needs a size_t-sized relocation target. How do we know when we have one?

If the relocation is not relative and not size_t sized, there would be
the possibility of overflowing at runtime, no?

Cheers,
Rafael


More information about the llvm-commits mailing list