In the process of my work, I need to build Linux versions of our codebase & release. The toolchain is LLVM/clang. I also have GNU tools installed on my system. I sometimes need to strip symbols out of .so's, using
objcopy --only-keep-debug libraryname.so libraryname.pdb
objcopy --strip-debug libraryname.so
However, this uses /usr/bin/objcopy on my PC, which the GNU version. If I use llvm-objcopy, I see different size file results for both the resulting symbol-only and no-symbol .so files. Using either stripped .so file in my executable appears to not make a difference.
So the question: Are there any known incompatibilities when using GNU objcopy when the .so was created with clang? Is there any guidance on this use by the LLVM project?
-
@Mike'Pomax'Kamermans not looking for a legal opinion here - just a technical explanation.Brie– Brie2025年08月06日 15:22:11 +00:00Commented Aug 6, 2025 at 15:22
-
They're just files. As long as the file format matches the standard, it doesn't matter what tools made them or process them. It's not like they carry the manufacturer's UPC code somewhere.Tim Roberts– Tim Roberts2025年08月06日 18:07:17 +00:00Commented Aug 6, 2025 at 18:07
1 Answer 1
Based on this thread from the LLVM Discussions Board, the goal for LLVM binutils is to maintain as much compatibility as possible with their GNU equivalents:
"be gnu compatible, except when it doesn’t make sense" – support for ancient platforms, bugs, weird formatting, etc.
Also, comparing the headers of the 2 .so's gives the same results, and a cursory compare of their disassemblies shows equivalence as well. So while not definitive, it appears the answer is Yes.