[PATCH] D14167: [lld][elf2] Generate PT_TLS.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 07:19:07 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/Writer.cpp:671
@@ -678,1 +670,3 @@
+  Elf_Phdr *TlsPhdr = nullptr;
+  uintX_t ThreadBSSOffset = 0;
   // Create phdrs as we assign VAs and file offsets to all output sections.
----------------
ThreadBSSOffset -> TbssOffset since .tbss is a section name.

================
Comment at: ELF/Writer.cpp:706-707
@@ +705,4 @@
+      if (Sec->getType() == SHT_NOBITS) {
+        ThreadBSSOffset = TVA - VA;
+        ThreadBSSOffset += Sec->getSize();
+      } else {
----------------
  ThreadBSSOffset = TVA - VA + Sec->getSize();

================
Comment at: ELF/Writer.cpp:725
@@ -710,1 +724,3 @@
 
+  if (TlsPhdr)
+    Phdrs[++PhdrIdx] = TlsPhdrStorage;
----------------
Can you make TlsPhdr a Elf_Phdr (instead of Elf_Phdr *) and check if its validity using its members? If TlsPhdr.p_vaddr > 0, for example, it must have a valid value.


http://reviews.llvm.org/D14167





More information about the llvm-commits mailing list