Skip to content

[SYCL][Driver] Blacklist known system library paths to exclude force link system libs#22712

Merged
uditagarwal97 merged 1 commit into
syclfrom
private/udit/fixSysLibDetect
Jul 22, 2026
Merged

[SYCL][Driver] Blacklist known system library paths to exclude force link system libs#22712
uditagarwal97 merged 1 commit into
syclfrom
private/udit/fixSysLibDetect

Conversation

@uditagarwal97

@uditagarwal97 uditagarwal97 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Under -fsycl-allow-device-image-dependencies on Windows, the driver scans user .libs and force-loads them via /INCLUDE:_imp, skipping system libraries. isSystemLib() excluded a lib only if it lived under one exact SDK/UCRT dir computed by clang, which is always the highest-installed version. But the linker resolves bare names through the LIB env var in order, so a system lib such as kernel32.lib can resolve against a different, earlier-listed SDK version dir.

Match instead on the version- and location-agnostic Microsoft toolchain directory markers ("Windows Kits", "Microsoft Visual Studio", "Microsoft SDKs"), which cover the SDK/UCRT/NETFXSDK and VC/ATLMFC libs regardless of which installed version resolves.

Fixes CMPLRLLVM-76984

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

@uditagarwal97
uditagarwal97 requested a review from mdtoguchi July 21, 2026 21:21
@uditagarwal97 uditagarwal97 self-assigned this Jul 21, 2026
@uditagarwal97
uditagarwal97 requested a review from a team as a code owner July 21, 2026 21:21

@mdtoguchi mdtoguchi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable for exclusion. Of course, we can't stop folks from using those names for their non-system library paths.

…version

Under -fsycl-allow-device-image-dependencies on Windows, the driver scans
user .libs and force-loads them via /INCLUDE:__imp_<sym>, skipping system
libraries. isSystemLib() excluded a lib only if it lived under one exact
SDK/UCRT dir computed by clang, which is always the highest-installed
version. But the linker resolves bare names through the LIB env var in
order, so a system lib such as kernel32.lib can resolve against a different,
earlier-listed SDK version dir. That mismatched the exact-version prefix,
so the lib was treated as user-provided and wrongly force-loaded.

Match instead on the version- and location-agnostic Microsoft toolchain
directory markers ("Windows Kits", "Microsoft Visual Studio",
"Microsoft SDKs"), which cover the SDK/UCRT/NETFXSDK and VC/ATLMFC libs
regardless of which installed version resolves. The computed-dir prefix
check is kept as a fallback for clang's own resource lib dir, which carries
no such marker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@uditagarwal97
uditagarwal97 force-pushed the private/udit/fixSysLibDetect branch from 123ac3e to b807028 Compare July 22, 2026 03:34
@uditagarwal97
uditagarwal97 merged commit 4831624 into sycl Jul 22, 2026
44 of 47 checks passed
@uditagarwal97
uditagarwal97 deleted the private/udit/fixSysLibDetect branch July 22, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants