Index: lld/trunk/ELF/Driver.cpp =================================================================== --- lld/trunk/ELF/Driver.cpp +++ lld/trunk/ELF/Driver.cpp @@ -651,7 +651,7 @@ StringRef S = Arg->getValue(); if (S.getAsInteger(0, Config->ImageBase)) error(Arg->getSpelling() + ": number expected, but got " + S); - else if ((Config->ImageBase % Target->PageSize) != 0) + else if ((Config->ImageBase % Target->MaxPageSize) != 0) warning(Arg->getSpelling() + ": address isn't multiple of page size"); } else { Config->ImageBase = Config->Pic ? 0 : Target->DefaultImageBase; Index: lld/trunk/ELF/Target.cpp =================================================================== --- lld/trunk/ELF/Target.cpp +++ lld/trunk/ELF/Target.cpp @@ -546,7 +546,6 @@ } template X86_64TargetInfo::X86_64TargetInfo() { - MaxPageSize = 0x200000; // 2MiB CopyRel = R_X86_64_COPY; GotRel = R_X86_64_GLOB_DAT; PltRel = R_X86_64_JUMP_SLOT; @@ -989,7 +988,7 @@ // We need 64K pages (at least under glibc/Linux, the loader won't // set different permissions on a finer granularity than that). - PageSize = 65536; + MaxPageSize = 65536; // The PPC64 ELF ABI v1 spec, says: // @@ -1855,7 +1854,7 @@ template MipsTargetInfo::MipsTargetInfo() { GotPltHeaderEntriesNum = 2; - PageSize = 65536; + MaxPageSize = 65536; GotEntrySize = sizeof(typename ELFT::uint); GotPltEntrySize = sizeof(typename ELFT::uint); PltEntrySize = 16; Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -1154,7 +1154,7 @@ for (OutputSectionBase *Sec : OutputSections) { uintX_t Alignment = Sec->getAlignment(); if (Sec->PageAlign) - Alignment = std::max(Alignment, Target->PageSize); + Alignment = std::max(Alignment, Target->MaxPageSize); auto I = Config->SectionStartMap.find(Sec->getName()); if (I != Config->SectionStartMap.end()) @@ -1182,14 +1182,14 @@ static uintX_t getFileAlignment(uintX_t Off, OutputSectionBase *Sec) { uintX_t Alignment = Sec->getAlignment(); if (Sec->PageAlign) - Alignment = std::max(Alignment, Target->PageSize); + Alignment = std::max(Alignment, Target->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->PageSize, Sec->getVA()); + return alignTo(Off, Target->MaxPageSize, Sec->getVA()); } template @@ -1241,7 +1241,7 @@ H.p_vaddr = First->getVA(); } if (H.p_type == PT_LOAD) - H.p_align = Target->PageSize; + H.p_align = Target->MaxPageSize; else if (H.p_type == PT_GNU_RELRO) H.p_align = 1; Index: lld/trunk/test/ELF/linkerscript/data-segment-relro.s =================================================================== --- lld/trunk/test/ELF/linkerscript/data-segment-relro.s +++ lld/trunk/test/ELF/linkerscript/data-segment-relro.s @@ -31,7 +31,7 @@ # CHECK-NEXT: SHF_ALLOC # CHECK-NEXT: SHF_WRITE # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x2000F0 +# CHECK-NEXT: Address: 0x10F0 # CHECK-NEXT: Offset: 0x10F0 # CHECK-NEXT: Size: # CHECK-NEXT: Link: @@ -47,7 +47,7 @@ # CHECK-NEXT: SHF_ALLOC # CHECK-NEXT: SHF_WRITE # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x201000 +# CHECK-NEXT: Address: 0x2000 # CHECK-NEXT: Offset: 0x2000 # CHECK-NEXT: Size: # CHECK-NEXT: Link: Index: lld/trunk/test/ELF/linkerscript/locationcounter.s =================================================================== --- lld/trunk/test/ELF/linkerscript/locationcounter.s +++ lld/trunk/test/ELF/linkerscript/locationcounter.s @@ -65,9 +65,9 @@ # CHECK: .greateq {{.*}} 0000000000021000 # CHECK: .eq {{.*}} 0000000000022000 # CHECK: .neq {{.*}} 0000000000023000 -# CHECK: .maxpagesize {{.*}} 0000000004800000 +# CHECK: .maxpagesize {{.*}} 0000000000024000 # CHECK: .commonpagesize {{.*}} 0000000000025000 -# CHECK: .datasegmentalign {{.*}} 0000000000200000 +# CHECK: .datasegmentalign {{.*}} 0000000000026000 # CHECK: .plusassign {{.*}} 0000000000028000 # CHECK: .unary {{.*}} 000000000002a000 # CHECK: .shiftl {{.*}} 0000000000030040 Index: lld/trunk/test/ELF/linkerscript/outsections-addr.s =================================================================== --- lld/trunk/test/ELF/linkerscript/outsections-addr.s +++ lld/trunk/test/ELF/linkerscript/outsections-addr.s @@ -80,7 +80,7 @@ #CHECK: Flags [ #CHECK: SHF_ALLOC #CHECK: ] -#CHECK: Address: 0x203008 +#CHECK: Address: 0x4008 #CHECK: Offset: 0x2008 #CHECK: Size: 8 #CHECK: Link: 0 Index: lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s =================================================================== --- lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s +++ lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s @@ -21,13 +21,13 @@ # CHECK-NEXT: 0000000000000000 *UND* 00000000 # CHECK-NEXT: .text 00000000 _start # CHECK-NEXT: .text 00000000 foo -# CHECK-NEXT: 0000000000200000 *ABS* 00000000 symbol -# CHECK-NEXT: 0000000000201234 *ABS* 00000000 symbol2 -# CHECK-NEXT: 0000000000201234 *ABS* 00000000 symbol3 -# CHECK-NEXT: 00000000001ffffc *ABS* 00000000 symbol4 -# CHECK-NEXT: 000000000020fffc *ABS* 00000000 symbol5 -# CHECK-NEXT: 000000000020fffc *ABS* 00000000 symbol6 -# CHECK-NEXT: 0000000000210000 *ABS* 00000000 symbol7 +# CHECK-NEXT: 0000000000001000 *ABS* 00000000 symbol +# CHECK-NEXT: 0000000000002234 *ABS* 00000000 symbol2 +# CHECK-NEXT: 0000000000002234 *ABS* 00000000 symbol3 +# CHECK-NEXT: 0000000000000ffc *ABS* 00000000 symbol4 +# CHECK-NEXT: 0000000000010ffc *ABS* 00000000 symbol5 +# CHECK-NEXT: 0000000000010ffc *ABS* 00000000 symbol6 +# CHECK-NEXT: 0000000000011000 *ABS* 00000000 symbol7 # CHECK-NEXT: ffffffffffff0004 *ABS* 00000000 symbol8 # CHECK-NEXT: fffffffffffffffc *ABS* 00000000 symbol9 # CHECK-NEXT: fedcba9876543210 *ABS* 00000000 symbol10