[all-commits] [llvm/llvm-project] 3a45b8: [lld] Preliminary fat-lto-object support

Paul Kirth via All-commits all-commits at lists.llvm.org
Wed Jul 19 16:08:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a45b843dec1bca195884aa1c5bc56bd0e6755b4
      https://github.com/llvm/llvm-project/commit/3a45b843dec1bca195884aa1c5bc56bd0e6755b4
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/Options.td
    M lld/docs/ReleaseNotes.rst
    M lld/docs/ld.lld.1
    A lld/test/ELF/fatlto/fatlto.invalid.s
    A lld/test/ELF/fatlto/fatlto.test

  Log Message:
  -----------
  [lld] Preliminary fat-lto-object support

This patch adds support to lld for --fat-lto-objects. We add a new
--fat-lto-objects flag to LLD, and slightly change how it chooses input
files in the driver when the flag is set.

Fat LTO objects contain both LTO compatible IR, as well as generated object
code. This allows users to defer the choice of whether to use LTO or not to
link-time. This is a feature available in GCC for some time, and makes the
existing -ffat-lto-objects flag functional in the same way as GCC's.

If the --fat-lto-objects option is passed to LLD and the input files are fat
object files, then the linker will chose the LTO compatible bitcode sections
embedded within the fat object and link them together using LTO. Otherwise,
standard object file linking is done using the assembly section in the object
files.

Original RFC: https://discourse.llvm.org/t/rfc-ffat-lto-objects-support/63977

Depends on D146777

Reviewed By: MaskRay

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


  Commit: 421e4026111315d002879b1e7a0cf3aacd00f488
      https://github.com/llvm/llvm-project/commit/421e4026111315d002879b1e7a0cf3aacd00f488
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M llvm/lib/Object/ObjectFile.cpp
    M llvm/test/LTO/X86/Inputs/bcsection.macho.s
    A llvm/test/LTO/X86/Inputs/llvm.lto.section.s
    M llvm/test/LTO/X86/bcsection.ll
    A llvm/test/LTO/X86/llvm.lto.section.ll
    A llvm/test/tools/gold/X86/fatlto/fatlto.invalid.s
    A llvm/test/tools/gold/X86/fatlto/fatlto.test
    M llvm/tools/gold/gold-plugin.cpp

  Log Message:
  -----------
  [gold] Add preliminary FatLTO support to the Gold plugin

This changes the definition if `isSectionBitcode` to only be valid for the
`.llvm.lto` section, since this API is only called from LTO, and the
`.llvmbc` section was not intended to be used for LTO. This allows the
gold plugin to keep its existing behavior without introducing any
significant changes.

Depends on D146778

Reviewed By: MaskRay

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


Compare: https://github.com/llvm/llvm-project/compare/5fdf86051020...421e40261113


More information about the All-commits mailing list