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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] ARM64 branch out of range when building MLIR project with M1 MAC
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I met a problem recently when I build mlir project with my M1 MacBook Pro:

```
cmake -G Ninja ../llvm \
   -DLLVM_ENABLE_PROJECTS=mlir \
   -DLLVM_BUILD_EXAMPLES=ON \
   -DLLVM_TARGETS_TO_BUILD="AArch64" \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_ENABLE_ASSERTIONS=ON

```

```console
 Linking CXX executable bin/mlir-opt
FAILED: bin/mlir-opt :
 // omitted

final section layout:
    __TEXT/__text addr=0x1000024D0, size=0x084F2ADC, fileOffset=0x000024D0, type=1
    __TEXT/__text_exit addr=0x1084F4FB0, size=0x000065B4, fileOffset=0x084F4FB0, type=1
    __TEXT/__text_startup addr=0x1084FB570, size=0x000AD704, fileOffset=0x084FB570, type=1
    __TEXT/__text_cold addr=0x1085A8C74, size=0x00000494, fileOffset=0x085A8C74, type=1
    __TEXT/__stubs addr=0x1085A9108, size=0x0000F45C, fileOffset=0x085A9108, type=29
    __TEXT/__init_offsets addr=0x1085B8564, size=0x00001970, fileOffset=0x085B8564, type=50
    __TEXT/__cstring addr=0x1085B9ED8, size=0x003D326F, fileOffset=0x085B9ED8, type=13
    __TEXT/__const addr=0x10898D150, size=0x0006F3F0, fileOffset=0x0898D150, type=0
    __TEXT/__eh_frame addr=0x1089FC540, size=0x01517AC0, fileOffset=0x089FC540, type=19
    __DATA_CONST/__got addr=0x109F14000, size=0x00028280, fileOffset=0x09F14000, type=30
    __DATA_CONST/__const addr=0x109F3C280, size=0x00110770, fileOffset=0x09F3C280, type=0
    __DATA/__data addr=0x10A050000, size=0x01BE35D8, fileOffset=0x0A050000, type=0
    __DATA/__bss addr=0x10BC335E0, size=0x01AD3D80, fileOffset=0x00000000, type=26
    __DATA/__common addr=0x10D707360, size=0x0000A518, fileOffset=0x00000000, type=26
ld: b(l) ARM64 branch out of range (137552688 max is +/-128MB): from __ZL27isReplicationMaskWithParamsN4llvm8ArrayRefIiEEii (0x10027A724) to __ZN4llvm6detail10CheckedInt17assertOutOfBoundsEv (0x1085A8CE4) in '__ZL27isReplicationMaskWithParamsN4llvm8ArrayRefIiEEii' from lib/libLLVMCore.a(Instructions.cpp.o) for architecture arm64
```

Please let me know if I can provide more information :-)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclltv4jgUxz-NebFAjuPcHnjIdcQulIqyu919iZzEAU-dGNnOtN1Pv0qgUy4pI21VgUj-Pr9zThyfP9Wa71rG5sCJgJNMaGf2Us1jKYQ8SGU6jSaFrN7nC9gwAyk8KFkI1kDFStYa8Q5f96yFC1h0XFSwEVz1ku-sNPCVmz1s3uHKgitaRlK-gBiDED0qCewQoASgj08Xnf6Hn2VDXxicfoMPvP1O4WwGcCbEjwYCJz4qIITTZLn8c5WnD2G0TPPHzfq3NN4-ATsZchhRRn8slkmePoerx2XaC9cPY7JtuPmWbp_y7fq4AtgJwDgMVbl3CcD4ak28Cn9PT7G3fz-mwE42TDCq2Z1sw6endLNdrB-OadxpxdXFUrZaCnYKu-TtC293MH5-huyNlZ2hhWCw4C3AWd-GqTyYozYLF8s0AXZ4dRf-fBIQ4AzgDMqGG8Oqc3zNWyqgZqXhsoWCvsvOfK6DEOb5Nn3eApzluWFvBtKqUsBO0JuFEEKYJAjgGGr-LxuuIp9kOEzi_mLNBVvXtWbmeOtMb94Pvd76kpOzN34B80lGsugKhhBynYiMwc70v4ZpQ5XpDle8yPFueGHioa94H_pf80opqguYE_qxR26KQyQYh33q78K06Qp9BQos5N-AMuKMP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