Skip to content

Commit 32a4ad3

Browse files
committed
[LLD] Set alignment as part of Characteristics in TLS table.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46473 LLD wasn't previously specifying any specific alignment in the TLS table's Characteristics field so the loader would just assume the default value (16 bytes). This works most of the time except if you have thread locals that want specific higher alignments (e.g. 32 as in the bug) *even* if they specify an alignment on the thread local. This change updates LLD to take the max alignment from tls section. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D88637
1 parent 7fe13af commit 32a4ad3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lld/COFF/Writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ void Writer::fixTlsAlignment() {
20672067
: sizeof(object::coff_tls_directory32);
20682068

20692069
if (tlsOffset + directorySize > sec->getRawSize())
2070-
fatal("_tls_used is malformed");
2070+
fatal("_tls_used sym is malformed");
20712071

20722072
if (config->is64()) {
20732073
object::coff_tls_directory64 *tlsDir =

0 commit comments

Comments
 (0)