This adds the other potential bitcode sections that can exist and should
be stripped with -r from llvm-bitcode-strip.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I see the producers of the sections here:
- https://github.com/llvm/llvm-project/blob/main/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp#L4910-L4938
- https://github.com/apple/swift/blob/91b2abe99686600cd18daa2e898d8376440fba9e/lib/IRGen/IRGen.cpp#L1131-L1140
- https://github.com/llvm/llvm-project/blob/main/clang/tools/driver/cc1as_main.cpp#L517-L524
The only one not totally clear is the __asm section, is this the only time that section is used?
Functionally, this looks to do what it says it does - I have no comments there. I don't know enough about either bitcode or Mach-O to identify the sections that should be removed though. Soft LGTM apart from that point, with someone with more knowledge needing to confirm it or otherwise.
According to https://jonasdevlieghere.com/embedded-bitcode/ and https://lists.llvm.org/pipermail/llvm-dev/2016-June/101019.html __LLVM,__asm is just a way to know that the source was built directly from assembly. I included it given this logic from ld64 https://github.com/keith/ld64/blob/eddf3fd275669887e70392a1f7d8355222fa295e/src/ld/parsers/macho_relocatable_file.cpp#L2631-L2643 and it looks like ld64 uses this knowledge for some logic https://github.com/keith/ld64/blob/eddf3fd275669887e70392a1f7d8355222fa295e/src/ld/passes/bitcode_bundle.cpp#L662-L664
Either way I think it's safe to remove as Apple's bitcode_strip does as well