[lld] r221594 - [ELF] add missing test for max-page-size

Shankar Easwaran shankare at codeaurora.org
Mon Nov 10 07:16:31 PST 2014


Author: shankare
Date: Mon Nov 10 09:16:31 2014
New Revision: 221594

URL: http://llvm.org/viewvc/llvm-project?rev=221594&view=rev
Log:
[ELF] add missing test for max-page-size

Added:
    lld/trunk/test/elf/X86_64/maxpagesize.test

Added: lld/trunk/test/elf/X86_64/maxpagesize.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/maxpagesize.test?rev=221594&view=auto
==============================================================================
--- lld/trunk/test/elf/X86_64/maxpagesize.test (added)
+++ lld/trunk/test/elf/X86_64/maxpagesize.test Mon Nov 10 09:16:31 2014
@@ -0,0 +1,104 @@
+# Checks that segments are aligned as per ELF spec when the user specifies
+# max-page-size option, and the segment alignment is set to the page size
+# specified by the user.
+
+# Build executable
+# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o
+# RUN: not lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \
+# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0
+# RUN: not lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \
+# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0xFF
+# RUN: not lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \
+# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x100000
+# RUN: lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \
+# RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x10000
+# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s
+#
+#CHECK:    VirtualAddress: 0x400000
+#CHECK:    PhysicalAddress: 0x400000
+#CHECK:    Alignment: 65536
+#CHECK:    VirtualAddress: 0x400178
+#CHECK:    PhysicalAddress: 0x400178
+#CHECK:    Alignment: 65536
+
+# object
+---
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  OSABI:           ELFOSABI_GNU
+  Type:            ET_REL
+  Machine:         EM_X86_64
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:    0x0000000000000010
+    Content:         554889E5B864000000C745FC000000005DC366666666662E0F1F840000000000554889E531C05DC3
+  - Name:            .data
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_WRITE, SHF_ALLOC ]
+    AddressAlign:    0x0000000000000004
+    Content:         ''
+  - Name:            .bss
+    Type:            SHT_NOBITS
+    Flags:           [ SHF_WRITE, SHF_ALLOC ]
+    AddressAlign:    0x0000000000000004
+    Content:         '64000000'
+  - Name:            .rodata
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC ]
+    AddressAlign:    0x0000000000000004
+    Content:         '64000000'
+  - Name:            .eh_frame
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC ]
+    AddressAlign:    0x0000000000000008
+    Content:         1400000000000000037A5200017810011B0C070890010000180000001C000000000000001200000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000
+  - Name:            .rela.eh_frame
+    Type:            SHT_RELA
+    Link:            .symtab
+    AddressAlign:    0x0000000000000008
+    Info:            .eh_frame
+    Relocations:
+      - Offset:          0x0000000000000020
+        Symbol:          .text
+        Type:            R_X86_64_PC32
+        Addend:          0
+      - Offset:          0x000000000000003C
+        Symbol:          .text
+        Type:            R_X86_64_PC32
+        Addend:          32
+Symbols:
+  Local:
+    - Name:            .text
+      Type:            STT_SECTION
+      Section:         .text
+    - Name:            .data
+      Type:            STT_SECTION
+      Section:         .data
+    - Name:            .bss
+      Type:            STT_SECTION
+      Section:         .bss
+    - Name:            .eh_frame
+      Type:            STT_SECTION
+      Section:         .eh_frame
+  Global:
+    - Name:            foo
+      Type:            STT_FUNC
+      Section:         .text
+      Value:           0x0000000000000020
+      Size:            0x0000000000000008
+    - Name:            main
+      Type:            STT_FUNC
+      Section:         .text
+      Size:            0x0000000000000012
+    - Name:            myval
+      Type:            STT_OBJECT
+      Section:         .bss
+      Size:            0x0000000000000004
+    - Name:            val
+      Type:            STT_OBJECT
+      Section:         .rodata
+      Size:            0x0000000000000004
+...





More information about the llvm-commits mailing list