[PATCH] D35509: Covnert .[cd]tors to .{init, fini}_array using synthetic section.

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 02:13:23 PDT 2017


joerg added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:124
+// out there that contain .ctors/.dtors, so we want to handle them by
+// converting them to .init/fini.
+InputSection *elf::createInitFiniSection(InputSection *Sec) {
----------------
This comment is bogus, since .init/.fini is a completely different thing.


================
Comment at: lld/ELF/Writer.cpp:140
+template <class ELFT> static void convertCtorsDtorsToInitFini() {
+  for (InputSectionBase *&S : InputSections)
+    if (InputSection *IS = dyn_cast<InputSection>(S))
----------------
grimar wrote:
> emaste wrote:
> > rafael wrote:
> > > We have to check if all systems support .init_array. Ed, can you confirm?
> > FreeBSD support was added in [[ https://reviews.freebsd.org/rS232831 | r232831 ]] in March 2012.
> > 
> > NetBSD has support, although I don't know if there are platform-specific differences. I'm not sure about OpenBSD; I see patches were posted last year but I do not know if they were merged in. Perhaps @joerg and @kettenis can add more info?
> > 
> > 
> Should we show warning when have .ctors/.dtors ?
NetBSD uses .init_array only on new archs (arm64) and where mandated by the ABI (arm-eabi).


https://reviews.llvm.org/D35509





More information about the llvm-commits mailing list