[flang-commits] [clang] [flang] [llvm] [flang] Add runtime trampoline pool for W^X compliance (PR #183108)
Sairudra More via flang-commits
flang-commits at lists.llvm.org
Sat Feb 28 03:48:27 PST 2026
================
@@ -0,0 +1,69 @@
+//===-- flang-rt/runtime/trampoline.h ----------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Internal declarations for the W^X-compliant trampoline pool.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FLANG_RT_RUNTIME_TRAMPOLINE_H_
+#define FLANG_RT_RUNTIME_TRAMPOLINE_H_
+
+#include <cstddef>
+#include <cstdint>
+
+namespace Fortran::runtime::trampoline {
+
+/// Per-trampoline data entry. Stored in a writable (non-executable) region.
+/// Each entry is paired with a trampoline code stub in the executable region.
+struct TrampolineData {
+ const void *calleeAddress;
+ const void *staticChainAddress;
+};
+
+/// Default number of trampoline slots in the pool.
+/// Can be overridden via FLANG_TRAMPOLINE_POOL_SIZE environment variable.
+constexpr std::size_t kDefaultPoolSize = 1024;
----------------
Saieiei wrote:
Sorry about that
Converted all local variable initializations to brace init (`{}`) throughout trampoline.cpp and added `{}` braces to all single-statement `if`/`for`/`while` bodies. Latest [push](github.com/llvm/llvm-project/pull/183108/changes/95239b46c85d9e8c1deb7fd70189b119e5159e73) should have them all.
https://github.com/llvm/llvm-project/pull/183108
More information about the flang-commits
mailing list