public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Joel Sherrill <joel.sherrill@oarcorp.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	 binutils@sourceware.org,   Andreas Schwab <schwab@suse.de>,
	 Ralf Corsepius <ralf.corsepius@rtems.org>
Subject: Re: binary to elf conversion
Date: Mon, 20 Aug 2007 19:54:00 -0000	[thread overview]
Message-ID: <46C99EB8.30606@oarcorp.com> (raw)
In-Reply-To: <200708190735.20119.vapier@gentoo.org>

Mike Frysinger wrote:
> On Friday 17 August 2007, Maciej W. Rozycki wrote:
>   
>> On Thu, 16 Aug 2007, Mike Frysinger wrote:
>>     
>>>> Why doesn't it default to the default architecture binutils was
>>>> built for?
>>>>         
>>> i think a similar question was posed for default -EB/-EL selection and
>>> the answer was no one really cared enough to fix it ;)
>>>       
>>  One issue is for some architectures you cannot set some ELF file header
>> flags that may be needed for some uses of the resulting object file.  For
>> example for MIPS/Linux you cannot set the PIC flag which makes the file
>> less that useful if you want it to become a part of userland binary.  A
>> better solution these days is often to use `gas' (through the `gcc' driver
>> and hence accepting all the usual target-specific and less so object
>> generation options) and its .incbin directive instead...
>>     
>
> i'd say this is to be expected ... the binary only contains so much 
> information so the resulting ELF is only as useful as what the binary 
> contains and what you give it
>
> in other words, i dont think this sort of thing is enough to say the default 
> behavior of objcopy should remain the same
>   
So objcopy from binary to  linkable file isn't really the best
or most reliable way.

Sounds like I need to change  the  procedure on my side
to generate a .s file which defines the same symbolic
information around an incbin as objcopy did and then
assemble it with the same flags as the rest of the application.
Right?

Or would I be better off to write a program to dump the
binary file as a C file with an initialized array?

I am looking for something cross-target and reliable.  For RTEMS
we convert a tar image of the initial RAM filesystem image into
an object and link it with the application. 

--joel

--joel
> -mike
>   

  reply	other threads:[~2007-08-20 14:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 14:55 Joel Sherrill
2007-08-16 16:20 ` Sergei Organov
2007-08-16 16:28 ` Andreas Schwab
2007-08-16 17:39   ` Joel Sherrill
2007-08-16 18:04     ` Mike Frysinger
2007-08-17 14:08       ` Maciej W. Rozycki
2007-08-19 17:10         ` Mike Frysinger
2007-08-20 19:54           ` Joel Sherrill [this message]
2007-08-22  1:29             ` Segher Boessenkool
2007-08-16 19:55 ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46C99EB8.30606@oarcorp.com \
    --to=joel.sherrill@oarcorp.com \
    --cc=binutils@sourceware.org \
    --cc=macro@linux-mips.org \
    --cc=ralf.corsepius@rtems.org \
    --cc=schwab@suse.de \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).