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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 10 11:04:52 PST 2017


Both bfd and gold mark .so executable actually.

This needs a test.

Cheers,
Rafael

Petr Hosek via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:

> 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 + ": " +
>
>
> 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 + ": " +
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list