Jon Chesterfield | e0ca2ff | 2017-07-18 18:40:50 +0000 | [diff] [blame] | 1 | // REQUIRES: x86 |
Rafael Espindola | 5210141 | 2017-05-12 14:52:22 +0000 | [diff] [blame] | 2 | // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o |
| 3 | // RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : { *(.text) } }" > %t.script |
Rafael Espindola | c207590 | 2017-09-07 19:07:49 +0000 | [diff] [blame] | 4 | // RUN: ld.lld -T %t.script %t.o -o %t |
Rafael Espindola | 5210141 | 2017-05-12 14:52:22 +0000 | [diff] [blame] | 5 | // RUN: llvm-readobj -t %t | FileCheck %s |
| 6 | |
| 7 | // Test that _start is in the correct section. |
| 8 | // CHECK: Name: _start |
| 9 | // CHECK-NEXT: Value: 0x120 |
| 10 | // CHECK-NEXT: Size: 0 |
| 11 | // CHECK-NEXT: Binding: Global |
| 12 | // CHECK-NEXT: Type: None |
| 13 | // CHECK-NEXT: Other: 0 |
| 14 | // CHECK-NEXT: Section: dm |
| 15 | |
| 16 | .macro gen_sections4 x |
| 17 | .section a\x,"a" |
| 18 | .section b\x,"a" |
| 19 | .section c\x,"a" |
| 20 | .section d\x,"a" |
| 21 | .endm |
| 22 | |
| 23 | .macro gen_sections8 x |
| 24 | gen_sections4 a\x |
| 25 | gen_sections4 b\x |
| 26 | .endm |
| 27 | |
| 28 | .macro gen_sections16 x |
| 29 | gen_sections8 a\x |
| 30 | gen_sections8 b\x |
| 31 | .endm |
| 32 | |
| 33 | .macro gen_sections32 x |
| 34 | gen_sections16 a\x |
| 35 | gen_sections16 b\x |
| 36 | .endm |
| 37 | |
| 38 | .macro gen_sections64 x |
| 39 | gen_sections32 a\x |
| 40 | gen_sections32 b\x |
| 41 | .endm |
| 42 | |
| 43 | .macro gen_sections128 x |
| 44 | gen_sections64 a\x |
| 45 | gen_sections64 b\x |
| 46 | .endm |
| 47 | |
| 48 | .macro gen_sections256 x |
| 49 | gen_sections128 a\x |
| 50 | gen_sections128 b\x |
| 51 | .endm |
| 52 | |
| 53 | .macro gen_sections512 x |
| 54 | gen_sections256 a\x |
| 55 | gen_sections256 b\x |
| 56 | .endm |
| 57 | |
| 58 | .macro gen_sections1024 x |
| 59 | gen_sections512 a\x |
| 60 | gen_sections512 b\x |
| 61 | .endm |
| 62 | |
| 63 | .macro gen_sections2048 x |
| 64 | gen_sections1024 a\x |
| 65 | gen_sections1024 b\x |
| 66 | .endm |
| 67 | |
| 68 | .macro gen_sections4096 x |
| 69 | gen_sections2048 a\x |
| 70 | gen_sections2048 b\x |
| 71 | .endm |
| 72 | |
| 73 | .macro gen_sections8192 x |
| 74 | gen_sections4096 a\x |
| 75 | gen_sections4096 b\x |
| 76 | .endm |
| 77 | |
| 78 | .macro gen_sections16384 x |
| 79 | gen_sections8192 a\x |
| 80 | gen_sections8192 b\x |
| 81 | .endm |
| 82 | |
| 83 | .macro gen_sections32768 x |
| 84 | gen_sections16384 a\x |
| 85 | gen_sections16384 b\x |
| 86 | .endm |
| 87 | |
| 88 | .bss |
| 89 | .section bar |
| 90 | |
| 91 | gen_sections32768 a |
| 92 | gen_sections16384 b |
| 93 | gen_sections8192 c |
| 94 | gen_sections4096 d |
| 95 | gen_sections2048 e |
| 96 | gen_sections1024 f |
| 97 | gen_sections512 g |
| 98 | gen_sections128 h |
| 99 | gen_sections64 i |
| 100 | gen_sections32 j |
| 101 | gen_sections16 k |
| 102 | gen_sections8 l |
| 103 | gen_sections4 m |
| 104 | |
| 105 | .global _start |
| 106 | _start: |