<div dir="ltr">So, why? The fact that X could do Y doesn't mean that we should make X do Y.<div><br></div><div>MachO actually uses this as a bitmap to check if an atom has RW bits set. If you make this non-bitmask, you'd have to do (perm == RW || perm == RWX || perm == RWXL) instead of ((perm & RW) == RW). And even worse, you'd have to update the statement every time you add a new permission to your enum.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 6, 2015 at 12:18 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
The permission enums in the DefinedAtom could no more be a bitmask.<br>
<br>
The writer could create a map of the enum variables to the exact bit representation that the format cares about.<span class="HOEnZb"><font color="#888888"><br>
<br>
Shankar Easwaran</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 2/6/2015 1:41 PM, Rui Ueyama wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't get it. What do you mean by "all permissions map need to be done in<br>
the writer"? Is that related to making the permission enums non-bitmask?<br>
<br>
On Fri, Feb 6, 2015 at 6:58 AM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>><br>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Reverted this patch. I think all the permissions map need to be done in<br>
the writer.<br>
<br>
<br>
On 2/5/2015 11:48 PM, Rui Ueyama wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This needed a pre-commit review. Obviously they are bitmasks just like<br>
Unix<br>
file permission. Not sure we want to lose that characteristic.<br>
<br>
On Thu, Feb 5, 2015 at 9:29 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a><br>
wrote:<br>
<br>
  Author: shankare<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Date: Thu Feb  5 23:29:49 2015<br>
New Revision: 228381<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228381&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=228381&view=rev</a><br>
Log:<br>
[Core] Update ContentPermissions<br>
<br>
The values are already arranged in ascending order, and all tests still<br>
pass.<br>
<br>
Removing the values as its confusing when new enumerations need to be<br>
added.<br>
<br>
Modified:<br>
      lld/trunk/include/lld/Core/<u></u>DefinedAtom.h<br>
<br>
Modified: lld/trunk/include/lld/Core/<u></u>DefinedAtom.h<br>
URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/include/lld/</a><br>
Core/DefinedAtom.h?rev=228381&<u></u>r1=228380&r2=228381&view=diff<br>
<br>
==============================<u></u>==============================<br>
==================<br>
--- lld/trunk/include/lld/Core/<u></u>DefinedAtom.h (original)<br>
+++ lld/trunk/include/lld/Core/<u></u>DefinedAtom.h Thu Feb  5 23:29:49 2015<br>
@@ -157,14 +157,14 @@ public:<br>
     // important, because the layout pass may sort atoms by permission if<br>
other<br>
     // attributes are the same.<br>
     enum ContentPermissions {<br>
-    perm___  = 0,           // mapped as unaccessible<br>
-    permR__  = 8,           // mapped read-only<br>
-    permRW_  = 8 + 2,       // mapped readable and writable<br>
-    permRW_L = 8 + 2 + 1,   // initially mapped r/w, then made read-only<br>
-                            // loader writable<br>
-    permR_X  = 8 + 4,       // mapped readable and executable<br>
-    permRWX  = 8 + 2 + 4,   // mapped readable and writable and<br>
executable<br>
-    permUnknown = 16        // unknown or invalid permissions<br>
+    perm___,           // mapped as unaccessible<br>
+    permR__,           // mapped read-only<br>
+    permRW_,           // mapped readable and writable<br>
+    permRW_L,           // initially mapped r/w, then made read-only<br>
+                        // loader writable<br>
+    permR_X,            // mapped readable and executable<br>
+    permRWX,            // mapped readable and writable and executable<br>
+    permUnknown         // unknown or invalid permissions<br>
     };<br>
<br>
     enum SectionChoice {<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
<br>
<br>
</blockquote></blockquote>
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br>
<br>
</blockquote></blockquote>
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</div></div></blockquote></div><br></div>