Hi all, Thanks to Sebastian Macke it was discovered that the constructors and destructors in dynamic loaded libraries were never executed. After some more investigation, it became clear that not even __init and __fini were execute. The dynamic linker performs init/fini execution by looking for the DT_INIT/DT_FINI elements in the dynamic library and what is found there is executed [1][2]. The problem now was that DT_INIT/DT_FINI elements were never inserted into the dynamic library and the reason for that is that GNU linker expects the init and fini function names to be _init and _fini and not __init and __fini [3].
AFAICT, there are two options to solve this: 1) rename our __init and __fini functions to _init and _fini 2) set link_info.init_function to __init and link_info.fini_function to __fini I think 1) is the path to take, mostly because that is the naming that most architectures follow and none does 2). Following this mail comes a set of patches that I intend to commit to uClibc, binutils and gcc unless someone has any objections or better ideas to solve this. It might not be strictly necessary to do the change in all of those repositories, but I think it's worth being consistent on this. Stefan [1] https://github.com/openrisc/uClibc-or1k/blob/master/ldso/libdl/libdl.c#L636 [2] https://github.com/openrisc/uClibc-or1k/blob/master/ldso/libdl/libdl.c#L845 [3] https://github.com/openrisc/or1k-src/blob/or1k/ld/ldmain.c#L288 _______________________________________________ OpenRISC mailing list OpenRISC@lists.openrisc.net http://lists.openrisc.net/listinfo/openrisc