[PATCH] D47601: AMDGPU: Add 64-bit relative variant kind

Konstantin Zhuravlyov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 10:25:04 PDT 2018


kzhuravl added a comment.

In https://reviews.llvm.org/D47601#1121159, @t-tye wrote:

> In https://reviews.llvm.org/D47601#1120916, @nhaehnle wrote:
>
> > In https://reviews.llvm.org/D47601#1120903, @nhaehnle wrote:
> >
> > > What is this actually needed for? Having a relative relocation in a data segment doesn't seem that useful?
> >
> >
> > Never mind, I see it in the other commit. Could you please update the table of relocation types in AMDGPUUsage.rst? It has an `R_AMDGPU_RELATIVE64`, I don't know what that's about, but it doesn't mention `R_AMDGPU_REL64`.
>
>
> The AMDGPU_REL64 is defined in AMDGPUUsage as:
>
> '''
>  Relocation Type 	Kind 	Value 	Field 	Calculation
>  R_AMDGPU_REL64 	Static 	5 	word64 	S + A - P
>  '''
>
> It is a static relocation used to create PC relative values between sections. For example, there is a field in the kernel descriptor that has to be the delta from the kernel descriptor to the kernel entry point. So if the kernel descriptor is put in a different section to the code, a static relocation record is need. It will be resolved when the executable is linked.
>
> The R_AMDGPU_RELATIVE64 is a dynamic relocation record implemented by most targets to support having absolute addresses in data sections that need to be initialized to the address of a symbol in the same shared object. For example, a variable initialized to the address of another variable which is considered a compile time constant in languages such as C/C++.


Is current wording about R_AMDGPU_REL64 and R_AMDGPU_RELATIVE64 in AMDGPUUsage enough?


https://reviews.llvm.org/D47601





More information about the llvm-commits mailing list