Open 0xced opened 1 year ago
@llvm/issue-subscribers-tools-llvm-objcopy-strip
The input binary appears to be invalid:
$ llvm-readobj --macho-indirect-symbols mongodb-macos-x86_64-6.0.4/bin/mongod | tail -n 20
Symbol Index: 0x4A7A5
}
Entry {
Entry Index: 12348
Symbol Index: 0x4A7A6
}
Entry {
Entry Index: 12349
Symbol Index: 0x10A1CF
}
Entry {
Entry Index: 12350
Symbol Index: 0x11C4B9
}
Entry {
Entry Index: 12351
Symbol Index: 0x11C62D
}
]
}
At the same time:
$ nm mongodb-macos-x86_64-6.0.4/bin/mongod | wc -l
305064
0x10A1CF = 1089999 > 305064
P.S. The tool shouldn't crash on invalid object files, but this is a quite old issue. In this particular case it's probably not hard to fix - patches are always welcome.
I'm not sure how much invalid this executable is but the strip
tool that comes with the Xcode toolchain is able to strip it from 132 MB to 95 MB without any issues.
$ ls -ks mongod
132096 mongod
$ xcrun strip mongod
$ ls -ks mongod
95328 mongod
The executable still runs after being stripped.
$ ./mongod --version
db version v6.0.4
Build Info: {
"version": "6.0.4",
"gitVersion": "44ff59461c1353638a71e710f385a566bcd2f547",
"modules": [],
"allocator": "system",
"environment": {
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
What do you mean by this is a quite old issue? Is there a duplicate issue that I failed to find?
LLVM 15.0.7 installed with Homebrew:
Reproduction steps:
Crashes with the following stack trace: