https://sourceware.org/bugzilla/show_bug.cgi?id=26806
Bug ID: 26806 Summary: Suspected linker bug with LTO Product: binutils Version: 2.35 Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: jakub at redhat dot com Target Milestone: --- #include <unistd.h> int foo (int x) { if (__builtin_constant_p (x)) return getpid (); return 0; } compiled with gcc -shared -fpic -O2 -flto -o testpid.so testpid.c nm testpid.so | grep getpid; nm -D testpid.so | grep getpid shows getpid@@GLIBC_2.2.5 in both symbol tables when linked with binutils 2.35 and none when linked with binutils 2.31.1. As the ltrans assembly file lto1 emits doesn't contain any references to getpid, i.e. getpid as undefined symbol is there before IPA optimizations and later optimized away, it doesn't seem like a GCC bug (unless it is a linker plugin bug, but then, the same linker plugin works fine against older linker). https://bugzilla.redhat.com/show_bug.cgi?id=1889763 contains another testcase (even more important one, where because of this the link is rejected, as the symbol kept in symbol table that really shouldn't be there gets an linker error (__open*_missing_mode). -- You are receiving this mail because: You are on the CC list for the bug.