aboutsummaryrefslogtreecommitdiff
path: root/ELF
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-09-28 18:12:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-09-28 18:12:13 +0000
commitb3e88dc9506fc05e8f660dd708628d4e1977deac (patch)
tree0bcf9b46a9656e12b16b916a75caeb30a9737152 /ELF
parent13d486dfefe004cb3593f9a9925af75a9cb05f48 (diff)
Fix header location with PHDR.
We were not subtracting its size, causing it to overlap with section data. Fixes PR34750. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@314440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'ELF')
-rw-r--r--ELF/LinkerScript.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp
index e72a20d9f..6fc38756c 100644
--- a/ELF/LinkerScript.cpp
+++ b/ELF/LinkerScript.cpp
@@ -752,8 +752,7 @@ void LinkerScript::allocateHeaders(std::vector<PhdrEntry *> &Phdrs) {
// unless there's a space for them.
uint64_t Base = Opt.HasSections ? alignDown(Min, Config->MaxPageSize) : 0;
if (HeaderSize <= Min - Base || Script->hasPhdrsCommands()) {
- Min = Opt.HasSections ? Base
- : alignDown(Min - HeaderSize, Config->MaxPageSize);
+ Min = alignDown(Min - HeaderSize, Config->MaxPageSize);
Out::ElfHeader->Addr = Min;
Out::ProgramHeaders->Addr = Min + Out::ElfHeader->Size;
return;