[PATCH] D98291: [compiler-rt] Fix stale incremental builds when using `LLVM_BUILD_EXTERNAL_COMPILER_RT=ON`.

Dan Liew via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 9 14:18:10 PST 2021


delcypher created this revision.
delcypher added reviewers: kubamracek, yln, aralisza, beanz, samsonov.
Herald added subscribers: mgorny, dberris.
delcypher requested review of this revision.
Herald added a project: clang.

When building with `LLVM_BUILD_EXTERNAL_COMPILER_RT=ON` (e.g. Swift does
this) we do an "external" build of compiler-rt where we build
compiler-rt with the just built clang.

Unfortunately building in this mode had a bug where compiler-rt would
not get rebuilt if compiler-rt sources changed. This is problematic
for incremental builds because it meant that the compiler-rt binaries
were stale.

The fix is to use the `BUILD_ALWAYS` ExternalProject_Add option which
means the build command for compiler-rt is always run.

If all of the following are true:

- compiler-rt has already been built.
- there are no compiler-rt source changes.
- ninja is being used as the generator for the compiler-rt build.

then the overhead for always running the build command for incremental
builds is negligible.

rdar://75150660


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98291

Files:
  clang/runtime/CMakeLists.txt


Index: clang/runtime/CMakeLists.txt
===================================================================
--- clang/runtime/CMakeLists.txt
+++ clang/runtime/CMakeLists.txt
@@ -95,6 +95,8 @@
     USES_TERMINAL_CONFIGURE 1
     USES_TERMINAL_BUILD 1
     USES_TERMINAL_INSTALL 1
+    # Always run the build command so that incremental builds are correct.
+    BUILD_ALWAYS 1
     )
 
   get_ext_project_build_command(run_clean_compiler_rt clean)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98291.329464.patch
Type: text/x-patch
Size: 442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210309/bee8f65b/attachment.bin>


More information about the cfe-commits mailing list