[PATCH] D94329: [lld-macho] Fix TLV data initialization

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 14:26:55 PST 2021


int3 added inline comments.


================
Comment at: lld/MachO/InputSection.cpp:50
+        // References from thread-local variable sections are treated as offsets
+        // relative to the start of the first thread-local data section, instead
+        // of as absolute addresses.
----------------
thakis wrote:
> fwiw I think of it as a single thread-local data memory area – it's kind of more like a segment than a section I suppose, and it implicitly consists of __DATA,__thread_data and __DATA,__thread_bss (and, per dyld code, everything in between -- which is why we don't want anything in between, since that'd uselessly waste memory)
good point -- rephrased


================
Comment at: lld/MachO/Writer.cpp:566
+    // to minimize the amount of memory used. Additionally, since zerofill
+    // sections must be at the end of their segments, and since TLV data
+    // sections can be zerofills, we end up putting all TLV data sections at the
----------------
thakis wrote:
> Are there zerofill sections in segments other than `__DATA`? `__DATA_CONST` I guess, but that can't be TLV. (I'm wondering about the plural "segments" here.)
"segments" is plural here because zerofill sections must be at the end of their segments regardless of which segment it is and whether they contain TLV. I'm speaking in generalities :)

(The bss.s test has a test for zerofill at in a non-`__DATA` segment.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94329



More information about the llvm-commits mailing list