[clang] [compiler-rt] [Sanitizers] the access size (8 bytes) exceeds the max lock-free size (4 bytes) for 32-bit (PR #125388)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 14:48:41 PST 2025


================
@@ -338,6 +338,13 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-lpthread");
   }
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
+    
+// Required for 64-bit atomic operations used in sanitizer runtimes 
+// (e.g., sanitizer_common's atomic utilities). On 32-bit AIX, these 
+// are not natively supported, necessitating linkage with -latomic.
+  if (Sanitize.hasAnySanitizer() && IsArch32Bit) {
+    CmdArgs.push_back("-latomic");
----------------
hubert-reinterpretcast wrote:

re: https://github.com/llvm/llvm-project/pull/125388/files#r1945365836:

> Our implementation in AIX.cpp follows the established behavior in the LLVM community codebase.

Ignoring the lack of elaboration on how exactly placing this logic in `AIX.cpp` "follows the established behavior in the LLVM community codebase". The statement ignores the fact that the majority of `linkSanitizerRuntimeDeps` is code that is conditional based on platforms. For example:
https://github.com/llvm/llvm-project/blob/f7294776570e125b94bb5625905cbc57a4956760/clang/lib/Driver/ToolChains/CommonArgs.cpp#L1452-L1454

> While IBM’s downstream has opted to centralize similar logic in clang::tools::driver::linkSanitizerRuntimeDeps

The characterization that it is "IBM's downstream" that opted to centralize the logic in said function is misleading. The _LLVM community_ had created said function for logic associated with linking in dependencies for static sanitizer components; IBM's downstream followed with that.

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


More information about the cfe-commits mailing list