Related to the changes explained in: https://reviews.llvm.org/D28434
___[start|stop]___sancov_guard should be defined only once per module, because of that, I include them inside the static asan runtime: "clang_rt.asan_dynamic_runtime_thunk", that will be included in both, dlls and executables.
Details
- Reviewers
kcc zturner alekseyshl aizatsky rnk - Commits
- rGc1f8a82491db: [sancov] Define delimiters for sanitizer coverage's binary section on Windows.
rCRT293959: [sancov] Define delimiters for sanitizer coverage's binary section on Windows.
rL293959: [sancov] Define delimiters for sanitizer coverage's binary section on Windows.
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/asan/asan_win_coverage_sections.cc | ||
---|---|---|
18 ↗ | (On Diff #83495) | You can use the same technique as asan_globals_win.cc to avoid having a dynamic initializer in every TU with coverage. |
@kcc this is because all the support for Windows, auxiliary static libraries and dlls, are defined in asan directory. This is how code is organized now.
I think this ok for now. We can consider moving it in the future when all sanitizer coverage's code is moved to the new sancov folder.
This sounds like accumulating more technical debt.
None of this code belongs to asan (right??) and we should not be adding it to asan.
@kcc Yes it belongs to asan, since that is the only place where we build the dlls for windows.
All the hooks for windows, interception, etc, are implemented inside asan directory, even though some of that code is related to sanitizer coverage. For example, you can see the file: asan_win_dll_thunk.cc, that we re using interception for all the functions of sanitizer coverage. And that code is in asan directory. I think this was coded that way to simplify the code, and avoid many files in different places.
I would like to reorganize all the files, but maybe in a different diff, in the future, after finishing with this?
I'd like to avoid changes that are known to require large reorg in future.
can we do such reorg right away?
I update this diff to include the changes only for sanitizer coverage, independent of asan.
Hi @alekseyshl @kcc,
Related to the changes explained in: https://reviews.llvm.org/D28434 ___[start|stop]___sancov_guard should be defined only once per module.
In Windows, we have 2 different cases:
+ When considering MD:
All the modules, main executable and dlls, are linked to an auxiliary static library "asan_dynamic_runtime_thunk.lib". Because of that, I include `sanitizer_coverage_win_sections.cc` to `SancovDynamicRuntimeThunk`.
+ When considering MT:
The main executable in linked to the static library: "asan.lib". All the dlls are linked to an auxiliary static library "asan_dll_thunk.lib". Because of that, I include `sanitizer_coverage_win_sections.cc` to both `SancovDllThunk` and `SANITIZER_LIBCDEP_SOURCES` (which is included in `asan.lib`).
Would you agree?
@kcc all the reorganization required was included in these diffs:
+ https://reviews.llvm.org/D29148
+ https://reviews.llvm.org/D29154
+ https://reviews.llvm.org/D29158