| Issue |
207835
|
| Summary |
[Offload] Objects with mixed targets cause new driver to produce duplicate symbols
|
| Labels |
|
| Assignees |
jhuber6
|
| Reporter |
zGoldthorpe
|
See [minrepro.zip](https://github.com/user-attachments/files/29718715/minrepro.zip).
When building a shared object e.g. via
```sh
clang++ -shared -o lib.so generic.o specific.o -fgpu-rdc -shared --hip-link --offload-arch=gfx90a:xnack+ --offload-arch=gfx90a:xnack-
```
where `generic.o` has device code targeting `gfx90a` and `specific.o` has device code targeting `gfx90a:xnack+` and `gfx90a:xnack-`, then the new driver issues a linker command for each of the three targets, even though we only ask for `gfx90a:xnack+` and `gfx90a:xnack-`.
Moreover, when linking for the generic `gfx90a`, it pulls in the device code for `gfx90a:xnack+` *and* `gfx90a:xnack-` from `specific.o` since both are compatible with `gfx90a`, which leads to the whole build failing with
```log
ld.lld: error: duplicate symbol: specific()
>>> defined in /tmp/specific-amdgcn-amd-amdhsa-gfx90a:xnack+-74f57d.o
>>> defined in /tmp/specific-amdgcn-amd-amdhsa-gfx90a:xnack--7c3e3e.o
ld.lld: error: duplicate symbol: __hip_cuid_1090d77a21c8dc49
>>> defined in /tmp/specific-amdgcn-amd-amdhsa-gfx90a:xnack+-74f57d.o
>>> defined in /tmp/specific-amdgcn-amd-amdhsa-gfx90a:xnack--7c3e3e.o
```
Note that the old driver (via `--no-offload-new-driver`) only builds for `gfx90a:xnack+` and `gfx90a:xnack-`, and does not crash.
cc: @jhuber6
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs