Skip to content

Commit d3a813b

Browse files
authored
[DTLTO][PS4,PS5] Suppress system headers directory warning (#167685)
Our 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
1 parent 905c7aa commit d3a813b

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

clang/lib/Driver/ToolChains/PS4CPU.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,9 @@ toolchains::PS4PS5Base::PS4PS5Base(const Driver &D, const llvm::Triple &Triple,
488488
// control of header or library search. If we're not linking, don't check
489489
// for missing libraries.
490490
auto CheckSDKPartExists = [&](StringRef Dir, StringRef Desc) {
491+
// In ThinLTO code generation mode SDK files are not required.
492+
if (Args.hasArgNoClaim(options::OPT_fthinlto_index_EQ))
493+
return true;
491494
if (llvm::sys::fs::exists(Dir))
492495
return true;
493496
D.Diag(clang::diag::warn_drv_unable_to_find_directory_expected)

clang/test/Driver/ps4-sdk-root.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
///
1212
/// The default <SDKROOT> for both headers and libraries is taken from the
1313
/// SCE_ORBIS_SDK_DIR environment variable.
14+
///
15+
/// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required
16+
/// so all warnings are suppressed.
1417

1518
// RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-scei-ps4" > %t.rsp
1619

@@ -31,6 +34,10 @@
3134
/// headers and libraries.
3235
// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s
3336

37+
/// -fthinlto-index= warning suppression.
38+
// RUN: touch %t_dummy.o
39+
// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored -c 2>&1 | FileCheck -check-prefixes=NO-WARN %s
40+
3441
/// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK
3542
/// libraries is skipped because no linking will be performed. We only expect
3643
/// warnings about missing headers.

clang/test/Driver/ps5-sdk-root.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
///
1414
/// The default <SDKROOT> for both headers and libraries is taken from the
1515
/// SCE_PROSPERO_SDK_DIR environment variable.
16+
///
17+
/// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required
18+
/// so all warnings are suppressed.
1619

1720
// RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-sie-ps5" > %t.rsp
1821

@@ -33,6 +36,10 @@
3336
/// headers and libraries.
3437
// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s
3538

39+
/// -fthinlto-index= warning suppression.
40+
// RUN: touch %t_dummy.o
41+
// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored -c 2>&1 | FileCheck -check-prefixes=NO-WARN %s
42+
3643
/// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK
3744
/// libraries is skipped because no linking will be performed. We only expect
3845
/// warnings about missing headers.

0 commit comments

Comments
 (0)