From 0db736d815ee5360cb95d2dafe35f5cc51193a62 Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 28 Jun 2017 07:37:38 +0000 Subject: [PATCH] if we return nullptr for a "noexec" section, then don't change section. prevents core dumps :) okay tedu@ --- gnu/llvm/lib/MC/MCELFStreamer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) { -- 2.20.1