[all-commits] [llvm/llvm-project] cd3f27: [ORC][ORC-RT][ELF] Move selection of eh-frame regi...

lhames via All-commits all-commits at lists.llvm.org
Thu Apr 6 09:32:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd3f2749ed156492f8d50bad7055a0d68b9bea05
      https://github.com/llvm/llvm-project/commit/cd3f2749ed156492f8d50bad7055a0d68b9bea05
  Author: Lang Hames <lhames at gmail.com>
  Date:   2023-04-06 (Thu, 06 Apr 2023)

  Changed paths:
    M compiler-rt/lib/orc/elfnix_platform.cpp
    M llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp

  Log Message:
  -----------
  [ORC][ORC-RT][ELF] Move selection of eh-frame registration APIs into orc-rt.

ORC's ELF platform support prefers the newer libunwind registration functions
(__unw_add_dynamic_eh_frame_section, __unw_remove_dynamic_eh_frame_section) when
they're available, and falls back to the older registration functions
(__register_frame, __deregister_frame) when they're not.

Until now the choice of registration functions has been made on the controller
side in ELFNixPlatform: The platform JITDylib was searched for the registration
functions and aliases set depending on which ones were found. This patch drops
that selection logic from ELFNixPlatform and instead uses weak imports of the
registration functions in elfnix_platform.cpp to identify which ones are
available and choose which ones to use.

This has a few small benefits:
(1) The registration functions don't need to be defined in the same JITDylib as
the ORC runtime -- it's sufficient for them to be defined in a JITDylib that the
ORC runtime's JITDylib links against.

(2) THe elfnix_platfrom code is more readable, as we don't have to dig into
ELFNixPlatform.cpp on the controller side to discover the definition of the
registration aliases.

(3) We may save a separate round-trip to look up the registration APIs (the
lookup will be folded into the ordinary external symbol lookup when linking the
runtime).




More information about the All-commits mailing list