From: Gary Funck <gary@intrepid.com>
To: GCC List <gcc@gcc.gnu.org>
Subject: multiple defs. of TLS common symbols?
Date: Wed, 13 Jan 2010 19:33:00 -0000 [thread overview]
Message-ID: <20100113193306.GF9119@intrepid.com> (raw)
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?
next reply other threads:[~2010-01-13 19:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 19:33 Gary Funck [this message]
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
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=20100113193306.GF9119@intrepid.com \
--to=gary@intrepid.com \
--cc=gcc@gcc.gnu.org \
/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.
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).