[PATCH] D137803: [lld-macho] Set 4-byte alignment for `__init_offsets`
Daniel Bertalan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 13:50:38 PST 2022
BertalanD created this revision.
BertalanD added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
BertalanD requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
dyld refuses to run initializers if this section is not aligned.
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1383240
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137803
Files:
lld/MachO/SyntheticSections.cpp
lld/test/MachO/init-offsets.s
Index: lld/test/MachO/init-offsets.s
===================================================================
--- lld/test/MachO/init-offsets.s
+++ lld/test/MachO/init-offsets.s
@@ -27,7 +27,7 @@
# FLAGS-NEXT: addr
# FLAGS-NEXT: size 0x0000000000000010
# FLAGS-NEXT: offset
-# FLAGS-NEXT: align
+# FLAGS-NEXT: align 2^2 (4)
# FLAGS-NEXT: reloff 0
# FLAGS-NEXT: nreloc 0
# FLAGS-NEXT: type S_INIT_FUNC_OFFSETS
Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -1899,6 +1899,7 @@
InitOffsetsSection::InitOffsetsSection()
: SyntheticSection(segment_names::text, section_names::initOffsets) {
flags = S_INIT_FUNC_OFFSETS;
+ align = 4; // This section contains 32-bit integers.
}
uint64_t InitOffsetsSection::getSize() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137803.474607.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221110/fe4c794a/attachment.bin>
More information about the llvm-commits
mailing list