Skip to content

Commit 9f032d6

Browse files
committed
fix: fix build
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
1 parent 1432c97 commit 9f032d6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

deps/libffi/preprocess_asm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import argparse
44
import os
55
from pathlib import Path
6+
import re
67
import shlex
78
import shutil
89
import subprocess
@@ -72,7 +73,12 @@ def preprocess(args):
7273
sys.stderr.write(result.stderr)
7374
raise RuntimeError(f'Preprocessing failed: {" ".join(command)}')
7475

75-
output.write_text(result.stdout, encoding='utf-8')
76+
# Strip preprocessor line directives that some assemblers can't handle
77+
# (e.g., armasm64.exe doesn't accept #line directives)
78+
cleaned = re.sub(r'^#\s*\d+\s+"[^"]*".*$', '', result.stdout, flags=re.MULTILINE)
79+
cleaned = re.sub(r'^#\s*line\s+\d+.*$', '', cleaned, flags=re.MULTILINE)
80+
81+
output.write_text(cleaned, encoding='utf-8')
7682

7783

7884
def main(argv=None):

0 commit comments

Comments
 (0)