66 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3 4## This is a regression test. Previously, we would emit a bogus LSDA pointer if5## the following conditions held:6## * ICF and dead-strip were both done7## * There exist two functions different compact unwind encodings, but the8## same LSDA9##10## Essentially, we'd neglected to canonicalize the LSDA pointer after ICF, but11## the broken output would only appear if the compact unwind entry that pointed12## to it was not itself folded.13 14# RUN: llvm-mc -emit-compact-unwind-non-canonical=true -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/test.s -o %t/test.o15# RUN: %lld -dylib -dead_strip --icf=all %t/test.o -o %t/test16# RUN: llvm-objdump --macho --syms --unwind-info %t/test | FileCheck %s17 18# CHECK: SYMBOL TABLE:19## Sanity check: Verify that the LSDAs are dedup'ed20# CHECK-NEXT: [[#%.16x, EXC:]] l O __TEXT,__gcc_except_tab _exception021# CHECK-NEXT: [[#EXC]] l O __TEXT,__gcc_except_tab _exception122## But that the functions themselves aren't23# CHECK-NEXT: [[#%.16x, FOO:]] g F __TEXT,__text _foo24# CHECK-NEXT: [[#%.16x, BAR:FOO + 1]] g F __TEXT,__text _bar25 26## _foo and _bar should share the same LSDA. We would previously emit a bogus27## address for _bar's LSDA.28# CHECK: Contents of __unwind_info section:29# CHECK: LSDA descriptors:30# CHECK-NEXT: [0]: function offset=0x[[#%.8x, FOO]], LSDA offset=0x[[#%.8x, EXC]]31# CHECK-NEXT: [1]: function offset=0x[[#%.8x, BAR]], LSDA offset=0x[[#%.8x, EXC]]32 33## But there should be two distinct encodings, one for each function34# CHECK: Second level indices:35# CHECK-NEXT: Second level index[0]:36# CHECK-NEXT: [0]: function offset=0x[[#%.8x, FOO]], encoding[0]=0x4202000037# CHECK-NEXT: [1]: function offset=0x[[#%.8x, BAR]], encoding[1]=0x4201000038 39#--- test.s40.text41.globl _foo, _bar42 43_foo:44 .cfi_startproc45 .cfi_lsda 16, _exception046 .cfi_def_cfa_offset 1647 ret48 .cfi_endproc49 50_bar:51 .cfi_startproc52 .cfi_lsda 16, _exception153 .cfi_def_cfa_offset 8 ## ensure _bar's CUE doesn't get folded with _foo's54 ret55 .cfi_endproc56 57.section __TEXT,__gcc_except_tab58 59_exception0:60 .quad 0x123461 62_exception1:63 .quad 0x123464 65.subsections_via_symbols66