Bug 47631 - Support native TLS on Tru64 UNIX
Summary: Support native TLS on Tru64 UNIX
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.6.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-07 12:50 UTC by Rainer Orth
Modified: 2012-03-09 16:11 UTC (History)
1 user (show)

See Also:
Host: alpha-dec-osf5.1b
Target: alpha-dec-osf5.1b
Build: alpha-dec-osf5.1b
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2011-02-07 12:50:56 UTC
I've just noticed that Tru64 UNIX does have native support for TLS, obviously
already in V4.0.  The details are described in the Object File and Symbol Table Format Specification:

http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/SUPPDOCS/OBJSPEC/TITLE.HTM

especially 

3.3.9        Thread Local Storage (TLS) Data
4.3.3.7      TLS Relocations
4.3.4.26     R_TLS_LITERAL
4.3.4.27     R_TLS_HIGH
4.3.4.28     R_TLS_LOW
8.3.5        Finding Thread Local Storage (TLS) Symbols
13.3.5       TLS Symbols

Compiling th example in 4.3.4.26

__declspec(thread) long foo;
main(){
foo = 2;
}

with cc -S, I get

        .set noat
        .set noreorder
        .tlscomm foo 8
        .rdata
$$1:
        .extern __tlsoffset 8
        .text
        .arch   generic
        .align 4
        .file 1 "osf-tls.c"
        .loc 1 2
 #      2 main(){
        .globl  main
        .ent    main
        .loc 1 2
main:
        .context full
        ldah    $gp, ($27)!gpdisp!1
        lda     $gp, ($gp)!gpdisp!1
        .frame  $sp, 0, $26
        .prologue 1
L$2:
        .loc 1 3
 #      3 foo = 2;
        call_pal 0x9E # rdunique                                                  # 000003
        ldq     $0, 96($0)
        ldq     $28, __tlsoffset($gp)!tlsliteral!2
        addq    $0, $28, $0
        ldq     $0, ($0)
        mov     2, $3
        ldah    $0, foo($0)!tlshigh!3
        stq     $3, foo($0)!tlslow!3
        .loc 1 4
 #      4 }
        mov     $31, $0                                                           # 000004
        unop
        ret     ($26)
        .end    main
        .loc 1 2

A port will probably be somewhat different from an ELF port since there aren't
the 4 different access models.
Comment 1 Rainer Orth 2012-03-09 16:11:41 UTC
Given that the Tru64 UNIX port is about to be removed in 4.8 and the TLS model
differs sufficiently from the ELF one, this won't be fixed anywhere.

  Rainer