Index: clang/lib/Frontend/CompilerInvocation.cpp
--- clang/lib/Frontend/CompilerInvocation.cpp.orig
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1765,6 +1765,10 @@ void CompilerInvocationBase::GenerateCodeGenArgs(const
                 F.Filename);
   }
 
+  if (Opts.ReturnProtector) {
+    GenerateArg(Consumer, OPT_ret_protector);
+  }
+
   if (Opts.EmulatedTLS)
     GenerateArg(Consumer, OPT_femulated_tls);
 
@@ -2146,6 +2150,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptio
     }
     Opts.LinkBitcodeFiles.push_back(F);
   }
+
+  Opts.ReturnProtector = Args.hasArg(OPT_ret_protector);
 
   if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
     StringRef Val = A->getValue();
