[lld] r263539 - [COFF] Use the correct size of the TLS directory
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 14 23:41:03 PDT 2016
Author: majnemer
Date: Tue Mar 15 01:41:02 2016
New Revision: 263539
URL: http://llvm.org/viewvc/llvm-project?rev=263539&view=rev
Log:
[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.
Modified:
lld/trunk/COFF/Writer.cpp
lld/trunk/test/COFF/tls32.test
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=263539&r1=263538&r2=263539&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Tue Mar 15 01:41:02 2016
@@ -596,7 +596,9 @@ template <typename PEHeaderTy> void Writ
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")) {
Modified: lld/trunk/test/COFF/tls32.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/tls32.test?rev=263539&r1=263538&r2=263539&view=diff
==============================================================================
--- lld/trunk/test/COFF/tls32.test (original)
+++ lld/trunk/test/COFF/tls32.test Tue Mar 15 01:41:02 2016
@@ -3,7 +3,7 @@
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
# CHECK: TLSTableRVA: 0x1000
-# CHECK: TLSTableSize: 0x28
+# CHECK: TLSTableSize: 0x18
---
header:
More information about the llvm-commits
mailing list