<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/67583>67583</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP] Multiple definition error with --save-temps when linking CUDA device code
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          markdewing
      </td>
    </tr>
</table>

<pre>
    Error occurs when linking a CUDA device function with OpenMP offload and `--save-temps` is specified.  The code links successfully without `--save-temps`.

The error is:
 /usr/bin/ld: a.out.image.wrapper.o:(cuda_offloading_entries+0x0): multiple definition of `__dummy.cuda_offloading.entry'; a.out.image.wrapper.o:(cuda_offloading_entries+0x0): first defined here

[dev_func_save_temps.tar.gz](https://github.com/llvm/llvm-project/files/12741812/dev_func_save_temps.tar.gz)
 (Might need to adjust the `--cuda-gpu-arch` in the first compile command in c1)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykU02PmzoU_TVmYwUZExJYsJi8PHaj9xbvrSNjX-DOGBv5I2n66ys703ZajSpV3YBky-eeez6E9zgbgJ40J9KcCxHDYl2_Cveq4IZmLkar7v3fzllHrZTReXpbwFCN5hXNTAX96__zE1VwRQl0ikYGtIbeMCz0nw3M87_UTpO2QlFhFCUHttt5cYVdgHXz5MAoeuo3kDghqJLS_xag0irIEzz1UUrwfopa3zOqjeEDlJKwM2FPj2-CgMwYPanfDinhQ_SO8GFEQ_igFamfqChtDCWuYoby5sS2gSttesNbGZW4vHFHM1_ABIfgCT-xT4zwLj1fow64aaAKJjSYV7dT4ne5qLiu9_InlDKh3Ak_kvr0p8MndD48JoOiCzh4LwJpTgqul-TIJUl1yVKVQbhy_kyaM-HtEsKWBeID4cOMYYljKe2a1NHXr7_d5uwLyED4MKFOHIaKH_dVW3HCh1_M4N035dtnnJdADYCiwVKhXqIPNCzwsDJtu5u3uBNOLjkTJl8-NpR23VCnVKxryhAaKivCu0L1terqThTQV4euaetj19bF0rcHxirRqqauRNsKwVnVdY1UUomx5WpfYM8Zr1nHj1XLDrwuWdPw-qhGzpr6OMqa7BmsAnWZBCitmwv0PkJ_ODZtXWgxgva5MpwbuNF8SThPDXJ9Fm2Msyd7ptEH_x0lYNC5a49qkOZMnz-I0CO8uUPvc_5j8973LhWmiE73v21ppp48zat9CQAA___0EFWo">