[libc-commits] [PATCH] D130966: [libc] Add init and fini array iteration to the laoder.

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 2 01:22:27 PDT 2022


abrachet added inline comments.


================
Comment at: libc/test/integration/loader/linux/cxx_globals_test.cpp:17
+  A(int a) : val(a) {}
+  // TODO: when we have implementation for __cxa_atexit, an explicit definition
+  // of the destructor should be provided to test that path of registering the
----------------
`__cxa_atexit` is a alternative for the `.fini_array`, it doesn't use it


================
Comment at: libc/test/integration/loader/linux/cxx_globals_test.cpp:24
+
+A global(0x1234);
+
----------------
The compiler has no requirement that this constructor be placed in the `.init_array`. It seems the better way to test this would be to either use `__attribute__(({destructor,constructor}))` on a function or `__attribute__((section(secname)))` on a function pointer to explicitly put things in `{preinit,init,fini}_array` sections. The later being the only way I would know how to get something in `.preinit_array`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130966



More information about the libc-commits mailing list