Index: clang/lib/Frontend/CompilerInvocation.cpp
--- clang/lib/Frontend/CompilerInvocation.cpp.orig
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1527,6 +1527,10 @@ void CompilerInvocation::GenerateCodeGenArgs(
                 F.Filename, SA);
   }
 
+  if (Opts.ReturnProtector) {
+    GenerateArg(Args, OPT_ret_protector, SA);
+  }
+
   if (Opts.EmulatedTLS)
     GenerateArg(Args, OPT_femulated_tls, SA);
 
@@ -1883,6 +1887,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptio
     }
     Opts.LinkBitcodeFiles.push_back(F);
   }
+
+  Opts.ReturnProtector = Args.hasArg(OPT_ret_protector);
 
   if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
     if (T.isOSAIX()) {
