summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/OutputSections.cpp8
-rw-r--r--lld/ELF/Symbols.cpp6
-rw-r--r--lld/ELF/Writer.cpp16
-rw-r--r--lld/test/ELF/amdgpu-globals.s20
-rw-r--r--lld/test/ELF/amdgpu-kernels.s8
5 files changed, 16 insertions, 42 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 8c294f6865a..1e83fc649ca 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -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;
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 7d91f05dc77..51ab6678680 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -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;
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 0dca801c85e..ad6e9660439 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -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;
}
diff --git a/lld/test/ELF/amdgpu-globals.s b/lld/test/ELF/amdgpu-globals.s
index ff0899f60a9..7f46b989b95 100644
--- a/lld/test/ELF/amdgpu-globals.s
+++ b/lld/test/ELF/amdgpu-globals.s
@@ -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: }
diff --git a/lld/test/ELF/amdgpu-kernels.s b/lld/test/ELF/amdgpu-kernels.s
index 208ede18406..62a8cb74a54 100644
--- a/lld/test/ELF/amdgpu-kernels.s
+++ b/lld/test/ELF/amdgpu-kernels.s
@@ -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: }
OpenPOWER on IntegriCloud