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: [RFC PATCH, binutils] Add support for creating ELF import libraries


On Friday, February 05, 2016 01:35:26 PM Nick Clifton wrote:
> Hi Thomas,

Hi Nick,

Sorry for the delay, I've been in holidays for a while.

> > One convenient mechanism is to create a so called import library that
> > application developers can link against. Such a library can already be
> > created with objcopy --extract-symbol but this means it is done as a
> > separate step than linking. This patch aims to add support in ld to
> > create ELF import libraries at link time.
> Why ?  As you say this can already be done with objcopy.  Why add code to
> the linker, potentially creating new bugs, when there is an already
> existing mechanism that works ?

The main reason I see is that creating import libraries is really a part of 
the linking process and that is what ld is for.

>From the actual manpages:

objcopy - copy and translate object files
ld - The GNU linker

Creating import libraries with objcopy means the user has to specify how to 
make an import library instead of just saying "I want an import library of 
that executable". It's akin to not add support for moving file accross file 
system in mv because we already have cp and rm.

Import libraries should be first class citizen of the linking process and not 
just the output of a tool invoked with the right switches.

There is other reasons too:

* --extract-symbol also keeps local symbols and I didn't find an easy way to 
remove local symbols (and not just compiler generated)
* there is precedent since pe 32bit x86 backend already have a --out-implib 
option when dlltool exists according to the manpage
* the implementation is small since all the infrastructure is already there in 
ld

Best regards,

Thomas


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