[all-commits] [llvm/llvm-project] a0222a: [AsmPrinter] Do not define local aliases for globa...

Leonard Chan via All-commits all-commits at lists.llvm.org
Mon Apr 6 13:49:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a0222ac1f9c20d513caed09557d5ef83574f453c
      https://github.com/llvm/llvm-project/commit/a0222ac1f9c20d513caed09557d5ef83574f453c
  Author: Leonard Chan <leonardchan at google.com>
  Date:   2020-04-06 (Mon, 06 Apr 2020)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    A llvm/test/CodeGen/X86/semantic-interposition-comdat.ll

  Log Message:
  -----------
  [AsmPrinter] Do not define local aliases for global objects in a comdat

A global symbol that is defined in a comdat should not generate an alias since
call sites that would've referred to that symbol will refer to their own
independent local aliases rather than the surviving global comdat one. This
could result in something that looks like:

```
ld.lld: error: relocation refers to a discarded section: .text._ZN3fbl8internal18NullFunctionTargetIvJjjPjEED1Ev.stub
>>> defined in user-x64-clang/obj/system/ulib/minfs/libminfs.a(minfs._sources.file.cc.o)
>>> section group signature: _ZN3fbl8internal18NullFunctionTargetIvJjjPjEED1Ev.stub
>>> prevailing definition is in user-x64-clang/obj/system/ulib/minfs/libminfs.a(minfs._sources.vnode.cc.o)
>>> referenced by function.h:169 (../../zircon/system/ulib/fbl/include/fbl/function.h:169)
>>>               minfs._sources.file.cc.o:(minfs::File::AllocateAndCommitData(std::__2::unique_ptr<minfs::Transaction, std::__2::default_delete<minfs::Transaction> >)) in archive user-x64-clang/obj/system/ulib/minfs/libminfs.a
```

We ran into this when experimenting with a new C++ ABI for fuchsia
(refer to D72959) which takes relative offsets between comdat'd functions
which is why the normal C++ user wouldn't run into this.

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




More information about the All-commits mailing list