38 lines · plain
1# REQUIRES: x862## basic-block-sections tests.3## This simple test checks if redundant direct jumps are converted to4## implicit fallthrus when PC32 reloc is present. The jcc's must be converted5## 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.o8# RUN: llvm-objdump -dr %t.o| FileCheck %s --check-prefix=RELOC9# RUN: ld.lld --optimize-bb-jumps %t.o -o %t.out10# RUN: llvm-objdump -d %t.out| FileCheck %s11 12# RELOC: jmp13# RELOC-NEXT: R_X86_64_PC3214 15# CHECK: <foo>:16# CHECK-NEXT: nopl (%rax)17# CHECK-NEXT: jne 0x{{[[:xdigit:]]+}} <r.BB.foo>18# CHECK-NOT: jmp19 20 21.section .text,"ax",@progbits22.type foo,@function23foo:24 nopl (%rax)25 je a.BB.foo26# Encode a jmp r.BB.foo insn using a PC32 reloc27 .byte 0xe928 .long r.BB.foo - . - 429 30# CHECK: <a.BB.foo>:31# CHECK-NEXT: nopl (%rax)32 33.section .text,"ax",@progbits,unique,334a.BB.foo:35 nopl (%rax)36r.BB.foo:37 ret38