[PATCH] D15969: [WebAssembly] Don't create a needless .note.GNU-stack section
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 16:03:00 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL257962: [WebAssembly] Don't create a needless .note.GNU-stack section (authored by djg).
Changed prior to commit:
http://reviews.llvm.org/D15969?vs=45027&id=45048#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15969
Files:
llvm/trunk/include/llvm/MC/MCAsmInfoELF.h
llvm/trunk/lib/MC/MCAsmInfoELF.cpp
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll
Index: llvm/trunk/include/llvm/MC/MCAsmInfoELF.h
===================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfoELF.h
+++ llvm/trunk/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();
};
}
Index: llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll
===================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll
+++ llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll
@@ -0,0 +1,9 @@
+; RUN: llc < %s -asm-verbose=false | FileCheck %s
+
+; Test that we don't emit anything declaring a non-executable stack,
+; because wasm's stack is always non-executable.
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; CHECK-NOT: .note.GNU-stack
Index: llvm/trunk/lib/MC/MCAsmInfoELF.cpp
===================================================================
--- llvm/trunk/lib/MC/MCAsmInfoELF.cpp
+++ llvm/trunk/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: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
@@ -48,4 +48,7 @@
ExceptionsType = ExceptionHandling::None;
// TODO: UseIntegratedAssembler?
+
+ // WebAssembly's stack is never executable.
+ UsesNonexecutableStackSection = false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15969.45048.patch
Type: text/x-patch
Size: 2275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160116/b8e3d4d9/attachment.bin>
More information about the llvm-commits
mailing list