| Index: syzygy/integration_tests/make_integration_tests_clang.py
|
| diff --git a/syzygy/integration_tests/make_integration_tests_clang.py b/syzygy/integration_tests/make_integration_tests_clang.py
|
| index e6520227b17759402281531a054f8e84fd293bc1..defa4b06963a6d4f9f76cca66e14c9e538bae9b9 100644
|
| --- a/syzygy/integration_tests/make_integration_tests_clang.py
|
| +++ b/syzygy/integration_tests/make_integration_tests_clang.py
|
| @@ -21,7 +21,7 @@ _CLANG_CL_PATH = os.path.join(_SRC_DIR,
|
|
|
|
|
| def compile_with_asan(clang_path, source_files, src_dir, object_files,
|
| - target_name):
|
| + target_name, target_arch):
|
| """Compiles the files and instruments them with LLVM's ASAN.
|
| The linking is done with the method link below.
|
|
|
| @@ -34,11 +34,17 @@ def compile_with_asan(clang_path, source_files, src_dir, object_files,
|
| src_dir: The repository where the syzygy src is located.
|
| object_files: The path where each object file should be generated.
|
| target_name: The name of the target being build.
|
| + target_arch: The target architecture ia32 for 32 bit and x64 for 64 bit.
|
| """
|
|
|
| + # By default set the bittness flag to 32 bit.
|
| + bitness_flag = '-m32'
|
| + if target_arch == 'x64':
|
| + bitness_flag = '-m64'
|
| +
|
| compiler_flags = [
|
| '-c',
|
| - '-m32',
|
| + bitness_flag,
|
| '-fsanitize=address',
|
| '-mllvm',
|
| '-asan-instrumentation-with-call-threshold=0',
|
| @@ -66,7 +72,8 @@ def compile_with_asan(clang_path, source_files, src_dir, object_files,
|
| return ret
|
|
|
|
|
| -def link(clang_path, object_files, build_dir, target_name, def_file):
|
| +def link(clang_path, object_files, build_dir, target_name, def_file,
|
| + target_arch):
|
| """ Links the object files and produces the integration_tests_clang_dll.dll.
|
|
|
| Links the object files and produces the dll. The object files have to be
|
| @@ -77,7 +84,13 @@ def link(clang_path, object_files, build_dir, target_name, def_file):
|
| source_files: The source file names which are converted to obj filenames.
|
| build_dir: The directory where to produce the linked dll.
|
| target_name: The name of the target being build.
|
| + target_arch: The target architecture ia32 for 32 bit and x64 for 64 bit.
|
| """
|
| +
|
| + if target_arch == 'x64':
|
| + bitness_flag = '-m64'
|
| + elif target_arch = 'ia32':
|
| + bitness_flag = '-m32'
|
|
|
| linker_flags = [
|
| '-o',
|
| @@ -91,7 +104,7 @@ def link(clang_path, object_files, build_dir, target_name, def_file):
|
| '/def:' + def_file,
|
| ]
|
|
|
| - linker_command = [clang_path, '-m32']
|
| + linker_command = [clang_path, bitness_flag]
|
| linker_command.extend(object_files)
|
| linker_command.extend(linker_flags)
|
|
|
| @@ -109,6 +122,7 @@ def main():
|
| parser.add_option('--input-files', help='Files to be compiled and linked.')
|
| parser.add_option('--target-name', help='Name of the target to be compiled.')
|
| parser.add_option('--def-file', help='Definition file for the dll.')
|
| + parser.add_option('--target-arch', help='Target architecture x64 or ia32.')
|
|
|
| options, _ = parser.parse_args()
|
|
|
| @@ -120,6 +134,8 @@ def main():
|
| parser.error('--target-name is required.')
|
| if not options.def_file:
|
| parser.error('--def-file is required.')
|
| + if not options.target_arch:
|
| + parser.error('--target-arch is required.')
|
|
|
| def get_object_file_location(source_file,
|
| output_dir, target_name):
|
| @@ -137,11 +153,12 @@ def main():
|
| options.target_name))
|
|
|
| ret = compile_with_asan(_CLANG_CL_PATH, source_files, _SRC_DIR,
|
| - object_files, options.target_name)
|
| + object_files, options.target_name,
|
| + options.target_arch)
|
|
|
| if ret == 0:
|
| ret = link(_CLANG_CL_PATH, object_files, options.output_dir,
|
| - options.target_name, options.def_file)
|
| + options.target_name, options.def_file, options.target_arch)
|
| else:
|
| print ('ERROR: Compilation of %s failed, skipping link step.'
|
| % options.target_name)
|
|
|