[PATCH] D106305: [compiler-rt][CMake] create aarch64 helper asm during configure time

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 12:52:20 PDT 2021


steven_wu added a comment.

In D106305#2891318 <https://reviews.llvm.org/D106305#2891318>, @tambre wrote:

> In D106305#2890733 <https://reviews.llvm.org/D106305#2890733>, @steven_wu wrote:
>
>> The configured directory is rather large so let me give some more detail from the makefile generated. The custom target is generated in two of the makefiles I mentioned above, like following:
>>
>>   projects/compiler-rt/lib/builtins/outline_atomic_helpers.dir/outline_atomic_cas1_1.S:
>>           @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/Users/steven/makefile_build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Generating outline_atomic_helpers.dir/outline_atomic_cas1_1.S"
>>           cd /Users/steven/makefile_build/projects/compiler-rt/lib/builtins && /usr/local/bin/cmake -E create_symlink /Users/steven/llvm-project/compiler-rt/lib/builtins/aarch64/lse.S /Users/steven/makefile_build/projects/compiler-rt/lib/builtins/outline_atomic_helpers.dir/outline_atomic_cas1_1.S
>>
>> When you build the clang builtin library, it does:
>>
>>   $ make -j 32 clang_rt.osx VERBOSE=1
>>   ...
>>   /usr/bin/make  -f projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_arm64_osx.dir/build.make projects/compiler-rt/lib/        builtins/CMakeFiles/clang_rt.builtins_arm64_osx.dir/depend
>>   /usr/bin/make  -f projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_arm64e_osx.dir/build.make projects/compiler-rt/lib/       builtins/CMakeFiles/clang_rt.builtins_arm64e_osx.dir/depend
>>   ...
>>   CMake Error: failed to create symbolic link '/Users/steven/makefile_build/projects/compiler-rt/lib/builtins/outline_atomic_helpers.dir/outline_atomic_ldset1_3.S': file already exists
>>   ``
>
> Thanks, I now understand why this issue happens. With Make each target gets a Make subinvocation, while in Ninja they're generated into a single buildfile and can be correctly scheduled.
> This issue only happens with targets that can build multiple sub-architectures at the same time (ARM32, MIPS, PPC64) possibly causing the symlinking to run at the sametime. On Apple this includes ARM64 and x86-64, making this a bit easier to hit.
>
> The `add_custom_target()` solution noted in the mailing list seems the most appropriate to force ordering but still keep parallelism as noted by @thakis. Let's go with that.

I don't know how to use add_custom_target() to fix this. Maybe you can propose a patch?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106305/new/

https://reviews.llvm.org/D106305



More information about the llvm-commits mailing list