Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -1931,7 +1931,8 @@ LastRX = nullptr; } if (LastRX) - LastRX->p_filesz = alignTo(LastRX->p_filesz, Target->PageSize); + LastRX->p_memsz = LastRX->p_filesz = + alignTo(LastRX->p_filesz, Target->PageSize); } // Write section contents to a mmap'ed file. Index: lld/trunk/test/ELF/avoid-empty-program-headers.s =================================================================== --- lld/trunk/test/ELF/avoid-empty-program-headers.s +++ lld/trunk/test/ELF/avoid-empty-program-headers.s @@ -43,7 +43,7 @@ // CHECK-NEXT: VirtualAddress: 0x201000 // CHECK-NEXT: PhysicalAddress: 0x201000 // CHECK-NEXT: FileSize: 4096 -// CHECK-NEXT: MemSize: 1 +// CHECK-NEXT: MemSize: 4096 // CHECK-NEXT: Flags [ (0x5) // CHECK-NEXT: PF_R (0x4) // CHECK-NEXT: PF_X (0x1) Index: lld/trunk/test/ELF/basic-aarch64.s =================================================================== --- lld/trunk/test/ELF/basic-aarch64.s +++ lld/trunk/test/ELF/basic-aarch64.s @@ -186,7 +186,7 @@ # CHECK-NEXT: VirtualAddress: 0x20000 # CHECK-NEXT: PhysicalAddress: 0x20000 # CHECK-NEXT: FileSize: 4096 -# CHECK-NEXT: MemSize: 12 +# CHECK-NEXT: MemSize: 4096 # CHECK-NEXT: Flags [ (0x5) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: PF_X (0x1) Index: lld/trunk/test/ELF/basic-sparcv9.s =================================================================== --- lld/trunk/test/ELF/basic-sparcv9.s +++ lld/trunk/test/ELF/basic-sparcv9.s @@ -177,7 +177,7 @@ # CHECK-NEXT: VirtualAddress: 0x200000 # CHECK-NEXT: PhysicalAddress: 0x200000 # CHECK-NEXT: FileSize: 8192 -# CHECK-NEXT: MemSize: 12 +# CHECK-NEXT: MemSize: 8192 # CHECK-NEXT: Flags [ (0x5) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: PF_X (0x1) Index: lld/trunk/test/ELF/basic.s =================================================================== --- lld/trunk/test/ELF/basic.s +++ lld/trunk/test/ELF/basic.s @@ -179,7 +179,7 @@ # CHECK-NEXT: VirtualAddress: 0x201000 # CHECK-NEXT: PhysicalAddress: 0x201000 # CHECK-NEXT: FileSize: 4096 -# CHECK-NEXT: MemSize: 16 +# CHECK-NEXT: MemSize: 4096 # CHECK-NEXT: Flags [ (0x5) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: PF_X (0x1) Index: lld/trunk/test/ELF/basic32.s =================================================================== --- lld/trunk/test/ELF/basic32.s +++ lld/trunk/test/ELF/basic32.s @@ -156,7 +156,7 @@ # CHECK-NEXT: VirtualAddress: 0x11000 # CHECK-NEXT: PhysicalAddress: 0x11000 # CHECK-NEXT: FileSize: 4096 -# CHECK-NEXT: MemSize: 12 +# CHECK-NEXT: MemSize: 4096 # CHECK-NEXT: Flags [ (0x5) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: PF_X (0x1) Index: lld/trunk/test/ELF/build-id.s =================================================================== --- lld/trunk/test/ELF/build-id.s +++ lld/trunk/test/ELF/build-id.s @@ -48,15 +48,15 @@ # DEFAULT: Contents of section .note.test: # DEFAULT: Contents of section .note.gnu.build-id: # DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU. -# DEFAULT-NEXT: b0148597 ba5eb7e9 +# DEFAULT-NEXT: bc208f98 7f8e4770 # MD5: Contents of section .note.gnu.build-id: # MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU. -# MD5-NEXT: dce3bcaf 5219454c e89a1fc7 86ab17bd +# MD5-NEXT: 8e13f077 f9c94068 9d63c715 6c952cd3 # SHA1: Contents of section .note.gnu.build-id: # SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU. -# SHA1-NEXT: 2f716666 fe3668fe 370a02a1 579c3eb2 +# SHA1-NEXT: 754ac1ea 0a2e5144 0f4642b9 3f096bbb # UUID: Contents of section .note.gnu.build-id: # UUID-NEXT: 04000000 10000000 03000000 474e5500 ............GNU. Index: lld/trunk/test/ELF/image-base.s =================================================================== --- lld/trunk/test/ELF/image-base.s +++ lld/trunk/test/ELF/image-base.s @@ -45,7 +45,7 @@ # CHECK-NEXT: VirtualAddress: 0x1001000 # CHECK-NEXT: PhysicalAddress: 0x1001000 # CHECK-NEXT: FileSize: 4096 -# CHECK-NEXT: MemSize: 1 +# CHECK-NEXT: MemSize: 4096 # CHECK-NEXT: Flags [ (0x5) # CHECK-NEXT: PF_R (0x4) # CHECK-NEXT: PF_X (0x1)