[all-commits] [llvm/llvm-project] 33b383: [lld] Add module name to LTO inline asm diagnostic

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jan 28 11:33:00 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33b38339a0961c04ce32a6656aa54293d5ca4790
      https://github.com/llvm/llvm-project/commit/33b38339a0961c04ce32a6656aa54293d5ca4790
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-01-28 (Fri, 28 Jan 2022)

  Changed paths:
    M lld/Common/ErrorHandler.cpp
    A lld/test/ELF/lto/inline-asm-err.ll
    A lld/test/MachO/lto-module-asm-err.ll
    M llvm/include/llvm/IR/DiagnosticInfo.h
    M llvm/lib/CodeGen/MachineModuleInfo.cpp

  Log Message:
  -----------
  [lld] Add module name to LTO inline asm diagnostic

Close #52781: for LTO, the inline asm diagnostic uses `<inline asm>` as the file
name (lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp) and it is unclear which
module has the issue.

With this patch, we will see the module name (say `asm.o`) before `<inline asm>` with ThinLTO.

```
% clang -flto=thin -c asm.c && myld.lld asm.o -e f
ld.lld: error: asm.o <inline asm>:1:2: invalid instruction mnemonic 'invalid'
        invalid
        ^~~~~~~
```

For regular LTO, unfortunately the original module name is lost and we only get
ld-temp.o.

Reviewed By: #lld-macho, ychen, Jez Ng

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




More information about the All-commits mailing list