[PATCH] D134594: [lld-macho] Force higher alignment for __thread_vars
Daniel Bertalan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 24 23:22:32 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd2f3d7bad26a: [lld-macho] Force higher alignment for __thread_vars (authored by BertalanD).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134594/new/
https://reviews.llvm.org/D134594
Files:
lld/MachO/Writer.cpp
lld/test/MachO/tlv-dylib.s
Index: lld/test/MachO/tlv-dylib.s
===================================================================
--- lld/test/MachO/tlv-dylib.s
+++ lld/test/MachO/tlv-dylib.s
@@ -43,7 +43,7 @@
# FLAGS-NEXT: addr
# FLAGS-NEXT: size 0x0000000000000030
# FLAGS-NEXT: offset
-# FLAGS-NEXT: align
+# FLAGS-NEXT: align 2^3 (8)
# FLAGS-NEXT: reloff 0
# FLAGS-NEXT: nreloc 0
# FLAGS-NEXT: type S_THREAD_LOCAL_VARIABLES
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -960,6 +960,12 @@
segname == segment_names::text)
osec->align = target->wordSize;
+ // MC keeps the default 1-byte alignment for __thread_vars, even though it
+ // contains pointers that are fixed up by dyld, which requires proper
+ // alignment.
+ if (isThreadLocalVariables(osec->flags))
+ osec->align = std::max<uint32_t>(osec->align, target->wordSize);
+
getOrCreateOutputSegment(segname)->addOutputSection(osec);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134594.462698.patch
Type: text/x-patch
Size: 1073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220925/6b6a216f/attachment.bin>
More information about the llvm-commits
mailing list