[libc-commits] [libc] b014335 - [libc] Distinguish compiler and run failures

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Thu Jan 21 15:27:45 PST 2021


Author: Petr Hosek
Date: 2021-01-21T15:27:34-08:00
New Revision: b0143352634ba7ed29f1db6ea576c0abfd0b4a29

URL: https://github.com/llvm/llvm-project/commit/b0143352634ba7ed29f1db6ea576c0abfd0b4a29
DIFF: https://github.com/llvm/llvm-project/commit/b0143352634ba7ed29f1db6ea576c0abfd0b4a29.diff

LOG: [libc] Distinguish compiler and run failures

This is useful for debugging issues, for example when cross-compiling.

Differential Revision: https://reviews.llvm.org/D95118

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake b/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
index 86c3822c864c..57dfbd9731d6 100644
--- a/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
+++ b/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
@@ -115,12 +115,14 @@ function(_check_defined_cpu_feature output_var)
     COMPILE_DEFINITIONS ${flags}
     COMPILE_OUTPUT_VARIABLE compile_output
     RUN_OUTPUT_VARIABLE run_output)
-  if(${compile_result} AND ("${run_result}" EQUAL 0))
+  if("${run_result}" EQUAL 0)
     set(${output_var}
         "${run_output}"
         PARENT_SCOPE)
+  elseif(NOT ${compile_result})
+    message(FATAL_ERROR "Failed to compile: ${compile_output}")
   else()
-    message(FATAL_ERROR "${compile_output}")
+    message(FATAL_ERROR "Failed to run: ${run_output}")
   endif()
 endfunction()
 


        


More information about the libc-commits mailing list