bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/12557] --as-needed doesn't work with g++


From: hjl.tools at gmail dot com
Subject: [Bug ld/12557] --as-needed doesn't work with g++
Date: Fri, 11 Mar 2011 18:36:43 +0000

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 ---
address@hidden pr12557]$ cat x.c
int x = 20;
address@hidden pr12557]$ cat foo.c
#include <stdio.h>

extern int x;

void
foo ()
{
  printf ("%d\n", x);
}
address@hidden pr12557]$ cat main.c
extern void foo ();

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



reply via email to

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