[PATCH] D116263: [lld-macho] Fix alignment of TLV data sections

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 25 02:22:09 PST 2021


int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

Can you include a description of the problem in the commit message? (Just copying the block comment is fine)



================
Comment at: lld/MachO/Writer.cpp:916
+    // earlier ones, the offsets of data within those sections won't be
+    // guaranteed to aligned unless we normalize alignments. We use the largest
+    // alignment for all TLV data sections.
----------------



================
Comment at: lld/MachO/Writer.cpp:918
+    // alignment for all TLV data sections.
+    uint32_t tlv_align = 0;
+    for (OutputSection *osec : seg->getSections()) {
----------------



================
Comment at: lld/MachO/Writer.cpp:919
+    uint32_t tlv_align = 0;
+    for (OutputSection *osec : seg->getSections()) {
+      if (isThreadLocalData(osec->flags) && osec->align > tlv_align) {
----------------
int3 wrote:
> convention is to omit braces for one-liners



================
Comment at: lld/MachO/Writer.cpp:919-923
+    for (OutputSection *osec : seg->getSections()) {
+      if (isThreadLocalData(osec->flags) && osec->align > tlv_align) {
+        tlv_align = osec->align;
+      }
+    }
----------------
convention is to omit braces for one-liners


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116263/new/

https://reviews.llvm.org/D116263



More information about the llvm-commits mailing list