[all-commits] [llvm/llvm-project] 59d3fb: [ELF] Suggest extern "C" when the definition is ma...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Nov 8 09:49:35 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 59d3fbc227cca41e3e7b213ea744ca3a48d5244f
      https://github.com/llvm/llvm-project/commit/59d3fbc227cca41e3e7b213ea744ca3a48d5244f
  Author: Fangrui Song <maskray at google.com>
  Date:   2019-11-08 (Fri, 08 Nov 2019)

  Changed paths:
    M lld/ELF/Relocations.cpp
    A lld/test/ELF/undef-suggest-extern-c2.s

  Log Message:
  -----------
  [ELF] Suggest extern "C" when the definition is mangled while an undefined reference is not

The definition may be mangled while an undefined reference is not.
This may come up when (1) the reference is from a C file or (2) the definition
misses an extern "C".

(2) is more common. Suggest an arbitrary mangled name that matches the
undefined reference, if such a definition exists.

  ld.lld: error: undefined symbol: foo
  >>> referenced by a.o:(.text+0x1)
  >>> did you mean to declare foo(int) as extern "C"?
  >>> defined in: a1.o

Reviewed By: dblaikie, ruiu

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




More information about the All-commits mailing list