bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function name prefix


From: Tim Klein
Subject: Re: function name prefix
Date: Sun, 17 Jun 2001 23:34:22 -0700

> It sounds like you are linking together two different object file
> formats.  You should be aware that that feature of the linker is
> rarely tested, and it is quite possible that you will encounter bugs.

You are absolutely right - I can now see the linux and cygwin object file
formats are different.  This is apparent when I run 'nm' on the linux  and
cygwin generated versions of the library.    When run on a library file built
in the alternate environment, Nm gives an error of the form :

nm: file.o: File format not recognized

As far as I can tell the archiver file format for both cygwin and linux are
the same.  Though I may be wrong?

So it strikes me that I have two choices:-

1) Generate the libraries for both Linux & Cygwin environments.
2) Translate the linux library to cygwin object/archive format.

My choice would be the latter as I really don't want to be supporting two
versions of the libraries.  Is it possible do you think to convert the linux
gcc format to cygwin object file format?  This will require a knowledge of
both the cygwin and linux object file formats as well as a knowledge of the
ar(chiver) file format.    If this is feasible can any one tell me where the
file formats are documented - or do I need to go and reverse engineer the
code.

It does, I guess, beg the question - why are they different in the first
place .  I thought they were both gcc - or have I missed something.

Tim

Ian Lance Taylor wrote:

> Tim Klein <address@hidden> writes:
>
> > I am trying to build and link a C file on Windows NT running CYGWIN.
> > The problem I'm seeing appears to be that the compiler under CYGWIN
> > prefixes an underscore (-) to all file names.  Unfortunately the
> > libraries I'm using were built under linux and don't have underscore
> > prefixed function names.  The result of course is lots of unresolved
> > references when I link.
> >
> > I should point out that the libraries do not contain anything which is
> > platform dependant so what I'm trying to do is perfectly valid.
> >
> > Is their an easy fix for this eg. a command line switch in gcc or ld.
> > Alternatively a tool I can post process the linux generated libraries to
> > prefix all file names with '_' or perhaps a description of the archiver
> > file format so I can write a conversion utility myself.
>
> Perhaps the --change-leading-char or --remove-leading-char options of
> objcopy will do what you need.
>
> It sounds like you are linking together two different object file
> formats.  You should be aware that that feature of the linker is
> rarely tested, and it is quite possible that you will encounter bugs.
>
> Ian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]