[PATCH] D119910: [clang][debug] port clang-cl /JMC flag to ELF

Yuanfang Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 15 18:24:08 PST 2022


ychen created this revision.
ychen added reviewers: hans, rnk, aganea, JDevlieghere, labath.
Herald added a subscriber: hiraditya.
ychen requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

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 <https://reviews.llvm.org/D118428>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119910

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119910.409117.patch
Type: text/x-patch
Size: 20176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220216/3314f61d/attachment-0001.bin>


More information about the cfe-commits mailing list