Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121006203939.GF24157@port70.net>
Date: Sat, 6 Oct 2012 22:39:39 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: TLS (thread-local storage) support

* Szabolcs Nagy <nsz@...t70.net> [2012-10-06 16:33:01 +0200]:
> should the attached code work with dlopen
> when compiled as a dso?
> 
> (i wanted to check if the alignments are ok after a dlopen,
> but i can see how this usage may not be supported)
> 
> it seems it dies here in the ctor

a more minimal example:

a.c:
__thread int xx;
int *p;
__attribute__((constructor)) static void init(void)
{
        p = &xx;
}

b.c:
#include <dlfcn.h>
void *h;
int main()
{
        h = dlopen("./a.so", RTLD_LAZY);
}

compiled as
musl-gcc -shared -fPIC -g -o a.so a.c
musl-gcc -g -o b b.c

./b segfaults in init at p=&xx

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.