[ThinLTO] Don't link module level assembly when importing
authorTeresa Johnson <tejohnson@google.com>
Wed, 12 Oct 2016 18:39:29 +0000 (18:39 +0000)
committerTeresa Johnson <tejohnson@google.com>
Wed, 12 Oct 2016 18:39:29 +0000 (18:39 +0000)
commit4b9b3791727dd8664c2d228ce3abeb5be82719ca
tree03a824116b6a3073ee8c6da758dc66915b022db2
parentd2775ec8de822620d1cd060c8f790189d165bffa
[ThinLTO] Don't link module level assembly when importing

Module inline asm was always being linked/concatenated
when running the IRLinker. This is correct for full LTO but not when
we are importing for ThinLTO, as it can result in multiply defined
symbols when the module asm defines a global symbol.

In order to test with llvm-lto2, I had to work around PR30396,
where a symbol that is defined in module assembly but defined in the
LLVM IR appears twice. Added workaround to llvm-lto2 with a FIXME.

Fixes PR30610.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 284030
llvm/include/llvm/Linker/IRMover.h
llvm/lib/LTO/LTO.cpp
llvm/lib/Linker/IRMover.cpp
llvm/lib/Linker/LinkModules.cpp
llvm/test/ThinLTO/X86/Inputs/module_asm.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/module_asm_glob.ll [new file with mode: 0644]
llvm/tools/llvm-lto2/llvm-lto2.cpp