[ORC] Add weak symbol support to defineMaterializing, fix for PR40074.
authorLang Hames <lhames@gmail.com>
Fri, 17 Jan 2020 22:48:48 +0000 (14:48 -0800)
committerLang Hames <lhames@gmail.com>
Sun, 19 Jan 2020 18:46:07 +0000 (10:46 -0800)
commit84217ad66115cc31b184374a03c8333e4578996f
treee14b8dba59b6a962605f282a7520a4535bdb8399
parent70b53a301888fe2be36996b41a7dd5aa7c256dc9
[ORC] Add weak symbol support to defineMaterializing, fix for PR40074.

The MaterializationResponsibility::defineMaterializing method allows clients to
add new definitions that are in the process of being materialized to the JIT.
This patch adds support to defineMaterializing for symbols with weak linkage
where the new definitions may be rejected if another materializer concurrently
defines the same symbol. If a weak symbol is rejected it will not be added to
the MaterializationResponsibility's responsibility set. Clients can check for
membership in the responsibility set via the
MaterializationResponsibility::getSymbols() method before resolving any
such weak symbols.

This patch also adds code to RTDyldObjectLinkingLayer to tag COFF comdat symbols
introduced during codegen as weak, on the assumption that these are COFF comdat
constants. This fixes http://llvm.org/PR40074.
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp