This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: libtool piecewise linking


On Aug 21, 2003, Alan Modra <amodra@bigpond.net.au> wrote:

> 	* ltmain.sh: Use ld script in preference to piecewise linking.

Unfortunately ld scripts are far too fragile in their syntax.  E.g.,
there's nothing stopping libtool object filenames from containing
blanks or parentheses, and libtool actually tries hard to make them
work.  Adding cases in which it doesn't work is not something I'm
looking forward to do.

Anyway, ltmain.sh is not to be patched in the GCC tree unless a
corresponding patch makes it to the libtool master CVS repository.

> +	  if $LD --version | grep GNU > /dev/null 2>&1; then

This is quite inappropriate in ltmain.sh.  ltconfig does have complete
information on whether the linker is GNU ld, so the right way to do
this would be to set some variable in the configuration section
enabling this feature.  Ideally, it should be done with a
configuration macro that lists commands to be run to modify in any way
needed a variable containing the name of a file that contains a list
of files, say one per line, into an argument that can be passed to the
linker and will result in having the object files listed in the
original file linked in.  Then, for GNU ld, the command would cat the
file into an INPUT () clause of a linker script that is then passed as
an argument to the linker, as long as none of the files contain
characters that are illegal in the linker script syntax.  As a
fallback, if whole archive is supported, one could incrementally
create an archive out of the files listed in the input file, and use
that archive, enclosed between --whole-archive/--no-whole-archive, as
the argument to the linker.  Assuming the linker can't directly read a
list of input files from a file, of course!

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


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