summaryrefslogtreecommitdiff
path: root/lld/ELF/Writer.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-01-29 03:44:44 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-01-29 03:44:44 +0000
commitf92ab67310bea0224fe239e069f0ea5919aae41f (patch)
tree3ddc02dcbdd1c5e4bd95d2ad004b07cb55f106a4 /lld/ELF/Writer.h
parentd63516e7630e1a0763044bd07996f076489e115a (diff)
Put the header in the first PT_LOAD even if that PT_LOAD has a LMAExpr.
This should fix PR36017. The root problem is that we were creating a PT_LOAD just for the header. That was technically valid, but inconvenient: we should not be making the ELF discontinuous. The solution is to allow a section with LMAExpr to be added to a PT_LOAD if that PT_LOAD doesn't already have a LMAExpr.
Diffstat (limited to 'lld/ELF/Writer.h')
-rw-r--r--lld/ELF/Writer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h
index 6875dc51403..f48f9d1e01b 100644
--- a/lld/ELF/Writer.h
+++ b/lld/ELF/Writer.h
@@ -44,6 +44,12 @@ struct PhdrEntry {
OutputSection *FirstSec = nullptr;
OutputSection *LastSec = nullptr;
bool HasLMA = false;
+
+ // True if one of the sections in this program header has a LMA specified via
+ // linker script: AT(addr). We never allow 2 or more sections with LMA in the
+ // same program header.
+ bool ASectionHasLMA = false;
+
uint64_t LMAOffset = 0;
};