This patch changes the handling of OpenMP to add the device attributes
to the canonical definitions when we encounter a non-canonical
definition. Previously, the following code would not work because it
would find the non-canonical definition first which would then not be
used anywhere else.
int x; extern int x;
This patch now adds the attribute to both of them. This allows us to
perform the following operation if, for example, there were an
implementation of stderr on the device.
#include <stdio.h> // List of libc symbols supported on the device. extern FILE *stderr;
Unfortunately I cannot think of an equivalent solution to HIP / CUDA
device declarations as those are done with simple attributes. Attributes
themselves cannot be used to affect a definition once its canonical
definition has already been seen. Some help on that front would be
appreciated.