<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55046>55046</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            CMake error when trying to build Compiler-RT for ARM32. (Attempt to add a custom rule to output ... which already has a custom rule.)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            cmake,
            compiler-rt,
            build-problem
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          UsmanNadeem
      </td>
    </tr>
</table>

<pre>
    Seeing this issue after: https://reviews.llvm.org/D120682

```
-- Compiler-RT supported architectures: arm;armv6m
-- Builtin supported architectures: arm;armv6m
-- For arm builtins preferring arm/fp_mode.c to fp_mode.c
-- For arm builtins preferring arm/bswapdi2.S to bswapdi2.c
-- For arm builtins preferring arm/bswapsi2.S to bswapsi2.c
-- For arm builtins preferring arm/clzdi2.S to clzdi2.c
-- For arm builtins preferring arm/clzsi2.S to clzsi2.c
-- For arm builtins preferring arm/comparesf2.S to comparesf2.c
-- For arm builtins preferring arm/divmodsi4.S to divmodsi4.c
-- For arm builtins preferring arm/divsi3.S to divsi3.c
-- For arm builtins preferring arm/modsi3.S to modsi3.c
-- For arm builtins preferring arm/udivmodsi4.S to udivmodsi4.c
-- For arm builtins preferring arm/udivsi3.S to udivsi3.c
-- For arm builtins preferring arm/umodsi3.S to umodsi3.c
-- For armv6m builtins preferring arm/divsi3.S to divsi3.c
-- For armv6m builtins preferring arm/udivsi3.S to udivsi3.c
-- For armv6m builtins preferring arm/comparesf2.S to comparesf2.c
-- For armv6m builtins preferring arm/addsf3.S to addsf3.c
-- Supported architectures for crt: arm;armv6m
CMake Error: Attempt to add a custom rule to output ".../compiler-rt/arm32/linux/lib/linux/clang_rt.crtbegin-arm.o.rule" which already has a custom rule.
CMake Error: Attempt to add a custom rule to output ".../compiler-rt/arm32/linux/lib/linux/clang_rt.crtend-arm.o.rule" which already has a custom rule.
-- Configuring incomplete, errors occurred!
```

Before the patch, if I printed `${CRT_SUPPORTED_ARCH}`  in  `compiler-rt/lib/crt/CMakeLists.txt` I only got `arm`. Now I get `arm;armv6m`. Like this:

```
# compiler-rt/lib/crt/CMakeLists.txt
+ message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}")
foreach(arch ${CRT_SUPPORTED_ARCH})
  add_compiler_rt_runtime(clang_rt.crtbegin
    OBJECT
    ARCHS ${arch}
    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
    CFLAGS ${CRT_CFLAGS}
    PARENT_TARGET crt)
  add_compiler_rt_runtime(clang_rt.crtend
    OBJECT
    ARCHS ${arch}
    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
    CFLAGS ${CRT_CFLAGS}
    PARENT_TARGET crt)
endforeach()

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVluTqjgQ_jX4kpJigjrwwAOinp3duRXqsxUgQvZwq1xmzuyv305E1LNz3GHOqV3LgiRNf91fp7uTpMnegjWlrM6RLJhATAhFEdlLyi03RIWUrYCBhVfw5_SF0Vdhl-VLZTc8h6XFDXZmHracheWE3XPmdH8zHY9R1FQtKykfxxskVNs2XNIMEZ4WTNJUKk61DVioLHcOz5dZ1evOFSslqwfrrRquBSg56AvUcrqnnGumWgGv9u2uajJqp0g2qJ8MAEjEK2kzhu21RuhngyHEBYQYCJGWf_U-dOOB6uJMfbB12FoC-7A_QpzmQ2Ay9gLhF2xyQDlNB4II5vYIejxE3Vjs1LvxEHX1HQf1ORLqnIX6BA11zkP9iAiUyk9G8jrCx2hcxxiSW9eRSJaJfedMNz4hrN_vLGgPyCmX73eY6IF8pWjJeWP6ZCglrVrZ4SOCUiVkUyGuSqoXGyVbJZGFsW3bHTXTEQEf3OOVi-Fdslp9M-_kbJaWpM53XNrgTEJzVo_he7uxNTYAoteCpQUiJacke0MFEZfm7f_VYVpnn3LXnBr1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