Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -3319,8 +3319,11 @@ if (SanArgs.linkCXXRuntimes()) StaticRuntimes.push_back("ubsan_standalone_cxx"); } - if (SanArgs.needsSafeStackRt()) + if (SanArgs.needsSafeStackRt()) { StaticRuntimes.push_back("safestack"); + if (Args.hasFlag(options::OPT_mseparate_stack_seg, options::OPT_mno_separate_stack_seg, false)) + StaticRuntimes.push_back("safestacksepseg"); + } if (SanArgs.needsCfiRt()) StaticRuntimes.push_back("cfi"); if (SanArgs.needsCfiDiagRt()) {