[PATCH] D32399: [LLD] Order writable executable sections before writable ones

Mark Kettenis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 14:23:50 PDT 2017


kettenis added inline comments.


================
Comment at: lld/ELF/Writer.cpp:698
     if (AIsExec != BIsExec)
-      return BIsExec;
+      return (A->Flags & SHF_WRITE) ? AIsExec : BIsExec;
   }
----------------
ruiu wrote:
> Is there any problem if you just return `AIsExec`?
Yes.  Then read-only executable sections would be sorted before read-only sections, which is not what we want.  Basically the current ordering is:

R
RX
RW <- contains .bss
RWX

I propose we change this to

R
RX
RWX
RW <- contains .bss



https://reviews.llvm.org/D32399





More information about the llvm-commits mailing list