[lld] r328319 - [ELF] - Simplify. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 23 07:43:52 PDT 2018


Author: grimar
Date: Fri Mar 23 07:43:51 2018
New Revision: 328319

URL: http://llvm.org/viewvc/llvm-project?rev=328319&view=rev
Log:
[ELF] - Simplify. NFC.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=328319&r1=328318&r2=328319&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Mar 23 07:43:51 2018
@@ -1757,11 +1757,9 @@ template <class ELFT> std::vector<PhdrEn
   // pages for the stack non-executable. If you really want an executable
   // stack, you can pass -z execstack, but that's not recommended for
   // security reasons.
-  unsigned Perm;
+  unsigned Perm = PF_R | PF_W;
   if (Config->ZExecstack)
-    Perm = PF_R | PF_W | PF_X;
-  else
-    Perm = PF_R | PF_W;
+    Perm |= PF_X;
   AddHdr(PT_GNU_STACK, Perm)->p_memsz = Config->ZStackSize;
 
   // PT_OPENBSD_WXNEEDED is a OpenBSD-specific header to mark the executable




More information about the llvm-commits mailing list