[compiler-rt] Remove maximum OSX version for sanitizers (PR #77543)

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 13:57:25 PST 2024


yln wrote:

Thank you Chris for this detailed write up.  We really appreciate open source contributions to make sanitizers work better on Darwin.

I am happy with this PR since it just removes the "clamp max min version at some arbitrary (old) value".  The default stays the same.

Comment on:
> There are some sanitizers that do not intercept functions that they could because these APIs do not exist in the version we are targeting.

I don't think this is necessarily true.  There is 2 issues to consider: building and availability at runtime.
* For building, if we want to intercept a newly-introduced API we usually "forward declare" the API (copy the minimal set of declarations necessary from the headers) in compiler-rt itself.  This enables us to add interceptors for APIs without requiring all builders of compiler-rt to use the new SDK that declares this API.
* For running: we can include interceptors for APIs that are not available on our minimal deployment target.  This intercepter will then be present in the resulting dylib, but will be dormant (never called) when the dylib is used on an older system that doesn't have the intercept target.  We need to ensure the declaration of the intercept target has the right availability annotations so `REAL(xxx)` is indirected through a pointer (when availability > minimum deployment target).  If we get this wrong we will get a `undefined reference` at dylib load time.  An example for this is `os_unfair_lock_lock` with availability `macOS 10.12` while our minimum deployment target is `macOS 10.10`.

>  intercept more modern calls like `aligned_alloc`

I am not 100% certain if there isn't a more tricky reason, but my guess for `aligned_alloc` not being intercepted is that no one has done the work to do so.  Again, we really appreciate open source contributions in this area.

On a different note: I am open to bumping the minimal deployment target (even if not strictly necessary) if it eases the maintenance burden.

cc: @thetruestblue @wrotki @rsundahl 

https://github.com/llvm/llvm-project/pull/77543


More information about the llvm-commits mailing list