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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 09:20:49 PST 2017


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:1843
+                       ? FileOutputBuffer::F_executable
+                       : 0;
   Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
----------------
grimar wrote:
> I believe LLD style avoids using ternary operator where possible.
> So I see this code better as:
> ```
> unsigned Flags = FileOutputBuffer::F_executable;
> if (Config->Relocatable || Config->Shared)
>   Flags = 0;
> 
> ```
Yeah, sort of. I learned this style from Go. I'd prefer defaulting to 0 and re-setting F_executable though.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41041





More information about the llvm-commits mailing list