This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: binary filer & linking ..


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]