forked from OSchip/llvm-project
[COFF] Use the correct size of the TLS directory
The TLS directory has a different layout depending on the bitness of the machine the image will run on. LLD would always use the 64-bit TLS directory for the data directory entry instead of an appropriately sized TLS directory. llvm-svn: 263539
This commit is contained in:
parent
0c2adbc7a0
commit
22a19a9ace
|
|
@ -596,7 +596,9 @@ template <typename PEHeaderTy> void Writer::writeHeader() {
|
|||
if (Symbol *Sym = Symtab->findUnderscore("_tls_used")) {
|
||||
if (Defined *B = dyn_cast<Defined>(Sym->Body)) {
|
||||
Dir[TLS_TABLE].RelativeVirtualAddress = B->getRVA();
|
||||
Dir[TLS_TABLE].Size = 40;
|
||||
Dir[TLS_TABLE].Size = Config->is64()
|
||||
? sizeof(object::coff_tls_directory64)
|
||||
: sizeof(object::coff_tls_directory32);
|
||||
}
|
||||
}
|
||||
if (Symbol *Sym = Symtab->findUnderscore("_load_config_used")) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
|
||||
|
||||
# CHECK: TLSTableRVA: 0x1000
|
||||
# CHECK: TLSTableSize: 0x28
|
||||
# CHECK: TLSTableSize: 0x18
|
||||
|
||||
---
|
||||
header:
|
||||
|
|
|
|||
Loading…
Reference in New Issue