Open chen3feng opened 3 years ago
Something like this would be a starting point:
objcopy --input binary \
--output elf64-x86-64 \
--binary-architecture i386:x86-64 \
myfile.txt myfile.o
If you wanted to generate 32-bit objects you could use:
objcopy --input binary \
--output elf32-i386 \
--binary-architecture i386 \
myfile.txt myfile.o
https://stackoverflow.com/questions/4158900/embedding-resources-in-executable-using-gcc
ld -r -b binary
$ ld -r -b binary -o outfile.o /bin/ls
$ nm outfile.o
0000000000023008 D _binary__bin_ls_end
0000000000023008 A _binary__bin_ls_size
0000000000000000 D _binary__bin_ls_star
maybe faster.