[lld] r257023 - [ELF] Add AMDGPU support
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 18 09:11:55 PST 2016
> +
> + // Symbol offsets for AMDGPU need to be the offset in bytes of the symbol
> + // from the beginning of the section.
> + if (Config->EMachine == EM_AMDGPU)
> + return SC->getOffset(DR.Sym);
> if (DR.Sym.getType() == STT_TLS)
> return SC->OutSec->getVA() + SC->getOffset(DR.Sym) -
> Out<ELFT>::TlsPhdr->p_vaddr;
> @@ -1325,7 +1330,11 @@ void SymbolTableSection<ELFT>::writeLoca
> continue;
> const OutputSectionBase<ELFT> *OutSec = Section->OutSec;
> ESym->st_shndx = OutSec->SectionIndex;
> - VA += OutSec->getVA() + Section->getOffset(Sym);
> + VA = Section->getOffset(Sym);
> + // Symbol offsets for AMDGPU need to be the offset in bytes of the
> + // symbol from the beginning of the section.
> + if (Config->EMachine != EM_AMDGPU)
> + VA += OutSec->getVA();
> }
This is a horrible design error. The ELF spec is very explicit:
In executable and shared object files, st_value holds a virtual address.
Is there any hope of fixing this? AMDGPU using ELF is relatively new,
so I hope so. Some options
* User -r.
* Change the consumer.
But please do something. The fact that symbols and relocations use
offsets in .o and addresses in .so and executables is central to ELF.
Cheers,
Rafael
More information about the llvm-commits
mailing list