[m-rev.] for review: granularity control

Peter Wang wangp at students.csse.unimelb.edu.au
Fri Nov 3 19:55:15 AEDT 2006


On 2006-11-03, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> On 03-Nov-2006, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> > I am doing an asm_fast.gc.par
> > bootcheck of an unmodified workspace now to see whether it is related to my
> > change.
> 
> The unmodified workspace also crashes on all tests, so I am committing this
> change.
> 
> With lmc, the output of ldd on the executable is
> 
> 	linux-gate.so.1 =>  (0xffffe000)
> 	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7f71000)
> 	libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7f5c000)
> 	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7f58000)
> 	libreadline.so.5 => /lib/libreadline.so.5 (0xb7f2a000)
> 	libncurses.so.5 => /lib/libncurses.so.5 (0xb7ee9000)
> 	libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7ed7000)
> 	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7da8000)
> 	/lib/ld-linux.so.2 (0xb7fa6000)
> 
> For the executables created by bootcheck, ldd says they are not dynamic
> executable; the file command also says they are statically linked.

Then it's probably the same problem as I had with Debian's libc package.
It doesn't include a static version of the NPTL implementation of pthreads,
so when you statically link it pulls in the LinuxThreads implementation.
As far as I know, linux 2.6.x requires the NPTL implementation, at least
when thread-local variables are involved.
For example, the following C program crashes if you compile it with

    gcc t.c -lpthread -static

but is fine if you just remove the "-static".

Peter


#include <pthread.h>
#include <stdio.h>

__thread int x;

void *thread_func(void *unused)
{
    (void)unused;
    x = 1;
    printf("%d\n", x);
    return NULL;
}

int main(void)
{
    pthread_t th;
    x = 2;
    pthread_create(&th, NULL, thread_func, NULL);
    pthread_join(th, NULL);
    printf("%d\n", x);
    return 0;
}


--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list