https://github.com/bd1976bris updated https://github.com/llvm/llvm-project/pull/167685
>From 4d87c937214aea1efd02f5e60f77ec3ecc12bb67 Mon Sep 17 00:00:00 2001 From: Ben <[email protected]> Date: Wed, 12 Nov 2025 12:19:44 +0000 Subject: [PATCH 1/3] [DTLTO][PS5] Suppress system headers directory warning The PS5 driver warns under various circumstances if SDK directories can't be found. This warning is not applicable in ThinLTO codegen mode (-fthinlto-index=). Suppress it. The motivation for doing this is that we sometimes see this warning emitted when DTLTO invokes the compiler on a remote machine to do the LTO backend compilations (with -fthinlto-index=). Internal Ref: TOOLCHAIN-20592 --- clang/lib/Driver/ToolChains/PS4CPU.cpp | 3 +++ clang/test/Driver/ps4-sdk-root.c | 8 ++++++++ clang/test/Driver/ps5-sdk-root.c | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index 6fe18aa4cceba..5b5b5607da69e 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -488,6 +488,9 @@ toolchains::PS4PS5Base::PS4PS5Base(const Driver &D, const llvm::Triple &Triple, // control of header or library search. If we're not linking, don't check // for missing libraries. auto CheckSDKPartExists = [&](StringRef Dir, StringRef Desc) { + // In ThinLTO code generation mode SDK files are not required. + if (Args.hasArgNoClaim(options::OPT_fthinlto_index_EQ)) + return true; if (llvm::sys::fs::exists(Dir)) return true; D.Diag(clang::diag::warn_drv_unable_to_find_directory_expected) diff --git a/clang/test/Driver/ps4-sdk-root.c b/clang/test/Driver/ps4-sdk-root.c index 6e5f1e28958ad..7c568a6680f25 100644 --- a/clang/test/Driver/ps4-sdk-root.c +++ b/clang/test/Driver/ps4-sdk-root.c @@ -11,6 +11,9 @@ /// /// The default <SDKROOT> for both headers and libraries is taken from the /// SCE_ORBIS_SDK_DIR environment variable. +/// +/// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required +/// so all warnings are suppressed. // RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-scei-ps4" > %t.rsp @@ -31,6 +34,11 @@ /// headers and libraries. // RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s +/// -fthinlto-index= warning suppression. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s + /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK /// libraries is skipped because no linking will be performed. We only expect /// warnings about missing headers. diff --git a/clang/test/Driver/ps5-sdk-root.c b/clang/test/Driver/ps5-sdk-root.c index 16ef2cc01f5e7..558601d3a2082 100644 --- a/clang/test/Driver/ps5-sdk-root.c +++ b/clang/test/Driver/ps5-sdk-root.c @@ -13,6 +13,9 @@ /// /// The default <SDKROOT> for both headers and libraries is taken from the /// SCE_PROSPERO_SDK_DIR environment variable. +/// +/// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required +/// so all warnings are suppressed. // RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-sie-ps5" > %t.rsp @@ -33,6 +36,11 @@ /// headers and libraries. // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s +/// -fthinlto-index= warning suppression. +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o +// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s + /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK /// libraries is skipped because no linking will be performed. We only expect /// warnings about missing headers. >From 799bcfe804f212afce247b8616e4de47f5d3bc20 Mon Sep 17 00:00:00 2001 From: Ben <[email protected]> Date: Wed, 12 Nov 2025 14:00:19 +0000 Subject: [PATCH 2/3] Use dummy inputs rather than creating real inputs for the new test-case --- clang/test/Driver/ps4-sdk-root.c | 5 ++--- clang/test/Driver/ps5-sdk-root.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/clang/test/Driver/ps4-sdk-root.c b/clang/test/Driver/ps4-sdk-root.c index 7c568a6680f25..610f49aedb545 100644 --- a/clang/test/Driver/ps4-sdk-root.c +++ b/clang/test/Driver/ps4-sdk-root.c @@ -35,9 +35,8 @@ // RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s /// -fthinlto-index= warning suppression. -// RUN: %clang -O2 %s -flto=thin -c -o %t.o -// RUN: llvm-lto -thinlto -o %t %t.o -// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s +// RUN: touch %t_dummy.o +// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored 2>&1 | FileCheck -check-prefixes=NO-WARN %s /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK /// libraries is skipped because no linking will be performed. We only expect diff --git a/clang/test/Driver/ps5-sdk-root.c b/clang/test/Driver/ps5-sdk-root.c index 558601d3a2082..920d5d576141b 100644 --- a/clang/test/Driver/ps5-sdk-root.c +++ b/clang/test/Driver/ps5-sdk-root.c @@ -37,9 +37,8 @@ // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s /// -fthinlto-index= warning suppression. -// RUN: %clang -O2 %s -flto=thin -c -o %t.o -// RUN: llvm-lto -thinlto -o %t %t.o -// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s +// RUN: touch %t_dummy.o +// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored 2>&1 | FileCheck -check-prefixes=NO-WARN %s /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK /// libraries is skipped because no linking will be performed. We only expect >From d3e82d19db245457b7bfb5a38267308da3d42f28 Mon Sep 17 00:00:00 2001 From: Ben <[email protected]> Date: Wed, 12 Nov 2025 14:40:19 +0000 Subject: [PATCH 3/3] Add -c to the command line for the test-case as realistically we will pair this with -fthinlto-index --- clang/test/Driver/ps4-sdk-root.c | 2 +- clang/test/Driver/ps5-sdk-root.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/Driver/ps4-sdk-root.c b/clang/test/Driver/ps4-sdk-root.c index 610f49aedb545..791b96ac12ae6 100644 --- a/clang/test/Driver/ps4-sdk-root.c +++ b/clang/test/Driver/ps4-sdk-root.c @@ -36,7 +36,7 @@ /// -fthinlto-index= warning suppression. // RUN: touch %t_dummy.o -// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored 2>&1 | FileCheck -check-prefixes=NO-WARN %s +// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored -c 2>&1 | FileCheck -check-prefixes=NO-WARN %s /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK /// libraries is skipped because no linking will be performed. We only expect diff --git a/clang/test/Driver/ps5-sdk-root.c b/clang/test/Driver/ps5-sdk-root.c index 920d5d576141b..a337ce3801456 100644 --- a/clang/test/Driver/ps5-sdk-root.c +++ b/clang/test/Driver/ps5-sdk-root.c @@ -38,7 +38,7 @@ /// -fthinlto-index= warning suppression. // RUN: touch %t_dummy.o -// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored 2>&1 | FileCheck -check-prefixes=NO-WARN %s +// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored -c 2>&1 | FileCheck -check-prefixes=NO-WARN %s /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK /// libraries is skipped because no linking will be performed. We only expect _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
