brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 133b0df Raw
172 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly updates ORC unwind information used by the Linux4## kernel.5 6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o7# RUN: %clang %cflags -nostdlib %t.o -o %t.exe \8# RUN:   -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr9 10## Verify reading contents of ORC sections.11 12# RUN: llvm-bolt %t.exe --dump-orc -o /dev/null 2>&1 | FileCheck %s \13# RUN:   --check-prefix=CHECK-ORC14 15# CHECK-ORC: 	    BOLT-INFO: ORC unwind information:16# CHECK-ORC-NEXT: {sp: 8, bp: 0, info: 0x5}: _start17# CHECK-ORC-NEXT: {terminator}18# CHECK-ORC-NEXT: {sp: 8, bp: 0, info: 0x5}: foo19# CHECK-ORC-NEXT: {sp: 16, bp: -16, info: 0x15}: foo20# CHECK-ORC-NEXT: {sp: 16, bp: -16, info: 0x14}: foo21# CHECK-ORC-NEXT: {sp: 8, bp: 0, info: 0x5}: foo22# CHECK-ORC-NEXT: {terminator}23# CHECK-ORC-NEXT: {terminator}24# CHECK-ORC-NEXT: {terminator}25 26 27## Verify ORC bindings to instructions.28 29# RUN: llvm-bolt %t.exe --print-normalized --dump-orc --print-orc -o %t.out \30# RUN:   --keep-nops=0 --bolt-info=0 2>&1 | FileCheck %s31 32 33## Verify ORC bindings after rewrite.34 35# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized --print-orc \36# RUN:   2>&1 | FileCheck %s37 38## Verify ORC binding after rewrite when some of the functions are skipped.39 40# RUN: llvm-bolt %t.exe -o %t.out --skip-funcs=bar --bolt-info=0 --keep-nops=041# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized --print-orc \42# RUN:   2>&1 | FileCheck %s43 44# CHECK:      BOLT-INFO: Linux kernel binary detected45# CHECK:      BOLT-INFO: parsed 9 ORC entries46 47  .text48  .globl _start49  .type _start, %function50_start:51# CHECK: Binary Function "_start"52 53  call foo54# CHECK:      callq foo           # ORC: {sp: 8, bp: 0, info: 0x5}55  ret56  .size _start, .-_start57 58  .globl foo59  .type foo, %function60foo:61# CHECK: Binary Function "foo"62 63  push %rbp64# CHECK:      pushq   %rbp        # ORC: {sp: 8, bp: 0, info: 0x5}65.L1:66  mov %rsp, %rbp67# CHECK:      movq    %rsp, %rbp  # ORC: {sp: 16, bp: -16, info: 0x15}68.L2:69  pop %rbp70# CHECK:      popq    %rbp        # ORC: {sp: 16, bp: -16, info: 0x14}71  nop72.L3:73  ret74# CHECK:      retq                # ORC: {sp: 8, bp: 0, info: 0x5}75  .size foo, .-foo76 77  .globl bar78  .type bar, %function79bar:80# CHECK:   Binary Function "bar"81	ret82## Same ORC info propagated from foo above.83# CHECK:      retq                # ORC: {sp: 8, bp: 0, info: 0x5}84.L4:85  .size bar, .-bar86 87# CHECK: BOLT-WARNING: Linux kernel support is experimental88 89  .section .orc_unwind,"a",@progbits90  .align 491  .section .orc_unwind_ip,"a",@progbits92  .align 493 94## ORC for _start.95  .section .orc_unwind96  .2byte 897  .2byte 098  .2byte 599  .section .orc_unwind_ip100  .long _start - .101 102  .section .orc_unwind103  .2byte 0104  .2byte 0105  .2byte 0106  .section .orc_unwind_ip107  .long foo - .108 109## ORC for foo.110  .section .orc_unwind111  .2byte 8112  .2byte 0113  .2byte 5114  .section .orc_unwind_ip115  .long foo - .116 117  .section .orc_unwind118  .2byte 16119  .2byte -16120  .2byte 21121  .section .orc_unwind_ip122  .long .L1 - .123 124  .section .orc_unwind125  .2byte 16126  .2byte -16127  .2byte 20128  .section .orc_unwind_ip129  .long .L2 - .130 131  .section .orc_unwind132  .2byte 8133  .2byte 0134  .2byte 5135  .section .orc_unwind_ip136  .long .L3 - .137 138  .section .orc_unwind139  .2byte 0140  .2byte 0141  .2byte 0142  .section .orc_unwind_ip143  .long .L4 - .144 145## Duplicate terminator entries to test ORC reader.146  .section .orc_unwind147  .2byte 0148  .2byte 0149  .2byte 0150  .section .orc_unwind_ip151  .long .L4 - .152 153  .section .orc_unwind154  .2byte 0155  .2byte 0156  .2byte 0157  .section .orc_unwind_ip158  .long .L4 - .159 160## Linux kernel version161  .rodata162  .align 16163  .globl linux_banner164  .type  linux_banner, @object165linux_banner:166  .string  "Linux version 6.6.61\n"167  .size  linux_banner, . - linux_banner168 169## Fake Linux Kernel sections.170  .section __ksymtab,"a",@progbits171  .section __ksymtab_gpl,"a",@progbits172