1283625Sdim//===---- OrcMCJITReplacement.h - Orc-based MCJIT replacement ---*- C++ -*-===// 2283625Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6283625Sdim// 7283625Sdim//===----------------------------------------------------------------------===// 8283625Sdim// 9283625Sdim// This file forces OrcMCJITReplacement to link in on certain operating systems. 10283625Sdim// (Windows). 11283625Sdim// 12283625Sdim//===----------------------------------------------------------------------===// 13283625Sdim 14283625Sdim#ifndef LLVM_EXECUTIONENGINE_ORCMCJITREPLACEMENT_H 15283625Sdim#define LLVM_EXECUTIONENGINE_ORCMCJITREPLACEMENT_H 16283625Sdim 17283625Sdim#include "llvm/ExecutionEngine/ExecutionEngine.h" 18283625Sdim#include <cstdlib> 19283625Sdim 20283625Sdimextern "C" void LLVMLinkInOrcMCJITReplacement(); 21283625Sdim 22283625Sdimnamespace { 23283625Sdim struct ForceOrcMCJITReplacementLinking { 24283625Sdim ForceOrcMCJITReplacementLinking() { 25283625Sdim // We must reference OrcMCJITReplacement in such a way that compilers will 26283625Sdim // not delete it all as dead code, even with whole program optimization, 27283625Sdim // yet is effectively a NO-OP. As the compiler isn't smart enough to know 28283625Sdim // that getenv() never returns -1, this will do the job. 29283625Sdim if (std::getenv("bar") != (char*) -1) 30283625Sdim return; 31283625Sdim 32283625Sdim LLVMLinkInOrcMCJITReplacement(); 33283625Sdim } 34283625Sdim } ForceOrcMCJITReplacementLinking; 35283625Sdim} 36283625Sdim 37283625Sdim#endif 38