forked from OSchip/llvm-project
[ELF] NMAGIC support : Find the BSS section to setup the virtual address of _end.
llvm-svn: 183816
This commit is contained in:
parent
d5ff08ca5f
commit
79dbc5b5d1
|
@ -118,16 +118,13 @@ template <class ELFT> void ExecutableWriter<ELFT>::finalizeDefaultAtomValues() {
|
|||
endAtomIter == this->_layout->absoluteAtoms().end()) &&
|
||||
"Unable to find the absolute atoms that have been added by lld");
|
||||
|
||||
auto phe = this->_programHeader
|
||||
->findProgramHeader(llvm::ELF::PT_LOAD, llvm::ELF::PF_W, llvm::ELF::PF_X);
|
||||
auto bssSection = this->_layout->findOutputSection(".bss");
|
||||
|
||||
assert(!(phe == this->_programHeader->rend()) &&
|
||||
"Can't find a data segment in the program header!");
|
||||
|
||||
(*bssStartAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_filesz;
|
||||
(*bssEndAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_memsz;
|
||||
(*underScoreEndAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_memsz;
|
||||
(*endAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_memsz;
|
||||
(*bssStartAtomIter)->_virtualAddr = bssSection->virtualAddr();
|
||||
(*bssEndAtomIter)->_virtualAddr =
|
||||
bssSection->virtualAddr() + bssSection->memSize();
|
||||
(*underScoreEndAtomIter)->_virtualAddr = (*bssEndAtomIter)->_virtualAddr;
|
||||
(*endAtomIter)->_virtualAddr = (*bssEndAtomIter)->_virtualAddr;
|
||||
|
||||
// Give a chance for the target to finalize its atom values
|
||||
this->_targetHandler.finalizeSymbolValues();
|
||||
|
|
Loading…
Reference in New Issue