<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 - lldb/mac can't load object files from thin archives"
   href="https://bugs.llvm.org/show_bug.cgi?id=50770">50770</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb/mac can't load object files from thin archives
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>lld/mac and llvm-ar support thin archives (where the .a file just stores an
index of symbols and then links to .o files on-disk for data).

Thin archives confuse lldb:

% cat foo.c
#include <stdio.h>
void foo() { printf("asdf\n"); }

% clang -c -g foo.c

% cat mainfoo.c
void foo();
int main() { foo(); }

% clang -c -g mainfoo.c

## -T here makes llvm-ar create a thin archive:
% rm -f libfoo.a && out/gn/bin/llvm-ar -rcsDT libfoo.a foo.o

% out/gn/bin/clang -fuse-ld=lld mainfoo.o libfoo.a

% lldb a.out
(lldb) target create "a.out"
Current executable set to '/Users/thakis/src/llvm-project/a.out' (x86_64).
(lldb) b main
error: libfoo.a(foo.o) failed to load objfile for
/Users/thakis/src/llvm-project/libfoo.a


This works fine with a non-thin archive.

(Remember to rm the .a file before re-running llvm-ar since the thin archive
flag seems to be sticky.)</pre>
        </div>
      </p>


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

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>