$OpenBSD: patch-lib_MC_MCELFStreamer_cpp,v 1.2 2020/03/25 06:16:30 rsadowski Exp $

Index: lib/MC/MCELFStreamer.cpp
--- lib/MC/MCELFStreamer.cpp.orig
+++ lib/MC/MCELFStreamer.cpp
@@ -93,8 +93,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, SMLoc Loc) {
