This is the mail archive of the 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]

Re: (windres) linking VisualC++ ``coff'' objects under Linux?

On Thu, Jul 13, 2000 at 04:02:42PM -0700, wrote:
> "H . J . Lu" <> writes:
> > Here it is. The binary rpm supports linking MS COFF .obj files under
> > Linux. But you may have to run
> > 
> > # objcopy --remove-leading-char 
> > 
> > on the MS COFF .obj files first before linking them under Linux.
> yahoo it works.
> The binary RPM is ok but for some reason the default configured executables
> from binutils- archive do not 
> (answer is File format not recognized)

You need to add --enable-targets=i386-pe to configrue.

> Looks like black magic but using --remove-leading-char to first remove the 
> leading underscores, I could get from ld a running executable calling trivial
> functions using int and double types, and simple malloc/free. One
> symbol was missing called _chkesp I implemented with
> void _chkesp() {}
> Why can't I objcopy from MSVC coff to elf32-i386? Anyways now that
> I can link nicely the answer is just for sport

From binutils.texi:

The @sc{gnu} @code{objcopy} utility copies the contents of an object
file to another.  @code{objcopy} uses the @sc{gnu} @sc{bfd} Library to
read and write the object files.  It can write the destination object
file in a format different from that of the source object file.  The
exact behavior of @code{objcopy} is controlled by command-line options.
Note that @code{objcopy} should be able to copy a fully linked file
between any two formats. However, copying a relocatable object file
between any two formats may not work as expected.

Yes, I put the warning there after consulting Ian.

> Why did you choose to overwrite objects with objcopy without warning
> even if the user sets them read-only?

# man objcopy
      infile and outfile are the source and output files
      respectively.  If you do not specify outfile, objcopy
      creates a temporary file and destructively renames the
      result with the name of the input file.


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