[clang] [dataflow][nfc] Fix u8 string usage with c++20 (PR #84291)
https://github.com/thevinster created https://github.com/llvm/llvm-project/pull/84291 Clang returns an error when compiling this file with c++20 ``` error: ISO C++20 does not permit initialization of char array with UTF-8 string literal ``` It seems like c++20 treats u8strings differently than strings (probably needs char8_t). Make this a string to fix the error. >From 17a6d9dbdb07631b174d89fa2e95f28244e15e8f Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Thu, 7 Mar 2024 01:14:07 -0800 Subject: [PATCH] [dataflow][nfc] Fix u8 string usage with c++20 --- clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp index ff4e18de2c70f1..d9f40d28859f5e 100644 --- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp +++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp @@ -500,7 +500,7 @@ class HTMLLogger : public Logger { for (unsigned I = 0; I < CFG.getNumBlockIDs(); ++I) { std::string Name = blockID(I); // Rightwards arrow, vertical line - char ConvergenceMarker[] = u8"\\n\u2192\u007c"; + char ConvergenceMarker[] = "\\n\u2192\u007c"; if (BlockConverged[I]) Name += ConvergenceMarker; GraphS << " " << blockID(I) << " [id=" << blockID(I) << " label=\"" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[compiler-rt] [clang] [flang] [libc] [lldb] [libcxx] [clang-tools-extra] [llvm] [lld] [lld-macho] Find objects in library search path (PR #78628)
https://github.com/thevinster closed https://github.com/llvm/llvm-project/pull/78628 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects (PR #128157)
https://github.com/thevinster updated https://github.com/llvm/llvm-project/pull/128157 >From 4d44ed82dc822e486aee3620707b463214fb18cb Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 02:04:53 -0800 Subject: [PATCH 1/3] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 +- clang/test/Driver/fat-lto-objects.c| 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1a2299a92c54e..50db1e2f7d509 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -860,7 +860,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const bool IsAMDGCN = Triple.isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver &D = ToolChain.getDriver(); - const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index d9a5ba88ea6d6..691fcbfc72140 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -41,6 +41,9 @@ // CHECK-CC-NOLTO-SAME: -emit-obj // CHECK-CC-NOLTO-NOT: -ffat-lto-objects +/// Disable fat LTO when it is overridden by -fno-fat-lto-objects +// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO + /// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects /// But it should not be there when LTO is disabled w/ -fno-lto // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ >From 6336c91ed91c5605e012aa1fdf669dcf3d0f01ad Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 02:17:55 -0800 Subject: [PATCH 2/3] format --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 50db1e2f7d509..7c931649de3c4 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -860,7 +860,8 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const bool IsAMDGCN = Triple.isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver &D = ToolChain.getDriver(); - const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); + const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, + options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { >From 7ea5fbaba5f0032c997d36fb64ad0b43432f1e8e Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 11:15:35 -0800 Subject: [PATCH 3/3] remove comment --- clang/test/Driver/fat-lto-objects.c | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index 691fcbfc72140..fae64ea7fd1a1 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -41,7 +41,6 @@ // CHECK-CC-NOLTO-SAME: -emit-obj // CHECK-CC-NOLTO-NOT: -ffat-lto-objects -/// Disable fat LTO when it is overridden by -fno-fat-lto-objects // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO /// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects (PR #128157)
https://github.com/thevinster closed https://github.com/llvm/llvm-project/pull/128157 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects (PR #128157)
https://github.com/thevinster updated https://github.com/llvm/llvm-project/pull/128157 >From 4d44ed82dc822e486aee3620707b463214fb18cb Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 02:04:53 -0800 Subject: [PATCH 1/2] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 +- clang/test/Driver/fat-lto-objects.c| 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1a2299a92c54e..50db1e2f7d509 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -860,7 +860,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const bool IsAMDGCN = Triple.isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver &D = ToolChain.getDriver(); - const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index d9a5ba88ea6d6..691fcbfc72140 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -41,6 +41,9 @@ // CHECK-CC-NOLTO-SAME: -emit-obj // CHECK-CC-NOLTO-NOT: -ffat-lto-objects +/// Disable fat LTO when it is overridden by -fno-fat-lto-objects +// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO + /// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects /// But it should not be there when LTO is disabled w/ -fno-lto // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ >From 6336c91ed91c5605e012aa1fdf669dcf3d0f01ad Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 02:17:55 -0800 Subject: [PATCH 2/2] format --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 50db1e2f7d509..7c931649de3c4 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -860,7 +860,8 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const bool IsAMDGCN = Triple.isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver &D = ToolChain.getDriver(); - const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); + const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, + options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects (PR #128157)
https://github.com/thevinster created https://github.com/llvm/llvm-project/pull/128157 For builds that cannot easily modified and enabled with `-ffat-lto-objects`, `-fno-fat-lto-objects` acts as an escape hatch to disable this option (which is standard to how many clang and lld flags are used). >From 4d44ed82dc822e486aee3620707b463214fb18cb Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 02:04:53 -0800 Subject: [PATCH] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 +- clang/test/Driver/fat-lto-objects.c| 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1a2299a92c54e..50db1e2f7d509 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -860,7 +860,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const bool IsAMDGCN = Triple.isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver &D = ToolChain.getDriver(); - const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index d9a5ba88ea6d6..691fcbfc72140 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -41,6 +41,9 @@ // CHECK-CC-NOLTO-SAME: -emit-obj // CHECK-CC-NOLTO-NOT: -ffat-lto-objects +/// Disable fat LTO when it is overridden by -fno-fat-lto-objects +// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO + /// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects /// But it should not be there when LTO is disabled w/ -fno-lto // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects (PR #128157)
https://github.com/thevinster edited https://github.com/llvm/llvm-project/pull/128157 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Allow -fno-fat-lto-objects to override -ffat-lto-objects (PR #128157)
https://github.com/thevinster edited https://github.com/llvm/llvm-project/pull/128157 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Detect LLD linker more reliably (PR #128285)
https://github.com/thevinster updated https://github.com/llvm/llvm-project/pull/128285 >From b8d961acfa2bf17486d63de9481ff46445d6b38f Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 20:33:25 -0800 Subject: [PATCH 1/2] [FatLTO] Detect LLD linker more reliably --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 5 ++--- .../usr/x86_64-unknown-linux-gnu/bin/lld-wrapper | 0 clang/test/Driver/fat-lto-objects.c | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100755 clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 360754bdb3161..4f60287a1142b 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -862,13 +862,12 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const llvm::Triple &Triple = ToolChain.getTriple(); const bool IsOSAIX = Triple.isOSAIX(); const bool IsAMDGCN = Triple.isAMDGCN(); - const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); + StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ); const Driver &D = ToolChain.getDriver(); const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); - if (llvm::sys::path::filename(Linker) != "ld.lld" && - llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { + if (Linker != "lld" && Linker != "lld-link" && !Triple.isOSOpenBSD()) { // Tell the linker to load the plugin. This has to come before // AddLinkerInputs as gold requires -plugin and AIX ld requires -bplugin to // come before any -plugin-opt/-bplugin_opt that -Wl might forward. diff --git a/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper new file mode 100755 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index fae64ea7fd1a1..7b87e2b468886 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -49,5 +49,8 @@ // RUN: -fuse-ld=lld -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ // RUN: -fuse-ld=lld -fno-lto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=NOLTO %s +// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ +// RUN: -fuse-ld=lld --ld-path=%S/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper \ +// RUN: -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s // LTO: "--fat-lto-objects" // NOLTO-NOT: "--fat-lto-objects" >From da36ced7d82588da99d6348cde24062a7efa3c54 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 20:50:05 -0800 Subject: [PATCH 2/2] Make lld-wrapper a symlink to ld.lld --- .../usr/x86_64-unknown-linux-gnu/bin/lld-wrapper | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 12 clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper diff --git a/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper deleted file mode 100755 index e69de29bb2d1d..0 diff --git a/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper new file mode 12 index 0..9b032ee3b3f1d --- /dev/null +++ b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper @@ -0,0 +1 @@ +ld.lld \ No newline at end of file ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Detect LLD linker more reliably (PR #128285)
@@ -862,13 +862,12 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const llvm::Triple &Triple = ToolChain.getTriple(); thevinster wrote: I can restore the original behavior on the linker path plus the additional check on -fuse-ld=. This would at least solve our use case if that's what you're suggesting here. https://github.com/llvm/llvm-project/pull/128285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [FatLTO] Detect LLD linker more reliably (PR #128285)
https://github.com/thevinster updated https://github.com/llvm/llvm-project/pull/128285 >From b8d961acfa2bf17486d63de9481ff46445d6b38f Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 20:33:25 -0800 Subject: [PATCH 1/3] [FatLTO] Detect LLD linker more reliably --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 5 ++--- .../usr/x86_64-unknown-linux-gnu/bin/lld-wrapper | 0 clang/test/Driver/fat-lto-objects.c | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100755 clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 360754bdb3161..4f60287a1142b 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -862,13 +862,12 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const llvm::Triple &Triple = ToolChain.getTriple(); const bool IsOSAIX = Triple.isOSAIX(); const bool IsAMDGCN = Triple.isAMDGCN(); - const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); + StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ); const Driver &D = ToolChain.getDriver(); const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects, options::OPT_fno_fat_lto_objects, false); const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); - if (llvm::sys::path::filename(Linker) != "ld.lld" && - llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) { + if (Linker != "lld" && Linker != "lld-link" && !Triple.isOSOpenBSD()) { // Tell the linker to load the plugin. This has to come before // AddLinkerInputs as gold requires -plugin and AIX ld requires -bplugin to // come before any -plugin-opt/-bplugin_opt that -Wl might forward. diff --git a/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper new file mode 100755 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index fae64ea7fd1a1..7b87e2b468886 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -49,5 +49,8 @@ // RUN: -fuse-ld=lld -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s // RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ // RUN: -fuse-ld=lld -fno-lto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=NOLTO %s +// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \ +// RUN: -fuse-ld=lld --ld-path=%S/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper \ +// RUN: -flto -ffat-lto-objects -### 2>&1 | FileCheck --check-prefix=LTO %s // LTO: "--fat-lto-objects" // NOLTO-NOT: "--fat-lto-objects" >From da36ced7d82588da99d6348cde24062a7efa3c54 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 21 Feb 2025 20:50:05 -0800 Subject: [PATCH 2/3] Make lld-wrapper a symlink to ld.lld --- .../usr/x86_64-unknown-linux-gnu/bin/lld-wrapper | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 12 clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper diff --git a/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper deleted file mode 100755 index e69de29bb2d1d..0 diff --git a/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper new file mode 12 index 0..9b032ee3b3f1d --- /dev/null +++ b/clang/test/Driver/Inputs/basic_cross_linux_tree/usr/x86_64-unknown-linux-gnu/bin/lld-wrapper @@ -0,0 +1 @@ +ld.lld \ No newline at end of file >From b03056a9b7737557e4e5fac6333a93d9c4ff67ec Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Sat, 22 Feb 2025 23:18:20 -0800 Subject: [PATCH 3/3] Recover original lld check --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 4f60287a1142b..b43472a52038b 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -863,11 +863,14 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const bool IsOSAIX = Triple.isOSAIX(); const bool IsAMDGCN = Triple.isAMDGCN(); StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_E
[clang] [FatLTO] Detect LLD linker more reliably (PR #128285)
https://github.com/thevinster closed https://github.com/llvm/llvm-project/pull/128285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)
@@ -294,6 +305,32 @@ ThinBackend createInProcessThinBackend(ThreadPoolStrategy Parallelism, bool ShouldEmitIndexFiles = false, bool ShouldEmitImportsFiles = false); +/// This ThinBackend generates the index shards and then runs the individual +/// backend jobs via an external process. It takes the same parameters as the +/// InProcessThinBackend, however, these parameters only control the behavior +/// when generating the index files for the modules. Addtionally: thevinster wrote: typo: `Addtionally` -> `Additionally`. https://github.com/llvm/llvm-project/pull/126654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)
https://github.com/thevinster commented: The example of using `llvm/utils/dtlto/local.py` is super useful. Could be worth mentioning that explicitly as a helpful tip for folks looking to integrate with their distribution process. Looking forward to the smaller patches. https://github.com/llvm/llvm-project/pull/126654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)
https://github.com/thevinster edited https://github.com/llvm/llvm-project/pull/126654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits