mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: TLS (thread-local storage) support
Date: Sat, 6 Oct 2012 16:33:01 +0200	[thread overview]
Message-ID: <20121006143300.GE24157@port70.net> (raw)
In-Reply-To: <20121005172729.GN254@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

* Rich Felker <dalias@aerifal.cx> [2012-10-05 13:27:29 -0400]:
> On Thu, Oct 04, 2012 at 11:04:14PM -0400, Rich Felker wrote:
> > Scratch that. It's now supported everywhere except dynamically loaded
> > (dlopen'd) shared libraries. And I'm working on adding support for
> 
> And they're working now too.
> 

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

[-- Attachment #2: tls.c --]
[-- Type: text/x-csrc, Size: 574 bytes --]

#include <stddef.h>

__thread char      c1 = 1;
__thread char      xchar = 2;
__thread char      c2 = 3;
__thread short     xshort = 4;
__thread char      c3 = 5;
__thread int       xint = 6;
__thread char      c4 = 7;
__thread long long xllong = 8;

struct {
	char *name;
	size_t size;
	size_t align;
	size_t addr;
} t[4];

#define entry(i,x) \
	t[i].name = #x; \
	t[i].size = sizeof x; \
	t[i].align = __alignof__(x); \
	t[i].addr = (size_t)&x;

__attribute__((constructor)) static void init(void)
{
	entry(0, xchar)
	entry(1, xshort)
	entry(2, xint)
	entry(3, xllong)
}


  reply	other threads:[~2012-10-06 14:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04 21:13 Rich Felker
2012-10-04 21:29 ` Daniel Cegiełka
2012-10-04 22:36   ` Rich Felker
2012-10-06  8:17     ` Daniel Cegiełka
2012-10-16 21:27       ` boris brezillon
2012-10-16 21:47         ` boris brezillon
2012-10-16 22:09           ` Szabolcs Nagy
2012-10-16 23:16             ` boris brezillon
2012-10-17 10:37               ` Szabolcs Nagy
2012-10-16 23:29             ` Rich Felker
2012-10-16 22:54           ` Rich Felker
2012-10-16 23:39             ` boris brezillon
2012-10-16 23:48               ` Rich Felker
2012-10-17  0:08                 ` boris brezillon
2012-10-17  0:42                   ` Rich Felker
2012-10-17  1:03                     ` boris brezillon
2012-10-17  1:49                     ` boris brezillon
2012-10-17  1:58                       ` Rich Felker
2012-10-17  7:48                         ` musl
2012-10-19 18:39           ` orc
2012-10-19 18:41             ` Rich Felker
2012-10-05  3:04 ` Rich Felker
2012-10-05 17:27   ` Rich Felker
2012-10-06 14:33     ` Szabolcs Nagy [this message]
2012-10-06 20:39       ` Szabolcs Nagy
2012-10-06 20:58         ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121006143300.GE24157@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).