[Issue 13742] undefined reference to __coverage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 16 04:41:42 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=13742
--- Comment #8 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/69e7bd18892df18f682906916bf8c8ad87fb30e5
fix Issue 13742 - undefined reference to __coverage
- Nested template functions may reference coverage symbols of other modules.
Those coverage symbols are either still `null` or already `symbol_reset`, in
the former case coverage instrumentation is silently skipped, in the later
case the linker will cause an error. This is because the current object file
ends up with two `__coverage` symbols, one local BSS symbols and an undefined
external symbol (for the other module's coverage).
- Fixed by mangling the symbols as _D3pkg3mod__coverageZ (similar to
__ModuleInfoZ) and making them global.
- Ideally the symbols would use -visibility=hidden, but that ELF backend
feature
isn't yet accessible from glue.d.
- This does not fix missing coverage when the referenced module hasn't yet
been codegen'ed (e.g. because it follows on the command line or is part of
another separate compilation). Using weak linkage to make this heuristically
work would incurr some overhead for the coverage instrumentation.
Unconditionally referencing coverage info OTOH might be too excessive,
e.g. when the template function is in phobos, which would require to
recompile
phobos with -cov for successful linking.
https://github.com/dlang/dmd/commit/0cb16110c307b608034d49289e2a650e7d7d7dd8
Merge pull request #7654 from MartinNowak/fix13742
fix Issue 13742 - undefined reference to __coverage
--
More information about the Digitalmars-d-bugs
mailing list