diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6170,7 +6170,13 @@ Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden_static_local_var, options::OPT_fno_visibility_inlines_hidden_static_local_var); Args.AddLastArg(CmdArgs, options::OPT_fvisibility_global_new_delete_hidden); - Args.AddLastArg(CmdArgs, options::OPT_ftlsmodel_EQ); + if (Triple.isOSSerenity()) { + StringRef tls_model = + Args.getLastArgValue(options::OPT_ftlsmodel_EQ, "initial-exec"); + CmdArgs.push_back(Args.MakeArgString("-ftls-model=" + tls_model)); + } else { + Args.AddLastArg(CmdArgs, options::OPT_ftlsmodel_EQ); + } if (Args.hasFlag(options::OPT_fnew_infallible, options::OPT_fno_new_infallible, false))