brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 20eb6cf Raw
81 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3 4## Test that we correctly handle the sdata4 DWARF pointer encoding. llvm-mc's5## CFI directives always generate EH frames using the absptr (i.e. system6## pointer size) encoding, but it is possible to hand-roll your own EH frames7## that use the sdata4 encoding. For instance, libffi does this.8 9# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15 %t/sdata4.s -o %t/sdata4.o10# RUN: %lld -lSystem %t/sdata4.o -o %t/sdata411# RUN: llvm-objdump --macho --syms --dwarf=frames %t/sdata4 | FileCheck %s12 13# CHECK: SYMBOL TABLE:14# CHECK: [[#%.16x,MAIN:]] g     F __TEXT,__text _main15 16# CHECK: .eh_frame contents:17# CHECK: 00000000 00000010 00000000 CIE18# CHECK:   Format:                DWARF3219# CHECK:   Version:               120# CHECK:   Augmentation:          "zR"21# CHECK:   Code alignment factor: 122# CHECK:   Data alignment factor: 123# CHECK:   Return address column: 124# CHECK:   Augmentation data:     1B25# CHECK:   DW_CFA_def_cfa: reg7 +826# CHECK:   CFA=reg7+827 28# CHECK: 00000014 00000010 00000018 FDE cie=00000000 pc=[[#%x,MAIN]]...[[#%x,MAIN+1]]29# CHECK:   Format:       DWARF3230# CHECK:   DW_CFA_GNU_args_size: +1631# CHECK:   DW_CFA_nop:32# CHECK:   0x[[#%x,MAIN]]: CFA=reg7+833 34#--- sdata4.s35.globl  _main36_main:37  retq38LmainEnd:39 40.balign 441.section __TEXT,__eh_frame42# Although we don't reference this EhFrame symbol directly, we must have at43# least one non-local symbol in this section, otherwise llvm-mc generates bogus44# subtractor relocations.45EhFrame:46LCieHdr:47  .long LCieEnd - LCieStart48LCieStart:49  .long 0           # CIE ID50  .byte 1           # CIE version51  .ascii "zR\0"52  .byte 1           # Code alignment53  .byte 1           # Data alignment54  .byte 1           # RA column55  .byte 1           # Augmentation size56  .byte 0x1b        # FDE pointer encoding (pcrel | sdata4)57  .byte 0xc, 7, 8   # DW_CFA_def_cfa reg7 +858  .balign 459LCieEnd:60 61LFdeHdr:62  .long LFdeEnd - LFdeStart63LFdeStart:64  .long LFdeStart - LCieHdr65  # The next two fields are longs instead of quads because of the sdata466  # encoding.67  .long _main - .        # Function address68  .long LmainEnd - _main # Function length69  .byte 070  ## Insert DW_CFA_GNU_args_size to prevent ld64 from creating a compact unwind71  ## entry to replace this FDE. Makes it easier for us to cross-check behavior72  ## across the two linkers (LLD never bothers trying to synthesize compact73  ## unwind if it is not already present).74  .byte 0x2e, 0x10       # DW_CFA_GNU_args_size75  .balign 476LFdeEnd:77 78  .long 0 # terminator79 80.subsections_via_symbols 81