https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109128

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
My initial thought was to handle it via lto1. This works well if all relevant
files are compiled with "-flto" as then the callers of the offload functions,
the offload functions themselves are available, permitting to generate
__OFFLOAD_TABLE__ directly.

However, if -flto is not used  or not used for all translation units (with
offload code), this approach will fail due to visibility problems.

Namely, the offload functions have local binding. This could be solved by
forcing global binding (with visibility hidden), but this approach will fail if
the assembler name is not unique.

 * * *

Thus, placing the symbols into a section will work (current behavior), except
that the linker might remove symbols (this bug) and one needs to hope that the
linking order is the same on the host as it is with LTO.

Still remains the question how to handle this PR...

Reply via email to