<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - llvm-ar-generated library + Xcode 9 ranlib result in malformed archive"
   href="https://bugs.llvm.org/show_bug.cgi?id=34808">34808</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-ar-generated library + Xcode 9 ranlib result in malformed archive
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llvm-ar
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jbc.engelen@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19217" name="attach_19217" title="Zip archive with libbug.o object file to reproduce the error">attachment 19217</a> <a href="attachment.cgi?id=19217&action=edit" title="Zip archive with libbug.o object file to reproduce the error">[details]</a></span>
Zip archive with libbug.o object file to reproduce the error

Running ranlib (Xcode 9) on a library generated by llvm-ar results in a
malformed archive.

Using the attached object file libbug.o, there is no error using the system
tools:
- rm -f libbug.ar.a
- ar rcs libbug.ar.a libbug.o
- ranlib libbug.ar.a
- nm -g libbug.ar.a (no error)

Now with llvm-ar, we get an error:
- rm -f libbug.llvmar.a
- llvm-ar rcs libbug.llvmar.a libbug.o
- ranlib libbug.llvmar.a (system ranlib, with llvm-ranlib no error happens)
- nm -g libbug.llvmar.a (errors) (also errors with llvm-nm)

The error is:
"nm: libbug.llvmar.a truncated or malformed archive (terminator characters in
archive member ".o" not the correct "`\n" values for the archive member header
at offset 864)"

(bug was discovered in LDC when using the internal archiver (LLVM). See
<a href="https://github.com/ldc-developers/ldc/issues/2350">https://github.com/ldc-developers/ldc/issues/2350</a>)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>