FLANG
trampoline.h
1//===-- include/flang/Runtime/trampoline.h ----------------------*- C++ -*-===//
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// Runtime support for W^X-compliant trampoline pool management.
10//
11// This provides an alternative to stack-based trampolines for internal
12// procedures with host association. Instead of requiring the stack to be
13// both writable and executable (violating W^X security policies), this
14// implementation uses a pool of trampoline stubs generated during pool
15// initialization in a separate executable (but not writable) memory region,
16// paired with writable (but not executable) data entries.
17//
18// See flang/docs/InternalProcedureTrampolines.md for design details.
19//
20//===----------------------------------------------------------------------===//
21
22#ifndef FORTRAN_RUNTIME_TRAMPOLINE_H_
23#define FORTRAN_RUNTIME_TRAMPOLINE_H_
24
25#include "flang/Runtime/entry-names.h"
26
27namespace Fortran::runtime {
28extern "C" {
29
47void *RTDECL(TrampolineInit)(
48 void *scratch, const void *calleeAddress, const void *staticChainAddress);
49
55void *RTDECL(TrampolineAdjust)(void *handle);
56
63void RTDECL(TrampolineFree)(void *handle);
64
65} // extern "C"
66} // namespace Fortran::runtime
67
68#endif // FORTRAN_RUNTIME_TRAMPOLINE_H_