[Compiler-rt] Emit error if builtins library cannot be found
authorYi Kong <yikong@google.com>
Sat, 16 May 2020 03:59:21 +0000 (11:59 +0800)
committerYi Kong <yikong@google.com>
Sun, 17 May 2020 02:54:53 +0000 (10:54 +0800)
Since setting COMPILER_RT_USE_BUILTINS_LIBRARY would remove -z,defs
flag, missing builtins library would continue to build unnoticed.
Explicitly emit an error in such case.

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

compiler-rt/cmake/Modules/AddCompilerRT.cmake

index 50611d6..1dde396 100644 (file)
@@ -237,6 +237,9 @@ function(add_compiler_rt_runtime name type)
       if(COMPILER_RT_USE_BUILTINS_LIBRARY AND NOT type STREQUAL "OBJECT")
         get_compiler_rt_target(${arch} target)
         find_compiler_rt_library(builtins ${target} builtins_${libname})
+                               if(builtins_${libname} STREQUAL "NOTFOUND")
+          message(FATAL_ERROR "Cannot find builtins library for the target architecture")
+        endif()
       endif()
       set(sources_${libname} ${LIB_SOURCES})
       format_object_libs(sources_${libname} ${arch} ${LIB_OBJECT_LIBS})