http://sourceware.org/bugzilla/show_bug.cgi?id=12942

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |amodra at gmail dot com
            Version|unspecified                 |2.22 (HEAD)

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2011-06-28 17:29:31 
UTC ---
Here is the real testcase:

[hjl@gnu-6 pr12942]$ cat a.h 
extern void link_error ();

inline int test (void)
{
  int exp = -1;
  if ((exp < 2 ? 2U : (unsigned int) exp) != 2)
    link_error ();

  return 0;
}

typedef int (*test_t) (void);
[hjl@gnu-6 pr12942]$ cat a.cc
#include "a.h"
extern "C" void abort ();

test_t b(void);

int
main(void)
{
  if (test != b ())
    abort ();
}
[hjl@gnu-6 pr12942]$ cat b.cc
#include <stdio.h>
#include "a.h"

test_t b(void)
{
  return test;
}
[hjl@gnu-6 pr12942]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/../../release/usr/gcc-4.7.0/bin/g++
-flto    -c -o a.o a.cc
/export/build/gnu/gcc/build-x86_64-linux/gcc/../../release/usr/gcc-4.7.0/bin/g++
   -c -o b.o b.cc
/export/build/gnu/gcc/build-x86_64-linux/gcc/../../release/usr/gcc-4.7.0/bin/g++
-O2 -flto -fuse-linker-plugin -B./ -o x a.o b.o
b.o: In function `test()':
b.cc:(.text._Z4testv[test()]+0x16): undefined reference to `link_error()'
collect2: error: ld returned 1 exit status
make: *** [x] Error 1
[hjl@gnu-6 pr12942]$ 

Gold works fine.  The problem is BFD linker failed to pick the
correct definition.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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