brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · ab63670 Raw
129 lines · plain
1# REQUIRES: aarch642 3## This is a regression test which makes sure that when there is an invalid section index4## associated with a section symbol, the linker does not segfault.5 6## Test YAML content was created using the following steps7## 1. Create an object file from the following assembly 8##     `llvm-mc -filetype=obj -triple=arm64-apple-darwin symbol.s -o symbol.o`9##10##     .text11##     .section __TEST,__mystuff12##     .globl _mysec13## _mysec:14##     .byte 0xC315##16## 2. Use obj2yaml to convert object file to yaml17##    `obj2yaml symbol.o -o symbol.yaml`18##19## 3. Manually set n_sect value of ltmp1 symbol to 0 instead of 1.20##21 22# RUN: yaml2obj %s -o %t23# RUN: not %lld -platform_version macos 10.14 11.0 -arch arm64 %t 2>&1 | FileCheck %s --check-prefix=FATAL24 25# FATAL: error: section symbol ltmp0 in {{.*}} has an invalid section index [0]26 27--- !mach-o28FileHeader:29  magic:           0xFEEDFACF30  cputype:         0x100000C31  cpusubtype:      0x032  filetype:        0x133  ncmds:           334  sizeofcmds:      33635  flags:           0x036  reserved:        0x037LoadCommands:38  - cmd:             LC_SEGMENT_6439    cmdsize:         23240    segname:         ''41    vmaddr:          042    vmsize:          143    fileoff:         36844    filesize:        145    maxprot:         746    initprot:        747    nsects:          248    flags:           049    Sections:50      - sectname:        __text51        segname:         __TEXT52        addr:            0x053        size:            054        offset:          0x17055        align:           056        reloff:          0x057        nreloc:          058        flags:           0x8000000059        reserved1:       0x060        reserved2:       0x061        reserved3:       0x062        content:         ''63      - sectname:        __mystuff64        segname:         __TEST65        addr:            0x066        size:            167        offset:          0x17068        align:           069        reloff:          0x070        nreloc:          071        flags:           0x072        reserved1:       0x073        reserved2:       0x074        reserved3:       0x075        content:         C376  - cmd:             LC_SYMTAB77    cmdsize:         2478    symoff:          37679    nsyms:           380    stroff:          42481    strsize:         2482  - cmd:             LC_DYSYMTAB83    cmdsize:         8084    ilocalsym:       085    nlocalsym:       286    iextdefsym:      287    nextdefsym:      188    iundefsym:       389    nundefsym:       090    tocoff:          091    ntoc:            092    modtaboff:       093    nmodtab:         094    extrefsymoff:    095    nextrefsyms:     096    indirectsymoff:  097    nindirectsyms:   098    extreloff:       099    nextrel:         0100    locreloff:       0101    nlocrel:         0102LinkEditData:103  NameList:104    - n_strx:          14105      n_type:          0xE106      n_sect:          0107      n_desc:          0108      n_value:         0109    - n_strx:          8110      n_type:          0xE111      n_sect:          2112      n_desc:          0113      n_value:         0114    - n_strx:          1115      n_type:          0xF116      n_sect:          2117      n_desc:          0118      n_value:         0119  StringTable:120    - ''121    - _mysec122    - ltmp1123    - ltmp0124    - ''125    - ''126    - ''127    - ''128...129