[PATCH] D41041: [ELF] Don't set the executable bit for relocatable or shared files

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 17:46:30 PST 2017


phosek updated this revision to Diff 126253.
phosek retitled this revision from "[ELF] Don't set the executable bit for relocatable files" to "[ELF] Don't set the executable bit for relocatable or shared files".
phosek edited the summary of this revision.
phosek added a comment.

True, that's a good point.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41041

Files:
  ELF/Writer.cpp


Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -1838,9 +1838,11 @@
   }
 
   unlinkAsync(Config->OutputFile);
+  unsigned Flags = !Config->Relocatable && !Config->Shared
+                       ? FileOutputBuffer::F_executable
+                       : 0;
   Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
-      FileOutputBuffer::create(Config->OutputFile, FileSize,
-                               FileOutputBuffer::F_executable);
+      FileOutputBuffer::create(Config->OutputFile, FileSize, Flags);
 
   if (!BufferOrErr)
     error("failed to open " + Config->OutputFile + ": " +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41041.126253.patch
Type: text/x-patch
Size: 680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171209/93401ecc/attachment.bin>


More information about the llvm-commits mailing list