Embedding binary data into an executable using LLVM tools
4
votes
4
answers
3400
views
In the past I have embedded resource files (images) into programs by first converting them to
.o
files using the GNU linker. For example:
ld -r -b binary -o file.o file.svg
Starting with FreeBSD 12, the default linker has changed from GNU's to LLVM's. Although the linker appears to understand the command line options, it results in an error. For example:
ld -r -b binary -o file.o file.svg
ld: error: target emulation unknown: -m or at least one .o file required
Also tried using the command line options from the [ld.lld(1)](https://www.freebsd.org/cgi/man.cgi?query=ld) manual page:
ld --relocatable --format=binary -o file.o file.svg
ld: error: target emulation unknown: -m or at least one .o file required
Am I using the correct tool? Do I need to specify a value for the -m
option?
Asked by Richard Smith
(1288 rep)
Jan 16, 2019, 02:29 PM
Last activity: Feb 14, 2024, 11:51 AM
Last activity: Feb 14, 2024, 11:51 AM