This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: binary filer & linking ..
- From: Ian Lance Taylor <ian at airs dot com>
- To: Lars Segerlund <lars dot segerlund at comsys dot se>
- Cc: binutils at sources dot redhat dot com
- Date: 20 May 2003 10:06:38 -0700
- Subject: Re: binary filer & linking ..
- References: <3ECA2BC1.9030609@comsys.se>
Lars Segerlund <lars.segerlund@comsys.se> writes:
> I have a short question,
>
> Is it possible to include a binary file in the linking ?
>
> What I want to do is the following:
>
> I have a file test.bin which I want to be able to link in with my
> application program, and locate by symbols.
>
> I intend to do this by a linker script, but I can't find how to
> include a binary file in the linking ? ( I can parse the file and have
> a lot of BYTE(xx) statements :-) ) but there should be an easier way.
>
> I know how to get the symbols as documented in the ld info pages, so
> all that I'm stumbling on now is how to include the data.
Yes, you can include a binary file in a link. On the command line, do
something like this:
ld ... -b binary BINARY-FILE -b YOUR-FORMAT ...
In a linker script, do something like
TARGET("binary")
INPUT("BINARY-FILE")
TARGET("YOUR_FORMAT")
Ian