[libc-commits] [libc] [libc] lift app's definition out of startup (PR #75717)

via libc-commits libc-commits at lists.llvm.org
Mon Dec 18 12:41:08 PST 2023


================
@@ -18,21 +18,23 @@ namespace LIBC_NAMESPACE {
 // Data structure to capture properties of the linux/ELF TLS image.
 struct TLSImage {
   // The load address of the TLS.
-  uintptr_t address;
+  uintptr_t address = 0;
 
   // The byte size of the TLS image consisting of both initialized and
   // uninitialized memory. In ELF executables, it is size of .tdata + size of
   // .tbss. Put in another way, it is the memsz field of the PT_TLS header.
-  uintptr_t size;
+  uintptr_t size = 0;
 
   // The byte size of initialized memory in the TLS image. In ELF exectubles,
   // this is the size of .tdata. Put in another way, it is the filesz of the
   // PT_TLS header.
-  uintptr_t init_size;
+  uintptr_t init_size = 0;
 
   // The alignment of the TLS layout. It assumed that the alignment
   // value is a power of 2.
-  uintptr_t align;
+  uintptr_t align = 0;
+
+  constexpr TLSImage() = default;
----------------
michaelrj-google wrote:

is this explicit constructor necessary? If it is, it should be marked `LIBC_INLINE`.

https://github.com/llvm/llvm-project/pull/75717


More information about the libc-commits mailing list