blob: 6cca1933f39f614df56bdc3f57413f5dce223f96 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===---- OrcMCJITReplacement.h - Orc-based MCJIT replacement ---*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8//
9// This file forces OrcMCJITReplacement to link in on certain operating systems.
10// (Windows).
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_EXECUTIONENGINE_ORCMCJITREPLACEMENT_H
15#define LLVM_EXECUTIONENGINE_ORCMCJITREPLACEMENT_H
16
17#include "llvm/ExecutionEngine/ExecutionEngine.h"
18#include <cstdlib>
19
20extern "C" void LLVMLinkInOrcMCJITReplacement();
21
22namespace {
23 struct ForceOrcMCJITReplacementLinking {
24 ForceOrcMCJITReplacementLinking() {
25 // We must reference OrcMCJITReplacement in such a way that compilers will
26 // not delete it all as dead code, even with whole program optimization,
27 // yet is effectively a NO-OP. As the compiler isn't smart enough to know
28 // that getenv() never returns -1, this will do the job.
29 if (std::getenv("bar") != (char*) -1)
30 return;
31
32 LLVMLinkInOrcMCJITReplacement();
33 }
34 } ForceOrcMCJITReplacementLinking;
35}
36
37#endif