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: RFA: Adding feature for putting system libraries for pe-coff targets as last in link order


2009/9/14 Dave Korn <dave.korn.cygwin@googlemail.com>:
> Kai Tietz wrote:
>> Hello,
>>
>> it is a pretty common issue, that symbols in system libraries are
>> possibly replacing own runtime functions, when users are specifying
>> additional system libraries by -l option to ld. AFAIK there is at the
>> moment no way to say, that a specific library should be imported at
>> tail of chain, and not at possition specified.
>
> ?Can you give us an example to demonstrate why the solution to the problem
> isn't just to tell people "write the libraries in the order you want, rather
> than in the wrong order that you don't want, on the command line"?
>
>> Therefore I would like to ask, if there is interest in an extension to
>> linker for this. I would suggest for this an linker option -sys-l, or
>> -tail-l.
>
> ?I'm not sure whether this should really be considered a problem with the
> linker, rather than a problem with the GCC driver or wherever the flags are
> coming from. ?I can't think of a situation where I've ever needed this sort of
> option and wished it existed, so I'll reserve judgment until I see what kind
> of example usage you're envisaging.
>
> ? ?cheers,
> ? ? ?DaveK
>

Well, as example (btw this could be done also in gcc driver but I
think a linker option for this is easier) the command 'gcc -o tst my.c
-lmsvcrt'. For this example the import library of libmsvcrt.a will be
linked before the libmingwex.a (specified by gcc spec).
For code of my.c:
#include <math.h>
#include <stdio.h>

int main (int argc, char **argv)
{
  printf ("Pow(%d)=%g\n", argc, pow ((double) argc, 2.0));
  return 0;
}

For this example above the function 'pow' will be taken from
msvcrt.dll. If you omit the -lmsvcrt option, it is taken from
libmingwex.a.

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination


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