2 ms·
> objcopy -I binary -O elf64-x86-64 -B i386:x86-64:intel in.bin out.o Neat! In the past I've used perl scripts to munge into C source. FYI, it generates symb
by tlb 9y ago
> objcopy -I binary -O elf64-x86-64 -B i386:x86-64:intel in.bin out.o
Neat! In the past I've used perl scripts to munge into C source.
FYI, it generates symbols named after the filename:
tlb@london:~/ur$ objcopy -I binary -O elf64-x86-64 -B i386:x86-64:intel /etc/services services.o
tlb@london:~/ur$ objdump -t services.o
SYMBOL TABLE:
0000000000000000 l d .data 0000000000000000 .data
0000000000000000 g .data 0000000000000000 _binary__etc_services_start
0000000000004c95 g .data 0000000000000000 _binary__etc_services_end
0000000000004c95 g *ABS* 0000000000000000 _binary__etc_services_size
And in C++ you can get the contents with:
extern const char _binary__etc_services_start;
extern const char _binary__etc_services_end;
string services(&_binary__etc_services_start, &_binary__etc_services_end);