The following check in the amdgpu-toolchain.c file causes false negatives:
The problem occurs when -shared is a part of the build directory name, e.g. build-shared-llvm-project-debug, see:
clang/test/Driver/amdgpu-toolchain.c:36:14: error: RELO-NOT: excluded string found in input
// RELO-NOT: -shared
^
<stdin>:4:74: note: found here
InstalledDir: ~/upstream/build-shared-llvm-project-debug/bin
^~~~~~~
Input file: <stdin>
Check file: clang/test/Driver/amdgpu-toolchain.c