Skip to content

Commit a3bf873

Browse files
committed
[llvm-mc] --no-exec-stack: replace initSection with switchSection. NFC
AsmParser will call initSection unless -n is specified. It is not good to call initSection twice.
1 parent 296c294 commit a3bf873

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/test/MC/ELF/noexec.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
// CHECK-NEXT: AddressAlignment: 1
1515
// CHECK-NEXT: EntrySize: 0
1616
// CHECK-NEXT: }
17+
nop

llvm/tools/llvm-mc/llvm-mc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ int main(int argc, char **argv) {
569569
: MAB->createObjectWriter(*OS),
570570
std::unique_ptr<MCCodeEmitter>(CE), *STI));
571571
if (NoExecStack)
572-
Str->initSections(true, *STI);
572+
Str->switchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
573573
Str->emitVersionForTarget(TheTriple, VersionTuple(), nullptr,
574574
VersionTuple());
575575
}

0 commit comments

Comments
 (0)