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.
Generally all flags have an fno- variant. Normally, this would be hasFlag(OPT_fjmc, OPT_fno_jmc, false), which handles the behavior of making the last flag win. Any reason not to set that up?