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

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 16:52:53 PST 2017


phosek created this revision.
Herald added a subscriber: emaste.

Relocatable files are object not executable files.


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,9 @@
   }
 
   unlinkAsync(Config->OutputFile);
+  unsigned Flags = Config->Relocatable ? 0 : FileOutputBuffer::F_executable;
   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.126244.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171209/4645126d/attachment.bin>


More information about the llvm-commits mailing list