]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/native.rs
Add test cases for issue #26186
[rust.git] / src / bootstrap / native.rs
index 37578e30f6d0f698a4185ac5d23e0c410c5a063c..4a754e6da12097293417c5f401728bf0c7e07ae2 100644 (file)
@@ -249,9 +249,14 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
             }
         }
 
-        if target.starts_with("riscv") {
-            // In RISC-V, using C++ atomics require linking to `libatomic` but the LLVM build
-            // system check cannot detect this. Therefore it is set manually here.
+        if !target.contains("freebsd") && target.starts_with("riscv") {
+            // RISC-V GCC erroneously requires linking against
+            // `libatomic` when using 1-byte and 2-byte C++
+            // atomics but the LLVM build system check cannot
+            // detect this. Therefore it is set manually here.
+            // FreeBSD uses Clang as its system compiler and
+            // provides no libatomic in its base system so does
+            // not want this.
             if !builder.config.llvm_tools_enabled {
                 cfg.define("CMAKE_EXE_LINKER_FLAGS", "-latomic");
             } else {