82 lines · plain
1# This reproduces a bug where BOLT would read __hot_end as2# the name of a function even when -hot-text is used, which3# means BOLT will emit another __hot_end label, eventually4# asserting due to a symbol redefinition in MCStreamer.5 6# REQUIRES: system-linux7 8# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \9# RUN: %s -o %t.o10# RUN: link_fdata %s %t.o %t.fdata11# RUN: llvm-strip --strip-unneeded %t.o12# RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q13 14# RUN: llvm-bolt %t.exe --relocs=1 --hot-text --reorder-functions=hfsort \15# RUN: --split-functions --split-strategy=all \16# RUN: --data %t.fdata -o %t.out | FileCheck %s17 18# RUN: %t.out 119 20# CHECK: BOLT-INFO: setting __hot_end to21 22# RUN: llvm-nm -n %t.exe | FileCheck %s --check-prefix=CHECK-INPUT23# RUN: llvm-nm -n %t.out | FileCheck %s --check-prefix=CHECK-OUTPUT24 25# CHECK-INPUT: __hot_start26# CHECK-INPUT-NEXT: main27# CHECK-INPUT-NEXT: foo28# CHECK-INPUT-NEXT: __hot_end29 30# Our fdata only logs activity in main, so hot markers will change31# CHECK-OUTPUT: __hot_start32# CHECK-OUTPUT-NEXT: main33# CHECK-OUTPUT-NEXT: __hot_end34# CHECK-OUTPUT-NOT: __hot_start.cold35 36 .text37 .globl main38 .type main, %function39 .globl __hot_start40 .p2align 441main:42__hot_start:43# FDATA: 0 [unknown] 0 1 main 0 0 51044 pushq %rbp45 movq %rsp, %rbp46 cmpl $0x2, %edi47 jb .BBend48.BB2:49 callq bar50 leaq mystring, %rdi51 callq puts52 53.BBend:54 xorq %rax, %rax55 leaveq56 retq57 .size main, .-main58 59 .globl foo60 .type foo, %function61 .p2align 462foo:63 retq64 .size foo, .-foo65 66 .globl __hot_end67 .type __hot_end, %object68 .p2align 269__hot_end:70 int371 .size __hot_end, 072 73 .globl bar74 .type bar, %function75 .p2align 476bar:77 retq78 .size bar, .-bar79 80 .data81mystring: .asciz "test\n"82