On 20/07/2020 08:35, Richard Biener wrote:
The way simple_object is supposed to work is to clone (or merge) the ELF
headers from an existing binary. Unfortunately, the way mkoffload is
currently coded we don't have any to clone from until too late. We could
separate the assemble and link steps, but I chose not to go that way at
this time.
You could defer the debug copying to after mkoffload assembled the
offloaded code and use those objects as template. Maybe that's
what you refer to with separating assemble and link steps.
That's exactly it.
We'd still have to solve the relocation and symbol issues though, so for
now we may as well solve both problems in one place.
Does it even make sense to add support for those steps to simple_object?
The relocation translation is highly target-specific, of course. The
symbol weakening is necessary because the early debug info contains
references to symbols that will not exist in the offloaded code (leading
to either link failure or bloat).
Andrew