5 ms·
It's a possibility. It's not unreasonable for me to ship builds of objcopy and lld that I can run at embed time. An immediate difficulty is that I support Windo
by electroly 3y ago
It's a possibility. It's not unreasonable for me to ship builds of objcopy and lld that I can run at embed time. An immediate difficulty is that I support Windows and macOS, so I need a solution for PE and Mach-O executables too. I think a solution probably exists but I may need a separate solution for each platform. Embedding resources into binaries is pretty easy, it's just a matter of how to do it without shipping an entire C toolchain to users of my language.
- saagarjha 3y agoThe linker that ships on macOS supports embedding data from a file with -sectcreate.
- regularfry 3y agoI suspect the easier thing to do today is actually just embed tcc, and use its linker. Generating a C source file that embeds whatever binary you want in a string literal is straightforward templating. I couldn't really do that at the time.
- electroly 3y agoThat's a great idea. I'll have to check and see if some fork of tcc today supports all my target platforms, but I bet it does.
- zokier 3y agowould using libbfd or llvms objcopy library be of use here? https://llvm.org/doxygen/namespacellvm_1_1objcopy.html https://llvm.org/doxygen/namespacellvm_1_1objcopy.html