[ORC] Fix fallout from switch to _objc_map/load_images-based registration.
authorLang Hames <lhames@gmail.com>
Tue, 11 Apr 2023 04:17:37 +0000 (21:17 -0700)
committerLang Hames <lhames@gmail.com>
Tue, 11 Apr 2023 23:48:26 +0000 (16:48 -0700)
commit9d701c8a8d65a830c3d454479b13a50dcc097b57
tree25b195cc2b8b9b46509d60ee2217962840cd2a8b
parent9d9a7732e14d7d4c0db7b46d6ebe588e8f43b951
[ORC] Fix fallout from switch to _objc_map/load_images-based registration.

In f448d44663a we switched to calling _objc_map_images and _objc_load_images
for MachO language metadata registration. This patch fixes some bugs arising
from that change:

(1) __objc_imageinfo processing was moved to a post-allocation pass, but this
    prevents us from discarding the redundant copies. This commit moves
    processing back to a pre-prune pass and inserts a symbol for the uniqued
    __objc_image section. Runtime objects use an edge pointing to this symbol
    to access the address.

(2) We were assuming that _objc_map_images & _objc_load_images were available
    in the Objective-C runtime on 10.15, but these functions didn't become
    available until later. This commit bumps the macOS version requirement to
    13.1 where the functions should be available.

(3) The ORC-RT trivial-swift-types-section.S test was missing an
    __objc_unwindinfo section, which triggered an assert that should have
    been an error. The assert has been turned into an error, and the testcase
    has been updated to include an __objc_imageinfo.

rdar://107846455
compiler-rt/lib/orc/macho_platform.cpp
compiler-rt/test/lit.common.cfg.py
compiler-rt/test/orc/TestCases/Darwin/x86-64/trivial-swift-types-section.S
llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp