[libc-commits] [PATCH] D82700: [libc] Setup TLS in x86_64 loader.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jul 6 12:36:03 PDT 2020


sivachandra marked an inline comment as done.
sivachandra added inline comments.


================
Comment at: libc/loader/linux/x86_64/start.cpp:51
+  // entry.
+  size_t tlsSizeWithAddr = tlsSize + sizeof(uintptr_t);
+
----------------
MaskRay wrote:
> The size should be 2 words plus sizeof(pthread) plus p_memsz(PT_TLS) plus (headroom left for padding).
> 
> Initially dtv[0] = 1 (one module), dtv[1] = DTP offset. The pthread structure is placed at the end of dtv.
Size of pthread can/will be added once we develop or need an equivalent of that in LLVM-libc. So, without that, and without support for dynamic loading, can you give an example wherein the code as it stands in this patch would fail?

[I will add a note in the commit message and also a comment that we don't yet have dynamic loading support.]


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82700





More information about the libc-commits mailing list