[PATCH] D13838: [elf2] Don't allocate VA space for TLS NOBITS sections.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 17:52:33 PDT 2015


ruiu added a subscriber: ruiu.

================
Comment at: ELF/Writer.cpp:629-633
@@ -628,3 +628,7 @@
     uintX_t Size = Sec->getSize();
-    if (Sec->getFlags() & SHF_ALLOC) {
+    if ((Sec->getFlags() & SHF_ALLOC) &&
+        // Don't allocate VA space for TLS NOBITS sections. The PT_TLS PHDR is
+        // responsible for allocating space for them, not the PT_LOAD that
+        // contains the TLS initialization image.
+        !((Sec->getFlags() & SHF_TLS) && Sec->getType() == SHT_NOBITS)) {
       VA = RoundUpToAlignment(VA, Align);
----------------
Factor out as a function.


http://reviews.llvm.org/D13838





More information about the llvm-commits mailing list