This is the mail archive of the
mailing list for the binutils project.
Re: [RFC PATCH, binutils] Add support for creating ELF import libraries
- From: Thomas Preud'homme <thomas dot preudhomme at foss dot arm dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 16 Feb 2016 13:33:57 +0800
- Subject: Re: [RFC PATCH, binutils] Add support for creating ELF import libraries
- Authentication-results: sourceware.org; auth=none
- References: <000001d15738$a73c3160$f5b49420$ at foss dot arm dot com> <56B4A51E dot 2010103 at redhat dot com>
On Friday, February 05, 2016 01:35:26 PM Nick Clifton wrote:
> Hi Thomas,
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