This is an archive of the discontinued LLVM Phabricator instance.

[clang-offload-bundler] Add support for unbundling archives with fat objects
DraftPublic

Authored by sdmitriev on Jan 3 2021, 11:30 PM.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Summary

This patch adds support for unbundling archives under a new file type 'a'.
Input file for this mode is expected to be an archive with fat object files
and outputs (one per offload target) will be archives with extracted device
specific parts from the input's objects.

Diff Detail

Event Timeline

sdmitriev created this revision.Jan 3 2021, 11:30 PM
sdmitriev updated this revision to Diff 314340.Jan 4 2021, 2:25 AM

Fixed warnings from pre-merge checks.

If this splits an archive of bundles into N archives, it presumably doesn't suffer the same implicit whole-archive semantics that result from passing code through llvm-link. That seems great.

If this splits an archive of bundles into N archives, it presumably doesn't suffer the same implicit whole-archive semantics that result from passing code through llvm-link. That seems great.

This patch implements similar functionality to D80816/D93525 (except adding '-<device>' suffix to the target to be extracted) but it does not restrict users to specify only one target and one output file for unbundling. So, if you need to unbundle more than one target from input archive you will be able to do it in one clang-offload-bundler invocation as opposed to running clang-offload-bundler once per each target with D80816/D93525. That is probably unrelated to the whole-archive semantics when linking archives with llvm-link.

But regarding llvm-link behavior wrt archives, I assume it will be possible to link bitcode archives as libraries (i.e. link only required symbols) with –only-needed option after applying D92535.