From: espie Date: Wed, 28 Jun 2017 07:37:38 +0000 (+0000) Subject: if we return nullptr for a "noexec" section, then don't change section. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0db736d815ee5360cb95d2dafe35f5cc51193a62;p=openbsd if we return nullptr for a "noexec" section, then don't change section. prevents core dumps :) okay tedu@ --- diff --git a/gnu/llvm/lib/MC/MCELFStreamer.cpp b/gnu/llvm/lib/MC/MCELFStreamer.cpp index 0ef1b2a8bdc..fd0e3452071 100644 --- a/gnu/llvm/lib/MC/MCELFStreamer.cpp +++ b/gnu/llvm/lib/MC/MCELFStreamer.cpp @@ -91,8 +91,11 @@ void MCELFStreamer::InitSections(bool NoExecStack) { SwitchSection(Ctx.getObjectFileInfo()->getTextSection()); EmitCodeAlignment(4); - if (NoExecStack) - SwitchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx)); + if (NoExecStack) { + MCSection *s = Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx); + if (s) + SwitchSection(s); + } } void MCELFStreamer::EmitLabel(MCSymbol *S) {