Files
clang-p2996/bolt/test/X86/encoding-validation.s
Maksim Panchenko bcc4c90954 [BOLT] Fix instruction encoding validation
Always use non-symbolizing disassembler for instruction encoding
validation as symbols will be treated as undefined/zeros be the encoder
and causing byte sequence mismatches.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D136118
2022-10-18 13:50:00 -07:00

32 lines
791 B
ArmAsm

# REQUIRES: system-linux
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe -q
# RUN: llvm-bolt %t.exe --relocs -o %t.out --check-encoding |& FileCheck %s
.text
.globl _start
.type _start, %function
_start:
.cfi_startproc
## Check that llvm-bolt uses non-symbolizing disassembler while validating
## instruction encodings. If symbol "foo" below is symbolized, the encoded
## instruction would have a different sequence of bytes from the input
## sequence, as "foo" will not have any address assigned at that point.
movq foo(%rip), %rax
# CHECK-NOT: mismatching LLVM encoding detected
ret
.cfi_endproc
.size _start, .-_start
.globl foo
.type foo, %function
foo:
.cfi_startproc
ret
.cfi_endproc
.size foo, .-foo