summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2016-09-28 15:20:47 +0000
committerPetr Hosek <phosek@chromium.org>2016-09-28 15:20:47 +0000
commit997f8838e5ee5e10548de9cdb50322a7ace99c34 (patch)
tree6dfa02d5f1436b423e77823f66f651e6c6562c15 /lld/ELF/Writer.cpp
parentdd381c39e114e7f01439bac0e37723ab05857f67 (diff)
downloadbcm5719-llvm-997f8838e5ee5e10548de9cdb50322a7ace99c34.tar.gz
bcm5719-llvm-997f8838e5ee5e10548de9cdb50322a7ace99c34.zip
[ELF] Support -z max-page-size option
This options issupported by both BFD ld and gold and allows overriding the max page size whose default values are defined by the target. https://llvm.org/bugs/show_bug.cgi?id=30541 Differential Revision: https://reviews.llvm.org/D24891 llvm-svn: 282596
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 6681f46ce5d..9df5939e83d 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1154,7 +1154,7 @@ template <class ELFT> void Writer<ELFT>::assignAddresses() {
for (OutputSectionBase<ELFT> *Sec : OutputSections) {
uintX_t Alignment = Sec->getAlignment();
if (Sec->PageAlign)
- Alignment = std::max<uintX_t>(Alignment, Target->MaxPageSize);
+ Alignment = std::max<uintX_t>(Alignment, Config->MaxPageSize);
auto I = Config->SectionStartMap.find(Sec->getName());
if (I != Config->SectionStartMap.end())
@@ -1182,14 +1182,14 @@ template <class ELFT, class uintX_t>
static uintX_t getFileAlignment(uintX_t Off, OutputSectionBase<ELFT> *Sec) {
uintX_t Alignment = Sec->getAlignment();
if (Sec->PageAlign)
- Alignment = std::max<uintX_t>(Alignment, Target->MaxPageSize);
+ Alignment = std::max<uintX_t>(Alignment, Config->MaxPageSize);
Off = alignTo(Off, Alignment);
// Relocatable output does not have program headers
// and does not need any other offset adjusting.
if (Config->Relocatable || !(Sec->getFlags() & SHF_ALLOC))
return Off;
- return alignTo(Off, Target->MaxPageSize, Sec->getVA());
+ return alignTo(Off, Config->MaxPageSize, Sec->getVA());
}
template <class ELFT, class uintX_t>
@@ -1241,7 +1241,7 @@ template <class ELFT> void Writer<ELFT>::setPhdrs() {
H.p_vaddr = First->getVA();
}
if (H.p_type == PT_LOAD)
- H.p_align = Target->MaxPageSize;
+ H.p_align = Config->MaxPageSize;
else if (H.p_type == PT_GNU_RELRO)
H.p_align = 1;
OpenPOWER on IntegriCloud