[lld] [LLD, MachO] Default objc_relative_method_lists on MacOS11+/iOS14+ (PR #101360)

Peter Rong via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 12:02:28 PDT 2024


================
@@ -1140,12 +1140,20 @@ static bool shouldEmitRelativeMethodLists(const InputArgList &args) {
   if (arg && arg->getOption().getID() == OPT_no_objc_relative_method_lists)
     return false;
 
-  // TODO: If no flag is specified, don't default to false, but instead:
-  //   - default false on   <   ios14
-  //   - default true  on   >=  ios14
-  // For now, until this feature is confirmed stable, default to false if no
-  // flag is explicitly specified
-  return false;
+  // If no flag is specified:
+  //   - default true  on   >=  ios14/macos11
+  //   - default false on everything else
+  switch (config->platformInfo.target.Platform) {
+  case PLATFORM_IOS:
+  case PLATFORM_IOSSIMULATOR:
+    return config->platformInfo.target.MinDeployment >= VersionTuple(14, 0);
+  case PLATFORM_MACOS:
+    return config->platformInfo.target.MinDeployment >= VersionTuple(11, 0);
+  default:
+    return false;
+  };
----------------
DataCorrupted wrote:

I can definitely add those platforms as well. 

But can you shed more light how to special case x86 like the code [you mentioned](https://github.com/apple-oss-distributions/ld64/blob/47f477cb721755419018f7530038b272e9d0cdea/src/ld/Options.cpp#L6085-L6101)?

I don't find equivalence of `Options::kDynamicExecutable` in LLVM yet, only `MH_EXECUTE`.

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


More information about the llvm-commits mailing list