https://sourceware.org/bugzilla/show_bug.cgi?id=21702
Bug ID: 21702 Summary: MinGW ar cannot handle LTO object files when in MRI script mode Product: binutils Version: 2.28 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: spam.martin.schulze at gmx dot de Target Milestone: --- Created attachment 10239 --> https://sourceware.org/bugzilla/attachment.cgi?id=10239&action=edit Example project that exhibits the problem This problem turned up while cross-compiling Qt 5.9.0 with LTO enabled. ar gives the error "plugin needed to handle lto object" and generates an output file which results in undefined reference errors when linked. You can reproduce this by running make in the attached project tree. (Obviously you need x86_64-w64-mingw32-{ar,gcc} for this to work.) The run will result in the aformentioned errors instead of a successfully built binary. The output is as follows: $ make x86_64-w64-mingw32-gcc -c -flto -o func.o func.c x86_64-w64-mingw32-ar -M < mri_script x86_64-w64-mingw32-ar: func.o: plugin needed to handle lto object x86_64-w64-mingw32-gcc -flto main.c -o main -L. -lfunc /tmp/cc7mkhTU.ltrans0.ltrans.o:<artificial>:(.text+0x1b): undefined reference to `func' /tmp/cc7mkhTU.ltrans0.ltrans.o:<artificial>:(.text+0x22): undefined reference to `func2' I also added a make target main.non-mri that uses command line parameters for ar instead of the mri script. This invocation works as expected and builts an executable that can be run via wine. Additional Information: I am running this on Arch Linux 64bit: $ x86_64-w64-mingw32-ar --version GNU ar (GNU Binutils) 2.28 I did not post this on MinGW bugtracker as they seem to only handle bugs under Windows and this is a cross-compilation problem. I also decided against the GCC bugtracker as this seems to be a problem with the archiver. -- 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