This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix .tls_common handling in ld -r
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 15 Jun 2006 07:40:59 -0700
- Subject: Re: [PATCH] Fix .tls_common handling in ld -r
- References: <20060615130402.GJ3823@sunsite.mff.cuni.cz>
On Thu, Jun 15, 2006 at 03:04:02PM +0200, Jakub Jelinek wrote:
> Hi!
>
> cat > a.c <<EOF
> __asm (".tls_common foo,4,4");
>
> int
> main (void)
> {
> extern __thread int foo;
> return foo;
> }
> EOF
> gcc -c a.c
> ld -r -o b.o a.o
> gcc -o b b.o
>
> used to segfault the linker (before BZ#2735 fix), now just issues
> a bogus warning message:
> Warning: alignment 4 of common symbol `foo' in b.o is greater than the alignment (1) of its section .tcommon
> and e.g. doesn't create PT_TLS segment at all.
> The problem is that ld -r creates a bogus section:
> [ 7] .tcommon NOBITS 0000000000000000 000088 000000 00 WAT 0 0 1
> The following patch fixes this and is the solution e.g. IA-64 uses for its
> .scommon section as well.
>
> Ok to commit?
>
> 2006-06-15 Jakub Jelinek <jakub@redhat.com>
>
> * elflink.c (elf_link_add_object_symbols): Don't create .tcommon
> section for relocatable link.
>
Can you add a testcase?
H.J.