Skip to content

Commit 95eeb64

Browse files
committed
clang: Driver/tools.cpp: Add -lssp_nonshared on musl
musl driver will need to add ssp_nonshared for stack_check_local on the linker cmdline when using stack protector commands on compiler cmdline Upstream-Status: Pending Signed-off-by: Khem Raj <[email protected]>
1 parent 4e9440a commit 95eeb64

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
539539
if (IsIAMCU)
540540
CmdArgs.push_back("-lgloss");
541541

542+
if (ToolChain.getTriple().isMusl() &&
543+
(Args.hasArg(options::OPT_fstack_protector) ||
544+
Args.hasArg(options::OPT_fstack_protector_strong) ||
545+
Args.hasArg(options::OPT_fstack_protector_all))) {
546+
CmdArgs.push_back("-lssp_nonshared");
547+
}
542548
if (IsStatic || IsStaticPIE)
543549
CmdArgs.push_back("--end-group");
544550
else

0 commit comments

Comments
 (0)