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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Firefox fails to build with |--as-needed doesn't work
                   |-flto and --as-needed       |with g++
                   |LDFLAGS                     |

--- Comment #19 from H.J. Lu <hjl.tools at gmail dot com> 2011-03-11 18:36:35 
UTC ---
[hjl@gnu-6 pr12557]$ cat x.c
int x = 20;
[hjl@gnu-6 pr12557]$ cat foo.c
#include <stdio.h>

extern int x;

void
foo ()
{
  printf ("%d\n", x);
}
[hjl@gnu-6 pr12557]$ cat main.c
extern void foo ();

int
main ()
{
  foo ();
  return 0;
}
[hjl@gnu-6 pr12557]$ make
g++  -shared -fPIC -o libx.so x.c
g++  -shared -fPIC -o libfoo.so foo.c libx.so
g++  -Wl,--as-needed -o x main.o -L. -lfoo -lx -Wl,-R,.
main.o: In function `main':
main.c:(.text+0xa): undefined reference to `foo'
collect2: ld returned 1 exit status
make: *** [x] Error 1
[hjl@gnu-6 pr12557]$

-- 
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
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to