Simplify handling of --noexecstack by using getNonexecutableStackSection.
[oota-llvm.git] / tools / llvm-mc / llvm-mc.cpp
index 61d1d9960d028491ccaa9bab4a3848b375318324..5da9e8662353bd9bb8220754da072b09f6f9a2b5 100644 (file)
@@ -471,9 +471,10 @@ int main(int argc, char **argv) {
     assert(FileType == OFT_ObjectFile && "Invalid file type!");
     MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
     MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
-    Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB,
-                                                FOS, CE, *STI, RelaxAll,
-                                                NoExecStack));
+    Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB, FOS, CE,
+                                                *STI, RelaxAll));
+    if (NoExecStack)
+      Str->InitSections(true);
   }
 
   int Res = 1;