[PATCH] D119612: [clang] Pass more flags to ld64.lld

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 16 07:23:42 PST 2022


thakis added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:272
 
-  // ld64 version 262 and above run the deduplicate pass by default.
-  if (Version >= VersionTuple(262) && shouldLinkerNotDedup(C.getJobs().empty(), Args))
+  // ld64 version 262 and above and lld run the deduplicate pass by default.
+  if ((Version >= VersionTuple(262) || LinkerIsLLD) &&
----------------
MaskRay wrote:
> lld runs `--icf=none` (i.e. `-no_deduplicate`) by default.
Hm, good point. Should we pass `--icf=safe` for lld if `!shouldLinkerNotDedup` here then?


================
Comment at: clang/test/Driver/darwin-ld-dedup.c:4
+// -no_deduplicate is only present from ld64 version 262 and later, or lld.
+// RUN: %clang -target x86_64-apple-darwin10 -### -fuse-ld= %s \
 // RUN:   -mlinker-version=261 -O0 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s
----------------
MaskRay wrote:
> If you are going to change the command line, prefer the canonical `--target=` to the legacy `-target `.
"legacy" really has no semantic meaning here other than "I like that other spelling more". It's not like we're ever going to remove `-target`, it's way too actively used (see e.g. D119446 :P).

It seems like a change unrelated to what this patch is doing. If we want to change it, we can do it in a separate patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119612/new/

https://reviews.llvm.org/D119612



More information about the cfe-commits mailing list