-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'junghee/tls-local-exec' into 'main'
Fix bug that could result in missed symbolic expressions Closes rewriting/transforms/gtirb-reachable#8 See merge request rewriting/ddisasm!1226
- Loading branch information
Showing
6 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
all: ex_original.s | ||
gcc -o ex ex_original.s | ||
@./ex > out.txt | ||
clean: | ||
rm -f ex out.txt | ||
check: | ||
@./ex > /tmp/res.txt | ||
@ diff out.txt /tmp/res.txt && echo TEST OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
.section .rodata | ||
.align 8 | ||
.LC: | ||
.string "tls_var value: %d\n" | ||
|
||
.section .text ,"wa" | ||
|
||
.align 16 | ||
.globl get_tls_var | ||
.type get_tls_var, @function | ||
get_tls_var: | ||
pushq %rbp | ||
movq %rsp, %rbp | ||
var_tpoff_1: | ||
movq $var@tpoff, %rax | ||
movq %fs:0(%rax),%rax | ||
popq %rbp | ||
ret | ||
|
||
.size get_tls_var, .-get_tls_var | ||
|
||
.align 16 | ||
.globl set_tls_var | ||
.type set_tls_var, @function | ||
set_tls_var: | ||
pushq %rbp | ||
movq %rsp, %rbp | ||
movq %rdi, -8(%rbp) | ||
var_tpoff_2: | ||
movq $var@tpoff, %rax | ||
movq -8(%rbp), %rdx | ||
movq %rdx, %fs:0(%rax) | ||
nop | ||
popq %rbp | ||
ret | ||
|
||
.size set_tls_var, .-set_tls_var | ||
|
||
.align 16 | ||
.globl main | ||
.type main, @function | ||
main: | ||
pushq %rbp | ||
movq %rsp, %rbp | ||
movq $7, %rdi | ||
call set_tls_var@PLT | ||
movq %rax, %rdi | ||
call get_tls_var@PLT | ||
movq %rax, %rsi | ||
leaq .LC(%rip), %rdi | ||
call printf@PLT | ||
movl $0, %eax | ||
popq %rbp | ||
ret | ||
|
||
.size main, .-main | ||
|
||
.section .tbss ,"wa",@nobits | ||
|
||
.align 8 | ||
var: | ||
.zero 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters