[llvm-dev] Adding bitcode to an existing MachO object file

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 15 11:44:59 PDT 2020

What version of llvm-objcopy are you using? I know it’s had many fixes for Mach-O recently. If you’re running into a bug with the latest llvm-objcopy (from the master branch), it’d be great if you could file a bug on bugs.llvm.org with your input file (if possible).

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Joseph via llvm-dev <llvm-dev at lists.llvm.org>
Reply-To: Joseph <cybercheesecake2 at gmail.com>
Date: Saturday, August 15, 2020 at 6:53 AM
To: llvm-dev <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] Adding bitcode to an existing MachO object file

This is a silly question, but I am in a situation where I need to build x86 and arm assembly sources for some sources while the rest will be built with C. I do know that just adding `-fembed-bitcode` to a C sources would embed bitcode, but doing the same for the assembly files will not do that (at least, it will add the 1-byte `_LLVM,__asm` section, but not the `__LLVM,__bitcode` section). Furthermore, I do need the final output to contain bitcode for all files used.

So, my question is if it is possible to add the `__LLVM,__bitcode` section later to the MachO object file. I tried to archive the bitcode using `xar` and run `llvm-objcopy main.o --add-section=__LLVM,__bitcode=main.xar main2.o`, but it failed with an `unsupported load command`. This seems to be the case for all usages of `llvm-objcopy` with MachO files.

Cheers and thanks

-- Joseph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200815/2792362f/attachment.html>

More information about the llvm-dev mailing list