https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61967
Bug ID: 61967 Summary: regression: cannot link with -flto Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: dilyan.palauzov at aegee dot org I download tar-1.28 from ftp.gnu.org , and ./configure with CFLAGS='-pipe -O3 -flto -Wl,-S -Wl,--hash-style=gnu -Wl,-O1 -Wl,-z,relro' If I compile and link with gcc483, everything is fine, but with gcc491 I get: Making all in rmt make[2]: Entering directory '/mnt/new/src/tar-1.28/rmt' gcc -std=gnu99 -pipe -O3 -flto -Wl,-S -Wl,--hash-style=gnu -Wl,-O1 -Wl,-z,relro -L/usr/lib64 -L/lib64 -o rmt rmt.o ../gnu/libgnu.a /tmp/ccOs1raW.ltrans0.ltrans.o: In function `close_device': ccOs1raW.ltrans0.o:(.text+0x3b4): undefined reference to `umaxtostr' /tmp/ccOs1raW.ltrans0.ltrans.o: In function `main': ccOs1raW.ltrans0.o:(.text.startup+0x1a): undefined reference to `set_program_name' ccOs1raW.ltrans0.o:(.text.startup+0x29): undefined reference to `argp_version_setup' ccOs1raW.ltrans0.o:(.text.startup+0x1c4): undefined reference to `umaxtostr' ccOs1raW.ltrans0.o:(.text.startup+0x1e7): undefined reference to `full_write' ccOs1raW.ltrans0.o:(.text.startup+0x245): undefined reference to `safe_read' ccOs1raW.ltrans0.o:(.text.startup+0x25f): undefined reference to `umaxtostr' ccOs1raW.ltrans0.o:(.text.startup+0x282): undefined reference to `full_write' ccOs1raW.ltrans0.o:(.text.startup+0x295): undefined reference to `xstrdup' ccOs1raW.ltrans0.o:(.text.startup+0x3f8): undefined reference to `umaxtostr' ccOs1raW.ltrans0.o:(.text.startup+0x7cc): undefined reference to `umaxtostr' ccOs1raW.ltrans0.o:(.text.startup+0x860): undefined reference to `full_write' ccOs1raW.ltrans0.o:(.text.startup+0x89a): undefined reference to `xrealloc' ccOs1raW.ltrans0.o:(.text.startup+0x8c6): undefined reference to `xrealloc' collect2: error: ld returned 1 exit status Makefile:1266: recipe for target 'rmt' failed make[2]: *** [rmt] Error 1 make[2]: Leaving directory '/mnt/new/src/tar-1.28/rmt' Makefile:1348: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/mnt/new/src/tar-1.28' Makefile:1287: recipe for target 'all' failed make: *** [all] Error 2 Removing -flto leads to successful compilation.