[ELF] - Simplify. NFC.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 23 Mar 2018 14:43:51 +0000 (14:43 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 23 Mar 2018 14:43:51 +0000 (14:43 +0000)
llvm-svn: 328319

lld/ELF/Writer.cpp

index 99ce1c7ce79606264ad5769eb0e3eed6c521f9af..ffa29209e33ab37e0949be6ba58410b82d7ae6c4 100644 (file)
@@ -1757,11 +1757,9 @@ template <class ELFT> std::vector<PhdrEntry *> Writer<ELFT>::createPhdrs() {
   // 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