Hello
The following program crashes:
#include <stdio.h> #include <pthread.h>
__thread int i;
int main(void) { puts("Hello World!"); printf("address of i=%p\n", &i); printf("i=%d\n", i); return 0; }
with: MOE: loading 'rom/hello2' Hello World! address of i=0xb30001fc L4Re: unhandled exception: pc=0x100013c
How should TLS initialization be done? This is with L4_MULTITHREADED = y
Dump of assembler code for function main: 0x01000100 <+0>: push %ebp 0x01000101 <+1>: mov %esp,%ebp 0x01000103 <+3>: and $0xfffffff0,%esp 0x01000106 <+6>: sub $0x10,%esp 0x01000109 <+9>: movl $0x1017b20,(%esp) 0x01000110 <+16>: call 0x100dab0 <puts> 0x01000115 <+21>: movl $0x1,(%esp) 0x0100011c <+28>: call 0x100f9a0 <sleep> 0x01000121 <+33>: mov %gs:0x0,%eax 0x01000127 <+39>: movl $0x1017b2d,(%esp) 0x0100012e <+46>: add $0xfffffffc,%eax 0x01000133 <+51>: mov %eax,0x4(%esp) 0x01000137 <+55>: call 0x100da80 <printf> 0x0100013c <+60>: mov %gs:0xfffffffc,%eax 0x01000142 <+66>: movl $0x1017b3e,(%esp) 0x01000149 <+73>: mov %eax,0x4(%esp) 0x0100014d <+77>: call 0x100da80 <printf> 0x01000152 <+82>: xor %eax,%eax 0x01000154 <+84>: leave 0x01000155 <+85>: ret
So how to get this working?
ps. I have a rudimentary port of gccgo on L4Re working, and am polishing it over the holidays.
- Taru Karttunen
Hi,
On Tue Dec 21, 2010 at 21:03:39 +0200, Taru Karttunen wrote:
__thread int i;
How should TLS initialization be done? This is with L4_MULTITHREADED = y
So how to get this working?
__thread isn't currently working, as it's not supported by the uclibc backend version we're currently using. Changing this is a bit a of surgery but needs to be done I guess.
ps. I have a rudimentary port of gccgo on L4Re working, and am polishing it over the holidays.
Cool!
Adam
Hi
On 21.12.2010 20:03, Taru Karttunen wrote:
ps. I have a rudimentary port of gccgo on L4Re working, and am polishing it over the holidays.
I am also working on such a port. To be precise the runtime library (libgo) is to be ported, and this already works (not completly, as there are several linux syscalls which at the moment are just stubs).
I guess it would make sense to share the changes or at least work on different parts such that not everything is done twice ;)
If you are interested I can publish my changes.
Daniel
l4-hackers@os.inf.tu-dresden.de