This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix .tls_common handling in ld -r


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]