MCPcopy Create free account
hub / github.com/nodejs/node / render_fficonfig

Function render_fficonfig

deps/libffi/generate-headers.py:105–183  ·  view source on GitHub ↗
(os_name, target_arch)

Source from the content-addressed store, hash-verified

103
104
105def render_fficonfig(os_name, target_arch):
106 target_arch = normalize_arch(target_arch)
107 lines = [
108 '/* Auto-generated by generate-headers.py. */',
109 '#ifndef LIBFFI_FFICONFIG_H_',
110 '#define LIBFFI_FFICONFIG_H_',
111 '',
112 '#define HAVE_ALLOCA 1',
113 '#define HAVE_MEMCPY 1',
114 '#define HAVE_MEMORY_H 1',
115 '#define HAVE_STDINT_H 1',
116 '#define HAVE_STRING_H 1',
117 '#define STDC_HEADERS 1',
118 ]
119
120 if os_name != 'win':
121 lines.extend([
122 '#define HAVE_AS_CFI_PSEUDO_OP 1',
123 '#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1',
124 '#define HAVE_MKOSTEMP 1',
125 '#define HAVE_RO_EH_FRAME 1',
126 '#define EH_FRAME_FLAGS "a"',
127 ])
128
129 if target_arch in ('ia32', 'x64') and os_name != 'win':
130 lines.append('#define HAVE_AS_X86_PCREL 1')
131
132 if uses_exec_trampoline_table(os_name, target_arch):
133 lines.append('#define FFI_EXEC_TRAMPOLINE_TABLE 1')
134 elif os_name in ('freebsd', 'mac', 'openbsd'):
135 lines.append('#define FFI_MMAP_EXEC_WRIT 1')
136
137 if os_name != 'win':
138 lines.extend([
139 '#define HAVE_DLFCN_H 1',
140 '#define HAVE_MMAP 1',
141 '#define HAVE_MMAP_ANON 1',
142 '#define HAVE_MMAP_FILE 1',
143 '#define HAVE_SYS_MMAN_H 1',
144 '#define HAVE_UNISTD_H 1',
145 ])
146
147 if os_name in ('freebsd', 'ios', 'mac', 'openbsd'):
148 lines.extend([
149 '#define HAVE_MMAP_DEV_ZERO 1',
150 ])
151
152 if os_name == 'mac' and target_arch == 'arm64':
153 lines.extend([
154 '#if defined(__arm64e__)',
155 '#define HAVE_ARM64E_PTRAUTH 1',
156 '#endif',
157 ])
158
159 lines.extend([
160 '',
161 '#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE',
162 '#ifdef LIBFFI_ASM',

Callers 1

generate_headersFunction · 0.85

Calls 5

normalize_archFunction · 0.85
extendMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected