Fully support constructors for the purpose of code coverage analysis.
authormarcel <marcel@FreeBSD.org>
Mon, 20 Oct 2014 17:04:03 +0000 (17:04 +0000)
committermarcel <marcel@FreeBSD.org>
Mon, 20 Oct 2014 17:04:03 +0000 (17:04 +0000)
commitd2387926bad74ed69fd6276e007f3fe3177524e2
tree3a50bd48ab8a770ba6e79126bc1edb6227bd78f8
parentfbbd6ea1dce36d355ca0bd5788f5489b292fe9d3
Fully support constructors for the purpose of code coverage analysis.
This involves:
1.  Have the loader pass the start and size of the .ctors section to the
    kernel in 2 new metadata elements.
2.  Have the linker backends look for and record the start and size of
    the .ctors section in dynamically loaded modules.
3.  Have the linker backends call the constructors as part of the final
    work of initializing preloaded or dynamically loaded modules.

Note that LLVM appends the priority of the constructors to the name of
the .ctors section. Not so when compiling with GCC. The code currently
works for GCC and not for LLVM.

Submitted by: Dmitry Mikulin <dmitrym@juniper.net>
Obtained from: Juniper Networks, Inc.
sys/boot/common/load_elf.c
sys/kern/kern_linker.c
sys/kern/link_elf.c
sys/kern/link_elf_obj.c
sys/kern/subr_prof.c
sys/sys/linker.h