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

    <tr>
        <th>Summary</th>
        <td>
            Building LLVM-BOLT with the bazel build produces an non-working build 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            BOLT
      </td>
    </tr>

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

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

<pre>
    The bazel build Bolt fails with `architecture unsupported by MCPlusBuilder` because the Bazel build does not correctly set the `X86_AVAILABLE`, `AARCH64_AVAILABLE`, and/pr `RISCV_AVAILABLE` defines. 

To duplicate this follow the bazel build rules:

```
git clone https://github.com/llvm/llvm-project.git
cd llvm-project/utils/bazel
bazel build @llvm-project//bolt:llvm-bolt
bazel-bin/external/llvm-project/bolt/llvm-bolt bazel-bin/external/llvm-project/bolt/llvm-bolt -o optimized-bolt
```
output is: 
```
architecture unsupported by MCPlusBuilder
UNREACHABLE executed at external/llvm-project/bolt/lib/Rewrite/RewriteInstance.cpp:287!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: bazel-bin/external/llvm-project/bolt/llvm-bolt bazel-bin/external/llvm-project/bolt/llvm-bolt -o optimized-bolt
zsh: abort      bazel-bin/external/llvm-project/bolt/llvm-bolt  -o optimized-bolt
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVE1v4zYQ_TX0ZWBBpj4sH3SQvRE2gLcNkjToraCoscQNTQrkcLPJry8o7TZuWmDbnNYwbIrz3vBp5nGE92owiDUr9qz4sBKBRutq-mwNem1Xne2f6_sRoRMvqKELSvewt5rgJJT28KRoBFamwslREUoKDiEYH6bJOsIeumf4dLjRwe8jFR0rU-hQiuARaETYX-TtLXowlkBa51CSfgaPNMNYmf5elX80D831sdkfr1iZMn6I201ze_hY5v8ICdMz3k4uYm6v7w4Pf0NAjydl0CfA0g8sbZbfewt9mLSSgqI65eFktbZPs4TLCrig0bOsuSTHc5fv_DgoAqmtQRiJphnMW8bbQdEYukTaM-Ot1l--_60nZz-jpGRQtGSQPVwGGG8DKe0Zb2cpC-hSFcvTN4SItZpY1syBef1KW3fKMN7iV0JnhH4j5Dv3225cwztpawt2InVWL9hfiHhTMRtoCgQq1gr-FfHfXTbDf_vl9qo5fIwtB_yKMkSoIPixctUx3t7ik1OEr6tr40kYiYmcJpY1vNoyvlmOujleNXdX4EN3VgQCujCAw6gOyP5PBzDeKu8Dxk5HG4MyUod-uS_SCT9CJ-QjOSExWY6_IyEfoQ_n6S9TpglLdzfODk6cQbghnNHQXNqfovcvfoxaRBdLNH_emf-H5lr1ddbvsp1YYb3Z8nxbltV2sxprUeRFUVRVVeEuL067dFvtiiKtqqzYbTDPVqrmKc_Tim83WZFnm2SXY3qqCqyqtOvyvmJ5imehdBLlJNYNq7lx9SYtOS9XWnSo_TxaOd__erxnnMch6-pFfhh8vLLKk3_NQIo01rOPlRngeHz4tI7cZdS-HUSTs32Q6EEYMNasn6x7jLQlugpO1-8337fX-FLzPwMAAP__3UEAhg">