Skip to content

Commit de95e69

Browse files
committed
experiment to add -ftrampoline-impl=heap for gfortran
See #599
1 parent a012a4d commit de95e69

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ set_target_properties ( ${LIB_NAME}
235235
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
236236
Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR} )
237237

238+
# Add trampoline heap implementation flag for gfortran on Linux
239+
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
240+
target_link_options(${LIB_NAME} PRIVATE -ftrampoline-impl=heap)
241+
target_link_options(${LIB_NAME}-static PRIVATE -ftrampoline-impl=heap)
242+
endif()
243+
238244
#-------------------------------------
239245
# Build the documentation with FORD
240246
#-------------------------------------

fpm.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ homepage = "https://github.com/jacobwilliams/json-fortran"
77
categories = ["io"]
88
keywords = ["JSON"]
99

10+
[features]
11+
debug.gfortran.linux.link-time-flags = "-ftrampoline-impl=heap"
12+
release.gfortran.linux.link-time-flags = "-ftrampoline-impl=heap"
13+
1014
[build]
1115
external-modules = "ifcore"
1216
auto-executables = true

json-fortran.fobis

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $FORD_FILE = ford.md
1212
$STATIC_LIB = libjsonfortran.a
1313
$SHARED_LIB = libjsonfortran.so
1414
$OPTIMIZE = -O2
15+
$LFLAGS_GNU = -ftrampoline-impl=heap
1516
$CSTATIC_GNU = -c -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -Wno-unused-function -pedantic
1617
$DEBUG_GNU = -O0 -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan -fall-intrinsics
1718
$CSTATIC_INT = -c -std18
@@ -69,12 +70,14 @@ exclude_dirs = $EXCLUDE_DIRS
6970
description = Build library with GNU gfortran by optimized-static flags
7071
compiler = gnu
7172
cflags = $CSTATIC_GNU $OPTIMIZE
73+
lflags = $LFLAGS_GNU
7274
template = template-static
7375

7476
[static-gnu-debug]
7577
description = Build library with GNU gfortran by debug-static flags
7678
compiler = gnu
7779
cflags = $CSTATIC_GNU $DEBUG_GNU
80+
lflags = $LFLAGS_GNU
7881
template = template-static
7982

8083
[static-intel]
@@ -93,12 +96,14 @@ template = template-static
9396
description = Build library with GNU gfortran by optimized-shared flags
9497
compiler = gnu
9598
cflags = $CSTATIC_GNU $OPTIMIZE
99+
lflags = $LFLAGS_GNU
96100
template = template-shared
97101

98102
[shared-gnu-debug]
99103
description = Build library with GNU gfortran by debug-shared flags
100104
compiler = gnu
101105
cflags = $CSTATIC_GNU $DEBUG_GNU
106+
lflags = $LFLAGS_GNU
102107
template = template-shared
103108

104109
[shared-intel]
@@ -118,12 +123,14 @@ template = template-shared
118123
description = Build all tests with GNU gfortran by optimized-static flags
119124
compiler = gnu
120125
cflags = $CSTATIC_GNU $OPTIMIZE
126+
lflags = $LFLAGS_GNU
121127
template = template-tests
122128

123129
[tests-gnu-debug]
124130
description = Build all tests with GNU gfortran by debug-static flags
125131
compiler = gnu
126132
cflags = $CSTATIC_GNU $DEBUG_GNU
133+
lflags = $LFLAGS_GNU
127134
template = template-tests
128135

129136
[tests-intel]

0 commit comments

Comments
 (0)