1# REQUIRES: x86 2## basicblock-sections tests. 3## This simple test checks if redundant direct jumps are converted to 4## implicit fallthrus when PC32 reloc is present. The jcc's must be converted 5## to their inverted opcode, for instance jne to je and jmp must be deleted. 6 7# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o 8# RUN: llvm-objdump -dr %t.o| FileCheck %s --check-prefix=RELOC 9# RUN: ld.lld --optimize-bb-jumps %t.o -o %t.out 10# RUN: llvm-objdump -d %t.out| FileCheck %s 11 12# RELOC: jmp 13# RELOC-NEXT: R_X86_64_PC32 14 15# CHECK: <foo>: 16# CHECK-NEXT: nopl (%rax) 17# CHECK-NEXT: jne 0x{{[[:xdigit:]]+}} <r.BB.foo> 18# CHECK-NOT: jmp 19 20 21.section .text,"ax",@progbits 22.type foo,@function 23foo: 24 nopl (%rax) 25 je a.BB.foo 26# Encode a jmp r.BB.foo insn using a PC32 reloc 27 .byte 0xe9 28 .long r.BB.foo - . - 4 29 30# CHECK: <a.BB.foo>: 31# CHECK-NEXT: nopl (%rax) 32 33.section .text,"ax",@progbits,unique,3 34a.BB.foo: 35 nopl (%rax) 36r.BB.foo: 37 ret 38