https://sourceware.org/bugzilla/show_bug.cgi?id=26668
Bug ID: 26668 Summary: incremental linking of LTO and non-LTO objects always warns Product: binutils Version: 2.35 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: goswin-v-b at web dot de Target Milestone: --- I'm building a temporary library out of LTO and non-LTO object files like this: x86_64-elf-ld -plugin /home/mrvn/cross/libexec/gcc/x86_64-elf/10.2.0/liblto_plugin.so -plugin-opt=/home/mrvn/cross/libexec/gcc/x86_64-elf/10.2.0/lto-wrapper -plugin-opt=-fresolution=kernel/_tmp-y.o.res -T kernel/ldscript -i -o kernel/_tmp-y.o --start-group _empty.c.o kernel/main.cc.lto --end-group and the linker warns: x86_64-elf-ld: warning: incremental linking of LTO and non-LTO objects; using -flinker-output=nolto-rel which will bypass whole program optimization My understanding is that the linker will then optimize all the LTO objects given and produce a non-LTO object file, which is what I want. The library should be optimized internally but should not later optimize with other LTO code outside the library. My problem now is that the warning can not be avoided. I can't tell the linker that nolto-rel is what I want because adding -flinker-output=nolto-rel results in: x86_64-elf-ld: -f may not be used without -shared and adding -shared results in: x86_64-elf-ld: -r and -shared may not be used together Please add a way to specify that nolto-res is the desired behavior. -- You are receiving this mail because: You are on the CC list for the bug.