[all-commits] [llvm/llvm-project] c8e0bb: [LTO] Support for embedding bitcode section during...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Thu Dec 12 12:34:45 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c8e0bb3b2c24ef59556d81a275fb1f5db64899d3
      https://github.com/llvm/llvm-project/commit/c8e0bb3b2c24ef59556d81a275fb1f5db64899d3
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2019-12-12 (Thu, 12 Dec 2019)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    A clang/test/Frontend/x86-embed-bitcode.ll
    M llvm/include/llvm/Bitcode/BitcodeWriter.h
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/LTO/LTOBackend.cpp
    A llvm/test/LTO/X86/Inputs/start-lib1.ll
    A llvm/test/LTO/X86/Inputs/start-lib2.ll
    A llvm/test/LTO/X86/embed-bitcode.ll

  Log Message:
  -----------
  [LTO] Support for embedding bitcode section during LTO

Summary:
This adds support for embedding bitcode in a binary during LTO. The libLTO gains supports the `-lto-embed-bitcode` flag. The option allows users of the LTO library to embed a bitcode section. For example, LLD can pass the option via `ld.lld -mllvm=-lto-embed-bitcode`.

This feature allows doing something comparable to `clang -c -fembed-bitcode`, but on the (LTO) linker level. Having bitcode alongside native code has many use-cases. To give an example, the MacOS linker can create a `-bitcode_bundle` section containing bitcode. Also, having this feature built into LLVM is an alternative to 3rd party tools such as [[ https://github.com/travitch/whole-program-llvm | wllvm ]] or [[ https://github.com/SRI-CSL/gllvm | gllvm ]]. As with these tools, this feature simplifies creating "whole-program" llvm bitcode files, but in contrast to wllvm/gllvm it does not rely on a specific llvm frontend/driver.

Patch by Josef Eisl <josef.eisl at oracle.com>

Reviewers: #llvm, #clang, rsmith, pcc, alexshap, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, mehdi_amini, inglorion, hiraditya, aheejin, steven_wu, dexonsmith, dang, cfe-commits, llvm-commits, #llvm, #clang

Tags: #clang, #llvm

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




More information about the All-commits mailing list