http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61043
--- Comment #2 from andysem at mail dot ru --- (In reply to Andi Kleen from comment #1) > Yes LTO doesn't support different options for different files, and combines > some of them (which happens in your case) and ignores some others. > > You could use tag the functions in the different file with > > __attribute__(target("...")) > > This will also allow automatic switching. > > Arguably gcc should do this automatically for LTO, but unfortunately it > doesn't Unfortunately, gcc does not allow using SIMD intrinsics if not enabled by compiler switches, so leaving the compiler options for a generic target CPU wouldn't work. At least that is the case with gcc 4.8. > Or alternatively don't compile the file that needs the changed options with > LTO Yes, I'm currently not using LTO in my real world project that exhibits this problem. But users of my project would like to enable LTO, and currently this silently produces incorrect binaries. The purpose of this ticket is to indicate the problem and suggest a possible solution (automatically marking each function in every translation unit with the target options).