forked from OSchip/llvm-project
ELF: Remove non-standard ELF features from AMDGPU target.
Patch by Tom Stellard! llvm-svn: 263063
This commit is contained in:
parent
8f12eba78d
commit
e090fb2891
|
@ -1463,13 +1463,7 @@ void SymbolTableSection<ELFT>::writeLocalSymbols(uint8_t *&Buf) {
|
|||
const OutputSectionBase<ELFT> *OutSec = Section->OutSec;
|
||||
ESym->st_shndx = OutSec->SectionIndex;
|
||||
VA = Section->getOffset(*Sym);
|
||||
|
||||
// Symbol offsets for AMDGPU are the offsets in bytes of the
|
||||
// symbols from the beginning of the section. There seems to be no
|
||||
// reason for that deviation -- it's just that the definition of
|
||||
// st_value field in AMDGPU's ELF is odd.
|
||||
if (Config->EMachine != EM_AMDGPU)
|
||||
VA += OutSec->getVA();
|
||||
VA += OutSec->getVA();
|
||||
}
|
||||
ESym->st_name = P.second;
|
||||
ESym->st_size = Sym->st_size;
|
||||
|
|
|
@ -44,12 +44,6 @@ typename ELFFile<ELFT>::uintX_t SymbolBody::getVA() const {
|
|||
return D->Sym.st_value;
|
||||
assert(SC->Live);
|
||||
|
||||
// Symbol offsets for AMDGPU are the offsets in bytes of the symbols
|
||||
// from the beginning of the section. Note that this part of AMDGPU's
|
||||
// ELF spec is odd and not in line with the standard ELF.
|
||||
if (Config->EMachine == EM_AMDGPU)
|
||||
return SC->getOffset(D->Sym);
|
||||
|
||||
if (D->Sym.getType() == STT_TLS)
|
||||
return SC->OutSec->getVA() + SC->getOffset(D->Sym) -
|
||||
Out<ELFT>::TlsPhdr->p_vaddr;
|
||||
|
|
|
@ -1221,18 +1221,6 @@ static uint32_t toPhdrFlags(uint64_t Flags) {
|
|||
return Ret;
|
||||
}
|
||||
|
||||
/// For AMDGPU we need to use custom segment kinds in order to specify which
|
||||
/// address space data should be loaded into.
|
||||
template <class ELFT>
|
||||
static uint32_t getAmdgpuPhdr(OutputSectionBase<ELFT> *Sec) {
|
||||
uint32_t Flags = Sec->getFlags();
|
||||
if (Flags & SHF_AMDGPU_HSA_CODE)
|
||||
return PT_AMDGPU_HSA_LOAD_CODE_AGENT;
|
||||
if ((Flags & SHF_AMDGPU_HSA_GLOBAL) && !(Flags & SHF_AMDGPU_HSA_AGENT))
|
||||
return PT_AMDGPU_HSA_LOAD_GLOBAL_PROGRAM;
|
||||
return PT_LOAD;
|
||||
}
|
||||
|
||||
// Decide which program headers to create and which sections to include in each
|
||||
// one.
|
||||
template <class ELFT> void Writer<ELFT>::createPhdrs() {
|
||||
|
@ -1281,9 +1269,7 @@ template <class ELFT> void Writer<ELFT>::createPhdrs() {
|
|||
// If flags changed then we want new load segment.
|
||||
uintX_t NewFlags = toPhdrFlags(Sec->getFlags());
|
||||
if (Flags != NewFlags) {
|
||||
uint32_t LoadType = (Config->EMachine == EM_AMDGPU) ? getAmdgpuPhdr(Sec)
|
||||
: (uint32_t)PT_LOAD;
|
||||
Load = AddHdr(LoadType, NewFlags);
|
||||
Load = AddHdr(PT_LOAD, NewFlags);
|
||||
Flags = NewFlags;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ program_global_readonly:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: module_global_agent
|
||||
# CHECK: Value: 0x0
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Local
|
||||
# CHECK: Section: .hsadata_global_agent
|
||||
|
@ -85,7 +85,7 @@ program_global_readonly:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: module_global_program
|
||||
# CHECK: Value: 0x0
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Local
|
||||
# CHECK: Section: .hsadata_global_program
|
||||
|
@ -93,7 +93,7 @@ program_global_readonly:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: module_global_readonly
|
||||
# CHECK: Value: 0x0
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Local
|
||||
# CHECK: Type: Object
|
||||
|
@ -102,7 +102,7 @@ program_global_readonly:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: program_global_agent
|
||||
# CHECK: Value: 0x4
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Global
|
||||
# CHECK: Type: Object
|
||||
|
@ -111,7 +111,7 @@ program_global_readonly:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: program_global_program
|
||||
# CHECK: Value: 0x4
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Global
|
||||
# CHECK: Type: Object
|
||||
|
@ -120,7 +120,7 @@ program_global_readonly:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: program_global_readonly
|
||||
# CHECK: Value: 0x4
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Global
|
||||
# CHECK: Type: Object
|
||||
|
@ -128,11 +128,11 @@ program_global_readonly:
|
|||
# CHECK: }
|
||||
|
||||
# CHECK: ProgramHeader {
|
||||
# CHECK: Type: PT_AMDGPU_HSA_LOAD_GLOBAL_PROGRAM
|
||||
# CHECK: VirtualAddress: [[HSADATA_GLOBAL_PROGRAM_ADDR]]
|
||||
# CHECK: Type: PT_LOAD
|
||||
# CHECK: VirtualAddress:
|
||||
# CHECK: }
|
||||
|
||||
# CHECK: ProgramHeader {
|
||||
# CHECK: Type: PT_AMDGPU_HSA_LOAD_CODE_AGENT
|
||||
# CHECK: VirtualAddress: [[HSATEXT_ADDR]]
|
||||
# CHECK: Type: PT_LOAD
|
||||
# CHECK: VirtualAddress:
|
||||
# CHECK: }
|
||||
|
|
|
@ -41,7 +41,7 @@ kernel1:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: kernel0
|
||||
# CHECK: Value: 0x0
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 4
|
||||
# CHECK: Binding: Global
|
||||
# CHECK: Type: AMDGPU_HSA_KERNEL
|
||||
|
@ -50,7 +50,7 @@ kernel1:
|
|||
|
||||
# CHECK: Symbol {
|
||||
# CHECK: Name: kernel1
|
||||
# CHECK: Value: 0x100
|
||||
# CHECK: Value:
|
||||
# CHECK: Size: 8
|
||||
# CHECK: Binding: Global
|
||||
# CHECK: Type: AMDGPU_HSA_KERNEL
|
||||
|
@ -58,6 +58,6 @@ kernel1:
|
|||
# CHECK: }
|
||||
|
||||
# CHECK: ProgramHeader {
|
||||
# CHECK: Type: PT_AMDGPU_HSA_LOAD_CODE_AGENT
|
||||
# CHECK: VirtualAddress: [[HSATEXT_ADDR]]
|
||||
# CHECK: Type: PT_LOAD
|
||||
# CHECK: VirtualAddress:
|
||||
# CHECK: }
|
||||
|
|
Loading…
Reference in New Issue