[llvm] r257962 - [WebAssembly] Don't create a needless .note.GNU-stack section
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 15:59:14 PST 2016
Author: djg
Date: Fri Jan 15 17:59:13 2016
New Revision: 257962
URL: http://llvm.org/viewvc/llvm-project?rev=257962&view=rev
Log:
[WebAssembly] Don't create a needless .note.GNU-stack section
WebAssembly's stack will never be executable by default, so it isn't
necessary to declare .note.GNU-stack sections to request a non-executable
stack.
Differential Revision: http://reviews.llvm.org/D15969
Added:
llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfoELF.h
llvm/trunk/lib/MC/MCAsmInfoELF.cpp
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
Modified: llvm/trunk/include/llvm/MC/MCAsmInfoELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfoELF.h?rev=257962&r1=257961&r2=257962&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfoELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfoELF.h Fri Jan 15 17:59:13 2016
@@ -18,6 +18,10 @@ class MCAsmInfoELF : public MCAsmInfo {
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();
};
}
Modified: llvm/trunk/lib/MC/MCAsmInfoELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoELF.cpp?rev=257962&r1=257961&r2=257962&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoELF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoELF.cpp Fri Jan 15 17:59:13 2016
@@ -21,6 +21,8 @@ using namespace llvm;
void MCAsmInfoELF::anchor() { }
MCSection *MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
+ if (!UsesNonexecutableStackSection)
+ return nullptr;
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0);
}
@@ -29,4 +31,5 @@ MCAsmInfoELF::MCAsmInfoELF() {
WeakRefDirective = "\t.weak\t";
PrivateGlobalPrefix = ".L";
PrivateLabelPrefix = ".L";
+ UsesNonexecutableStackSection = true;
}
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp?rev=257962&r1=257961&r2=257962&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp Fri Jan 15 17:59:13 2016
@@ -48,4 +48,7 @@ WebAssemblyMCAsmInfo::WebAssemblyMCAsmIn
ExceptionsType = ExceptionHandling::None;
// TODO: UseIntegratedAssembler?
+
+ // WebAssembly's stack is never executable.
+ UsesNonexecutableStackSection = false;
}
Added: llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll?rev=257962&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll (added)
+++ llvm/trunk/test/CodeGen/WebAssembly/non-executable-stack.ll Fri Jan 15 17:59:13 2016
@@ -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
More information about the llvm-commits
mailing list