berkus / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

Support TLS #33

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dears,

TLS (Thread Local Storage) is also an important feature for modern programs.
I wish MCLinker can support it in the next milestone.

Best regards,
Luba

Original issue reported on code.google.com by LubaTang on 16 Mar 2012 at 8:10

GoogleCodeExporter commented 9 years ago
Diana is responsible for this issue.

Original comment by LubaTang on 7 Sep 2012 at 8:47

GoogleCodeExporter commented 9 years ago
Now we can handle TSL symbols and support three main types of TLS relocation on 
X86: TLS_GD, TLS_LE and TLS_IE. Not yet support linker optimization.

Original comment by mysekki on 20 Sep 2012 at 1:56

GoogleCodeExporter commented 9 years ago
R_386_TLS_LDM is needed for linking libgssapi.so.10 on freebsd.

llvm-mcld --eh-frame-hdr -V -Bshareable -o libgssapi.so.10 
/usr/obj/usr/src/tmp/usr/lib/crti.o /usr/obj/usr/src/tmp/usr/lib/crtbeginS.o 
-L/usr/obj/usr/src/tmp/usr/lib -L/usr/obj/usr/src/tmp/usr/lib -march=x86 
--version-script=Version.map -x -soname libgssapi.so.10 gss_wrap_size_limit.So 
gss_verify.So gss_unseal.So gss_sign.So gss_set_sec_context_option.So 
gss_set_cred_option.So gss_seal.So gss_release_oid.So gss_pseudo_random.So 
gss_process_context_token.So gss_pname_to_uid.So 
gss_inquire_sec_context_by_oid.So gss_inquire_mechs_for_name.So 
gss_inquire_cred_by_oid.So gss_inquire_cred_by_mech.So gss_inquire_cred.So 
gss_inquire_context.So gss_init_sec_context.So gss_indicate_mechs.So 
gss_import_sec_context.So gss_get_mic.So gss_export_sec_context.So 
gss_export_name.So gss_encapsulate_token.So gss_duplicate_oid.So 
gss_duplicate_name.So gss_display_name.So gss_delete_sec_context.So 
gss_decapsulate_token.So gss_context_time.So gss_compare_name.So 
gss_canonicalize_name.So gss_buffer_set.So gss_add_cred.So gss_acquire_cred.So 
gss_accept_sec_context.So gss_wrap.So gss_verify_mic.So gss_unwrap.So 
gss_release_cred.So gss_inquire_names_for_mech.So gss_import_name.So 
gss_release_oid_set.So gss_release_name.So gss_names.So gss_mech_switch.So 
gss_display_status.So gss_create_empty_oid_set.So gss_add_oid_set_member.So 
gss_test_oid_set_member.So gss_release_buffer.So gss_oid_to_str.So gss_utils.So 
-lgcc --as-needed -lgcc_s --no-as-needed -lc -lssp_nonshared -lgcc --as-needed 
-lgcc_s --no-as-needed /usr/obj/usr/src/tmp/usr/lib/crtendS.o 
/usr/obj/usr/src/tmp/usr/lib/crtn.o
WARNING: option -x/--discard-all is not implemented yet!
Unreachable: encounter unsupported relocation type `19'
Please report to mclinker@googlegroups.com

Original comment by pete.c...@gmail.com on 12 Oct 2012 at 2:54

GoogleCodeExporter commented 9 years ago
Is TLS_GD expected to work on x86_64 as well? I'm also trying to link a .so 
from a .o and I see "Unreachable: encounter unsupported relocation type `19'".

The .o uses the following relocation types:
R_X86_64_64
R_X86_64_GOTPCREL
R_X86_64_PC32
R_X86_64_PLT32
R_X86_64_TLSGD

I have a similar failure when trying to link another .o with the 
R_X86_64_TPOFF32 relocation type.

Original comment by jonathan...@gmail.com on 13 May 2013 at 10:41

GoogleCodeExporter commented 9 years ago
Hi, currently we do not support TLS on X86_64. If you need, I'll put it into 
our schedule and try to add as more relocation support of TLS as possible. I'm 
wondering what programs you meet these kinds of relocations? Or those are your 
hand write programs? Thank you.

Original comment by mysekki on 14 May 2013 at 2:29

GoogleCodeExporter commented 9 years ago
In the first case, I'm trying to cross-build FreeBSD's libc (from Mac OS X, if 
that makes any difference). Things seem to go wrong when I include 
locale-related code, which does per-thread stuff as of r227753 
(http://svnweb.freebsd.org/base?view=revision&revision=227753).

In the second case I just tried compiling a simple program that uses TLS:

__thread int foo;
void bar() { foo++; }

Original comment by jonathan...@gmail.com on 14 May 2013 at 2:59