harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Salikh Zakirov <Salikh.Zaki...@Intel.com>
Subject Re: [build][doc] building on Debian
Date Mon, 22 Jan 2007 17:33:03 GMT
Alexei Zakharov wrote:
> 2. However, DRLVM completely rejected to run after step 1. Even
> HelloWorld crashed. The problem was that the kernel I was using wasn't
> fresh enough - big thanks to Alexei Fedotov for pointing this out. So
> I've switched from version 2.4.27 to 2.6.8 and this brings DRLVM back
> to life.

This issue is likely to be related to the thread-local storage support in Glibc
(which is present in glibc provided by Debian stable distribution,
run /lib/libc.so.6 and look for the string "Thread-local storage support
included.") and GCC support of __thread storage modifier.

The __thread variables access is compiled to the code like the example below.
Note the usage of segment register %gs:.

However, the support of the segment register GS pointing to thread-specific
data area is only available starting from kernel version 2.6.
[http://linuxvm.org/present/SHARE100/S9361uwa.pdf, slide "Threading model
(cont.): Thread-local storage support"]

__thread variable is currently used in the DRLVM version of libhythr.so.

I suspect that DRLVM can be fixed to work on Linux 2.4 by using library calls
pthread_getspecific() and pthread_setspecific(), but doing this on 2.6 may
impact performance negatively.

And by the way, is there any interest in being able to run DRLVM on 2.4 kernels?

---------- Example ---------

$ cat > a.c
__thread void* x;
int main() {
  x = (void*)1;
  return 0;
}
$ cc -c a.c
$ objdump -d a.o

a.o:     file format elf32-i386

Disassembly of section .text:

00000000 <main>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   83 ec 08                sub    $0x8,%esp
   6:   83 e4 f0                and    $0xfffffff0,%esp
   9:   b8 00 00 00 00          mov    $0x0,%eax
   e:   83 c0 0f                add    $0xf,%eax
  11:   83 c0 0f                add    $0xf,%eax
  14:   c1 e8 04                shr    $0x4,%eax
  17:   c1 e0 04                shl    $0x4,%eax
  1a:   29 c4                   sub    %eax,%esp
  1c:   65 a1 00 00 00 00       mov    %gs:0x0,%eax
  22:   c7 80 00 00 00 00 01    movl   $0x1,0x0(%eax)
  29:   00 00 00
  2c:   b8 00 00 00 00          mov    $0x0,%eax
  31:   c9                      leave
  32:   c3                      ret




Mime
View raw message