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