[all-commits] [llvm/llvm-project] c53cb2: [Clang][Bundler] Reduce fat object size

Sergey Dmitriev via All-commits all-commits at lists.llvm.org
Thu Jan 30 08:25:03 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c53cb2bdc78ee3d3eec8c30821480b390b0eb145
      https://github.com/llvm/llvm-project/commit/c53cb2bdc78ee3d3eec8c30821480b390b0eb145
  Author: Sergey Dmitriev <serguei.n.dmitriev at intel.com>
  Date:   2020-01-30 (Thu, 30 Jan 2020)

  Changed paths:
    M clang/test/Driver/clang-offload-bundler.c
    M clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

  Log Message:
  -----------
  [Clang][Bundler] Reduce fat object size

Summary:
Fat object size has significantly increased after 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 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 changes to reduce fat object size and this patch essentially is doing that.

Reviewers: ABataev, alexshap, jdoerfert

Reviewed By: ABataev

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73642




More information about the All-commits mailing list