This is the bundler-side patch for enabling static library support in clang. The scheme has been discussed extensively in the past and is described in this document prepared by @sdmitriev:
.Patch was developed in collaboration with @kbobrovs and a similar version has been merged with Intel's SYCL compiler (https://github.com/intel/llvm/tree/sycl).
When a fat object is created, for each bundle the bundler also creates a corresponding "size" section consisting of a single 64-bit integer storing the size of the bundle. When linking from static objects, the host linker will fetch all dependencies and do a partial linking on them; this action concatenates all sections with the same name across fetched dependencies into a new aggregate section, so for each target there will be an aggregate section containing the concatenated bundles and another aggregate section containing the concatenated sizes. By visiting the aggregate sizes section the unbundler can then split the aggregate bundle into separate output device objects.
The patch introduces a new type "oo" which is used when unbundling partially-linked fat objects. When "oo" is specified, the output file is not an object file itself; instead it is a text file containing the paths to the actual outputs (because we may have multiple device objects as outputs - one for each dependency that was fetched).
Invocation of the host linker (to do partial-linking) and cleanup of temporary files will be done by the Driver. Once the bundler patch lands, the Driver patch will follow.
Very strange test. It should not contain standard includes. Also, it should not be an executable test, you have to check for the driver output or something similar