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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 09:23:29 PST 2017


On Sun, Dec 10, 2017 at 11:04 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Both bfd and gold mark .so executable actually.
>

Do you know why they do that?


> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171211/d04104ee/attachment.html>


More information about the llvm-commits mailing list