"H.J. Lu" <hjl.to...@gmail.com> writes: > How do you deal with -lm:
I believe we have agreed that LTO can only introduce new symbol references that are satisfied by -lc and -lgcc. Under those conditions, I believe my proposal will work just fine. Again, my proposal is this: I propose that we add a new linker option: --plugin-callback. At each point where this option appears on the command line, the linker will call a new plugin callback entry point. The LTO plugin will replace the all_symbols_read callback with this one. We will have the gcc driver run the linker more or less like this: object-files -lc -lgcc --plugin-callback -lc -lgcc crtend.o crtn.o So if the user runs something like gcc -o foo foo.o -lm -flto gcc will execute something like ld crt1.o crti.o crtbegin.o foo.o -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --plugin-callback -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o Why would that not work? Ian