1# RUN: ld64.lld -arch x86_64 %s %p/Inputs/write-final-sections.yaml \ 2# RUN: -o %t -e _foo 3# RUN: llvm-readobj --sections --section-data %t | FileCheck %s 4 5--- !native 6defined-atoms: 7# For __TEXT, __text (with typeCode) 8 - name: _foo 9 scope: global 10 content: [ 55 ] 11# CHECK: Name: __text 12# CHECK: Segment: __TEXT 13# CHECK: SectionData ( 14# CHECK-NEXT: 0000: 55 15# CHECK-NEXT: ) 16 17# For __TEXT, __const (with typeConstant), 18 - type: constant 19 content: [ 01, 00, 00, 00 ] 20# From __TEXT, __literal4, (with typeLiteral4) 21 - scope: hidden 22 type: const-4-byte 23 content: [ 02, 00, 00, 00 ] 24# From __TEXT, __literal8, (with typeLiteral8) 25 - scope: hidden 26 type: const-8-byte 27 content: [ 03, 00, 00, 00, 00, 00, 00, 00 ] 28# From __TEXT, __literal16, (with typeLiteral16) 29 - scope: hidden 30 type: const-16-byte 31 content: [ 04, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 ] 32# CHECK: Name: __const 33# CHECK: Segment: __TEXT 34# CHECK: SectionData ( 35# CHECK-NEXT: 0000: 01000000 02000000 03000000 00000000 36# CHECK-NEXT: 0010: 04000000 00000000 00000000 00000000 37# CHECK-NEXT: ) 38 39# For __TEXT, __cstring (with typeCString) 40 - scope: hidden 41 type: c-string 42 content: [ 57, 69, 62, 62, 6C, 65, 00 ] 43 merge: by-content 44# CHECK: Name: __cstring 45# CHECK: Segment: __TEXT 46# CHECK: SectionData ( 47# CHECK-NEXT: 0000: 57696262 6C6500 48# CHECK-NEXT: ) 49 50# For __TEXT, __ustring (with typeUTF16String) 51 - scope: hidden 52 type: utf16-string 53 content: [ 05, 00 ] 54 merge: by-content 55# CHECK: Name: __ustring 56# CHECK: Segment: __TEXT 57# CHECK: SectionData ( 58# CHECK-NEXT: 0000: 0500 59# CHECK-NEXT: ) 60 61# For __TEXT, __gcc_except_tab, (with typeLSDA) 62 - name: GCC_except_table0 63 type: unwind-lsda 64 content: [ 06, 00 ] 65# CHECK: Name: __gcc_except_tab 66# CHECK: Segment: __TEXT 67# CHECK: SectionData ( 68# CHECK-NEXT: 0000: 0600 69# CHECK-NEXT: ) 70 71# For __TEXT, __eh_frame, (with typeCFI) 72 - name: LCIE 73 type: unwind-cfi 74 content: [ 14, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 52, 00, 75 01, 78, 10, 01, 10, 0C, 07, 08, 90, 01, 00, 00 ] 76 77 - type: unwind-cfi 78 content: [ 24, 00, 00, 00, 1C, 00, 00, 00, C8, FE, FF, FF, 79 FF, FF, FF, FF, 01, 00, 00, 00, 00, 00, 00, 00, 80 00, 41, 0E, 10, 86, 02, 43, 0D, 06, 00, 00, 00, 81 00, 00, 00, 00 ] 82 references: 83 - kind: unwindFDEToFunction 84 offset: 8 85 target: _foo 86 - kind: negDelta32 87 offset: 4 88 target: LCIE 89 90# CHECK: Name: __eh_frame 91# CHECK: Segment: __TEXT 92# CHECK: SectionData ( 93# CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 94# CHECK-NEXT: 0010: 100C0708 90010000 24000000 1C000000 95# CHECK-NEXT: 0020: 70FFFFFF FFFFFFFF 01000000 00000000 96# CHECK-NEXT: 0030: 00410E10 8602430D 06000000 00000000 97# CHECK-NEXT: ) 98 99# For __DATA, __data, (with typeData) 100 - name: var 101 type: data 102 content: [ 08 ] 103# CHECK: Name: __data 104# CHECK: Segment: __DATA 105# CHECK: SectionData ( 106# CHECK-NEXT: 0000: 08 107# CHECK-NEXT: ) 108 109# For __DATA, __bss (with typeZeroFill) 110# FIXME: Attributes & tags of __bss are mostly broken. Should be at end of 111# __DATA, should have size, should have S_ZEROFILL flag. 112 - type: zero-fill 113 size: 8 114# CHECK: Name: __bss 115# CHECK: Segment: __DATA 116 117# For __DATA, __const, (with typeConstData) 118 - type: const-data 119 content: [ 09, 00, 00, 00 ] 120# CHECK: Name: __const 121# CHECK: Segment: __DATA 122# CHECK: SectionData ( 123# CHECK-NEXT: 0000: 09000000 124# CHECK-NEXT: ) 125 126# For __DATA, __cfstring, (with typeCFString) 127 - type: cfstring 128 content: [ 0A, 00 ] 129# CHECK: Name: __cfstring 130# CHECK: Segment: __DATA 131# CHECK: SectionData ( 132# CHECK-NEXT: 0000: 0A00 133# CHECK-NEXT: ) 134 135# For __DATA, __got (with typeGOT) 136 - type: got 137 content: [ 0B, 00, 00, 00, 00, 00, 00, 00 ] 138# CHECK: Name: __got 139# CHECK: Segment: __DATA 140# CHECK: SectionData ( 141# CHECK-NEXT: 0000: 0B000000 00000000 142# CHECK-NEXT: ) 143 144 145# For __DATA, __mod_init_func (with typeInitializerPtr) 146 - type: initializer-pointer 147 content: [ 0C, 00, 00, 00, 00, 00, 00, 00 ] 148# CHECK: Name: __mod_init_func 149# CHECK: Segment: __DATA 150# CHECK: SectionData ( 151# CHECK-NEXT: 0000: 0C000000 00000000 152# CHECK-NEXT: ) 153 154# For __DATA, __mod_term_func (with typeTerminatorPointer) 155 - type: terminator-pointer 156 content: [ 0D, 00, 00, 00, 00, 00, 00, 00 ] 157# CHECK: Name: __mod_term_func 158# CHECK: Segment: __DATA 159# CHECK: SectionData ( 160# CHECK-NEXT: 0000: 0D000000 00000000 161# CHECK-NEXT: ) 162 163 - type: compact-unwind 164 content: [ 0E, 00, 00, 00, 00, 00, 00, 00 ] 165# CHECK-NOT: Name: __compact_unwind 166