mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1527471 - part 1 - preprocess aarch64 windows assembly xptcall files; r=dmajor
We need to preprocess these files so we can eventually add unwind information, for which we need to include C headers. Differential Revision: https://phabricator.services.mozilla.com/D19819 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
85ee22eddd
commit
4935a6e5d2
@ -40,11 +40,21 @@ elif CONFIG['CPU_ARCH'] == 'aarch64':
|
||||
'xptcinvoke_aarch64.cpp',
|
||||
'xptcstubs_aarch64.cpp',
|
||||
]
|
||||
SOURCES += [
|
||||
asm_files = [
|
||||
'xptcinvoke_asm_aarch64.asm',
|
||||
'xptcstubs_asm_aarch64.asm',
|
||||
]
|
||||
|
||||
# make gets confused if the srcdir and objdir files have the same name, so
|
||||
# we generate different names for the objdir files
|
||||
for src in asm_files:
|
||||
obj = src.replace('_asm_aarch64', '')
|
||||
GENERATED_FILES += [obj]
|
||||
asm = GENERATED_FILES[obj]
|
||||
asm.script = 'preprocess.py:preprocess'
|
||||
asm.inputs = [src]
|
||||
SOURCES += ['!%s' % obj]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
38
xpcom/reflect/xptcall/md/win32/preprocess.py
Normal file
38
xpcom/reflect/xptcall/md/win32/preprocess.py
Normal file
@ -0,0 +1,38 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
import which
|
||||
import buildconfig
|
||||
|
||||
|
||||
def preprocess(out, asm_file):
|
||||
cxx = shlex.split(buildconfig.substs['CXX'])
|
||||
if not os.path.exists(cxx[0]):
|
||||
cxx[0] = which.which(cxx[0])
|
||||
cppflags = buildconfig.substs['OS_CPPFLAGS']
|
||||
|
||||
# subprocess.Popen(stdout=) only accepts actual file objects, which `out`,
|
||||
# above, is not. So fake a temporary file to write to.
|
||||
(outhandle, tmpout) = tempfile.mkstemp(suffix='.cpp')
|
||||
|
||||
# #line directives will confuse armasm64, and /EP is the only way to
|
||||
# preprocess without emitting #line directives.
|
||||
command = cxx + ['/EP'] + cppflags + ['/TP', asm_file]
|
||||
with open(tmpout, 'wb') as t:
|
||||
result = subprocess.Popen(command, stdout=t).wait()
|
||||
if result != 0:
|
||||
sys.exit(result)
|
||||
|
||||
with open(tmpout, 'rb') as t:
|
||||
out.write(t.read())
|
||||
|
||||
os.close(outhandle)
|
||||
os.remove(tmpout)
|
Loading…
Reference in New Issue
Block a user