mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
[experimental] Add sanitizer options to LDC.
Add some of the sanitizer passes to LDC. This is not complete (linking must be done using clang and the right `-fsanitize=` option) and may not be useful at all. If it proves to be usefull then a lot of other options (e.g. blacklist) must be added.
This commit is contained in:
parent
6fe28e1660
commit
e6529cfd3d
3 changed files with 91 additions and 0 deletions
|
@ -137,6 +137,21 @@ static int linkObjToBinaryGcc(bool sharedLib)
|
|||
// create path to exe
|
||||
CreateDirectoryOnDisk(gExePath);
|
||||
|
||||
#if LDC_LLVM_VER >= 303
|
||||
// Pass sanitizer arguments to linker. Requires clang.
|
||||
if (opts::sanitize == opts::AddressSanitizer) {
|
||||
args.push_back("-fsanitize=address");
|
||||
}
|
||||
|
||||
if (opts::sanitize == opts::MemorySanitizer) {
|
||||
args.push_back("-fsanitize=memory");
|
||||
}
|
||||
|
||||
if (opts::sanitize == opts::ThreadSanitizer) {
|
||||
args.push_back("-fsanitize=thread");
|
||||
}
|
||||
#endif
|
||||
|
||||
// additional linker switches
|
||||
for (unsigned i = 0; i < global.params.linkswitches->dim; i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue