Bug 574 - strip doesn't preserve TLS type
Summary: strip doesn't preserve TLS type
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-24 22:35 UTC by H.J. Lu
Modified: 2004-11-30 14:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2004-11-24 22:35:50 UTC
[hjl@gnu strip]$ cat foo.c
extern __thread int foo;

int
bar ()
{
  return foo;
}
[hjl@gnu strip]$ gcc -c foo.c
[hjl@gnu strip]$ readelf -s foo.o

Symbol table '.symtab' contains 10 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS foo.c
     2: 00000000     0 SECTION LOCAL  DEFAULT    1
     3: 00000000     0 SECTION LOCAL  DEFAULT    3
     4: 00000000     0 SECTION LOCAL  DEFAULT    4
     5: 00000000     0 SECTION LOCAL  DEFAULT    5
     6: 00000000     0 SECTION LOCAL  DEFAULT    6
     7: 00000000    13 FUNC    GLOBAL DEFAULT    1 bar
     8: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_
     9: 00000000     0 TLS     GLOBAL DEFAULT  UND foo
[hjl@gnu strip]$ strip -g foo.o
[hjl@gnu strip]$ readelf -s foo.o

Symbol table '.symtab' contains 9 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 SECTION LOCAL  DEFAULT    1
     2: 00000000     0 SECTION LOCAL  DEFAULT    3
     3: 00000000     0 SECTION LOCAL  DEFAULT    4
     4: 00000000     0 SECTION LOCAL  DEFAULT    5
     5: 00000000     0 SECTION LOCAL  DEFAULT    6
     6: 00000000    13 FUNC    GLOBAL DEFAULT    1 bar
     7: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_
     8: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND foo
Comment 1 Nick Clifton 2004-11-30 12:04:01 UTC
Subject: Re:  New: strip doesn't presever TLS type

Hi HJ,

> [hjl@gnu strip]$ gcc -c foo.c
> [hjl@gnu strip]$ readelf -s foo.o
> [hjl@gnu strip]$ strip -g foo.o
> [hjl@gnu strip]$ readelf -s foo.o

I just tried this procedure and ended up with a stripped foo.o that 
still has a symbol "foo" with the TLS type.  I was using today's GCC and 
BINUTILS sources and an i686-pc-linux-gnu target running natively.

In what environment did you reproduce this problem ?

Cheers
   Nick