sanitizer_platform_limits_posix.h defines __sanitizer_XDR if SANITIZER_LINUX && !SANITIZER_ANDROID, but sanitizer_platform_limits_posix.cpp tries to check it if HAVE_RPC_XDR_H. This coincidentally works because macOS has a broken <rpc/xdr.h> which causes HAVE_RPC_XDR_H to be 0, but if <rpc/xdr.h> is fixed then clang fails to compile on macOS. Restore the platform checks so that <rpc/xdr.h> can be fixed on macOS.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I didn't want to change the behavior on macOS, this part has never been on on that platform.
That would be changing the struct __sanitizer_XDR declaration in sanitizer_platform_limits_posix.h to be HAVE_RPC_XDR_H instead of SANITIZER_LINUX && !SANITIZER_ANDROID. I think right now it doesn't check HAVE_RPC_XDR_H because it's not actually using anything from xdr.h.
Mostly I wasn't totally sure what the intended behavior was, and I'm just trying to fix the build, not add new functionality to non-Linux platforms.
Wouldn't it be best to match the sanitizer_platform_limits_posix.h guard? That's the crux of the bug anyway, the declaration and checks are guarded with totally different macros.
No. This file applies to FREEBSD as well
so it should be HAVE_RPC_XDR_H && ((SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FREEBSD)
but on all these platform HAVE_RPC_XDR_H will be set anyway
so (HAVE_RPC_XDR_H && !SANITIZER_APPLE) is just shorter
TODO is not needed as Apple does not intercept XDR
so (HAVE_RPC_XDR_H && !SANITIZER_APPLE) is just shorter
So why not a shorter version? Do I miss some benefits of this long expression?
Feel free to land it then. I don't see a point to wait for other feedback. At first I thought it's a different kind of issue.