[lld] [lld/mac] Allow -segprot having stricter initprot than maxprot on mac (PR #107269)

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 09:29:11 PDT 2024


================
@@ -1882,9 +1882,20 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
     StringRef segName = arg->getValue(0);
     uint32_t maxProt = parseProtection(arg->getValue(1));
     uint32_t initProt = parseProtection(arg->getValue(2));
-    if (maxProt != initProt && config->arch() != AK_i386)
-      error("invalid argument '" + arg->getAsString(args) +
-            "': max and init must be the same for non-i386 archs");
+
+    bool allowsDifferentInitAndMaxProt =
+        config->platform() == PLATFORM_MACOS ||
+        config->platform() == PLATFORM_MACCATALYST;
----------------
nico wrote:

Sure, added a comment. Thanks!

https://github.com/llvm/llvm-project/pull/107269


More information about the llvm-commits mailing list