[PATCH] D18655: [ELF] - Move calculation of _end to fixAbsoluteSymbols()
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 10:16:45 PDT 2016
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
That is consistent with other symbols: _edata, _etext
and can help to avoid duplicate code.
http://reviews.llvm.org/D18655
Files:
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -1393,10 +1393,6 @@
SectionHeaderOff = alignTo(FileOff, sizeof(uintX_t));
FileSize = SectionHeaderOff + getNumSections() * sizeof(Elf_Shdr);
- // Update "_end" and "end" symbols so that they
- // point to the end of the data segment.
- ElfSym<ELFT>::End.st_value = VA;
-
for (Phdr &PHdr : Phdrs) {
Elf_Phdr &H = PHdr.H;
if (PHdr.First) {
@@ -1472,9 +1468,11 @@
// _etext is the first location after the last read-only loadable segment.
// _edata is the first location after the last read-write loadable segment.
+ // _end is the first location after the uninitialized data region.
for (Phdr &PHdr : Phdrs) {
if (PHdr.H.p_type != PT_LOAD)
continue;
+ ElfSym<ELFT>::End.st_value = PHdr.H.p_vaddr + PHdr.H.p_memsz;
uintX_t Val = PHdr.H.p_vaddr + PHdr.H.p_filesz;
if (PHdr.H.p_flags & PF_W)
ElfSym<ELFT>::Edata.st_value = Val;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18655.52232.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/e029950f/attachment.bin>
More information about the llvm-commits
mailing list