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
thread local variables don't work with static executables #2063
Comments
andrewrk
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Mar 14, 2019
andrewrk
added a commit
that referenced
this issue
Mar 14, 2019
disable failing thread local variable test. see #2063
Here's the difference in code generation between static and PIC: threadlocal var x: i32 = 1234;
export fn read_it() i32 {
return x;
}
export fn write_it(y: i32) void {
x = y;
} --- test-static.s 2019-04-03 22:10:40.343823505 -0400
+++ test-pic.s 2019-04-03 22:10:29.016752536 -0400
@@ -14,18 +14,27 @@
0000000000000010 <read_it>:
10: 55 push %rbp
11: 48 89 e5 mov %rsp,%rbp
- 14: 64 8b 04 25 00 00 00 mov %fs:0x0,%eax
- 1b: 00
- 1c: 5d pop %rbp
- 1d: c3 retq
- 1e: 66 90 xchg %ax,%ax
+ 14: 48 8d 3d 00 00 00 00 lea 0x0(%rip),%rdi # 1b <read_it+0xb>
+ 1b: e8 00 00 00 00 callq 20 <read_it+0x10>
+ 20: 8b 80 00 00 00 00 mov 0x0(%rax),%eax
+ 26: 5d pop %rbp
+ 27: c3 retq
+ 28: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
+ 2f: 00
-0000000000000020 <write_it>:
- 20: 55 push %rbp
- 21: 48 89 e5 mov %rsp,%rbp
- 24: 89 7d fc mov %edi,-0x4(%rbp)
- 27: 8b 7d fc mov -0x4(%rbp),%edi
- 2a: 64 89 3c 25 00 00 00 mov %edi,%fs:0x0
- 31: 00
- 32: 5d pop %rbp
- 33: c3 retq
+0000000000000030 <write_it>:
+ 30: 55 push %rbp
+ 31: 48 89 e5 mov %rsp,%rbp
+ 34: 53 push %rbx
+ 35: 50 push %rax
+ 36: 89 7d f4 mov %edi,-0xc(%rbp)
+ 39: 8b 7d f4 mov -0xc(%rbp),%edi
+ 3c: 89 7d f0 mov %edi,-0x10(%rbp)
+ 3f: 48 8d 3d 00 00 00 00 lea 0x0(%rip),%rdi # 46 <write_it+0x16>
+ 46: e8 00 00 00 00 callq 4b <write_it+0x1b>
+ 4b: 8b 5d f0 mov -0x10(%rbp),%ebx
+ 4e: 89 98 00 00 00 00 mov %ebx,0x0(%rax)
+ 54: 48 83 c4 08 add $0x8,%rsp
+ 58: 5b pop %rbx
+ 59: 5d pop %rbp
+ 5a: c3 retq I think this needs to be linked for it to make sense. |
OK when building an exe: 0000000000201050 <read_it>:
201050: 55 push %rbp
201051: 48 89 e5 mov %rsp,%rbp
201054: 64 8b 04 25 fc ff ff mov %fs:0xfffffffffffffffc,%eax
20105b: ff
20105c: 5d pop %rbp
20105d: c3 retq
20105e: 66 90 xchg %ax,%ax
0000000000201060 <write_it>:
201060: 55 push %rbp
201061: 48 89 e5 mov %rsp,%rbp
201064: 89 7d fc mov %edi,-0x4(%rbp)
201067: 8b 7d fc mov -0x4(%rbp),%edi
20106a: 64 89 3c 25 fc ff ff mov %edi,%fs:0xfffffffffffffffc
201071: ff
201072: 5d pop %rbp
201073: c3 retq
201074: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
20107b: 00 00 00
20107e: 66 90 xchg %ax,%ax pic: 0000000000201040 <read_it>:
201040: 55 push %rbp
201041: 48 89 e5 mov %rsp,%rbp
201044: 66 66 66 64 48 8b 04 data16 data16 data16 mov %fs:0x0,%rax
20104b: 25 00 00 00 00
201050: 8b 80 fc ff ff ff mov -0x4(%rax),%eax
201056: 5d pop %rbp
201057: c3 retq
201058: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
20105f: 00
0000000000201060 <write_it>:
201060: 55 push %rbp
201061: 48 89 e5 mov %rsp,%rbp
201064: 53 push %rbx
201065: 50 push %rax
201066: 89 7d f4 mov %edi,-0xc(%rbp)
201069: 8b 7d f4 mov -0xc(%rbp),%edi
20106c: 89 7d f0 mov %edi,-0x10(%rbp)
20106f: 66 66 66 64 48 8b 04 data16 data16 data16 mov %fs:0x0,%rax
201076: 25 00 00 00 00
20107b: 8b 5d f0 mov -0x10(%rbp),%ebx
20107e: 89 98 fc ff ff ff mov %ebx,-0x4(%rax)
201084: 48 83 c4 08 add $0x8,%rsp
201088: 5b pop %rbx
201089: 5d pop %rbp
20108a: c3 retq
20108b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
before 5d2edac:
after, I'm disabling the failing test with a TODO comment and a link to this issue.
The text was updated successfully, but these errors were encountered: