diff options
author | Maksim Panchenko <maks@fb.com> | 2024-12-15 17:13:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-15 17:13:04 -0800 |
commit | f86f4574bbab9cb8c998f9e6560c68696c45f90f (patch) | |
tree | 255c0569003c5edc9e44cc51d6c026cb3f44007d | |
parent | 8daf4f16fa08b5d876e98108721dd1743a360326 (diff) | |
download | llvm-f86f4574bbab9cb8c998f9e6560c68696c45f90f.zip llvm-f86f4574bbab9cb8c998f9e6560c68696c45f90f.tar.gz llvm-f86f4574bbab9cb8c998f9e6560c68696c45f90f.tar.bz2 |
[BOLT][Linux] Fix static keys test case (#119771)
The key address in the static keys jump table was incorrectly encoded as
an absolute value instead of PC-relative causing incorrect
interpretation of the "likely" property of the key.
-rw-r--r-- | bolt/test/X86/linux-static-keys.s | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/bolt/test/X86/linux-static-keys.s b/bolt/test/X86/linux-static-keys.s index 0bd17a3..d34dd64 100644 --- a/bolt/test/X86/linux-static-keys.s +++ b/bolt/test/X86/linux-static-keys.s @@ -35,13 +35,13 @@ _start: .L0: jmp L1 # CHECK: jit -# CHECK-SAME: # ID: 1 {{.*}} # Likely: 0 # InitValue: 1 +# CHECK-SAME: # ID: 1 {{.*}} # Likely: 1 # InitValue: 0 nop L1: .nops 5 - jmp .L0 # CHECK: jit -# CHECK-SAME: # ID: 2 {{.*}} # Likely: 1 # InitValue: 1 +# CHECK-SAME: # ID: 2 {{.*}} # Likely: 0 # InitValue: 0 + jmp .L0 ## Check that a branch profile associated with a NOP is handled properly when ## dynamic branch is created. @@ -67,18 +67,24 @@ foo: .type __start___jump_table, %object __start___jump_table: - .long .L0 - . # Jump address - .long L1 - . # Target address - .quad 1 # Key address + .long .L0 - . # Jump address + .long L1 - . # Target address + .quad fake_static_key + 1 - . # Key address; LSB = 1 : likely - .long L1 - . # Jump address - .long L2 - . # Target address - .quad 0 # Key address + .long L1 - . # Jump address + .long L2 - . # Target address + .quad fake_static_key -. # Key address; LSB = 0 : unlikely .globl __stop___jump_table .type __stop___jump_table, %object __stop___jump_table: +## Staic keys (we just use the label ignoring the format of the keys). + .data + .align 8 +fake_static_key: + .quad 0 + ## Fake Linux Kernel sections. .section __ksymtab,"a",@progbits .section __ksymtab_gpl,"a",@progbits |