Preliminary support for LLVM 20 RTSan#4924
Preliminary support for LLVM 20 RTSan#4924liushuyu wants to merge 26 commits intoldc-developers:masterfrom
Conversation
This is now required by LLVM API starting from LLVM 20
Based on checking the `ldc2 -help` output when using LLVM 20 and 19 on Linux x86_64 (with all targets enabled, incl. experimental SPIRV/ Xtensa). And comparing that against official LDC v1.34 with LLVM 16.
Where the ASan pass now apparently adds a `nosanitize_address` IR module flag, breaking these tests.
…profdata on Ubuntu 25.04
... when using LLVM JITLink on LLVM 20+
... this attribute can be used to mark a function as "blocking" (same mechanism as Clang's `[[clang::blocking]]` C/C++ attribute.
runtime/druntime/src/rt/dmain2.d
Outdated
| { | ||
| import ldc.attributes; | ||
|
|
||
| @weak extern (C) void __rtsan_disable() @nogc nothrow {} |
There was a problem hiding this comment.
Have a look at module ldc.sanitizers_optionally_linked. I think that's more robust / works on more platforms probably?
|
One of the authors of rtsan here, was just linked this PR! Just shout if you have any questions. Excited to see it go into D |
|
An overall note before I look any further - it may be simpler to break this up into:
Seems like there are two major steps being done in this single PR. Breaking them up would make it easier to review and roll back upon an issue |
|
Hi, thank you for your review!
This is also why this is a draft. I am currently waiting on LLVM upstream to fix a LLVM 20 regression that breaks LDC in a very bad way (see #4911). This pull request will be rebased when that LLVM 20 upgrade pull request lands. |
... this function is not real-time safe and also not rtsan safe (will lock-up rtsan's stack scanner)
This pull request adds basic RTSan (real-time sanitizer) support for D developers to check if their applications are real-time safe (i.e. suitable to use in a real-time context).
Needs #4911. Fix #4755.