[all-commits] [llvm/llvm-project] 6887cc: [Driver][HIP/SPIRV] Fix crash when llvm-link is ex...

Manuel Carrasco via All-commits all-commits at lists.llvm.org
Wed May 6 09:22:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6887ccf6251dcdf835e3df2bf93ad04133c5ad78
      https://github.com/llvm/llvm-project/commit/6887ccf6251dcdf835e3df2bf93ad04133c5ad78
  Author: Manuel Carrasco <Manuel.Carrasco at amd.com>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M clang/lib/Driver/ToolChains/HIPAMD.cpp
    A clang/test/Driver/hip-spirv-linker-crash.c

  Log Message:
  -----------
  [Driver][HIP/SPIRV] Fix crash when llvm-link is executed. (#196074)

There is a design limitation (see
[InputInfo](https://github.com/llvm/llvm-project/blob/f08b4fff52cdd3fc8fdd962080da089497c00fcc/clang/include/clang/Driver/InputInfo.h#L23))
that is forwarding flags to `llvm-link` when it shouldn't happen. This
commit fixes this issue by sanitizing the arguments forwarded to
`llvm-link`.

This may happen when `clang-linker-wrapper` eventually calls `clang`,
which adds the `-Xlinker` flags. Crash reproducer is here:
https://gcc.godbolt.org/z/rxvWcvan3.

The fix is based on @MrSidims' old PR (#183492).

The error started manifesting by default after the switch to the new
driver, and the issue has been in the new driver since commit
https://github.com/llvm/llvm-project/commit/4c6f398b866030c17fd94dcdca04f4df03c5214c.
However, the problem could potentially be triggered by any call to
`clang`, regardless of the `clang-linker-wrapper`.

---------

Co-authored-by: Dmitry Sidorov <18708689+MrSidims at users.noreply.github.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list