[all-commits] [llvm/llvm-project] 6c641d: [lld-macho] Handle user-provided dtrace symbols to...

Jacket via All-commits all-commits at lists.llvm.org
Mon Jul 11 12:32:44 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6c641d0de686efd3e3da055aa4c743bb3450acb7
      https://github.com/llvm/llvm-project/commit/6c641d0de686efd3e3da055aa4c743bb3450acb7
  Author: Kaining Zhong <zhongkaining.paxos at bytedance.com>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M lld/MachO/Arch/ARM.cpp
    M lld/MachO/Arch/ARM64Common.cpp
    M lld/MachO/Arch/ARM64Common.h
    M lld/MachO/Arch/X86_64.cpp
    M lld/MachO/InputSection.cpp
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/Target.h
    A lld/test/MachO/arm-dtrace.s
    A lld/test/MachO/arm64-32-dtrace.s
    A lld/test/MachO/arm64-dtrace.s
    A lld/test/MachO/x86_64-dtrace.s

  Log Message:
  -----------
  [lld-macho] Handle user-provided dtrace symbols to avoid linking failure

This fixes https://github.com/llvm/llvm-project/issues/56238. ld64.lld currently does not generate __dof section in Mach-O, and -no_dtrace_dof option is on by default. However when there are user-defined dtrace symbols, ld64.lld will treat them as undefined symbols, which causes the linking to fail because lld cannot find their definitions. This patch allows ld64.lld to rewrite the instructions calling dtrace symbols to instructions like nop as what ld64 does; therefore, when encountered with user-provided dtrace probes, the linking can still succeed.

I'm not sure whether support for dtrace is expected in lld, so for now I didn't add codes to make lld emit __dof section like ld64, and only made it possible to link with dtrace symbols provided. If this feature is needed, I can add that part in Dtrace.cpp & Dtrace.h.

Reviewed By: int3, #lld-macho

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




More information about the All-commits mailing list