Jump to content
  • Advertisement
Sign in to follow this  
fir

raw binary to obj conversion

This topic is 1501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

 
 

I wonder if in such case i get a .bin file with the raw contents of some procedure (x86-32) is it possible to convert this with some tool (or if it is at all possible) to some linkable object file (like coff) which i can link and use (for example with GCC)

Speciffically it seem to me that when converting i shoulf gabe some export symbol name, dont know what with import symbol names, also do not know if some reallocation table would be needed to use this with such bonary or it is not needed and can be build at the process of conversion, i dont manage to understand what is going on with this realocation data

is it possible to convert data such way? could someone explain this?

 

Share this post


Link to post
Share on other sites
Advertisement

Have you looked into disassemblers?

 

I use them sometimes but this is somethink different..

 

I need an avaliable converter (bin->obj) or i need to wrote some converter code by myself but im not sure how hard it is ad what exactly need to do (would like need to know which one of obj formats is most easy to easily wrote some code for saving this)

Share this post


Link to post
Share on other sites

Check out objcopy from gnu binutils. I used it many times to generate raw firmwares from objs (obj -> bin). It should work the other way, but if it doesn't, just write a simple script to generate C file with data as global array.

Share this post


Link to post
Share on other sites

Check out objcopy from gnu binutils. I used it many times to generate raw firmwares from objs (obj -> bin). It should work the other way, but if it doesn't, just write a simple script to generate C file with data as global array.

 

 what do you mean? I dont want to use assembler, compiler or something like that 

want to have a tool for converting bin->obj (othar way is much easier for example nasm can produce bin only, or other tools can strip obj to binary too) - and much preferably understand how this conversion in details look like

 

i would later need a way of generating binary object files by myself from c code (try to wrote some very simple assembler elements) but dont know what of the common object formats would be easier to generate

 

right now im thinking about just generating .bin and converting it on linker 'toolchain' side, but would like to get some help with all of this

Share this post


Link to post
Share on other sites

Assemblers and compilers are the tools to generate object files.

If you want to generate it in another fine way, write the tool yourself. Look into the specifications for the various object file formats and choose one to implement. Should not be very hard with your experiences.

 

Generating a bin file from objects is called linking. For embedded systems you often have an additional step of locating, because the different sections defined in an object file needs to be moved into the right memory addresses.

 

If someone needs an image file or some binary data within his/her application they use their application development environment and put it in as data. The toolchain do the rest. So it would be surprising if someone would need a special tool to create an object file from a binary.

Share this post


Link to post
Share on other sites

Assemblers and compilers are the tools to generate object files.

If you want to generate it in another fine way, write the tool yourself. Look into the specifications for the various object file formats and choose one to implement. Should not be very hard with your experiences.

 

Generating a bin file from objects is called linking. For embedded systems you often have an additional step of locating, because the different sections defined in an object file needs to be moved into the right memory addresses.

 

If someone needs an image file or some binary data within his/her application they use their application development environment and put it in as data. The toolchain do the rest. So it would be surprising if someone would need a special tool to create an object file from a binary.

 

i got moderate experience - generating .obj myself is possible

but depends what you mean "not so hard" those are complex formats with many variable size chunks and other stuff so this is considerable more work to succesfully go thru that 

 

need at least some hints which format could be easier one to chose, 

or some hints what i would need to code (and how to make it easy) when writing such kind bin->obj "enveloper" or conventer

Share this post


Link to post
Share on other sites

It depends completly on your experiences. Take a look into the specifications. There you find all information you need to make a decission.

Share this post


Link to post
Share on other sites

Have you evaluated GNU's Binary File Descriptor library referenced in the Wikipedia article?

need something opposite - not variety of 50 formats but info how to generate the only one but as simplest as possible (or even some ready tool as i said - will read on this but its a mountain of docs on this but not exactly the substantial answer i need to find)

 

(the substantial question is : "i got an .bin with some procedure contents - how exactly to do it in an easier way to make some object from that"

 

(i need more some more like quick workable hack than extensible code)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!