Rename existing relocation types to legacy/v1 (NFC)
Change-Id: Ided7f656c34131b8067a19c0d3b2955fc8823628
[ROCm/ROCR-Runtime commit: b2c32ad6cb]
这个提交包含在:
@@ -263,14 +263,14 @@ typedef enum {
|
||||
// ELF Symbol Flag Enumeration Values.
|
||||
#define STF_AMDGPU_HSA_CONST AMDGPU_HSA_SYMBOL_FLAG_CONST
|
||||
|
||||
// AMD GPU Relocation Type Enumeration Values.
|
||||
#define R_AMDGPU_NONE 0
|
||||
#define R_AMDGPU_32_LOW 1
|
||||
#define R_AMDGPU_32_HIGH 2
|
||||
#define R_AMDGPU_64 3
|
||||
#define R_AMDGPU_INIT_SAMPLER 4
|
||||
#define R_AMDGPU_INIT_IMAGE 5
|
||||
#define R_AMDGPU_RELATIVE64 13
|
||||
// Legacy/V1 AMD GPU Relocation Type Enumeration Values.
|
||||
#define R_AMDGPU_V1_NONE 0
|
||||
#define R_AMDGPU_V1_32_LOW 1
|
||||
#define R_AMDGPU_V1_32_HIGH 2
|
||||
#define R_AMDGPU_V1_64 3
|
||||
#define R_AMDGPU_V1_INIT_SAMPLER 4
|
||||
#define R_AMDGPU_V1_INIT_IMAGE 5
|
||||
#define R_AMDGPU_V1_RELATIVE64 13
|
||||
|
||||
// AMD GPU Note Type Enumeration Values.
|
||||
#define NT_AMD_HSA_CODE_OBJECT_VERSION 1
|
||||
|
||||
@@ -954,7 +954,7 @@ namespace code {
|
||||
uint64_t offset = ImageInitSection()->addData(&desc, sizeof(desc), 8);
|
||||
amd::elf::Symbol* imageInit =
|
||||
img->symtab()->addSymbol(ImageInitSection(), "", offset, 0, STT_AMDGPU_HSA_METADATA, STB_LOCAL);
|
||||
image->elfSym()->section()->relocationSection()->addRelocation(R_AMDGPU_INIT_IMAGE, imageInit, image->elfSym()->value() + destOffset, 0);
|
||||
image->elfSym()->section()->relocationSection()->addRelocation(R_AMDGPU_V1_INIT_IMAGE, imageInit, image->elfSym()->value() + destOffset, 0);
|
||||
}
|
||||
|
||||
void AmdHsaCode::AddImageInitializer(
|
||||
@@ -995,7 +995,7 @@ namespace code {
|
||||
uint64_t offset = SamplerInitSection()->addData(&desc, sizeof(desc), 8);
|
||||
amd::elf::Symbol* samplerInit =
|
||||
img->symtab()->addSymbol(SamplerInitSection(), "", offset, 0, STT_AMDGPU_HSA_METADATA, STB_LOCAL);
|
||||
sampler->elfSym()->section()->relocationSection()->addRelocation(R_AMDGPU_INIT_SAMPLER, samplerInit, sampler->elfSym()->value() + destOffset, 0);
|
||||
sampler->elfSym()->section()->relocationSection()->addRelocation(R_AMDGPU_V1_INIT_SAMPLER, samplerInit, sampler->elfSym()->value() + destOffset, 0);
|
||||
}
|
||||
|
||||
void AmdHsaCode::AddSamplerInitializer(Symbol* sampler, uint64_t destOffset,
|
||||
@@ -1014,7 +1014,7 @@ namespace code {
|
||||
|
||||
void AmdHsaCode::AddInitVarWithAddress(bool large, Symbol* dest, uint64_t destOffset, Symbol* addrOf, uint64_t addrAddend)
|
||||
{
|
||||
uint32_t rtype = large ? R_AMDGPU_64 : R_AMDGPU_32_LOW;
|
||||
uint32_t rtype = large ? R_AMDGPU_V1_64 : R_AMDGPU_V1_32_LOW;
|
||||
dest->elfSym()->section()->relocationSection()->addRelocation(rtype, addrOf->elfSym(), dest->elfSym()->value() + destOffset, addrAddend);
|
||||
}
|
||||
|
||||
|
||||
@@ -1639,9 +1639,9 @@ hsa_status_t ExecutableImpl::ApplyStaticRelocation(hsa_agent_t agent, amd::hsa::
|
||||
Segment* rseg = SectionSegment(agent, sec);
|
||||
size_t reladdr = sec->addr() + rel->offset();
|
||||
switch (rel->type()) {
|
||||
case R_AMDGPU_32_LOW:
|
||||
case R_AMDGPU_32_HIGH:
|
||||
case R_AMDGPU_64:
|
||||
case R_AMDGPU_V1_32_LOW:
|
||||
case R_AMDGPU_V1_32_HIGH:
|
||||
case R_AMDGPU_V1_64:
|
||||
{
|
||||
uint64_t addr;
|
||||
switch (sym->type()) {
|
||||
@@ -1672,15 +1672,15 @@ hsa_status_t ExecutableImpl::ApplyStaticRelocation(hsa_agent_t agent, amd::hsa::
|
||||
|
||||
uint32_t addr32 = 0;
|
||||
switch (rel->type()) {
|
||||
case R_AMDGPU_32_HIGH:
|
||||
case R_AMDGPU_V1_32_HIGH:
|
||||
addr32 = uint32_t((addr >> 32) & 0xFFFFFFFF);
|
||||
rseg->Copy(reladdr, &addr32, sizeof(addr32));
|
||||
break;
|
||||
case R_AMDGPU_32_LOW:
|
||||
case R_AMDGPU_V1_32_LOW:
|
||||
addr32 = uint32_t(addr & 0xFFFFFFFF);
|
||||
rseg->Copy(reladdr, &addr32, sizeof(addr32));
|
||||
break;
|
||||
case R_AMDGPU_64:
|
||||
case R_AMDGPU_V1_64:
|
||||
rseg->Copy(reladdr, &addr, sizeof(addr));
|
||||
break;
|
||||
default:
|
||||
@@ -1689,7 +1689,7 @@ hsa_status_t ExecutableImpl::ApplyStaticRelocation(hsa_agent_t agent, amd::hsa::
|
||||
break;
|
||||
}
|
||||
|
||||
case R_AMDGPU_INIT_SAMPLER:
|
||||
case R_AMDGPU_V1_INIT_SAMPLER:
|
||||
{
|
||||
if (STT_AMDGPU_HSA_METADATA != sym->type() ||
|
||||
SHT_PROGBITS != sym->section()->type() ||
|
||||
@@ -1720,7 +1720,7 @@ hsa_status_t ExecutableImpl::ApplyStaticRelocation(hsa_agent_t agent, amd::hsa::
|
||||
break;
|
||||
}
|
||||
|
||||
case R_AMDGPU_INIT_IMAGE:
|
||||
case R_AMDGPU_V1_INIT_IMAGE:
|
||||
{
|
||||
if (STT_AMDGPU_HSA_METADATA != sym->type() ||
|
||||
SHT_PROGBITS != sym->section()->type() ||
|
||||
@@ -1833,7 +1833,7 @@ hsa_status_t ExecutableImpl::ApplyDynamicRelocation(hsa_agent_t agent, amd::hsa:
|
||||
symAddr += rel->addend();
|
||||
|
||||
switch (rel->type()) {
|
||||
case R_AMDGPU_32_HIGH:
|
||||
case R_AMDGPU_V1_32_HIGH:
|
||||
{
|
||||
if (!symAddr) {
|
||||
logger_ << "LoaderError: symbol \"" << rel->symbol()->name() << "\" is undefined\n";
|
||||
@@ -1845,7 +1845,7 @@ hsa_status_t ExecutableImpl::ApplyDynamicRelocation(hsa_agent_t agent, amd::hsa:
|
||||
break;
|
||||
}
|
||||
|
||||
case R_AMDGPU_32_LOW:
|
||||
case R_AMDGPU_V1_32_LOW:
|
||||
{
|
||||
if (!symAddr) {
|
||||
logger_ << "LoaderError: symbol \"" << rel->symbol()->name() << "\" is undefined\n";
|
||||
@@ -1857,7 +1857,7 @@ hsa_status_t ExecutableImpl::ApplyDynamicRelocation(hsa_agent_t agent, amd::hsa:
|
||||
break;
|
||||
}
|
||||
|
||||
case R_AMDGPU_64:
|
||||
case R_AMDGPU_V1_64:
|
||||
{
|
||||
if (!symAddr) {
|
||||
logger_ << "LoaderError: symbol \"" << rel->symbol()->name() << "\" is undefined\n";
|
||||
@@ -1868,7 +1868,7 @@ hsa_status_t ExecutableImpl::ApplyDynamicRelocation(hsa_agent_t agent, amd::hsa:
|
||||
break;
|
||||
}
|
||||
|
||||
case R_AMDGPU_RELATIVE64:
|
||||
case R_AMDGPU_V1_RELATIVE64:
|
||||
{
|
||||
int64_t baseDelta = reinterpret_cast<uint64_t>(relSeg->Address(0)) - relSeg->VAddr();
|
||||
uint64_t relocatedAddr = baseDelta + rel->addend();
|
||||
|
||||
在新工单中引用
屏蔽一个用户