[PATCH] D73642: [Clang][Bundler] Reduce fat object size

Sergey Dmitriev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 09:58:27 PST 2020


sdmitriev created this revision.
sdmitriev added a reviewer: ABataev.
Herald added a reviewer: alexshap.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fat object size has significantly increased after D65819 <https://reviews.llvm.org/D65819> which changed bundler tool to add host object as a normal bundle to the fat output which almost doubled its size. That patch was fixing the following issues

1. Problems associated with the partial linking - global constructors were not called for partially linking objects which clearly resulted in incorrect behavior.
2. Eliminating "junk" target object sections from the linked binary on the host side.

The first problem is no longer relevant because we do not use partial linking for creating fat objects anymore. Target objects sections are now inserted into the resulting fat object with a help of llvm-objcopy tool.

The second issue, "junk" sections in the linked host binary, has been fixed in D73408 <https://reviews.llvm.org/D73408> by adding "exclude" flag to the fat object's sections which contain target objects. This flag tells linker to drop section from the inputs when linking executable or shared library, therefore these sections will not be propagated in the linked binary.

Since both problems have been solved, we can revert D65819 <https://reviews.llvm.org/D65819> changes to reduce fat object size and this patch essentially is doing that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73642

Files:
  clang/test/Driver/clang-offload-bundler.c
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73642.241205.patch
Type: text/x-patch
Size: 6637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200129/6fe07c46/attachment-0001.bin>


More information about the cfe-commits mailing list