-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[BOLT] Avoid reference updates for non-JT symbol operands #88838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# If the operand references a symbol that differs from the jump table label, | ||
# no reference updating is required even if its target address resides within | ||
# the jump table's range. | ||
# In this test case, consider the second instruction within the main function, | ||
# where the address resulting from 'c + 17' corresponds to one byte beyond the | ||
# address of the .LJTI2_0 jump table label. However, this operand represents | ||
# an offset calculation related to the global variable 'c' and should remain | ||
# unaffected by the jump table. | ||
|
||
# REQUIRES: system-linux | ||
|
||
|
||
# RUN: %clang -no-pie %s -o %t.exe -Wl,-q | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use llvm-mc + lld for assembly tests (check bolt/test/X86 for examples). |
||
|
||
# RUN: %t.exe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Runnable tests need to be under bolt/test/runtime. But in this case, there's no need to run the binary to verify the behavior. Please remove these lines with running the binary. |
||
# RUN: llvm-bolt -funcs=main,foo/1 %t.exe -o %t.exe.bolt -jump-tables=move | ||
# RUN: %t.exe.bolt | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a CHECK line verifying the intended behavior of the pass: that the output binary contains the correct reference. |
||
.text | ||
.globl main | ||
.type main,@function | ||
main: | ||
pushq %rbp | ||
movq %rsp, %rbp | ||
movq $-16, %rax | ||
movl c+17(%rax), %edx | ||
cmpl $255, %edx | ||
je .LCorrect | ||
movl $1, %eax | ||
popq %rbp | ||
ret | ||
.LCorrect: | ||
movl $0, %eax | ||
popq %rbp | ||
ret | ||
.p2align 4, 0x90 | ||
.type foo,@function | ||
foo: | ||
movq $0, %rax | ||
jmpq *.LJTI2_0(,%rax,8) | ||
addl $-36, %eax | ||
.LBB2_2: | ||
addl $-16, %eax | ||
retq | ||
.section .rodata,"a",@progbits | ||
.type c,@object | ||
.data | ||
.globl c | ||
.p2align 4, 0x0 | ||
c: | ||
.byte 1 | ||
.byte 0xff | ||
.zero 14 | ||
.size c, 16 | ||
.LJTI2_0: | ||
.quad .LBB2_2 | ||
.quad .LBB2_2 | ||
.quad .LBB2_2 | ||
.quad .LBB2_2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails on my AArch64-linux machine.
It seems that something is missing on this clang command line to tell it explicitly to target x86? In some of the other tests in this directory, it seems that might be done indirectly by adding %cflags to the clang command line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://lab.llvm.org/buildbot/#/builders/221/builds/22130
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted.