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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 12:03:49 PDT 2015


On 15 October 2015 at 15:06, Rui Ueyama <ruiu at google.com> wrote:
> 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)
> ----------------
> Bigcheese wrote:
>> ruiu wrote:
>> > It sounds like a compiler bug if it emits .tbss or .tdata without the writable bit. Do we actually care about this case?
>> There's assembly. It also makes layout a bit simpler, as you can assume all TLS sections are together, and there's no good reason to reject it.
> That's still a user code bug, no? I'm not convinced unless it is very prevalent issue that we had to take care of this specially.

It is a bug yes. Please really *assume* that the sections are rw.

Cheers,
Rafael


More information about the llvm-commits mailing list