https://sourceware.org/bugzilla/show_bug.cgi?id=21382
Bug ID: 21382 Summary: --as-needed cannot be combined with -flto Product: binutils Version: 2.29 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: dilyan.palauzov at aegee dot org Target Milestone: --- Created attachment 9991 --> https://sourceware.org/bugzilla/attachment.cgi?id=9991&action=edit Sample With the attached package I do ./configure and make clean && make LDFLAGS="-Wl,--as-needed" && ./m -- works, prints x make clean && CFLAGS="-flto" make && ./m -- works, prints x make clean && make CFLAGS="-flto" LDFLAGS="-Wl,--as-needed" && ./m -- does not work, prints x-0.libs/lt-m: symbol lookup error: x-0/.libs/libx.so.0: undefined symbol: x Why doesn't --as-needed work with LTO? It happens when I use GNU ld (GNU Binutils) 2.28.51.20170411 with either GCC 7.0.1 20170411 or GCC 6.3.1 20170329. As of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80407 it is not gcc bug and does not happen with gold. -- 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