Home | History | Annotate | Download | only in llvm2ice_tests
      1 ; Tests that we generate an ELF container with fields that make sense,
      2 ; cross-validating against llvm-mc.
      3 
      4 ; For the integrated ELF writer, we can't pipe the output because we need
      5 ; to seek backward and patch up the file headers. So, use a temporary file.
      6 ; RUN: %p2i -i %s --filetype=obj --output %t --args -O2 --verbose none \
      7 ; RUN:   -allow-externally-defined-symbols \
      8 ; RUN:   && llvm-readobj -file-headers -sections -section-data \
      9 ; RUN:       -relocations -symbols %t | FileCheck %s
     10 
     11 ; RUN: %if --need=allow_dump --command %p2i -i %s --args -O2 --verbose none \
     12 ; RUN:   -allow-externally-defined-symbols \
     13 ; RUN:   | %if --need=allow_dump --command llvm-mc -triple=i686-nacl \
     14 ; RUN:     -filetype=obj -o - \
     15 ; RUN:   | %if --need=allow_dump --command llvm-readobj -file-headers \
     16 ; RUN:     -sections -section-data -relocations -symbols - \
     17 ; RUN:   | %if --need=allow_dump --command FileCheck %s
     18 
     19 ; Add a run that shows relocations in code inline.
     20 ; RUN: %p2i -i %s --filetype=obj --output %t --disassemble --args -O2 \
     21 ; RUN:   -allow-externally-defined-symbols \
     22 ; RUN:   | FileCheck --check-prefix=TEXT-RELOCS %s
     23 
     24 ; Use intrinsics to test external calls.
     25 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
     26 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
     27 
     28 ; Try other external functions (for cross tests).
     29 ; Not testing external global variables since the NaCl bitcode writer
     30 ; refuses to freeze such IR.
     31 declare void @external_foo(i32)
     32 
     33 ; Test some global data relocs (data, rodata, bss).
     34 @bytes = internal global [7 x i8] c"ab\03\FF\F6fg", align 1
     35 @bytes_const = internal constant [7 x i8] c"ab\03\FF\F6fg", align 1
     36 
     37 @ptr = internal global i32 ptrtoint ([7 x i8]* @bytes to i32), align 16
     38 @ptr_const = internal constant i32 ptrtoint ([7 x i8]* @bytes to i32), align 16
     39 
     40 @ptr_to_func = internal global i32 ptrtoint (double ()* @returnDoubleConst to i32), align 4
     41 @ptr_to_func_const = internal constant i32 ptrtoint (double ()* @returnDoubleConst to i32), align 4
     42 
     43 @addend_ptr = internal global i32 add (i32 ptrtoint (i32* @ptr to i32), i32 128), align 4
     44 @addend_ptr_const = internal constant i32 add (i32 ptrtoint (i32* @ptr to i32), i32 64), align 4
     45 
     46 @short_zero = internal global [2 x i8] zeroinitializer, align 2
     47 @double_zero = internal global [8 x i8] zeroinitializer, align 32
     48 @double_zero2 = internal global [8 x i8] zeroinitializer, align 8
     49 @short_zero_const = internal constant [2 x i8] zeroinitializer, align 2
     50 @double_zero_const = internal constant [8 x i8] zeroinitializer, align 32
     51 @double_zero_const2 = internal constant [8 x i8] zeroinitializer, align 8
     52 
     53 ; Use float/double constants to test constant pools.
     54 define internal float @returnFloatConst() {
     55 entry:
     56   %f = fadd float -0.0, 0x3FF3AE1400000000
     57   ret float %f
     58 }
     59 ; TEXT-RELOCS-LABEL: returnFloatConst
     60 ; TEXT-RELOCS: movss {{.*}} R_386_32 {{.*}}80000000
     61 ; TEXT-RELOCS: addss {{.*}} R_386_32 {{.*}}3f9d70a0
     62 
     63 define internal double @returnDoubleConst() {
     64 entry:
     65   %d = fadd double 0x7FFFFFFFFFFFFFFFF, 0xFFF7FFFFFFFFFFFF
     66   %d2 = fadd double %d, 0xFFF8000000000003
     67   ret double %d2
     68 }
     69 ; TEXT-RELOCS-LABEL: returnDoubleConst
     70 ; TEXT-RELOCS: movsd {{.*}} R_386_32 {{.*}}ffffffffffffffff
     71 ; TEXT-RELOCS: addsd {{.*}} R_386_32 {{.*}}fff7ffffffffffff
     72 ; TEXT-RELOCS: addsd {{.*}} R_386_32 {{.*}}fff8000000000003
     73 
     74 ; Test intrinsics that call out to external functions.
     75 define internal void @test_memcpy(i32 %iptr_dst, i32 %len) {
     76 entry:
     77   %dst = inttoptr i32 %iptr_dst to i8*
     78   %src = bitcast [7 x i8]* @bytes to i8*
     79   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
     80                                        i32 %len, i32 1, i1 false)
     81   ret void
     82 }
     83 ; TEXT-RELOCS-LABEL: test_memcpy
     84 ; TEXT-RELOCS: mov {{.*}} R_386_32 {{bytes|.data}}
     85 
     86 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) {
     87 entry:
     88   %val = trunc i32 %wide_val to i8
     89   %dst = inttoptr i32 %iptr_dst to i8*
     90   call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val,
     91                                   i32 %len, i32 1, i1 false)
     92   ret void
     93 }
     94 ; TEXT-RELOCS-LABEL: test_memset
     95 
     96 ; Test calling internal functions (may be able to do the fixup,
     97 ; without emitting a relocation).
     98 define internal float @test_call_internal() {
     99   %f = call float @returnFloatConst()
    100   ret float %f
    101 }
    102 
    103 ; Test calling an external function.
    104 define internal void @test_call_external() {
    105   call void @external_foo(i32 42)
    106   ret void
    107 }
    108 
    109 ; Test copying a function pointer, or a global data pointer.
    110 define internal i32 @test_ret_fp() {
    111   %r = ptrtoint float ()* @returnFloatConst to i32
    112   ret i32 %r
    113 }
    114 ; TEXT-RELOCS-LABEL: test_ret_fp
    115 ; TEXT-RELOCS-NEXT: mov {{.*}} R_386_32 {{returnFloatConst|.text}}
    116 
    117 define internal i32 @test_ret_global_pointer() {
    118   %r = ptrtoint [7 x i8]* @bytes to i32
    119   ret i32 %r
    120 }
    121 ; TEXT-RELOCS-LABEL: test_ret_global_pointer
    122 ; TEXT-RELOCS-NEXT: mov {{.*}} R_386_32 {{bytes|.data}}
    123 
    124 ; Test defining a non-internal function.
    125 define void @_start(i32) {
    126   %f = call float @returnFloatConst()
    127   %d = call double @returnDoubleConst()
    128   call void @test_memcpy(i32 0, i32 99)
    129   call void @test_memset(i32 0, i32 0, i32 99)
    130   %f2 = call float @test_call_internal()
    131   %p1 = call i32 @test_ret_fp()
    132   %p2 = call i32 @test_ret_global_pointer()
    133   ret void
    134 }
    135 
    136 ; CHECK: ElfHeader {
    137 ; CHECK:   Ident {
    138 ; CHECK:     Magic: (7F 45 4C 46)
    139 ; CHECK:     Class: 32-bit
    140 ; CHECK:     DataEncoding: LittleEndian
    141 ; CHECK:     OS/ABI: SystemV (0x0)
    142 ; CHECK:     ABIVersion: 0
    143 ; CHECK:     Unused: (00 00 00 00 00 00 00)
    144 ; CHECK:   }
    145 ; CHECK:   Type: Relocatable (0x1)
    146 ; CHECK:   Machine: EM_386 (0x3)
    147 ; CHECK:   Version: 1
    148 ; CHECK:   Entry: 0x0
    149 ; CHECK:   ProgramHeaderOffset: 0x0
    150 ; CHECK:   SectionHeaderOffset: 0x{{[1-9A-F][0-9A-F]*}}
    151 ; CHECK:   Flags [ (0x0)
    152 ; CHECK:   ]
    153 ; CHECK:   HeaderSize: 52
    154 ; CHECK:   ProgramHeaderEntrySize: 0
    155 ; CHECK:   ProgramHeaderCount: 0
    156 ; CHECK:   SectionHeaderEntrySize: 40
    157 ; CHECK:   SectionHeaderCount: {{[1-9][0-9]*}}
    158 ; CHECK:   StringTableSectionIndex: {{[1-9][0-9]*}}
    159 ; CHECK: }
    160 
    161 
    162 ; CHECK: Sections [
    163 ; CHECK:   Section {
    164 ; CHECK:     Index: 0
    165 ; CHECK:     Name: (0)
    166 ; CHECK:     Type: SHT_NULL
    167 ; CHECK:     Flags [ (0x0)
    168 ; CHECK:     ]
    169 ; CHECK:     Address: 0x0
    170 ; CHECK:     Offset: 0x0
    171 ; CHECK:     Size: 0
    172 ; CHECK:     Link: 0
    173 ; CHECK:     Info: 0
    174 ; CHECK:     AddressAlignment: 0
    175 ; CHECK:     EntrySize: 0
    176 ; CHECK:     SectionData (
    177 ; CHECK:     )
    178 ; CHECK:   }
    179 ; CHECK:   Section {
    180 ; CHECK:     Index: {{[1-9][0-9]*}}
    181 ; CHECK:     Name: .text
    182 ; CHECK:     Type: SHT_PROGBITS
    183 ; CHECK:     Flags [ (0x6)
    184 ; CHECK:       SHF_ALLOC
    185 ; CHECK:       SHF_EXECINSTR
    186 ; CHECK:     ]
    187 ; CHECK:     Address: 0x0
    188 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    189 ; CHECK:     Size: {{[1-9][0-9]*}}
    190 ; CHECK:     Link: 0
    191 ; CHECK:     Info: 0
    192 ; CHECK:     AddressAlignment: 32
    193 ; CHECK:     EntrySize: 0
    194 ; CHECK:     SectionData (
    195 ;   There's probably halt padding (0xF4) in there somewhere.
    196 ; CHECK:       {{.*}}F4
    197 ; CHECK:     )
    198 ; CHECK:   }
    199 ; CHECK:   Section {
    200 ; CHECK:     Index: {{[1-9][0-9]*}}
    201 ; CHECK:     Name: .rel.text
    202 ; CHECK:     Type: SHT_REL
    203 ; CHECK:     Flags [ (0x0)
    204 ; CHECK:     ]
    205 ; CHECK:     Address: 0x0
    206 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    207 ; CHECK:     Size: {{[1-9][0-9]*}}
    208 ; CHECK:     Link: [[SYMTAB_INDEX:[1-9][0-9]*]]
    209 ; CHECK:     Info: {{[1-9][0-9]*}}
    210 ; CHECK:     AddressAlignment: 4
    211 ; CHECK:     EntrySize: 8
    212 ; CHECK:     SectionData (
    213 ; CHECK:     )
    214 ; CHECK:   }
    215 ; CHECK:   Section {
    216 ; CHECK:     Index: [[DATA_INDEX:[1-9][0-9]*]]
    217 ; CHECK:     Name: .data
    218 ; CHECK:     Type: SHT_PROGBITS
    219 ; CHECK:     Flags [ (0x3)
    220 ; CHECK:       SHF_ALLOC
    221 ; CHECK:       SHF_WRITE
    222 ; CHECK:     ]
    223 ; CHECK:     Address: 0x0
    224 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    225 ; CHECK:     Size: 28
    226 ; CHECK:     Link: 0
    227 ; CHECK:     Info: 0
    228 ; CHECK:     AddressAlignment: 16
    229 ; CHECK:     EntrySize: 0
    230 ; CHECK:     SectionData (
    231 ; CHECK:       0000: 616203FF F66667{{.*}} |ab...fg
    232 ; CHECK:     )
    233 ; CHECK:   }
    234 ; CHECK:   Section {
    235 ; CHECK:     Index: {{[1-9][0-9]*}}
    236 ; CHECK:     Name: .rel.data
    237 ; CHECK:     Type: SHT_REL
    238 ; CHECK:     Flags [ (0x0)
    239 ; CHECK:     ]
    240 ; CHECK:     Address: 0x0
    241 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    242 ; CHECK:     Size: 24
    243 ; CHECK:     Link: [[SYMTAB_INDEX]]
    244 ; CHECK:     Info: [[DATA_INDEX]]
    245 ; CHECK:     AddressAlignment: 4
    246 ; CHECK:     EntrySize: 8
    247 ; CHECK:     SectionData (
    248 ; CHECK:     )
    249 ; CHECK:   }
    250 ; CHECK:   Section {
    251 ; CHECK:     Index: {{[1-9][0-9]*}}
    252 ; CHECK:     Name: .bss
    253 ; CHECK:     Type: SHT_NOBITS
    254 ; CHECK:     Flags [ (0x3)
    255 ; CHECK:       SHF_ALLOC
    256 ; CHECK:       SHF_WRITE
    257 ; CHECK:     ]
    258 ; CHECK:     Address: 0x0
    259 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    260 ; CHECK:     Size: 48
    261 ; CHECK:     Link: 0
    262 ; CHECK:     Info: 0
    263 ; CHECK:     AddressAlignment: 32
    264 ; CHECK:     EntrySize: 0
    265 ; CHECK:   }
    266 ; CHECK:   Section {
    267 ; CHECK:     Index: {{[1-9][0-9]*}}
    268 ; CHECK:     Name: .rodata
    269 ; CHECK:     Type: SHT_PROGBITS
    270 ; CHECK:     Flags [ (0x2)
    271 ; CHECK:       SHF_ALLOC
    272 ; CHECK:     ]
    273 ; CHECK:     Address: 0x0
    274 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    275 ; CHECK:     Size: 48
    276 ; CHECK:     Link: 0
    277 ; CHECK:     Info: 0
    278 ; CHECK:     AddressAlignment: 32
    279 ; CHECK:     EntrySize: 0
    280 ; CHECK:     SectionData (
    281 ; CHECK:       0000: 616203FF F66667{{.*}} |ab...fg
    282 ; CHECK:     )
    283 ; CHECK:   }
    284 ; CHECK:   Section {
    285 ; CHECK:     Index: {{[1-9][0-9]*}}
    286 ; CHECK:     Name: .rel.rodata
    287 ; CHECK:     Type: SHT_REL
    288 ; CHECK:     Flags [ (0x0)
    289 ; CHECK:     ]
    290 ; CHECK:     Address: 0x0
    291 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    292 ; CHECK:     Size: {{[1-9][0-9]*}}
    293 ; CHECK:     Link: [[SYMTAB_INDEX]]
    294 ; CHECK:     Info: {{[1-9][0-9]*}}
    295 ; CHECK:     AddressAlignment: 4
    296 ; CHECK:     EntrySize: 8
    297 ; CHECK:     SectionData (
    298 ; CHECK:     )
    299 ; CHECK:   }
    300 ; CHECK:   Section {
    301 ; CHECK:     Index: {{[1-9][0-9]*}}
    302 ; CHECK:     Name: .rodata.cst4
    303 ; CHECK:     Type: SHT_PROGBITS
    304 ; CHECK:     Flags [ (0x12)
    305 ; CHECK:       SHF_ALLOC
    306 ; CHECK:       SHF_MERGE
    307 ; CHECK:     ]
    308 ; CHECK:     Address: 0x0
    309 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    310 ; CHECK:     Size: 8
    311 ; CHECK:     Link: 0
    312 ; CHECK:     Info: 0
    313 ; CHECK:     AddressAlignment: 4
    314 ; CHECK:     EntrySize: 4
    315 ; CHECK:     SectionData (
    316 ; CHECK:       0000: A0709D3F 00000080
    317 ; CHECK:     )
    318 ; CHECK:   }
    319 ; CHECK:   Section {
    320 ; CHECK:     Index: {{[1-9][0-9]*}}
    321 ; CHECK:     Name: .rodata.cst8
    322 ; CHECK:     Type: SHT_PROGBITS
    323 ; CHECK:     Flags [ (0x12)
    324 ; CHECK:       SHF_ALLOC
    325 ; CHECK:       SHF_MERGE
    326 ; CHECK:     ]
    327 ; CHECK:     Address: 0x0
    328 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    329 ; CHECK:     Size: 24
    330 ; CHECK:     Link: 0
    331 ; CHECK:     Info: 0
    332 ; CHECK:     AddressAlignment: 8
    333 ; CHECK:     EntrySize: 8
    334 ; CHECK:     SectionData (
    335 ; CHECK:       0000: FFFFFFFF FFFFF7FF 03000000 0000F8FF
    336 ; CHECK:       0010: FFFFFFFF FFFFFFFF
    337 ; CHECK:     )
    338 ; CHECK:   }
    339 ; CHECK:   Section {
    340 ; CHECK:     Index: {{[1-9][0-9]*}}
    341 ; CHECK:     Name: .shstrtab
    342 ; CHECK:     Type: SHT_STRTAB
    343 ; CHECK:     Flags [ (0x0)
    344 ; CHECK:     ]
    345 ; CHECK:     Address: 0x0
    346 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    347 ; CHECK:     Size: {{[1-9][0-9]*}}
    348 ; CHECK:     Link: 0
    349 ; CHECK:     Info: 0
    350 ; CHECK:     AddressAlignment: 1
    351 ; CHECK:     EntrySize: 0
    352 ; CHECK:     SectionData (
    353 ; CHECK:       {{.*}}.text{{.*}}
    354 ; CHECK:     )
    355 ; CHECK:   }
    356 ; CHECK:   Section {
    357 ; CHECK:     Index: [[SYMTAB_INDEX]]
    358 ; CHECK-NEXT: Name: .symtab
    359 ; CHECK:     Type: SHT_SYMTAB
    360 ; CHECK:     Flags [ (0x0)
    361 ; CHECK:     ]
    362 ; CHECK:     Address: 0x0
    363 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    364 ; CHECK:     Size: {{[1-9][0-9]*}}
    365 ; CHECK:     Link: [[STRTAB_INDEX:[1-9][0-9]*]]
    366 ; CHECK:     Info: [[GLOBAL_START_INDEX:[1-9][0-9]*]]
    367 ; CHECK:     AddressAlignment: 4
    368 ; CHECK:     EntrySize: 16
    369 ; CHECK:   }
    370 ; CHECK:   Section {
    371 ; CHECK:     Index: [[STRTAB_INDEX]]
    372 ; CHECK-NEXT: Name: .strtab
    373 ; CHECK:     Type: SHT_STRTAB
    374 ; CHECK:     Flags [ (0x0)
    375 ; CHECK:     ]
    376 ; CHECK:     Address: 0x0
    377 ; CHECK:     Offset: 0x{{[1-9A-F][0-9A-F]*}}
    378 ; CHECK:     Size: {{[1-9][0-9]*}}
    379 ; CHECK:     Link: 0
    380 ; CHECK:     Info: 0
    381 ; CHECK:     AddressAlignment: 1
    382 ; CHECK:     EntrySize: 0
    383 ; CHECK:   }
    384 
    385 
    386 ; CHECK: Relocations [
    387 ; CHECK:   Section ({{[0-9]+}}) .rel.text {
    388 ; CHECK:     0x7 R_386_32 {{.*}}80000000 0x0
    389 ; CHECK:     0xF R_386_32 {{.*}}3f9d70a0 0x0
    390 ; CHECK:     0x27 R_386_32 {{.*}}ffffffffffffffff 0x0
    391 ; CHECK:     0x2F R_386_32 {{.*}}fff7ffffffffffff 0x0
    392 ; CHECK:     0x37 R_386_32 {{.*}}fff8000000000003 0x0
    393 ; CHECK:     0x{{.*}} R_386_PC32 memcpy
    394 ; CHECK:     0x{{.*}} R_386_PC32 memset
    395 ; CHECK:     0x{{.*}} R_386_PC32 external_foo
    396 ; CHECK:   }
    397 ; CHECK:   Section ({{[0-9]+}}) .rel.data {
    398 ; The set of relocations between llvm-mc and the integrated elf-writer
    399 ; are different. For local symbols, llvm-mc uses the section + offset within
    400 ; the section, while the integrated elf-writer refers the symbol itself.
    401 ; CHECK:     0x10 R_386_32 {{.*}} 0x0
    402 ; CHECK:     0x14 R_386_32 {{.*}} 0x0
    403 ; CHECK:     0x18 R_386_32 {{.*}} 0x0
    404 ; CHECK:   }
    405 ; CHECK:   Section ({{[0-9]+}}) .rel.rodata {
    406 ; CHECK:     0x10 R_386_32 {{.*}} 0x0
    407 ; CHECK:     0x14 R_386_32 {{.*}} 0x0
    408 ; CHECK:     0x18 R_386_32 {{.*}} 0x0
    409 ; CHECK:   }
    410 ; CHECK: ]
    411 
    412 
    413 ; CHECK: Symbols [
    414 ; CHECK-NEXT:   Symbol {
    415 ; CHECK-NEXT:     Name: (0)
    416 ; CHECK-NEXT:     Value: 0x0
    417 ; CHECK-NEXT:     Size: 0
    418 ; CHECK-NEXT:     Binding: Local
    419 ; CHECK-NEXT:     Type: None
    420 ; CHECK-NEXT:     Other: 0
    421 ; CHECK-NEXT:     Section: Undefined (0x0)
    422 ; CHECK-NEXT:   }
    423 ; CHECK:        Symbol {
    424 ; CHECK:          Name: {{.*}}fff8000000000003
    425 ; CHECK-NEXT:     Value: 0x8
    426 ; CHECK-NEXT:     Size: 0
    427 ; CHECK-NEXT:     Binding: Local (0x0)
    428 ; CHECK-NEXT:     Type: None (0x0)
    429 ; CHECK-NEXT:     Other: 0
    430 ; CHECK-NEXT:     Section: .rodata.cst8
    431 ; CHECK-NEXT:   }
    432 ; CHECK:        Symbol {
    433 ; CHECK:          Name: {{.*}}ffffffffffffffff
    434 ; CHECK-NEXT:     Value: 0x10
    435 ; CHECK-NEXT:     Size: 0
    436 ; CHECK-NEXT:     Binding: Local (0x0)
    437 ; CHECK-NEXT:     Type: None (0x0)
    438 ; CHECK-NEXT:     Other: 0
    439 ; CHECK-NEXT:     Section: .rodata.cst8
    440 ; CHECK-NEXT:   }
    441 ; CHECK:        Symbol {
    442 ; CHECK:          Name: {{.*}}3f9d70a0
    443 ; CHECK-NEXT:     Value: 0x0
    444 ; CHECK-NEXT:     Size: 0
    445 ; CHECK-NEXT:     Binding: Local (0x0)
    446 ; CHECK-NEXT:     Type: None (0x0)
    447 ; CHECK-NEXT:     Other: 0
    448 ; CHECK-NEXT:     Section: .rodata.cst4
    449 ; CHECK-NEXT:   }
    450 ; CHECK:        Symbol {
    451 ; CHECK:          Name: {{.*}}80000000
    452 ; CHECK-NEXT:     Value: 0x4
    453 ; CHECK-NEXT:     Size: 0
    454 ; CHECK-NEXT:     Binding: Local (0x0)
    455 ; CHECK-NEXT:     Type: None (0x0)
    456 ; CHECK-NEXT:     Other: 0
    457 ; CHECK-NEXT:     Section: .rodata.cst4
    458 ; CHECK-NEXT:   }
    459 ; CHECK:        Symbol {
    460 ; CHECK:          Name: addend_ptr
    461 ; CHECK-NEXT:     Value: 0x18
    462 ; CHECK-NEXT:     Size: 4
    463 ; CHECK-NEXT:     Binding: Local (0x0)
    464 ; CHECK-NEXT:     Type: Object (0x1)
    465 ; CHECK-NEXT:     Other: 0
    466 ; CHECK-NEXT:     Section: .data
    467 ; CHECK-NEXT:   }
    468 ; CHECK:        Symbol {
    469 ; CHECK:          Name: addend_ptr_const
    470 ; CHECK-NEXT:     Value: 0x18
    471 ; CHECK-NEXT:     Size: 4
    472 ; CHECK-NEXT:     Binding: Local (0x0)
    473 ; CHECK-NEXT:     Type: Object (0x1)
    474 ; CHECK-NEXT:     Other: 0
    475 ; CHECK-NEXT:     Section: .rodata
    476 ; CHECK-NEXT:   }
    477 ; CHECK:        Symbol {
    478 ; CHECK:          Name: bytes
    479 ; CHECK-NEXT:     Value: 0x0
    480 ; CHECK-NEXT:     Size: 7
    481 ; CHECK-NEXT:     Binding: Local (0x0)
    482 ; CHECK-NEXT:     Type: Object (0x1)
    483 ; CHECK-NEXT:     Other: 0
    484 ; CHECK-NEXT:     Section: .data
    485 ; CHECK-NEXT:   }
    486 ; CHECK:        Symbol {
    487 ; CHECK:          Name: bytes_const
    488 ; CHECK-NEXT:     Value: 0x0
    489 ; CHECK-NEXT:     Size: 7
    490 ; CHECK-NEXT:     Binding: Local (0x0)
    491 ; CHECK-NEXT:     Type: Object (0x1)
    492 ; CHECK-NEXT:     Other: 0
    493 ; CHECK-NEXT:     Section: .rodata
    494 ; CHECK-NEXT:   }
    495 ; CHECK:        Symbol {
    496 ; CHECK:          Name: double_zero
    497 ; CHECK-NEXT:     Value: 0x20
    498 ; CHECK-NEXT:     Size: 8
    499 ; CHECK-NEXT:     Binding: Local
    500 ; CHECK-NEXT:     Type: Object
    501 ; CHECK-NEXT:     Other: 0
    502 ; CHECK-NEXT:     Section: .bss
    503 ; CHECK-NEXT:   }
    504 ; CHECK:        Symbol {
    505 ; CHECK:          Name: double_zero2
    506 ; CHECK-NEXT:     Value: 0x28
    507 ; CHECK-NEXT:     Size: 8
    508 ; CHECK-NEXT:     Binding: Local
    509 ; CHECK-NEXT:     Type: Object
    510 ; CHECK-NEXT:     Other: 0
    511 ; CHECK-NEXT:     Section: .bss
    512 ; CHECK-NEXT:   }
    513 ; CHECK:        Symbol {
    514 ; CHECK:          Name: double_zero_const
    515 ; CHECK-NEXT:     Value: 0x20
    516 ; CHECK-NEXT:     Size: 8
    517 ; CHECK-NEXT:     Binding: Local
    518 ; CHECK-NEXT:     Type: Object
    519 ; CHECK-NEXT:     Other: 0
    520 ; CHECK-NEXT:     Section: .rodata
    521 ; CHECK-NEXT:   }
    522 ; CHECK:        Symbol {
    523 ; CHECK:          Name: double_zero_const2
    524 ; CHECK-NEXT:     Value: 0x28
    525 ; CHECK-NEXT:     Size: 8
    526 ; CHECK-NEXT:     Binding: Local
    527 ; CHECK-NEXT:     Type: Object
    528 ; CHECK-NEXT:     Other: 0
    529 ; CHECK-NEXT:     Section: .rodata
    530 ; CHECK-NEXT:   }
    531 ; CHECK:        Symbol {
    532 ; CHECK:          Name: ptr
    533 ; CHECK-NEXT:     Value: 0x10
    534 ; CHECK-NEXT:     Size: 4
    535 ; CHECK-NEXT:     Binding: Local
    536 ; CHECK-NEXT:     Type: Object
    537 ; CHECK-NEXT:     Other: 0
    538 ; CHECK-NEXT:     Section: .data
    539 ; CHECK-NEXT:   }
    540 ; CHECK:        Symbol {
    541 ; CHECK:          Name: ptr_const
    542 ; CHECK-NEXT:     Value: 0x10
    543 ; CHECK-NEXT:     Size: 4
    544 ; CHECK-NEXT:     Binding: Local
    545 ; CHECK-NEXT:     Type: Object
    546 ; CHECK-NEXT:     Other: 0
    547 ; CHECK-NEXT:     Section: .rodata
    548 ; CHECK-NEXT:   }
    549 ; CHECK:        Symbol {
    550 ; CHECK:          Name: ptr_to_func
    551 ; CHECK-NEXT:     Value: 0x14
    552 ; CHECK-NEXT:     Size: 4
    553 ; CHECK-NEXT:     Binding: Local
    554 ; CHECK-NEXT:     Type: Object
    555 ; CHECK-NEXT:     Other: 0
    556 ; CHECK-NEXT:     Section: .data
    557 ; CHECK-NEXT:   }
    558 ; CHECK:        Symbol {
    559 ; CHECK:          Name: ptr_to_func_const
    560 ; CHECK-NEXT:     Value: 0x14
    561 ; CHECK-NEXT:     Size: 4
    562 ; CHECK-NEXT:     Binding: Local
    563 ; CHECK-NEXT:     Type: Object
    564 ; CHECK-NEXT:     Other: 0
    565 ; CHECK-NEXT:     Section: .rodata
    566 ; CHECK-NEXT:   }
    567 ; CHECK:        Symbol {
    568 ; CHECK:          Name: returnDoubleConst
    569 ; CHECK-NEXT:     Value: 0x{{[1-9A-F][0-9A-F]*}}
    570 ; CHECK-NEXT:     Size: 0
    571 ; CHECK-NEXT:     Binding: Local
    572 ; CHECK-NEXT:     Type: None
    573 ; CHECK-NEXT:     Other: 0
    574 ; CHECK-NEXT:     Section: .text
    575 ; CHECK-NEXT:   }
    576 ; CHECK:        Symbol {
    577 ; CHECK:          Name: returnFloatConst
    578 ;  This happens to be the first function, so its offset is 0 within the text.
    579 ; CHECK-NEXT:     Value: 0x0
    580 ; CHECK-NEXT:     Size: 0
    581 ; CHECK-NEXT:     Binding: Local
    582 ; CHECK-NEXT:     Type: None
    583 ; CHECK-NEXT:     Other: 0
    584 ; CHECK-NEXT:     Section: .text
    585 ; CHECK-NEXT:   }
    586 ; CHECK:        Symbol {
    587 ; CHECK:          Name: short_zero
    588 ; CHECK-NEXT:     Value: 0x0
    589 ; CHECK-NEXT:     Size: 2
    590 ; CHECK-NEXT:     Binding: Local
    591 ; CHECK-NEXT:     Type: Object
    592 ; CHECK-NEXT:     Other: 0
    593 ; CHECK-NEXT:     Section: .bss
    594 ; CHECK-NEXT:   }
    595 ; CHECK:        Symbol {
    596 ; CHECK:          Name: short_zero_const
    597 ; CHECK-NEXT:     Value: 0x1C
    598 ; CHECK-NEXT:     Size: 2
    599 ; CHECK-NEXT:     Binding: Local
    600 ; CHECK-NEXT:     Type: Object
    601 ; CHECK-NEXT:     Other: 0
    602 ; CHECK-NEXT:     Section: .rodata
    603 ; CHECK-NEXT:   }
    604 ; CHECK:        Symbol {
    605 ; CHECK:          Name: test_memcpy
    606 ; CHECK-NEXT:     Value: 0x{{[1-9A-F][0-9A-F]*}}
    607 ; CHECK-NEXT:     Size: 0
    608 ; CHECK-NEXT:     Binding: Local
    609 ; CHECK-NEXT:     Type: None
    610 ; CHECK-NEXT:     Other: 0
    611 ; CHECK-NEXT:     Section: .text
    612 ; CHECK-NEXT:   }
    613 ; CHECK:        Symbol {
    614 ; CHECK:          Name: _start
    615 ; CHECK-NEXT:     Value: 0x{{[1-9A-F][0-9A-F]*}}
    616 ; CHECK-NEXT:     Size: 0
    617 ; CHECK-NEXT:     Binding: Global
    618 ; CHECK-NEXT:     Type: Function
    619 ; CHECK-NEXT:     Other: 0
    620 ; CHECK-NEXT:     Section: .text
    621 ; CHECK-NEXT:   }
    622 ; CHECK:        Symbol {
    623 ; CHECK:          Name: external_foo
    624 ; CHECK-NEXT:     Value: 0x0
    625 ; CHECK-NEXT:     Size: 0
    626 ; CHECK-NEXT:     Binding: Global
    627 ; CHECK-NEXT:     Type: None
    628 ; CHECK-NEXT:     Other: 0
    629 ; CHECK-NEXT:     Section: Undefined
    630 ; CHECK-NEXT:   }
    631 ; CHECK:        Symbol {
    632 ; CHECK:          Name: memcpy
    633 ; CHECK-NEXT:     Value: 0x0
    634 ; CHECK-NEXT:     Size: 0
    635 ; CHECK-NEXT:     Binding: Global
    636 ; CHECK-NEXT:     Type: None
    637 ; CHECK-NEXT:     Other: 0
    638 ; CHECK-NEXT:     Section: Undefined
    639 ; CHECK-NEXT:   }
    640 ; CHECK:        Symbol {
    641 ; CHECK:          Name: memset
    642 ; CHECK-NEXT:     Value: 0x0
    643 ; CHECK-NEXT:     Size: 0
    644 ; CHECK-NEXT:     Binding: Global
    645 ; CHECK-NEXT:     Type: None
    646 ; CHECK-NEXT:     Other: 0
    647 ; CHECK-NEXT:     Section: Undefined
    648 ; CHECK-NEXT:   }
    649 ; CHECK: ]
    650