1//===----- DefaultHostBootstrapValues.cpp - Defaults for host process -----===//
2//
3// 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
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h"
10
11#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
12#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h"
13
14#ifdef __APPLE__
15#include <dlfcn.h>
16#endif // __APPLE__
17
18namespace llvm::orc {
19
20void addDefaultBootstrapValuesForHostProcess(
21 StringMap<std::vector<char>> &BootstrapMap,
22 StringMap<ExecutorAddr> &BootstrapSymbols) {
23
24 // FIXME: We probably shouldn't set these on Windows?
25 BootstrapSymbols[rt::RegisterEHFrameSectionAllocActionName] =
26 ExecutorAddr::fromPtr(Ptr: &llvm_orc_registerEHFrameSectionAllocAction);
27 BootstrapSymbols[rt::DeregisterEHFrameSectionAllocActionName] =
28 ExecutorAddr::fromPtr(Ptr: &llvm_orc_deregisterEHFrameSectionAllocAction);
29
30#ifdef __APPLE__
31 if (!dlsym(RTLD_DEFAULT, "__unw_add_find_dynamic_unwind_sections"))
32 BootstrapMap["darwin-use-ehframes-only"].push_back(1);
33#endif // __APPLE__
34}
35
36} // namespace llvm::orc
37