This is the mail archive of the mailing list for the Cygwin project.

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

RE: ld COFF processing

Thanks for the answer.

I have actually put the problem wrong. What I'm trying to do, is to process
the object files using ld. I'll list my reasons below. My intention is not
to build an archive library (with ar).

On Linux, the command that I mentioned produces new.obj, identical with
s.obj, same sections, symbols, etc:
	$ ld -o new.obj -r s.obj

On NT, when s.obj is compiled with Microsoft tools (cl) it can have, for
example, many .text sections and
some other special sections. After issuing the above mentioned command, the
output object file has many sections less (for example only one section
.text and the special sections missing) and is considerably smaller in size.
A lot of information from the COFF PE object file is lost once it's passed
through ld.

Also, the object file produced on NT can't be linked again using Microsoft
'link', which reports an internal error.

My question is if there is any way that ld on NT can link and produce a
relocatable (ld -r) output object file in the same way it does on Linux? Is
there an NT usage restriction that says: don't use 'ld -r' with object files
created with 'cl /c'?

I would also appreciate if anyone could point me to an ld or a bfd patch to
solve this problem!



P.S. Although unrelated directly to this mailing list, here is the reason I
want to use 'ld -r' instead of creating an archive with 'ar'. I need to
create a static library without exposing the internal symbol names but only
the exportable symbol names. The internal symbols cannot be stripped out
(using 'strip' or ld options) because they are needed for the relocation. I
modified ld (actually the bfd backend) to change symbol names as it creates
the output file. However, the problem I exposed is experienced with the
unmodified Cygwin ld.

> -----Original Message-----
> From: DJ Delorie []
> Sent: Friday, September 01, 2000 5:40 PM
> To:
> Cc:
> Subject: Re: ld COFF processing
> > $ ld -o s.a -r s.obj	(produces s.a)
> >
> > My question is, to what extent is the pe-i386 format compatible with the
> > Microsoft format?
> The formats are compatible, but you're using the tools wrong.  The
> "ar" program creates libraries, not the "ld" program.  Please read the
> documentation for the tools for further instructions.

Want to unsubscribe from this list?
Send a message to

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