[all-commits] [llvm/llvm-project] 731347: [clang][debug] port clang-cl /JMC flag to ELF

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Mon Mar 7 10:18:56 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 731347431976509823e38329a96fcbc69fe98cd2
      https://github.com/llvm/llvm-project/commit/731347431976509823e38329a96fcbc69fe98cd2
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2022-03-07 (Mon, 07 Mar 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/Driver/cl-options.c
    M clang/test/Driver/clang_f_opts.c
    M llvm/lib/CodeGen/JMCInstrumenter.cpp
    A llvm/test/Instrumentation/JustMyCode/jmc-instrument-elf.ll
    M llvm/test/Instrumentation/JustMyCode/jmc-instrument-x86.ll
    M llvm/test/Instrumentation/JustMyCode/jmc-instrument.ll

  Log Message:
  -----------
  [clang][debug] port clang-cl /JMC flag to ELF

The motivation is to enable the MSVC-style JMC instrumentation usable by a ELF-based
debugger. Since there is no prior experience implementing JMC feature for ELF-based
debugger, it might be better to just reuse existing MSVC-style JMC instrumentation.
For debuggers that support both ELF&COFF (like lldb), the JMC implementation might
be shared between ELF&COFF. If this is found to inadequate, it is pretty low-cost
switching to alternatives.

Implementation:
- The '-fjmc' is already a driver and cc1 flag. Wire it up for ELF in the driver.
- Refactor the JMC instrumentation pass a little bit.
- The ELF handling is different from MSVC in two places:
  * the flag section name is ".just.my.code" instead of ".msvcjmc"
  * the way default function is provided: MSVC uses /alternatename; ELF uses weak function.

Based on D118428.

Reviewed By: rnk

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




More information about the All-commits mailing list