[PATCH] D29242: ELF: Align RELRO to the target page size rather than the max page size.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 10:31:29 PST 2017

This revision was automatically updated to reflect the committed changes.
Closed by commit rL293519: ELF: Align RELRO to the target page size rather than the max page size. (authored by pcc).

Changed prior to commit:




Index: lld/trunk/test/ELF/aarch64-relro.s
--- lld/trunk/test/ELF/aarch64-relro.s
+++ lld/trunk/test/ELF/aarch64-relro.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t
+# RUN: ld.lld %t -o %t2
+# RUN: llvm-readobj -program-headers %t2 | FileCheck %s
+# CHECK:      Type: PT_GNU_RELRO
+# CHECK-NEXT: Offset:
+# CHECK-NEXT: VirtualAddress:
+# CHECK-NEXT: PhysicalAddress:
+# CHECK-NEXT: FileSize:
+# CHECK-NEXT: MemSize: 4096
+.section .data.rel.ro,"aw",%progbits
+.byte 1
Index: lld/trunk/ELF/Writer.cpp
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -1498,7 +1498,7 @@
       // The glibc dynamic loader rounds the size down, so we need to round up
       // to protect the last page. This is a no-op on FreeBSD which always
       // rounds up.
-      P.p_memsz = alignTo(P.p_memsz, Config->MaxPageSize);
+      P.p_memsz = alignTo(P.p_memsz, Target->PageSize);
     // The TLS pointer goes after PT_TLS. At least glibc will align it,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29242.86308.patch
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170130/b0f0240c/attachment.bin>

More information about the llvm-commits mailing list