https://sourceware.org/bugzilla/show_bug.cgi?id=19842

--- Comment #15 from H.J. Lu <hjl.tools at gmail dot com> ---
Here is the difference between gold and ld:

[hjl@gnu-6 test]$ cat foo.c
#include <stdio.h>

void foo () __attribute__ ((weak));

void
foo ()
{
  printf ("Non-LTO\n");
}

void
bar ()
{
}
[hjl@gnu-6 test]$ cat foo1.c
#include <stdio.h>

void foo () __attribute__ ((weak));

void
foo ()
{
  printf ("LTO\n");
}
[hjl@gnu-6 test]$ cat main.c
extern void foo ();
extern void bar ();

int
main ()
{
  foo ();
  bar ();
  return 0;
}
[hjl@gnu-6 test]$ make
gcc -B./ -O2 -g   -c -o main.o main.c
gcc -B./ -O2 -g -flto   -c -o foo1.o foo1.c
gcc -B./  -o x main.o foo1.o libfoo.a
gcc -B./  -fuse-ld=gold -o y main.o foo1.o libfoo.a
./x
Non-LTO
./y
LTO
[hjl@gnu-6 test]$ 

I am not sure if ld's behavior is intentional or not.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to