| Issue |
57298
|
| Summary |
(MachO/Darwin) llvm-objcopy processed BSD ar archive seems broken for LLDB debugger
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
dreampiggy
|
Platform: macOS 12.4 / Darwin
LLVM Version: 13
### Issue description
`llvm-objcopy` can use without any args. I just use that to strip some sections if need. However, when I just use the command below
```
llvm-objcopy input.a output.a
```
When use the output.a as a debug OSO on Darwin platform, the LLDB debugger seems can no longer parse the current ar archive format.
### Screenshot
See the comparation, the `ar(1)` command can succeesfully extract the object files.

However, seems LLDB can no longer extract the processed one.
The code in [ObjectContainerBSDArchive.cpp](https://lldb.llvm.org/cpp_reference/ObjectContainerBSDArchive_8cpp.html) shows that there are only 2 object in the archive.
```
Printing description of this->m_objects:
(std::vector<ObjectContainerBSDArchive::Object, std::allocator<ObjectContainerBSDArchive::Object> >) m_objects = size=3 {
[0] = {
ar_name = (m_string = "__.SYMDEF")
modification_time = 0
uid = 0
gid = 0
mode = 0
size = 1948
file_offset = 80
file_size = 1936
}
[1] = {
ar_name = (m_string = "AppDelegate.o")
modification_time = 0
uid = 0
gid = 0
mode = 420
size = 103812
file_offset = 2096
file_size = 103792
}
[2] = {
ar_name = (m_string = "AwemeMain.o")
modification_time = 0
uid = 0
gid = 0
mode = 420
size = 14229
file_offset = 105960
file_size = 14217
}
}
```
### Comparation and attachment
[archive.zip](https://github.com/llvm/llvm-project/files/9402166/archive.zip)
origin one:
```
➜ test ar -tlv origin/libAwemeCore_lib.a
rw-r--r-- 0/0 1936 Jan 1 08:00 1970 __.SYMDEF SORTED
rw-r--r-- 0/0 103792 Jan 1 08:00 1970 AppDelegate.o
rw-r--r-- 0/0 14224 Jan 1 08:00 1970 AwemeMain.o
rw-r--r-- 0/0 6888 Jan 1 08:00 1970 DebugLog.o
rw-r--r-- 0/0 2112 Jan 1 08:00 1970 AwemeCore.o
rw-r--r-- 0/0 16040 Jan 1 08:00 1970 NSBundle+AwemeCore.o
rw-r--r-- 0/0 15696 Jan 1 08:00 1970 AWEFriendsActivityWidgetConfigurationIntent.o
rw-r--r-- 0/0 8048 Jan 1 08:00 1970 AWEFriendsActivityWidgetLandingPage.o
rw-r--r-- 0/0 7896 Jan 1 08:00 1970 AWEFriendsWidgetsColorScheme.o
```
modified one(using `llvm-objcopy`):
```
➜ test ar -tlv modified/libAwemeCore_lib.a
rw-r--r-- 501/20 1936 Aug 23 19:40 2022 __.SYMDEF SORTED
rw-r--r-- 0/0 103792 Jan 1 08:00 1970 AppDelegate.o
rw-r--r-- 0/0 14224 Jan 1 08:00 1970 AwemeMain.o
rw-r--r-- 0/0 6888 Jan 1 08:00 1970 DebugLog.o
rw-r--r-- 0/0 2112 Jan 1 08:00 1970 AwemeCore.o
rw-r--r-- 0/0 16040 Jan 1 08:00 1970 NSBundle+AwemeCore.o
rw-r--r-- 0/0 15696 Jan 1 08:00 1970 AWEFriendsActivityWidgetConfigurationIntent.o
rw-r--r-- 0/0 8048 Jan 1 08:00 1970 AWEFriendsActivityWidgetLandingPage.o
rw-r--r-- 0/0 7896 Jan 1 08:00 1970 AWEFriendsWidgetsColorScheme.o
```
Is this because of the llvm-objcopy does not run some of `runlib(1)` tool ? I'm not really familiar with these archive format details.
Anyone who works on either LLDB or llvm-objcopy can answer this question ?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs