Page MenuHomePhabricator

[clang-offload-wrapper] Add standard notes for ELF offload images

Authored by vzakhari on Mar 29 2021, 4:13 PM.



This patch is a piece of D99360.

The patch adds ELF notes into SHT_NOTE sections of ELF offload images passed to clang-offload-wrapper.

The new notes use a null-terminated "LLVMOMPOFFLOAD" note name. There are currently three types of notes:

VERSION: a string (not null-terminated) representing the ELF offload image structure. The current version '1.0' does not put any restrictions on the structure of the image. If we ever need to come up with a common structure for ELF offload images (e.g. to be able to analyze the images in libomptarget in some standard way), then we will introduce new versions.
PRODUCER: a vendor specific name of the producing toolchain. Upstream LLVM uses "LLVM" (not null-terminated).
PRODUCER_VERSION: a vendor specific version of the producing toolchain. Upstream LLVM uses LLVM_VERSION_STRING with optional <space> LLVM_REVISION.

All three notes are not mandatory currently.

Diff Detail

Event Timeline

vzakhari created this revision.Mar 29 2021, 4:13 PM
vzakhari requested review of this revision.Mar 29 2021, 4:13 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
vzakhari updated this revision to Diff 334282.Mar 30 2021, 3:22 PM

I am not sure what is wrong with the uploaded ELF files. The test works locally. Let's try it with a thinner YAML template.

vzakhari updated this revision to Diff 334292.Mar 30 2021, 3:59 PM

Updated revision fixes BUILD_SHARED_LIBS build.

grokos accepted this revision.Tue, Apr 6, 7:19 PM

Change looks good, so it's accepted on my end. I'll let the other reviewers have a look and post their comments. Please do not commit until we have reached an agreement for all 4 patches together (D99551, D99552, D99553, D99612).

This revision is now accepted and ready to land.Tue, Apr 6, 7:19 PM