When a flags requires another flag (for example clang -fwhole-program-vtables requires -flto) it gets stripped even if the requirement is met. This happens because each flag is tested independently. Maybe the easiest way to fix it is by patching the compiler to just ignore those flags when the requirement is not met (or emit a warning instead of an error).