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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 11:15:48 PST 2015


ruiu added inline comments.

================
Comment at: ELF/Writer.cpp:674
@@ +673,3 @@
+  Elf_Phdr TlsPhdr;
+  TlsPhdr.p_vaddr = 0;
+  uintX_t ThreadBSSOffset = 0;
----------------
grimar wrote:
> ruiu wrote:
> > Bigcheese wrote:
> > > ruiu wrote:
> > > > Do we need this? Isn't an Elf_Phdr zero-initialized?
> > > There's no explicit zero init, and I'm pretty sure default-initialization here does nothing.
> > I'd zero out all fields using memset.
> What about next ?
> 
> ```
> Elf_Phdr TlsPhdr = {};
> ```
Seems like a good idea. I was not completely sure if the empty initializer is allowed to initialize a struct, but it seems to be accepted.


Repository:
  rL LLVM

http://reviews.llvm.org/D14167





More information about the llvm-commits mailing list