Skip to content

Commit a12f461

Browse files
committed
fix: fix compilation.
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
1 parent 5b1f6da commit a12f461

File tree

3 files changed

+74
-4
lines changed

3 files changed

+74
-4
lines changed

deps/libffi/libffi.gyp

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
'actions': [
141141
{
142142
'action_name': 'preprocess_win64_intel_asm',
143-
'process_outputs_as_sources': 1,
144143
'inputs': [
145144
'preprocess_asm.py',
146145
'include/ffi_cfi.h',
@@ -150,7 +149,7 @@
150149
'<(INTERMEDIATE_DIR)/fficonfig.h',
151150
],
152151
'outputs': [
153-
'<(INTERMEDIATE_DIR)/win64_intel.asm',
152+
'<(INTERMEDIATE_DIR)/win64_intel.pre.asm',
154153
],
155154
'action': [
156155
'<(python)',
@@ -167,13 +166,31 @@
167166
'FFI_STATIC_BUILD',
168167
],
169168
},
169+
{
170+
'action_name': 'sanitize_win64_intel_asm',
171+
'process_outputs_as_sources': 1,
172+
'inputs': [
173+
'sanitize-asm.py',
174+
'<(INTERMEDIATE_DIR)/win64_intel.pre.asm',
175+
],
176+
'outputs': [
177+
'<(INTERMEDIATE_DIR)/win64_intel.asm',
178+
],
179+
'action': [
180+
'<(python)',
181+
'sanitize-asm.py',
182+
'--input',
183+
'<(INTERMEDIATE_DIR)/win64_intel.pre.asm',
184+
'--output',
185+
'<@(_outputs)',
186+
],
187+
},
170188
],
171189
}],
172190
['OS == "win" and target_arch == "arm64"', {
173191
'actions': [
174192
{
175193
'action_name': 'preprocess_win64_arm_asm',
176-
'process_outputs_as_sources': 1,
177194
'inputs': [
178195
'preprocess_asm.py',
179196
'include/ffi_cfi.h',
@@ -183,7 +200,7 @@
183200
'<(INTERMEDIATE_DIR)/fficonfig.h',
184201
],
185202
'outputs': [
186-
'<(INTERMEDIATE_DIR)/win64_armasm.asm',
203+
'<(INTERMEDIATE_DIR)/win64_armasm.pre.asm',
187204
],
188205
'action': [
189206
'<(python)',
@@ -200,6 +217,25 @@
200217
'FFI_STATIC_BUILD',
201218
],
202219
},
220+
{
221+
'action_name': 'sanitize_win64_arm_asm',
222+
'process_outputs_as_sources': 1,
223+
'inputs': [
224+
'sanitize-asm.py',
225+
'<(INTERMEDIATE_DIR)/win64_armasm.pre.asm',
226+
],
227+
'outputs': [
228+
'<(INTERMEDIATE_DIR)/win64_armasm.asm',
229+
],
230+
'action': [
231+
'<(python)',
232+
'sanitize-asm.py',
233+
'--input',
234+
'<(INTERMEDIATE_DIR)/win64_armasm.pre.asm',
235+
'--output',
236+
'<@(_outputs)',
237+
],
238+
},
203239
],
204240
}],
205241
],

deps/libffi/sanitize-asm.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
from pathlib import Path
5+
6+
7+
def normalize_path(value):
8+
return str(value).strip().strip('"')
9+
10+
11+
def sanitize_asm(input_path, output_path):
12+
source = Path(normalize_path(input_path)).read_text(encoding='utf-8')
13+
lines = []
14+
for line in source.splitlines(keepends=True):
15+
if line.lstrip().startswith('#'):
16+
continue
17+
lines.append(line)
18+
19+
Path(normalize_path(output_path)).write_text(''.join(lines), encoding='utf-8')
20+
21+
22+
def main(argv=None):
23+
parser = argparse.ArgumentParser(description='Sanitize preprocessed assembly output')
24+
parser.add_argument('--input', required=True)
25+
parser.add_argument('--output', required=True)
26+
args = parser.parse_args(argv)
27+
28+
sanitize_asm(args.input, args.output)
29+
return 0
30+
31+
32+
if __name__ == '__main__':
33+
raise SystemExit(main())

test/ffi/test-ffi-module.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ test('ffi exports expected API surface', () => {
105105
'setUint32',
106106
'setUint64',
107107
'setUint8',
108+
'suffix',
108109
'toArrayBuffer',
109110
'toBuffer',
110111
'toString',

0 commit comments

Comments
 (0)