This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Handle TLS variables in Symbol::getVA. NFC
ClosedPublic

Authored by sbc100 on Oct 29 2021, 9:35 AM.

Details

Summary

In the shared memory case we can always assume that TLS addresses
are relative to __tls_base. In the non-shared memory case TLS
variables are absolute, just like normal data addresses.

This simplifies the code in calcNewValue so that TLS relocations
no longer need special handling.

Diff Detail

Event Timeline

sbc100 created this revision.Oct 29 2021, 9:35 AM
sbc100 requested review of this revision.Oct 29 2021, 9:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 29 2021, 9:35 AM
sbc100 added inline comments.
lld/wasm/InputFiles.cpp
182

This is taken care of now simply my marking the symbols as TLS which happens elsewhere in this file:

// Older object files did not include WASM_SEG_FLAG_TLS and instead                  
// relied on the naming convention.  To maintain compat with such objects    
// we still imply the TLS flag based on the name of the segment.             
if (!seg->isTLS() &&                                                         
    (seg->name.startswith(".tdata") || seg->name.startswith(".tbss"))) {     
  seg->flags |= WASM_SEG_FLAG_TLS;                                           
  seg->implicitTLS = true;                                                   
}
sbc100 updated this revision to Diff 383399.Oct 29 2021, 9:38 AM
  • comment
sbc100 updated this revision to Diff 383410.Oct 29 2021, 10:05 AM
  • comment
dschuff accepted this revision.Oct 29 2021, 10:35 AM
This revision is now accepted and ready to land.Oct 29 2021, 10:35 AM