bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/19842] LTO build fails to write call address for weak symbol r


From: hjl.tools at gmail dot com
Subject: [Bug gold/19842] LTO build fails to write call address for weak symbol reference
Date: Mon, 21 Mar 2016 21:05:27 +0000

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:

address@hidden test]$ cat foo.c
#include <stdio.h>

void foo () __attribute__ ((weak));

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

void
bar ()
{
}
address@hidden test]$ cat foo1.c
#include <stdio.h>

void foo () __attribute__ ((weak));

void
foo ()
{
  printf ("LTO\n");
}
address@hidden test]$ cat main.c
extern void foo ();
extern void bar ();

int
main ()
{
  foo ();
  bar ();
  return 0;
}
address@hidden 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
address@hidden 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]