Skip to content

Commit

Permalink
[llvm-mc] --no-exec-stack: replace initSection with switchSection. NFC
Browse files Browse the repository at this point in the history
AsmParser will call initSection unless -n is specified.
It is not good to call initSection twice.
  • Loading branch information
MaskRay committed Dec 19, 2024
1 parent 296c294 commit a3bf873
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions llvm/test/MC/ELF/noexec.s
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
// CHECK-NEXT: AddressAlignment: 1
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: }
nop
2 changes: 1 addition & 1 deletion llvm/tools/llvm-mc/llvm-mc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ int main(int argc, char **argv) {
: MAB->createObjectWriter(*OS),
std::unique_ptr<MCCodeEmitter>(CE), *STI));
if (NoExecStack)
Str->initSections(true, *STI);
Str->switchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
Str->emitVersionForTarget(TheTriple, VersionTuple(), nullptr,
VersionTuple());
}
Expand Down

0 comments on commit a3bf873

Please sign in to comment.