forked from OSchip/llvm-project
Use the correct page size.
Config->MaxPageSize is what we use for the segment alignment, so that is the one that we have to use for placing the header. llvm-svn: 287569
This commit is contained in:
parent
dac3808873
commit
28d5f059ae
|
@ -717,7 +717,7 @@ void LinkerScript<ELFT>::assignAddresses(std::vector<PhdrEntry<ELFT>> &Phdrs) {
|
|||
|
||||
// ELF and Program headers need to be right before the first section in
|
||||
// memory. Set their addresses accordingly.
|
||||
MinVA = alignDown(MinVA - HeaderSize, Target->PageSize);
|
||||
MinVA = alignDown(MinVA - HeaderSize, Config->MaxPageSize);
|
||||
Out<ELFT>::ElfHeader->Addr = MinVA;
|
||||
Out<ELFT>::ProgramHeaders->Addr = Out<ELFT>::ElfHeader->Size + MinVA;
|
||||
|
||||
|
|
|
@ -24,3 +24,24 @@
|
|||
# CHECK-NEXT: Alignment: 4096
|
||||
# CHECK-NEXT: }
|
||||
# CHECK-NEXT: ]
|
||||
|
||||
# RUN: ld.lld -o %t2.so --script %t.script %t.o -shared -z max-page-size=0x2000
|
||||
# RUN: llvm-readobj -program-headers %t2.so \
|
||||
# RUN: | FileCheck --check-prefix=MAXPAGE %s
|
||||
|
||||
# MAXPAGE: ProgramHeaders [
|
||||
# MAXPAGE-NEXT: ProgramHeader {
|
||||
# MAXPAGE-NEXT: Type: PT_LOAD
|
||||
# MAXPAGE-NEXT: Offset: 0x40
|
||||
# MAXPAGE-NEXT: VirtualAddress: 0x40
|
||||
# MAXPAGE-NEXT: PhysicalAddress: 0x40
|
||||
# MAXPAGE-NEXT: FileSize: 8272
|
||||
# MAXPAGE-NEXT: MemSize: 8272
|
||||
# MAXPAGE-NEXT: Flags [
|
||||
# MAXPAGE-NEXT: PF_R
|
||||
# MAXPAGE-NEXT: PF_W
|
||||
# MAXPAGE-NEXT: PF_X
|
||||
# MAXPAGE-NEXT: ]
|
||||
# MAXPAGE-NEXT: Alignment: 8192
|
||||
# MAXPAGE-NEXT: }
|
||||
# MAXPAGE-NEXT: ]
|
||||
|
|
Loading…
Reference in New Issue