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 pre-assembled trampolines in a separate
15// executable (but not writable) memory region, paired with writable (but
16// 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
48void *RTDECL(TrampolineInit)(
49 void *scratch, const void *calleeAddress, const void *staticChainAddress);
50
56void *RTDECL(TrampolineAdjust)(void *handle);
57
64void RTDECL(TrampolineFree)(void *handle);
65
66} // extern "C"
67} // namespace Fortran::runtime
68
69#endif // FORTRAN_RUNTIME_TRAMPOLINE_H_