public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* multiple defs. of TLS common symbols?
@ 2010-01-13 19:33 Gary Funck
  2010-01-14  1:15 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Funck @ 2010-01-13 19:33 UTC (permalink / raw)
  To: GCC List

We use TLS relocated symbols to create thread-local symbols
in the GCC UPC compiler, and have run into an issue illustrated
by the following program, on a test case that defines a
common symbol in several files, and uses it in a single file.

The following program fails to link, with multiple defs:

% head s.c t.c main.c
==> s.c <==
__thread int x;

==> t.c <==
__thread int x;

==> main.c <==
__thread int x;

int main()
{
  x = 1;
}

% gcc s.c t.c main.c
/tmp/ccK5Aj3k.o:(.tbss+0x0): multiple definition of `x'
/tmp/ccm0kY5f.o:(.tbss+0x0): first defined here
/tmp/ccchPiAt.o:(.tbss+0x0): multiple definition of `x'
/tmp/ccm0kY5f.o:(.tbss+0x0): first defined here
collect2: ld returned 1 exit status

But if we don't use TLS storage, it all links just fine:

% gcc -D__thread= s.c t.c main.c

Off-hand this looks like it might be a linker issue, but
perhaps there's an issue with the use of __thread in
in the context above?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-14 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-13 19:33 multiple defs. of TLS common symbols? Gary Funck
2010-01-14  1:15 ` Ian Lance Taylor
2010-01-14  6:52   ` Gary Funck
2010-01-14 16:26     ` Ian Lance Taylor
2010-01-14 17:11       ` Gary Funck

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 read-only IMAP folder(s) and NNTP newsgroup(s).