173 lines · plain
1# REQUIRES: x86, aarch642# RUN: rm -rf %t; mkdir %t3 4# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-macos10.15 %s -o %t/eh-frame-x86_64.o5# RUN: %lld -lSystem -lc++ %t/eh-frame-x86_64.o -o %t/eh-frame-x86_646# RUN: llvm-objdump --macho --syms --indirect-symbols --unwind-info \7# RUN: --dwarf=frames %t/eh-frame-x86_64 | FileCheck %s -D#BASE=0x100000000 -D#DWARF_ENC=48# RUN: llvm-nm -m %t/eh-frame-x86_64 | FileCheck %s --check-prefix NO-EH-SYMS9# RUN: llvm-readobj --section-headers %t/eh-frame-x86_64 | FileCheck %s --check-prefix=ALIGN -D#ALIGN=310 11## Test that we correctly handle the output of `ld -r`, which emits EH frames12## using subtractor relocations instead of implicitly encoding the offsets.13## In order to keep this test cross-platform, we check in ld64's output rather14## than invoking ld64 directly. NOTE: whenever this test is updated, the15## checked-in copy of `ld -r`'s output should be updated too!16# COM: ld -r %t/eh-frame-x86_64.o -o %S/Inputs/eh-frame-x86_64-r.o17# RUN: %lld -lSystem -lc++ %S/Inputs/eh-frame-x86_64-r.o -o %t/eh-frame-x86_64-r18# RUN: llvm-objdump --macho --syms --indirect-symbols --unwind-info \19# RUN: --dwarf=frames %t/eh-frame-x86_64-r | FileCheck %s -D#BASE=0x100000000 -D#DWARF_ENC=420# RUN: llvm-nm -m %t/eh-frame-x86_64-r | FileCheck %s --check-prefix NO-EH-SYMS21# RUN: llvm-readobj --section-headers %t/eh-frame-x86_64-r | FileCheck %s --check-prefix=ALIGN -D#ALIGN=322 23# RUN: llvm-mc -filetype=obj -emit-compact-unwind-non-canonical=true -triple=arm64-apple-macos11.0 %s -o %t/eh-frame-arm64.o24# RUN: %lld -arch arm64 -lSystem -lc++ %t/eh-frame-arm64.o -o %t/eh-frame-arm6425# RUN: llvm-objdump --macho --syms --indirect-symbols --unwind-info \26# RUN: --dwarf=frames %t/eh-frame-arm64 | FileCheck %s -D#BASE=0x100000000 -D#DWARF_ENC=327# RUN: llvm-nm -m %t/eh-frame-arm64 | FileCheck %s --check-prefix NO-EH-SYMS28 29# COM: ld -r %t/eh-frame-arm64.o -o %S/Inputs/eh-frame-arm64-r.o30# RUN: %lld -arch arm64 -lSystem -lc++ %S/Inputs/eh-frame-arm64-r.o -o %t/eh-frame-arm64-r31# RUN: llvm-objdump --macho --syms --indirect-symbols --unwind-info \32# RUN: --dwarf=frames %t/eh-frame-arm64-r | FileCheck %s -D#BASE=0x100000000 -D#DWARF_ENC=333# RUN: llvm-nm -m %t/eh-frame-arm64-r | FileCheck %s --check-prefix NO-EH-SYMS34 35# ALIGN: Name: __eh_frame36# ALIGN-NEXT: Segment: __TEXT37# ALIGN-NEXT: Address:38# ALIGN-NEXT: Size:39# ALIGN-NEXT: Offset:40# ALIGN-NEXT: Alignment: [[#ALIGN]]41 42# NO-EH-SYMS-NOT: __eh_frame43 44# CHECK: Indirect symbols for (__DATA_CONST,__got) 2 entries45# CHECK: address index name46# CHECK: 0x[[#%x,GXX_PERSONALITY_GOT:]] {{.*}} ___gxx_personality_v047# CHECK: 0x[[#%x,MY_PERSONALITY_GOT:]]48# CHECK: SYMBOL TABLE:49# CHECK-DAG: [[#%x,F:]] l F __TEXT,__text _f50# CHECK-DAG: [[#%x,NO_UNWIND:]] l F __TEXT,__text _no_unwind51# CHECK-DAG: [[#%x,G:]] l F __TEXT,__text _g52# CHECK-DAG: [[#%x,H:]] l F __TEXT,__text _h53# CHECK-DAG: [[#%x,EXCEPT0:]] l O __TEXT,__gcc_except_tab GCC_except_table054# CHECK-DAG: [[#%x,EXCEPT1:]] l O __TEXT,__gcc_except_tab GCC_except_table155# CHECK-DAG: [[#%x,EXCEPT2:]] l O __TEXT,custom_except custom_except_table256# CHECK-DAG: [[#%x,MY_PERSONALITY:]] g F __TEXT,__text _my_personality57# CHECK: Contents of __unwind_info section:58# CHECK: Version: 0x159# CHECK: Number of personality functions in array: 0x160# CHECK: Number of indices in array: 0x261# CHECK: Personality functions: (count = 1)62# CHECK: personality[1]: 0x[[#%.8x,GXX_PERSONALITY_GOT - BASE]]63# CHECK: LSDA descriptors:64# CHECK: [0]: function offset=0x[[#%.8x,F - BASE]], LSDA offset=0x[[#%.8x,EXCEPT0 - BASE]]65# CHECK: [1]: function offset=0x[[#%.8x,G - BASE]], LSDA offset=0x[[#%.8x,EXCEPT1 - BASE]]66# CHECK: [2]: function offset=0x[[#%.8x,H - BASE]], LSDA offset=0x[[#%.8x,EXCEPT2 - BASE]]67# CHECK: Second level indices:68# CHECK: Second level index[0]:69# CHECK [0]: function offset=0x[[#%.8x,F - BASE]], encoding[{{.*}}]=0x52{{.*}}70# CHECK [1]: function offset=0x[[#%.8x,NO_UNWIND - BASE]], encoding[{{.*}}]=0x0000000071# CHECK: [2]: function offset=0x[[#%.8x,G - BASE]], encoding[{{.*}}]=0x0[[#%x,DWARF_ENC]][[#%.6x, G_DWARF_OFF:]]72# CHECK: [3]: function offset=0x[[#%.8x,H - BASE]], encoding[{{.*}}]=0x0[[#%x,DWARF_ENC]][[#%.6x, H_DWARF_OFF:]]73# CHECK: [4]: function offset=0x[[#%.8x,MY_PERSONALITY - BASE]], encoding[{{.*}}]=0x0000000074 75# CHECK: .debug_frame contents:76# CHECK: .eh_frame contents:77 78# CHECK: [[#%.8x,CIE1_OFF:]] {{.*}} CIE79# CHECK: Format: DWARF3280# CHECK: Version: 181# CHECK: Augmentation: "zPLR"82# CHECK: Code alignment factor: 183# CHECK: Data alignment factor: -884# CHECK: Return address column:85# CHECK: Personality Address: [[#%.16x,GXX_PERSONALITY_GOT]]86# CHECK: Augmentation data: 9B {{(([[:xdigit:]]{2} ){4})}}10 1087 88# CHECK: [[#%.8x,G_DWARF_OFF]] {{.*}} [[#%.8x,G_DWARF_OFF + 4 - CIE1_OFF]] FDE cie=[[#CIE1_OFF]] pc=[[#%x,G]]89# CHECK: Format: DWARF3290# CHECK: LSDA Address: [[#%.16x,EXCEPT1]]91# CHECK: DW_CFA_def_cfa_offset: +892# CHECK: 0x[[#%x,G]]:93 94# CHECK: [[#%.8x,CIE2_OFF:]] {{.*}} CIE95# CHECK: Format: DWARF3296# CHECK: Version: 197# CHECK: Augmentation: "zPLR"98# CHECK: Code alignment factor: 199# CHECK: Data alignment factor: -8100# CHECK: Return address column:101# CHECK: Personality Address: [[#%.16x,MY_PERSONALITY_GOT]]102# CHECK: Augmentation data: 9B {{(([[:xdigit:]]{2} ){4})}}10 10103 104# CHECK: [[#%.8x,H_DWARF_OFF]] {{.*}} [[#%.8x,H_DWARF_OFF + 4 - CIE2_OFF]] FDE cie=[[#CIE2_OFF]] pc=[[#%x,H]]105# CHECK: Format: DWARF32106# CHECK: LSDA Address: [[#%.16x,EXCEPT2]]107# CHECK: DW_CFA_def_cfa_offset: +8108# CHECK: 0x[[#%x,H]]:109 110.globl _my_personality, _main111 112.text113## _f's unwind info can be encoded with compact unwind, so we shouldn't see an114## FDE entry for it in the output file.115.p2align 2116_f:117 .cfi_startproc118 .cfi_personality 155, ___gxx_personality_v0119 .cfi_lsda 16, Lexception0120 .cfi_def_cfa_offset 8121 ret122 .cfi_endproc123 124.p2align 2125_no_unwind:126 ret127 128.p2align 2129_g:130 .cfi_startproc131 .cfi_personality 155, ___gxx_personality_v0132 .cfi_lsda 16, Lexception1133 .cfi_def_cfa_offset 8134 ## cfi_escape cannot be encoded in compact unwind, so we must keep _g's FDE135 .cfi_escape 0x2e, 0x10136 ret137 .cfi_endproc138 139.p2align 2140_h:141 .cfi_startproc142 .cfi_personality 155, _my_personality143 .cfi_lsda 16, Lexception2144 .cfi_def_cfa_offset 8145 ## cfi_escape cannot be encoded in compact unwind, so we must keep _h's FDE146 .cfi_escape 0x2e, 0x10147 ret148 .cfi_endproc149 150.p2align 2151_my_personality:152 ret153 154.p2align 2155_main:156 ret157 158.section __TEXT,__gcc_except_tab159GCC_except_table0:160Lexception0:161 .byte 255162 163GCC_except_table1:164Lexception1:165 .byte 255166 167.section __TEXT,custom_except168custom_except_table2:169Lexception2:170 .byte 255171 172.subsections_via_symbols173