This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Changed behaviour of --as-needed


Given the following files:

$ cat liba.c
extern double log (double);

int a (double b) { return log (b); }
$ cat main.c
extern int a (double);

int main (void)
{
  a (1.0);
  return 0;
}
$ gcc -o liba.so -shared liba.c

Note that liba.so is not linked against -lm.  Now when trying to link them
together while using --as-needed, I get an undefined references:

$ gcc main.o liba.so -Wl,-as-needed -lm
liba.so: undefined reference to `log'

This is a side effect of the patch for PR 2434.  Is this the intended
behaviour?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]