Re: Determining size of embedded blobs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jean Hoderd wrote:

> I want to embed an image into an executable.  I managed
> to do it by running "ld -r -b binary -o blob.o blob.png"
> on the blob.png file, thus creating a blob.o that I can
> link into my main program.  I have access to the binary
> blob by declaring an extern variable:

Just another point to consider: objcopy can also be used to do this
process, and has the benefit of allowing you to rename the created data
section and change its flags; I do this to make the section named
'.rodata' and mark it READONLY, which will help with swapping and other
related things (since it won't have to be swapped out). This can also be
done using ld, but requires writing a small linker script to accomplish
the same result.

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux