On Tue, Oct 31, 2017 at 07:28:23PM +0100, Kamil Rytarowski wrote: > I'm giving it a try. I took the asan part and skipped > "%{!shared:libasan_preinit%O%s} ". If I understand this correctly, it > attempts to use the ELF section with preinit property in order to > bootstrap asan quickly. The preinit sections are not enabled on > NetBSD/amd64. From my understanding, there is a design choice in NetBSD > to not include extensional sections unless they are requested by ABI.
?? SHT_PREINIT_ARRAY/DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ is not any kind of extension, it is an integral part of the ELF gABI: http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#dynamic_section And that is quite essential for proper asan behavior, because the library interposes a lot of functions and if they are invoked before the library is initialized, they crash (of course better would be to fix the library not to rely on that and initialize the minimal stuff needed for interposition if they are called before the initialization, but that is unlikely to happen upstream). Jakub