[PATCH] D13763: [lld][elf2] Sort allocated TLS sections at the start of the R/W PT_LOAD.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 10:05:06 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/Writer.cpp:300-302
@@ -299,1 +299,5 @@
 
+  // The TLS spec says that the linker can assume that TLS sections are R/W. Do
+  // this so we can generate a minimal PT_TLS Phdr. Non-allocated TLS sections
+  // are ignored because they shouldn't be in the middle of allocated sections.
+  if (AFlags & SHF_TLS && AFlags & SHF_ALLOC)
----------------
It sounds like a compiler bug if it emits .tbss or .tdata without the writable bit. Do we actually care about this case?

================
Comment at: ELF/Writer.cpp:303
@@ +302,3 @@
+  // are ignored because they shouldn't be in the middle of allocated sections.
+  if (AFlags & SHF_TLS && AFlags & SHF_ALLOC)
+    AFlags |= SHF_WRITE;
----------------
(AFlags & SHF_TLS) && (AFlags & SHF_ALLOC)


http://reviews.llvm.org/D13763





More information about the llvm-commits mailing list