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: Update LTO plugin interface


On Thu, Dec 2, 2010 at 9:20 AM, Ian Lance Taylor <iant@google.com> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> On Thu, Dec 2, 2010 at 9:00 AM, Ian Lance Taylor <iant@google.com> wrote:
>>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>>
>>>> I am not saying we should go with 2 stage linking. Just for clarification.
>>>> In 2 stage linking, the first stage only does symbol resolution. The complete
>>>> linking starts at the second stage. ?So we don't do really complete relink
>>>> in 2 stage linking.
>>>
>>> Understood. ?But you still read and process all the symbols twice. ?It
>>> can be done if it must be done, but it would be significantly better to
>>> do something else if possible.
>>>
>>
>> Without 2 stage linking, which many compilers do for LTO, we will add hack
>> on top of hack. ?As Richard pointed out, we need at least
>>
>> -lc -lgcc -lm -lpthreads -lgcov ?and maybe libssp, libgomp, ...
>>
>> -lm is currently added by user, not GCC driver
>>
>> Pass-through is just a hack, not a solution.
>
> But I just suggested a different approach, which as far as I can see
> solves the entire problem. ?Why not criticize that approach, rather than
> continusing to discuss -pass-through, which we agree is a hack?

How do you deal with -lm:

[hjl@gnu-6 pr12245-6]$ cat y.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int
main (int argc, char **argv)
{
  int d = atoi (argv[1]);
  printf ("%f\n", sin (d));
  return 0;
}
[hjl@gnu-6 pr12245-6]$ make
/usr/gcc-4.6/bin/gcc -O2 -fwhole-program -flto=jobserver -fuse-linker-plugin
-c -o y.o y.c
/usr/gcc-4.6/bin/gcc -static -o foo -O2 -fwhole-program -flto=jobserver
-fuse-linker-plugin y.o -lm
/tmp/ccrHdm25.ltrans0.ltrans.o: In function `main':
ccrHdm25.ltrans0.o:(.text.startup+0x19): undefined reference to `sin'
collect2: ld returned 1 exit status
make: *** [foo] Error 1
[hjl@gnu-6 pr12245-6]$

	
-- 
H.J.


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