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

    <tr>
        <th>Summary</th>
        <td>
            llvm-ranlib fails to convert an archive with MacOS fat object files into a fat archive
        </td>
    </tr>

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

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

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

<pre>
    Tested with llvm 17.0.6 and 18.1.6, both of them seem to have the same issue.

1. Given an archive with a fat object file `Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit object x86_64Mach-O 64-bit object x86_64] [arm64:Mach-O 64-bit object arm64Mach-O 64-bit object arm64]`
2. Archived with ar using `ar qc archive.a object.o` (both Apple's ar and llvm-ar works fine in this step)
3. Running `llvm-ranlib archive.a` fails to split the fat object file and create a fat archive,
Running `cmp` on oldarchive.a and archive.a it tells me that only the metadata changes: 
```     20  40  57
     25 61  60
     26  67  40
     27  61  40
     28  67  40
     29 67  40
     30  65  40
     31  65  40
     32  65  40
     33 60  40
     34  71  40
     37  65  60
     38  60  40
     39 61  40
     43  62  60
     44  60  40
     49  61  66
     50 60  64
     51  60  64
     52  66  40
     53  64  40
     54 64  40
```
This behavior is different than Apple's ranlib, which does create the fat archive as expected.

Let me know if anything else is needed. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE2P4jgQ_TXmUurIcRwnOeTQMy32sqORdue-qiQV4m3HYW0D0_9-5Ri6gWYGIZBfud5zfaL3emeJWlZ-YeXLBg9hWlyLJqB5FcWmW4a39gf5QAOcdJjAmOMMeZXxTAHaAfI6yzPFxFfoljDBMkKYaAZPNENYYMIjRQQ8zgTa-wNljL8w_px-8wz-0EeygBbQ9ZM-UtJBGDHA0v1LfYBRGwKm-Dfsp6fvcLD6SM6jgU5bdG_JQySCQH04OPKseAZWfvlZq3-UZMXz2VfJp06_Eyfrb0ysfIks6OZfk6zGX1tY-cIUT-GKDJ5TlOd0ooOD13YXo0MH__WXLGR4JskWpjgwUa_5fd7vDTFR-egZ8x_r8YQOTot79TBqS6AthEl78IH2TDRJucjgr4O1Z6nVy6E1uvsQjDojauNj4fze6LBW7r4OUbV3hIHORToTMPE1SV3p9PM-si4WFjN8RBYpPk5Rh4zxMMdWiWrWvK3SMwUcMCD0E9rduaapexRPX4gfwQEkByirZE1gCSoHuKQ-YQpAVfHyNVjBevMWrB_dbD5jBQdQ5T2YPwLFI7AAxe8xCVDdP6iokvdNPEV85Sf35nM4sgBQ4s5bygfesknZUOoKLPl6UclrLIcHYNRQd5RlFJf3oLzB3guajj9iA3c04VEvDrSHQY8jObKxJ9FezUHq4riATpPuJxgW8pf-vLTvZbOgB_q5pz7QcLOF_qQQm-_VLifQI6B9C1PsYDI-Li2wRAMNGWyGthiaosENtXmVV1VZ8brYTC0JQQNWoh76uukKlY9VU_AaZc0rakS30a3gQnLFq5xLKYuM80F2_UhqLMu6rjmTnGbUJoujmS1ut1mXZdvIShYbgx0Zvy5pISyd0iZlQsSd7dp1nLvDzjPJjfbBf7AEHQy11_P-PuL9Yo_kwqfV-w3773_fj70HbcNyO_GbgzPtFMI-DiYTWya2Ox2mQ5f1y8zENqqe_572bolcTGzXp3smtim0Yyv-DwAA__-5-N4o">