Sat Sep 18 15:13:33 CEST 2010

Embedding arbitrary data in ELF using objcopy

Good hint from [1]:

objcopy \
        -I binary -O elf32-i386 -B i386 \
        --rename-section .data=.rodata file.bin file.o

Default secion is .data which is here renamed to .rodata for embedding
of const data that goes into program Flash.

This creates 3 symbols:

00000000 l    d  .rodata	00000000 .rodata
00000000 g       .rodata	00000000 _binary_file_bin_start
00000007 g       .rodata	00000000 _binary_file_bin_end
00000007 g       *ABS*	        00000000 _binary_file_bin_size

To use different names, use something like:
    -–redefine-sym _binary_file_bin_start=_my_bin_data

[1] http://www.doof.me.uk/2010/05/07/cute-objcopy-hack/