Currently the linker wrapper strictly assigns a single input binary to a
single link job based off of its input architecture. This is not
sufficient to implement the AMDGPU target ID correctly as this could
have many compatible architectures participating in multiple links.
This patch introduces the ability to have a single binary input be
linked multiple times. For example, given the following, we will now
link in the static library where previously we would not.
clang foo.c -fopenmp --offload-arch=gfx90a llvm-ar rcs libfoo.a foo.o clang foo.c -fopenmp --offload-arch=gfx90a:xnack+ libfoo.a
This also means that given the following we will link the basic input
twice, but that's on the user for providing two versions.
clang foo.c -fopenmp --offload-arch=gfx90a,gfx90a:xnack+
This should allow us to also support a "generic" target in the future
for IR without a specific architecture.
can we put some variables in the input bitcode so that we can check the linked bitcode?
I would expect there will be only one linked bitcode for gfx90a:xnack+ and it contains both variables.
I don't think it is a good idea to let the final object embed bitcode for both gfx90a:xnack+ and gfx90a since that will result in an invalid container. Therefore I think we should only do linking with target ID's from the first container.