diff options
author | marcel <marcel@FreeBSD.org> | 2014-10-20 17:04:03 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2014-10-20 17:04:03 +0000 |
commit | d2387926bad74ed69fd6276e007f3fe3177524e2 (patch) | |
tree | 3a50bd48ab8a770ba6e79126bc1edb6227bd78f8 /sys/sys/linker.h | |
parent | fbbd6ea1dce36d355ca0bd5788f5489b292fe9d3 (diff) | |
download | FreeBSD-src-d2387926bad74ed69fd6276e007f3fe3177524e2.zip FreeBSD-src-d2387926bad74ed69fd6276e007f3fe3177524e2.tar.gz |
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.
Diffstat (limited to 'sys/sys/linker.h')
-rw-r--r-- | sys/sys/linker.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/sys/linker.h b/sys/sys/linker.h index b2942f2..e09ff59 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -79,6 +79,8 @@ struct linker_file { int id; /* unique id */ caddr_t address; /* load address */ size_t size; /* size of file */ + caddr_t ctors_addr; /* address of .ctors */ + size_t ctors_size; /* size of .ctors */ int ndeps; /* number of dependencies */ linker_file_t* deps; /* list of dependencies */ STAILQ_HEAD(, common_symbol) common; /* list of common symbols */ @@ -211,6 +213,8 @@ void *linker_hwpmc_list_objects(void); #define MODINFOMD_KERNEND 0x0008 /* kernend */ #endif #define MODINFOMD_SHDR 0x0009 /* section header table */ +#define MODINFOMD_CTORS_ADDR 0x000a /* address of .ctors */ +#define MODINFOMD_CTORS_SIZE 0x000b /* size of .ctors */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ |