1# REQUIRES: system-linux 2 3# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \ 4# RUN: %s -o %t.o 5# RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q 6 7# RUN: llvm-bolt %t.exe --funcs init_impls --lite \ 8# RUN: -o %t.bolted 9# RUN: %t.bolted | FileCheck %s 10 11 .section .rodata.str1.1,"aMS",@progbits,1 12.LC2: 13 .string "Hello, world\n" 14 .text 15 .p2align 4 16 .globl init_impls 17 .type init_impls, @function 18init_impls: 19 .cfi_startproc 20 push %rbp 21 mov %rsp,%rbp 22 push %r15 23 push %rbx 24 sub $0x8,%rsp 251: 26 lea 1b(%rip),%rbx 27 # R_X86_64_GOTPC64 _GLOBAL_OFFSET_TABLE_+0x9 28 movabsq $_GLOBAL_OFFSET_TABLE_-1b, %r11 29 add %r11,%rbx 30 # R_X86_64_GOTOFF64 .LC2 31 movabs $.LC2@gotoff,%rax 32 lea (%rbx,%rax,1),%rax 33 mov %rax,%rdi 34 mov %rbx,%r15 35 # R_X86_64_PLTOFF64 puts 36 movabs $puts@pltoff,%rax 37 add %rbx,%rax 38 call *%rax 39 add $0x8,%rsp 40 pop %rbx 41 pop %r15 42 pop %rbp 43 retq 44 .cfi_endproc 45 .size init_impls, .-init_impls 46 47 .globl main 48 .type main, @function 49 .p2align 4 50main: 51 callq init_impls 52 xorq %rax, %rax 53 ret 54 55# CHECK: Hello, world 56