brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.1 KiB · 766efc5 Raw
247 lines · plain
1# REQUIRES: x862 3## Test that we correctly handle symbol relocations in the compact unwind4## section.5 6## llvm-mc does not emit such relocations for compact unwind, but `ld -r` does.7## As such, these yaml files were from an object file produced with 'ld -r',8## specifically:9##10##  // foo.s11## .globl _foo12## .text13## .p2align 214## _foo:15##   .cfi_startproc16##   .cfi_personality 155, ___gxx_personality_v017##   .cfi_lsda 16, _exception018##   .cfi_def_cfa_offset 1619##   ret20##   .cfi_endproc21##22## .section __TEXT,__gcc_except_tab23## _exception0:24##   .space 025##26## llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15 -o foo1.o foo.s27## ld -r -o foo.o foo1.o28 29# RUN: rm -rf %t; mkdir -p %t30# RUN: yaml2obj %s -o %t/foo.o31# RUN: %lld -dylib -lc++ %t/foo.o -o %t/foo32# RUN: llvm-objdump --macho --syms --unwind-info %t/foo | FileCheck %s33 34# CHECK:      SYMBOL TABLE:35# CHECK-DAG:  [[#%x,FOO:]]         g     F __TEXT,__text _foo36# CHECK-DAG:  [[#%x,EXCEPT0:]]     l     O __TEXT,__gcc_except_tab _exception037 38# CHECK:      LSDA descriptors:39# CHECK-NEXT: [0]: function offset=0x[[#%.8x,FOO]], LSDA offset=0x[[#%.8x,EXCEPT0]]40 41--- !mach-o42FileHeader:43  magic:           0xFEEDFACF44  cputype:         0x100000745  cpusubtype:      0x346  filetype:        0x147  ncmds:           248  sizeofcmds:      46449  flags:           0x050  reserved:        0x051LoadCommands:52  - cmd:             LC_SEGMENT_6453    cmdsize:         39254    segname:         ''55    vmaddr:          056    vmsize:          11257    fileoff:         52858    filesize:        11259    maxprot:         760    initprot:        761    nsects:          462    flags:           063    Sections:64      - sectname:        __text65        segname:         __TEXT66        addr:            0x067        size:            168        offset:          0x21069        align:           270        reloff:          0x071        nreloc:          072        flags:           0x8000040073        reserved1:       0x074        reserved2:       0x075        reserved3:       0x076        content:         C377      - sectname:        __gcc_except_tab78        segname:         __TEXT79        addr:            0x180        size:            081        offset:          0x21182        align:           083        reloff:          0x084        nreloc:          085        flags:           0x086        reserved1:       0x087        reserved2:       0x088        reserved3:       0x089        content:         ''90      - sectname:        __eh_frame91        segname:         __TEXT92        addr:            0x893        size:            7294        offset:          0x21895        align:           396        reloff:          0x28097        nreloc:          798        flags:           0x099        reserved1:       0x0100        reserved2:       0x0101        reserved3:       0x0102        content:         1C00000000000000017A504C5200017810079B0400000010100C0708900100002400000004000000F8FFFFFFFFFFFFFF010000000000000008E7FFFFFFFFFFFFFF0E100000000000103        relocations:104          - address:         0x13105            symbolnum:       4106            pcrel:           true107            length:          2108            extern:          true109            type:            4110            scattered:       false111            value:           0112          - address:         0x24113            symbolnum:       1114            pcrel:           false115            length:          2116            extern:          true117            type:            5118            scattered:       false119            value:           0120          - address:         0x24121            symbolnum:       2122            pcrel:           false123            length:          2124            extern:          true125            type:            0126            scattered:       false127            value:           0128          - address:         0x28129            symbolnum:       2130            pcrel:           false131            length:          3132            extern:          true133            type:            5134            scattered:       false135            value:           0136          - address:         0x28137            symbolnum:       3138            pcrel:           false139            length:          3140            extern:          true141            type:            0142            scattered:       false143            value:           0144          - address:         0x39145            symbolnum:       2146            pcrel:           false147            length:          3148            extern:          true149            type:            5150            scattered:       false151            value:           0152          - address:         0x39153            symbolnum:       0154            pcrel:           false155            length:          3156            extern:          true157            type:            0158            scattered:       false159            value:           0160      - sectname:        __compact_unwind161        segname:         __LD162        addr:            0x50163        size:            32164        offset:          0x260165        align:           3166        reloff:          0x2B8167        nreloc:          4168        flags:           0x2000000169        reserved1:       0x0170        reserved2:       0x0171        reserved3:       0x0172        content:         '0000000000000000010000000000024200000000000000000000000000000000'173        relocations:174          - address:         0x0175            symbolnum:       3176            pcrel:           false177            length:          3178            extern:          true179            type:            0180            scattered:       false181            value:           0182          - address:         0x18183            symbolnum:       0184            pcrel:           false185            length:          3186            extern:          true187            type:            0188            scattered:       false189            value:           0190          - address:         0x10191            symbolnum:       4192            pcrel:           false193            length:          3194            extern:          true195            type:            0196            scattered:       false197            value:           0198          - address:         0x18199            symbolnum:       0200            pcrel:           false201            length:          3202            extern:          true203            type:            0204            scattered:       false205            value:           0206  - cmd:             LC_SYMTAB207    cmdsize:         24208    symoff:          728209    nsyms:           5210    stroff:          808211    strsize:         57212LinkEditData:213  NameList:214    - n_strx:          29215      n_type:          0xE216      n_sect:          2217      n_desc:          32218      n_value:         1219    - n_strx:          41220      n_type:          0xE221      n_sect:          3222      n_desc:          0223      n_value:         8224    - n_strx:          51225      n_type:          0xE226      n_sect:          3227      n_desc:          0228      n_value:         40229    - n_strx:          2230      n_type:          0xF231      n_sect:          1232      n_desc:          32233      n_value:         0234    - n_strx:          7235      n_type:          0x1236      n_sect:          0237      n_desc:          0238      n_value:         0239  StringTable:240    - ' '241    - _foo242    - ___gxx_personality_v0243    - _exception0244    - EH_Frame1245    - func.eh246...247