This is the mail archive of the binutils@sourceware.org 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: Difference between --oformat binary, and objcopy -O binary of --oformat elf32-i386


Hi linuxyne,

> (1) --oformat binary
> (2) --oformat elf32-i386 and then objcopy -O binary,
> 
> the resulting code linked and stored within each resultant binary is
> different from one another, even though both use the same .o file.
> 
> An observation shows (2) creates correct binaries, but (1) does not.
> 
> Do we know, beforehand, if this is an error on the part of the user
> compiling the code, 

No - the compilation of the code is fine.

> or if this is a designed 

It is not a designed behaviour, but...

> or even an unsupported behaviour.

... it is basically unsupported.  Using the --oformat option of the
linker is known to be problematic in lots of cases.  It is far better
to use method (2), as this is much more likely to achieve the correct
outcome.

Possibly the use of --oformat in the linker should be deprecated, 
although there may be some situations where it does work.

Cheers
  Nick


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