[lld] r288970 - Use the correct MaxPageSize.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 12:10:43 PST 2016
Author: rafael
Date: Wed Dec 7 14:10:43 2016
New Revision: 288970
URL: http://llvm.org/viewvc/llvm-project?rev=288970&view=rev
Log:
Use the correct MaxPageSize.
Found by inspection.
Added:
lld/trunk/test/ELF/linkerscript/page-size-align.s
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=288970&r1=288969&r2=288970&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Dec 7 14:10:43 2016
@@ -1325,7 +1325,7 @@ static uintX_t getFileAlignment(uintX_t
// If two sections share the same PT_LOAD the file offset is calculated using
// this formula: Off2 = Off1 + (VA2 - VA1).
if (Sec == First)
- return alignTo(Off, Target->MaxPageSize, Sec->Addr);
+ return alignTo(Off, Config->MaxPageSize, Sec->Addr);
return First->Offset + Sec->Addr - First->Addr;
}
Added: lld/trunk/test/ELF/linkerscript/page-size-align.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/page-size-align.s?rev=288970&view=auto
==============================================================================
--- lld/trunk/test/ELF/linkerscript/page-size-align.s (added)
+++ lld/trunk/test/ELF/linkerscript/page-size-align.s Wed Dec 7 14:10:43 2016
@@ -0,0 +1,22 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+
+# RUN: echo "SECTIONS { \
+# RUN: . = SIZEOF_HEADERS; \
+# RUN: .text : { *(.text) } \
+# RUN: . = ALIGN(CONSTANT(MAXPAGESIZE)); \
+# RUN: . = . + 0x3000; \
+# RUN: .dynamic : { *(.dynamic) } \
+# RUN: }" > %t.script
+
+# RUN: ld.lld -T %t.script -z max-page-size=0x4000 %t.o -o %t.so -shared
+# RUN: llvm-readobj -s %t.so | FileCheck %s
+
+# CHECK: Name: .dynamic
+# CHECK-NEXT: Type: SHT_DYNAMIC
+# CHECK-NEXT: Flags [
+# CHECK-NEXT: SHF_ALLOC
+# CHECK-NEXT: SHF_WRITE
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x7000
+# CHECK-NEXT: Offset: 0x3000
More information about the llvm-commits
mailing list