if we return nullptr for a "noexec" section, then don't change section.
authorespie <espie@openbsd.org>
Wed, 28 Jun 2017 07:37:38 +0000 (07:37 +0000)
committerespie <espie@openbsd.org>
Wed, 28 Jun 2017 07:37:38 +0000 (07:37 +0000)
prevents core dumps :)

okay tedu@

gnu/llvm/lib/MC/MCELFStreamer.cpp

index 0ef1b2a..fd0e345 100644 (file)
@@ -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) {