[llvm-bugs] [Bug 50770] New: lldb/mac can't load object files from thin archives

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 18 12:36:38 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50770

            Bug ID: 50770
           Summary: lldb/mac can't load object files from thin archives
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: nicolasweber at gmx.de
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

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.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210618/e1d4123d/attachment.html>


More information about the llvm-bugs mailing list