[all-commits] [llvm/llvm-project] 82d074: [TargetLoweringObjectFileImpl] Make .llvmbc and .l...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Aug 25 13:42:05 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 82d0749749fafb0303414131dc570781376fdcfb
      https://github.com/llvm/llvm-project/commit/82d0749749fafb0303414131dc570781376fdcfb
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-08-25 (Tue, 25 Aug 2020)

  Changed paths:
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    A llvm/test/CodeGen/X86/embed-bitcode.ll
    M llvm/test/LTO/X86/embed-bitcode.ll

  Log Message:
  -----------
  [TargetLoweringObjectFileImpl] Make .llvmbc and .llvmcmd non-SHF_ALLOC

There are two ways .llvmbc can be produced:

* clang -c -fembed-bitcode=all (which also produces .llvmcmd)
* LTO backend: ld.lld -mllvm -lto-embed-bitcode or -plugin-opt=-lto-embed-bitcode

.llvmbc and .llvmcmd have the SHF_ALLOC flag, so they can be dropped by
--gc-sections.

This patch sets SectionKind::Metadata to drop the SHF_ALLOC flag. This
is conceptually correct: the two sections are not part of the process
image, so SHF_ALLOC is not appropriate.

`test/LTO/X86/embed-bitcode.ll`: changed `llvm-objcopy -O binary --only-section` to
`llvm-objcopy --dump-section`. `-O binary` does not dump non-SHF_ALLOC sections.

Reviewed By: tejohnson

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




More information about the All-commits mailing list