I realised that the article "Calling Global Constructors" on the wiki directs us to use the .init and .fini section methods to call constructors -- particularly the "gcc will nicely put the contents of ..." implementation. Unfortunately, with my GCC 9.2 OS-spec compiler, it's not populating those sections as advertised. (they're there, but empty).
What I did find to work was the .init_array and .fini_array method that is supposedly only for ARM, but from what I could find online it's the "new" method of doing things. So my question is: are there existing kernels on a recent(-ish) version of GCC that have had success with the .init .fini method? Maybe i'm just doing things wrong...
Accuracy of "Calling Global Constructors"
Re: Accuracy of "Calling Global Constructors"
No, everything is fine. The .init and .fini approach was extremely brittle, and precluded some linker options from being used (--sort-sections=alignment being the best known problematic one). So instead the newer .init_array and .fini_array mechanism is now used everywhere. .init and .fini are only there for legacy support.
Carpe diem!
Re: Accuracy of "Calling Global Constructors"
hmm, okay. i must've been doing something wrong then.
[nx] kernel: http://github.com/zhiayang/nx