[clang] [compiler-rt] [Sanitizers] the access size (8 bytes) exceeds the max lock-free size (4 bytes) for 32-bit (PR #125388)
Honey Goyal via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 6 12:15:13 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");
----------------
honeygoyal wrote:
Thank you for the suggestion, @hubert-reinterpretcast. After careful consideration, I believe that keeping the -latomic handling directly in AIX.cpp is the more appropriate approach for the following reasons:
1. Target-Specific Clarity:
The logic for appending -latomic is very specific to the 32-bit AIX environment. By keeping it in AIX.cpp, we maintain a clear separation between platform-specific behavior and the more general sanitizer runtime dependency logic. This makes it immediately obvious to developers reviewing AIX-specific code that this flag is required solely for this target.
https://github.com/llvm/llvm-project/pull/125388
More information about the cfe-commits
mailing list