[PATCH] D15969: [WebAssembly] Don't create a needless .note.GNU-stack section
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 13:37:22 PST 2016
sunfish updated this revision to Diff 45027.
sunfish added a comment.
Use a bool flag that is set by the constructor instead of a virtual function, as requested by Rafael.
Repository:
rL LLVM
http://reviews.llvm.org/D15969
Files:
include/llvm/MC/MCAsmInfoELF.h
lib/MC/MCAsmInfoELF.cpp
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
Index: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
===================================================================
--- lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
+++ lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
@@ -48,4 +48,7 @@
ExceptionsType = ExceptionHandling::None;
// TODO: UseIntegratedAssembler?
+
+ // WebAssembly's stack is never executable.
+ UsesNonexecutableStackSection = false;
}
Index: lib/MC/MCAsmInfoELF.cpp
===================================================================
--- lib/MC/MCAsmInfoELF.cpp
+++ lib/MC/MCAsmInfoELF.cpp
@@ -21,12 +21,15 @@
void MCAsmInfoELF::anchor() { }
MCSection *MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
+ if (!UsesNonexecutableStackSection)
+ return nullptr;
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0);
}
MCAsmInfoELF::MCAsmInfoELF() {
HasIdentDirective = true;
WeakRefDirective = "\t.weak\t";
PrivateGlobalPrefix = ".L";
PrivateLabelPrefix = ".L";
+ UsesNonexecutableStackSection = true;
}
Index: include/llvm/MC/MCAsmInfoELF.h
===================================================================
--- include/llvm/MC/MCAsmInfoELF.h
+++ include/llvm/MC/MCAsmInfoELF.h
@@ -18,6 +18,10 @@
MCSection *getNonexecutableStackSection(MCContext &Ctx) const final;
protected:
+ /// Targets which have non-executable stacks by default can set this to false
+ /// to disable the special section which requests a non-executable stack.
+ bool UsesNonexecutableStackSection;
+
MCAsmInfoELF();
};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15969.45027.patch
Type: text/x-patch
Size: 1592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160115/74cfc86b/attachment.bin>
More information about the llvm-commits
mailing list