34 lines · plain
1## Check that llvm-bolt properly updates references in unoptimized code when2## such references are non-trivial expressions.3 4# RUN: %clang %cflags %s -o %t.exe -Wl,-q -no-pie5# RUN: llvm-bolt %t.exe -o %t.bolt --funcs=_start6# RUN: llvm-objdump -d --disassemble-symbols=_start %t.bolt > %t.out7# RUN: llvm-objdump -d --disassemble-symbols=cold %t.bolt >> %t.out8# RUN: FileCheck %s < %t.out9 10## _start() will be optimized and assigned a new address.11# CHECK: [[#%x,ADDR:]] <_start>:12 13## cold() is not optimized, but references to _start are updated.14# CHECK-LABEL: <cold>:15# CHECK-NEXT: movl $0x[[#ADDR - 1]], %ecx16# CHECK-NEXT: movl $0x[[#ADDR]], %ecx17# CHECK-NEXT: movl $0x[[#ADDR + 1]], %ecx18 19 .text20 .globl cold21 .type cold, %function22cold:23 movl $_start-1, %ecx24 movl $_start, %ecx25 movl $_start+1, %ecx26 ret27 .size cold, .-cold28 29 .globl _start30 .type _start, %function31_start:32 ret33 .size _start, .-_start34