brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.2 KiB · 6516f71 Raw
185 lines · plain
1# REQUIRES: x86, aarch642# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/my-personality.s -o %t/x86_64-my-personality.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/main.s -o %t/x86_64-main.o5# RUN: %lld -arch x86_64 -lSystem -lc++ %t/x86_64-my-personality.o %t/x86_64-main.o -o %t/x86_64-personality-first6# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT7# RUN: %lld -dead_strip -arch x86_64 -lSystem -lc++ %t/x86_64-main.o %t/x86_64-my-personality.o -o %t/x86_64-personality-second8# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT9 10# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/my-personality.s -o %t/arm64-my-personality.o11# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %t/main.s -o %t/arm64-main.o12# RUN: %lld -arch arm64 -lSystem -lc++ %t/arm64-my-personality.o %t/arm64-main.o -o %t/arm64-personality-first13# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT14# RUN: %lld -dead_strip -arch arm64 -lSystem -lc++ %t/arm64-main.o %t/arm64-my-personality.o -o %t/arm64-personality-second15# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 -DSEG=__TEXT16 17# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos -emit-compact-unwind-non-canonical=true %t/my-personality.s -o %t/arm64-32-my-personality.o18# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos -emit-compact-unwind-non-canonical=true %t/main.s -o %t/arm64-32-main.o19# RUN: %lld-watchos -lSystem -lc++ %t/arm64-32-my-personality.o %t/arm64-32-main.o -o %t/arm64-32-personality-first20# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-32-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x4000 -DSEG=__TEXT21# RUN: %lld-watchos -dead_strip -lSystem -lc++ %t/arm64-32-main.o %t/arm64-32-my-personality.o -o %t/arm64-32-personality-second22# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-32-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x4000 -DSEG=__TEXT23 24# RUN: %lld -arch x86_64 -rename_section __TEXT __gcc_except_tab __RODATA __gcc_except_tab -lSystem -lc++ %t/x86_64-my-personality.o %t/x86_64-main.o -o %t/x86_64-personality-first25# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -DSEG=__RODATA26# RUN: %lld -dead_strip -arch x86_64 -rename_section __TEXT __gcc_except_tab __RODATA __gcc_except_tab -lSystem -lc++ %t/x86_64-main.o %t/x86_64-my-personality.o -o %t/x86_64-personality-second27# RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 -DSEG=__RODATA28 29# FIRST:      Indirect symbols for (__DATA_CONST,__got)30# FIRST-NEXT: address                    index name31# FIRST-DAG:  0x[[#%x,GXX_PERSONALITY:]] [[#]] ___gxx_personality_v032# FIRST-DAG:  0x[[#%x,MY_PERSONALITY:]] LOCAL33 34# SECOND:      Indirect symbols for (__DATA_CONST,__got)35# SECOND-NEXT: address                    index name36# SECOND-DAG:  0x[[#%x,GXX_PERSONALITY:]] [[#]] ___gxx_personality_v037# SECOND-DAG:  0x[[#%x,MY_PERSONALITY:]] LOCAL38 39# CHECK:      SYMBOL TABLE:40# CHECK-DAG:  [[#%x,MAIN:]]       g  F __TEXT,__text _main41# CHECK-DAG:  [[#%x,QUUX:]]       g  F __TEXT,__text _quux42# CHECK-DAG:  [[#%x,FOO:]]        l  F __TEXT,__text _foo43# CHECK-DAG:  [[#%x,BAZ:]]        l  F __TEXT,__text _baz44# CHECK-DAG:  [[#%x,EXCEPTION0:]] g  O [[SEG]],__gcc_except_tab _exception045# CHECK-DAG:  [[#%x,EXCEPTION1:]] g  O [[SEG]],__gcc_except_tab _exception146 47# CHECK:      Contents of __unwind_info section:48# CHECK:        Personality functions: (count = 2)49# CHECK-DAG:     personality[{{[0-9]+}}]: 0x{{0*}}[[#MY_PERSONALITY-BASE]]50# CHECK-DAG:     personality[{{[0-9]+}}]: 0x{{0*}}[[#GXX_PERSONALITY-BASE]]51# CHECK:      Top level indices: (count = 2)52# CHECK-DAG:    [0]: function offset={{.*}}, 2nd level page offset=0x[[#%x,PAGEOFF:]],53# CHECK-DAG:    [1]: function offset={{.*}}, 2nd level page offset=0x00000000,54# CHECK:        LSDA descriptors:55# CHECK-DAG:     function offset=0x[[#%.8x,FOO-BASE]],  LSDA offset=0x[[#%.8x,EXCEPTION0-BASE]]56# CHECK-DAG:     function offset=0x[[#%.8x,MAIN-BASE]], LSDA offset=0x[[#%.8x,EXCEPTION1-BASE]]57# CHECK:        Second level indices:58# CHECK-NEXT:   Second level index[0]: offset in section=0x[[#%.8x,PAGEOFF]]59# CHECK-DAG:     function offset=0x[[#%.8x,MAIN-BASE]], encoding60# CHECK-DAG:     function offset=0x[[#%.8x,FOO-BASE]], encoding61# CHECK-DAG:     function offset=0x[[#%.8x,BAZ-BASE]], encoding62# CHECK-DAG:     function offset=0x[[#%.8x,QUUX-BASE]], encoding{{.*}}=0x0000000063 64## Check that we do not add rebase opcodes to the compact unwind section.65# CHECK:      Rebase table:66# CHECK-NEXT: segment      section        address          type67# CHECK-NEXT: __DATA_CONST __got          0x{{[0-9A-F]*}}  pointer68# CHECK-NOT:  __TEXT69 70## Check that we don't create an __unwind_info section if no unwind info71## remains after dead-stripping.72# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 \73# RUN:   %t/empty-after-dead-strip.s -o %t/x86_64-empty-after-dead-strip.o74# RUN: %lld -dylib -dead_strip -arch x86_64 -lSystem \75# RUN:   %t/x86_64-empty-after-dead-strip.o -o %t/x86_64-empty-after-strip.dylib76# RUN: llvm-objdump --macho --unwind-info %t/x86_64-empty-after-strip.dylib | \77# RUN:   FileCheck %s --check-prefixes=NOUNWIND --allow-empty78# NOUNWIND-NOT: Contents of __unwind_info section:79 80#--- my-personality.s81.globl _my_personality, _exception082.text83.p2align 284.no_dead_strip _foo85_foo:86  .cfi_startproc87## This will generate a section relocation.88  .cfi_personality 155, _my_personality89  .cfi_lsda 16, _exception090  .cfi_def_cfa_offset 1691  ret92  .cfi_endproc93 94.p2align 295.no_dead_strip _bar96_bar:97  .cfi_startproc98## Check that we dedup references to the same statically-linked personality.99  .cfi_personality 155, _my_personality100  .cfi_lsda 16, _exception0101  .cfi_def_cfa_offset 16102  ret103  .cfi_endproc104 105.data106.p2align 2107## We put this personality in `__data` to test if we correctly handle108## personality symbols whose output addresses occur after that of the109## `__unwind_info` section.110_my_personality:111  ret112 113.section __TEXT,__gcc_except_tab114_exception0:115  .space 1116 117.subsections_via_symbols118 119#--- main.s120.globl _main, _quux, _my_personality, _exception1121 122.text123.p2align 2124_main:125  .cfi_startproc126  .cfi_personality 155, ___gxx_personality_v0127  .cfi_lsda 16, _exception1128  .cfi_def_cfa_offset 16129  ret130  .cfi_endproc131 132## _quux has no unwind information.133## (In real life, it'd be part of a separate TU that was built with134## -fno-exceptions, while the previous and next TU might be Objective-C++135## which has unwind info for Objective-C).136.p2align 2137.no_dead_strip _quux138_quux:139  ret140 141.globl _abs142.no_dead_strip _abs143_abs = 4144 145.p2align 2146.no_dead_strip _baz147_baz:148  .cfi_startproc149## This will generate a symbol relocation. Check that we reuse the personality150## referenced by the section relocation in my_personality.s.151  .cfi_personality 155, _my_personality152  .cfi_lsda 16, _exception1153  .cfi_def_cfa_offset 16154  ret155  .cfi_endproc156 157.globl _stripped158_stripped:159  .cfi_startproc160  .cfi_personality 155, ___gxx_personality_v0161  .cfi_lsda 16, _exception1162  .cfi_def_cfa_offset 16163  ret164  .cfi_endproc165 166 167.section __TEXT,__gcc_except_tab168_exception1:169  .space 1170 171.subsections_via_symbols172 173#--- empty-after-dead-strip.s174.text175 176## Local symbol with unwind info.177## The symbol is removed by -dead_strip.178_foo :179  .cfi_startproc180  .cfi_def_cfa_offset 16181  retq182  .cfi_endproc183 184.subsections_via_symbols185