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

Daniel Bertalan via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 11:33:51 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;
+  };
----------------
BertalanD wrote:

Is there a reason we can't enable it for the other platforms?

See for example what we do for chained fixups (which based on my understanding was basically introduced alongside this feature):
https://github.com/llvm/llvm-project/blob/0512ba0a435a9d693cb61f182fc9e3eb7f6dbd6a/lld/MachO/Driver.cpp#L1109-L1132

Looks like ld64 special-cases x86, but other than that, the `version2020Fall` condition covers watchOS, tvOS and friends as well.

 https://github.com/apple-oss-distributions/ld64/blob/47f477cb721755419018f7530038b272e9d0cdea/src/ld/Options.cpp#L6085-L6101

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


More information about the llvm-commits mailing list