[lld] r312384 - [ELF] Set p_memsz to p_filesz when aligning the last segment to page boundary
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 1 14:48:20 PDT 2017
Author: phosek
Date: Fri Sep 1 14:48:20 2017
New Revision: 312384
URL: http://llvm.org/viewvc/llvm-project?rev=312384&view=rev
Log:
[ELF] Set p_memsz to p_filesz when aligning the last segment to page boundary
Having p_filesz different from p_memsz is confusing some tools.
Differential Revision: https://reviews.llvm.org/D37369
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/avoid-empty-program-headers.s
lld/trunk/test/ELF/basic-aarch64.s
lld/trunk/test/ELF/basic-sparcv9.s
lld/trunk/test/ELF/basic.s
lld/trunk/test/ELF/basic32.s
lld/trunk/test/ELF/build-id.s
lld/trunk/test/ELF/image-base.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep 1 14:48:20 2017
@@ -1931,7 +1931,8 @@ template <class ELFT> void Writer<ELFT>:
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.
Modified: lld/trunk/test/ELF/avoid-empty-program-headers.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/avoid-empty-program-headers.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/avoid-empty-program-headers.s (original)
+++ lld/trunk/test/ELF/avoid-empty-program-headers.s Fri Sep 1 14:48:20 2017
@@ -43,7 +43,7 @@ _start:
// 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)
Modified: lld/trunk/test/ELF/basic-aarch64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-aarch64.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-aarch64.s (original)
+++ lld/trunk/test/ELF/basic-aarch64.s Fri Sep 1 14:48:20 2017
@@ -186,7 +186,7 @@ _start:
# 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)
Modified: lld/trunk/test/ELF/basic-sparcv9.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-sparcv9.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-sparcv9.s (original)
+++ lld/trunk/test/ELF/basic-sparcv9.s Fri Sep 1 14:48:20 2017
@@ -177,7 +177,7 @@ _start:
# 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)
Modified: lld/trunk/test/ELF/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic.s (original)
+++ lld/trunk/test/ELF/basic.s Fri Sep 1 14:48:20 2017
@@ -179,7 +179,7 @@ _start:
# 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)
Modified: lld/trunk/test/ELF/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic32.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic32.s (original)
+++ lld/trunk/test/ELF/basic32.s Fri Sep 1 14:48:20 2017
@@ -156,7 +156,7 @@ _start:
# 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)
Modified: lld/trunk/test/ELF/build-id.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/build-id.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/build-id.s (original)
+++ lld/trunk/test/ELF/build-id.s Fri Sep 1 14:48:20 2017
@@ -48,15 +48,15 @@ _start:
# 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.
Modified: lld/trunk/test/ELF/image-base.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/image-base.s?rev=312384&r1=312383&r2=312384&view=diff
==============================================================================
--- lld/trunk/test/ELF/image-base.s (original)
+++ lld/trunk/test/ELF/image-base.s Fri Sep 1 14:48:20 2017
@@ -45,7 +45,7 @@ _start:
# 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)
More information about the llvm-commits
mailing list