Wiki

by yszheda

View project onGitHub

objcopy

e.g. Convert a jpg into an ELF32 object

$ objcopy -I binary -O elf32-i386 -B i386 foo.jpg foo.o

In the C program which links with foo.o

extern char _binary_foo_jpg_start[];
extern char _binary_foo_jpg_end[];
extern char _binary_foo_jpg_size[];
const char *start = _binary_foo_jpg_start;
const char *end = _binary_foo_jpg_end;
int size = (int) _binary_foo_jpg_size;