Embedding Binary Objects in C
flak.tedunangst.com
Embedding Binary Objects in C
1–10 of 141 posts
Re: Embedding Binary Objects in C
#2Re: Embedding Binary Objects in C
#3 __asm__(“.incbin file”);Re: Embedding Binary Objects in C
#4 ld -r -b binary quine.c -o myself.o -m elf_amd64Re: Embedding Binary Objects in C
#5This post covers a lot of different approaches, and has lots of tips: https://www.devever.net/~hl/incbin
Re: Embedding Binary Objects in C
#6Where did they define the symbols `_binary_quine_c_start` and `_binary_quine_c_end`? I would expect that the symbol names would need to be passed to the command that produced the object file from the binary file: ld -r -b binary quine.c -o myself.o -m elf_amd64
It's the other way around. The command produces these symbols basing on the file name:
$ readelf --symbols myself.o
Symbol table '.symtab' contains 5 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 SECTION LOCAL DEFAULT 1
2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _binary_quine_c_start
3: 0000000000000113 0 NOTYPE GLOBAL DEFAULT ABS _binary_quine_c_size
4: 0000000000000113 0 NOTYPE GLOBAL DEFAULT 1 _binary_quine_c_endRe: Embedding Binary Objects in C
#7There's also gnu's objcopy. This post covers a lot of different approaches, and has lots of tips: https://www.devever.net/~hl/incbin
Re: Embedding Binary Objects in C
#8Is it possible to automate this with cmake?
Re: Embedding Binary Objects in C
#9Where did they define the symbols `_binary_quine_c_start` and `_binary_quine_c_end`? I would expect that the symbol names would need to be passed to the command that produced the object file from the binary file: ld -r -b binary quine.c -o myself.o -m elf_amd64