1#!/usr/bin/env python3
2
3import os
4import sys
5import tempfile
6
7import_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
8import_path = os.path.abspath(os.path.join(import_path, 'utils'))
9sys.path.insert(1, import_path)
10
11from utils import run_header_abi_dumper
12from utils import run_header_abi_linker
13from utils import SOURCE_ABI_DUMP_EXT
14
15
16SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
17ARCH_TARGET_CFLAGS = {
18    'arm': ('-target', 'arm-linux-androideabi'),
19    'arm64': ('-target', 'aarch64-linux-android'),
20    'x86': ('-target', 'i386-linux-androideabi'),
21    'x86_64': ('-target', 'x86_64-linux-android'),
22    'mips': ('-target', 'mips-linux-androideabi'),
23    'mips64': ('-target', 'mips64-linux-android'),
24}
25TARGET_ARCHES = ['arm', 'arm64', 'x86', 'x86_64', 'mips', 'mips64']
26
27
28def relative_to_abs_path(relative_path):
29    return os.path.join(SCRIPT_DIR, relative_path)
30
31
32def relative_to_abs_path_list(relative_path_list):
33    abs_paths = []
34    for relative_path in relative_path_list:
35        abs_paths.append(relative_to_abs_path(relative_path))
36    return abs_paths
37
38
39class Module(object):
40    def __init__(self, name, arch, cflags, export_include_dirs):
41        self.name = name
42        self.arch = arch
43        self.cflags = tuple(cflags)
44        self.arch_cflags = ARCH_TARGET_CFLAGS.get(self.arch, tuple())
45        self.export_include_dirs = relative_to_abs_path_list(
46            export_include_dirs)
47
48    def get_dump_name(self):
49        """Returns the module name followed by file extension."""
50        raise NotImplementedError()
51
52    def make_dump(self, output_path):
53        """Create a dump file."""
54        raise NotImplementedError()
55
56    def mutate_for_arch(self, target_arch):
57        """Returns a clone of this instance with arch=target_arch."""
58        raise NotImplementedError()
59
60    def mutate_for_all_arches(self):
61        if self.arch:
62            return [self]
63        modules = []
64        for target_arch in TARGET_ARCHES:
65            modules.append(self.mutate_for_arch(target_arch))
66        return modules
67
68    @staticmethod
69    def get_test_modules():
70        modules = []
71        for module in TEST_MODULES.values():
72            modules += module.mutate_for_all_arches()
73        return modules
74
75    @staticmethod
76    def get_test_modules_by_name(name):
77        return TEST_MODULES.get(name).mutate_for_all_arches()
78
79
80class SdumpModule(Module):
81    def __init__(self, name, src, export_include_dirs=tuple(), cflags=tuple(),
82                 arch='', dumper_flags=tuple()):
83        super(SdumpModule, self).__init__(name, arch, cflags,
84                                          export_include_dirs)
85        self.src = relative_to_abs_path(src)
86        self.dumper_flags = dumper_flags
87
88    def get_dump_name(self):
89        return self.name + '.sdump'
90
91    def make_dump(self, output_path):
92        return run_header_abi_dumper(
93            self.src, output_path, cflags=self.cflags,
94            export_include_dirs=self.export_include_dirs,
95            flags=self.dumper_flags)
96
97    def mutate_for_arch(self, target_arch):
98        return SdumpModule(self.name, self.src, self.export_include_dirs,
99                           self.cflags, target_arch, self.dumper_flags)
100
101
102class LsdumpModule(Module):
103    def __init__(self, name, srcs, version_script, export_include_dirs,
104                 cflags=tuple(), arch='', api='current', dumper_flags=tuple(),
105                 linker_flags=tuple()):
106        super(LsdumpModule, self).__init__(name, arch, cflags,
107                                           export_include_dirs)
108        self.srcs = relative_to_abs_path_list(srcs)
109        self.version_script = relative_to_abs_path(version_script)
110        self.api = api
111        self.dumper_flags = dumper_flags
112        self.linker_flags = linker_flags
113
114    def get_dump_name(self):
115        return self.name + SOURCE_ABI_DUMP_EXT
116
117    def make_dump(self, output_path):
118        """For each source file, produce a .sdump file, and link them to form
119           an lsump file."""
120        dumps_to_link = []
121        with tempfile.TemporaryDirectory() as tmp:
122            for src in self.srcs:
123                sdump_path = os.path.join(tmp,
124                                          os.path.basename(src) + '.sdump')
125                dumps_to_link.append(sdump_path)
126                run_header_abi_dumper(
127                    src, sdump_path, self.cflags + self.arch_cflags,
128                    self.export_include_dirs, self.dumper_flags)
129
130            lsdump_path = os.path.join(tmp, self.get_dump_name())
131            run_header_abi_linker(dumps_to_link, lsdump_path,
132                                  self.version_script, self.api, self.arch,
133                                  self.linker_flags)
134            # Replace the absolute tmp paths in the type ID.
135            with open(lsdump_path, 'r') as lsdump_file:
136                content = lsdump_file.read().replace(tmp, '')
137
138        with open(output_path, 'w') as output_file:
139            output_file.write(content)
140
141    def mutate_for_arch(self, target_arch):
142        return LsdumpModule(self.name, self.srcs, self.version_script,
143                            self.export_include_dirs, self.cflags, target_arch,
144                            self.api, self.dumper_flags, self.linker_flags)
145
146
147TEST_MODULES = [
148    SdumpModule(
149        name='undeclared_types.h',
150        src='integration/cpp/header/undeclared_types.h',
151        arch='',
152        dumper_flags=['-suppress-errors', '-output-format', 'Json']),
153    SdumpModule(
154        name='known_issues.h',
155        src='integration/cpp/header/known_issues.h',
156        arch='',
157        dumper_flags=['-suppress-errors', '-output-format', 'Json']),
158    LsdumpModule(
159        name='libc_and_cpp',
160        srcs=[
161            'integration/c_and_cpp/source1.cpp',
162            'integration/c_and_cpp/source2.c',
163        ],
164        version_script='integration/c_and_cpp/map.txt',
165        export_include_dirs=['integration/c_and_cpp/include'],
166    ),
167    LsdumpModule(
168        name='libc_and_cpp_with_opaque_ptr_a',
169        srcs=[
170            'integration/c_and_cpp/source1.cpp',
171            'integration/c_and_cpp/source2.c',
172        ],
173        version_script='integration/c_and_cpp/map.txt',
174        export_include_dirs=['integration/c_and_cpp/include'],
175        cflags=['-DOPAQUE_STRUCT_A=1'],
176    ),
177    LsdumpModule(
178        name='libc_and_cpp_with_opaque_ptr_b',
179        srcs=[
180            'integration/c_and_cpp/source1.cpp',
181            'integration/c_and_cpp/source2.c',
182        ],
183        version_script='integration/c_and_cpp/map.txt',
184        export_include_dirs=['integration/c_and_cpp/include'],
185        cflags=['-DOPAQUE_STRUCT_B=1'],
186    ),
187    LsdumpModule(
188        name='libc_and_cpp_with_unused_struct',
189        srcs=[
190            'integration/c_and_cpp/source1.cpp',
191            'integration/c_and_cpp/source2.c',
192        ],
193        version_script='integration/c_and_cpp/map.txt',
194        export_include_dirs=['integration/c_and_cpp/include'],
195        cflags=['-DINCLUDE_UNUSED_STRUCTS=1'],
196    ),
197    LsdumpModule(
198        name='libc_and_cpp_with_unused_cstruct',
199        srcs=[
200            'integration/c_and_cpp/source1.cpp',
201            'integration/c_and_cpp/source2.c',
202        ],
203        version_script='integration/c_and_cpp/map.txt',
204        export_include_dirs=['integration/c_and_cpp/include'],
205        cflags=['-DINCLUDE_UNUSED_STRUCTS=1', '-DMAKE_UNUSED_STRUCT_C=1'],
206    ),
207    LsdumpModule(
208        name='libgolden_cpp',
209        srcs=[
210            'integration/cpp/gold/golden_1.cpp',
211            'integration/cpp/gold/high_volume_speaker.cpp',
212            'integration/cpp/gold/low_volume_speaker.cpp',
213        ],
214        version_script='integration/cpp/gold/map.txt',
215        export_include_dirs=['integration/cpp/gold/include'],
216    ),
217    LsdumpModule(
218        name='libgolden_cpp_odr',
219        srcs=[
220            'integration/cpp/gold/golden_1.cpp',
221            'integration/cpp/gold/high_volume_speaker.cpp',
222            'integration/cpp/gold/low_volume_speaker.cpp',
223        ],
224        version_script='integration/cpp/gold/map.txt',
225        export_include_dirs=['integration/cpp/gold/include'],
226        cflags=['-DTEST_ODR'],
227    ),
228    LsdumpModule(
229        name='libgolden_cpp_add_function',
230        srcs=[
231            'integration/cpp/gold/golden_1.cpp',
232            'integration/cpp/gold/high_volume_speaker.cpp',
233            'integration/cpp/gold/low_volume_speaker.cpp',
234        ],
235        version_script='integration/cpp/gold/map_add_function.txt',
236        export_include_dirs=['integration/cpp/gold/include'],
237        cflags=['-DGOLDEN_ADD_FUNCTION=1'],
238    ),
239    LsdumpModule(
240        name='libgolden_cpp_add_function_and_unexported_elf',
241        srcs=[
242            'integration/cpp/gold/golden_1.cpp',
243            'integration/cpp/gold/high_volume_speaker.cpp',
244            'integration/cpp/gold/low_volume_speaker.cpp',
245        ],
246        version_script='integration/cpp/gold/map_add_function_elf_symbol.txt',
247        export_include_dirs=['integration/cpp/gold/include'],
248        cflags=['-DGOLDEN_ADD_FUNCTION=1', '-DADD_UNEXPORTED_ELF_SYMBOL'],
249        arch='',
250        api='current',
251    ),
252    LsdumpModule(
253        name='libgolden_cpp_add_function_sybmol_only',
254        srcs=[
255            'integration/cpp/gold/golden_1.cpp',
256            'integration/cpp/gold/high_volume_speaker.cpp',
257            'integration/cpp/gold/low_volume_speaker.cpp',
258        ],
259        version_script='integration/cpp/gold/map_add_function.txt',
260        export_include_dirs=['integration/cpp/gold/include'],
261    ),
262    LsdumpModule(
263        name='libgolden_cpp_change_function_access',
264        srcs=[
265            'integration/cpp/gold/golden_1.cpp',
266            'integration/cpp/gold/high_volume_speaker.cpp',
267            'integration/cpp/gold/low_volume_speaker.cpp',
268        ],
269        version_script='integration/cpp/gold/map.txt',
270        export_include_dirs=['integration/cpp/gold/include'],
271        cflags=['-DGOLDEN_CHANGE_FUNCTION_ACCESS=1'],
272    ),
273    LsdumpModule(
274        name='libgolden_cpp_add_global_variable',
275        srcs=[
276            'integration/cpp/gold/golden_1.cpp',
277            'integration/cpp/gold/high_volume_speaker.cpp',
278            'integration/cpp/gold/low_volume_speaker.cpp',
279        ],
280        version_script='integration/cpp/gold/map_added_globvar.txt',
281        export_include_dirs=['integration/cpp/gold/include'],
282        cflags=['-DGOLDEN_ADD_GLOBVAR=1'],
283    ),
284    LsdumpModule(
285        name='libgolden_cpp_add_global_variable_private',
286        srcs=[
287            'integration/cpp/gold/golden_1.cpp',
288            'integration/cpp/gold/high_volume_speaker.cpp',
289            'integration/cpp/gold/low_volume_speaker.cpp',
290        ],
291        version_script='integration/cpp/gold/map_added_globvar.txt',
292        export_include_dirs=['integration/cpp/gold/include'],
293        cflags=['-DGOLDEN_ADD_GLOBVAR=1', '-DGOLDEN_ADD_GLOBVAR_PRIVATE'],
294    ),
295    LsdumpModule(
296        name='libgolden_cpp_return_type_diff',
297        srcs=[
298            'integration/cpp/gold/golden_1.cpp',
299            'integration/cpp/gold/high_volume_speaker.cpp',
300            'integration/cpp/gold/low_volume_speaker.cpp',
301        ],
302        version_script='integration/cpp/gold/map.txt',
303        export_include_dirs=['integration/cpp/gold/include'],
304        cflags=['-DGOLDEN_RETURN_TYPE_DIFF=1'],
305    ),
306    LsdumpModule(
307        name='libgolden_cpp_parameter_type_diff',
308        srcs=[
309            'integration/cpp/gold/golden_1.cpp',
310            'integration/cpp/gold/high_volume_speaker.cpp',
311            'integration/cpp/gold/low_volume_speaker.cpp',
312        ],
313        version_script='integration/cpp/gold/map_parameter_type_diff.txt',
314        export_include_dirs=['integration/cpp/gold/include'],
315        cflags=['-DGOLDEN_PARAMETER_TYPE_DIFF=1'],
316    ),
317    LsdumpModule(
318        name='libgolden_cpp_vtable_diff',
319        srcs=[
320            'integration/cpp/gold/golden_1.cpp',
321            'integration/cpp/gold/high_volume_speaker.cpp',
322            'integration/cpp/gold/low_volume_speaker.cpp',
323        ],
324        version_script='integration/cpp/gold/map.txt',
325        export_include_dirs=['integration/cpp/gold/include'],
326        cflags=['-DGOLDEN_VTABLE_DIFF=1'],
327    ),
328    LsdumpModule(
329        name='libgolden_cpp_member_diff',
330        srcs=[
331            'integration/cpp/gold/golden_1.cpp',
332            'integration/cpp/gold/high_volume_speaker.cpp',
333            'integration/cpp/gold/low_volume_speaker.cpp',
334        ],
335        version_script='integration/cpp/gold/map.txt',
336        export_include_dirs=['integration/cpp/gold/include'],
337        cflags=['-DGOLDEN_MEMBER_DIFF=1'],
338    ),
339    LsdumpModule(
340        name='libgolden_cpp_member_fake_diff',
341        srcs=[
342            'integration/cpp/gold/golden_1.cpp',
343            'integration/cpp/gold/high_volume_speaker.cpp',
344            'integration/cpp/gold/low_volume_speaker.cpp',
345        ],
346        version_script='integration/cpp/gold/map.txt',
347        export_include_dirs=['integration/cpp/gold/include'],
348        cflags=['-DGOLDEN_MEMBER_FAKE_DIFF=1'],
349    ),
350    LsdumpModule(
351        name='libgolden_cpp_member_cv_diff',
352        srcs=[
353            'integration/cpp/gold/golden_1.cpp',
354            'integration/cpp/gold/high_volume_speaker.cpp',
355            'integration/cpp/gold/low_volume_speaker.cpp',
356        ],
357        version_script='integration/cpp/gold/map.txt',
358        export_include_dirs=['integration/cpp/gold/include'],
359        cflags=['-DGOLDEN_MEMBER_CV_DIFF=1'],
360    ),
361    LsdumpModule(
362        name='libgolden_cpp_change_member_access',
363        srcs=[
364            'integration/cpp/gold/golden_1.cpp',
365            'integration/cpp/gold/high_volume_speaker.cpp',
366            'integration/cpp/gold/low_volume_speaker.cpp',
367        ],
368        version_script='integration/cpp/gold/map.txt',
369        export_include_dirs=['integration/cpp/gold/include'],
370        cflags=['-DGOLDEN_CHANGE_MEMBER_ACCESS=1'],
371    ),
372    LsdumpModule(
373        name='libgolden_cpp_member_integral_type_diff',
374        srcs=[
375            'integration/cpp/gold/golden_1.cpp',
376            'integration/cpp/gold/high_volume_speaker.cpp',
377            'integration/cpp/gold/low_volume_speaker.cpp',
378        ],
379        version_script='integration/cpp/gold/map.txt',
380        export_include_dirs=['integration/cpp/gold/include'],
381        cflags=['-DGOLDEN_MEMBER_INTEGRAL_TYPE_DIFF=1'],
382    ),
383    LsdumpModule(
384        name='libgolden_cpp_enum_diff',
385        srcs=[
386            'integration/cpp/gold/golden_1.cpp',
387            'integration/cpp/gold/high_volume_speaker.cpp',
388            'integration/cpp/gold/low_volume_speaker.cpp',
389        ],
390        version_script='integration/cpp/gold/map.txt',
391        export_include_dirs=['integration/cpp/gold/include'],
392        cflags=['-DGOLDEN_ENUM_DIFF=1'],
393    ),
394    LsdumpModule(
395        name='libgolden_cpp_enum_extended',
396        srcs=[
397            'integration/cpp/gold/golden_1.cpp',
398            'integration/cpp/gold/high_volume_speaker.cpp',
399            'integration/cpp/gold/low_volume_speaker.cpp',
400        ],
401        version_script='integration/cpp/gold/map.txt',
402        export_include_dirs=['integration/cpp/gold/include'],
403        cflags=['-DGOLDEN_ENUM_EXTENSION=1'],
404    ),
405    LsdumpModule(
406        name='libgolden_cpp_unreferenced_elf_symbol_removed',
407        srcs=[
408            'integration/cpp/gold/golden_1.cpp',
409            'integration/cpp/gold/high_volume_speaker.cpp',
410            'integration/cpp/gold/low_volume_speaker.cpp',
411        ],
412        version_script='integration/cpp/gold/map_elf_symbol_removed.txt',
413        export_include_dirs=['integration/cpp/gold/include'],
414    ),
415    LsdumpModule(
416        name='libreproducability',
417        srcs=['integration/c_and_cpp/reproducability.c'],
418        version_script='integration/c_and_cpp/repro_map.txt',
419        export_include_dirs=['integration/c_and_cpp/include'],
420    ),
421    LsdumpModule(
422        name='libifunc',
423        srcs=['integration/ifunc/ifunc.c'],
424        version_script='integration/ifunc/map.txt',
425        export_include_dirs=[],
426        linker_flags=[
427            '-so', relative_to_abs_path(
428                'integration/ifunc/prebuilts/libifunc.so'
429            ),
430        ]
431    ),
432    LsdumpModule(
433        name='libgolden_cpp_member_name_changed',
434        srcs=[
435            'integration/cpp/gold/golden_1.cpp',
436            'integration/cpp/gold/high_volume_speaker.cpp',
437            'integration/cpp/gold/low_volume_speaker.cpp',
438        ],
439        version_script='integration/cpp/gold/map.txt',
440        export_include_dirs=['integration/cpp/gold/include'],
441        cflags=['-DGOLDEN_CHANGE_MEMBER_NAME_SAME_OFFSET=1'],
442    ),
443    LsdumpModule(
444        name='libgolden_cpp_function_pointer',
445        srcs=[
446            'integration/cpp/gold/golden_1.cpp',
447            'integration/cpp/gold/high_volume_speaker.cpp',
448            'integration/cpp/gold/low_volume_speaker.cpp',
449        ],
450        version_script='integration/cpp/gold/map.txt',
451        export_include_dirs=['integration/cpp/gold/include'],
452        cflags=['-DGOLDEN_FUNCTION_POINTER=1'],
453    ),
454    LsdumpModule(
455        name='libgolden_cpp_function_pointer_parameter_added',
456        srcs=[
457            'integration/cpp/gold/golden_1.cpp',
458            'integration/cpp/gold/high_volume_speaker.cpp',
459            'integration/cpp/gold/low_volume_speaker.cpp',
460        ],
461        version_script='integration/cpp/gold/map.txt',
462        export_include_dirs=['integration/cpp/gold/include'],
463        cflags=['-DGOLDEN_FUNCTION_POINTER_ADD_PARAM=1',
464                '-DGOLDEN_FUNCTION_POINTER=1'],
465    ),
466    LsdumpModule(
467        name='libgolden_cpp_internal_public_struct',
468        srcs=[
469            'integration/cpp/gold/golden_1.cpp',
470            'integration/cpp/gold/high_volume_speaker.cpp',
471            'integration/cpp/gold/low_volume_speaker.cpp',
472        ],
473        version_script='integration/cpp/gold/map.txt',
474        export_include_dirs=['integration/cpp/gold/include'],
475        cflags=['-DGOLDEN_WITH_INTERNAL_STRUCT',
476                '-DGOLDEN_WITH_PUBLIC_INTERNAL_STRUCT'],
477    ),
478    LsdumpModule(
479        name='libgolden_cpp_internal_private_struct',
480        srcs=[
481            'integration/cpp/gold/golden_1.cpp',
482            'integration/cpp/gold/high_volume_speaker.cpp',
483            'integration/cpp/gold/low_volume_speaker.cpp',
484        ],
485        version_script='integration/cpp/gold/map.txt',
486        export_include_dirs=['integration/cpp/gold/include'],
487        cflags=['-DGOLDEN_WITH_INTERNAL_STRUCT'],
488    ),
489    LsdumpModule(
490        name='libgolden_cpp_inheritance_type_changed',
491        srcs=[
492            'integration/cpp/gold/golden_1.cpp',
493            'integration/cpp/gold/high_volume_speaker.cpp',
494            'integration/cpp/gold/low_volume_speaker.cpp',
495        ],
496        version_script='integration/cpp/gold/map.txt',
497        export_include_dirs=['integration/cpp/gold/include'],
498        cflags=['-DGOLDEN_CHANGE_INHERITANCE_TYPE'],
499    ),
500    LsdumpModule(
501        name='libpure_virtual_function',
502        srcs=['integration/cpp/pure_virtual/pure_virtual_function.cpp'],
503        export_include_dirs=['integration/cpp/pure_virtual/include'],
504        version_script='',
505    ),
506    LsdumpModule(
507        name='libgolden_cpp_json',
508        srcs=[
509            'integration/cpp/gold/golden_1.cpp',
510            'integration/cpp/gold/high_volume_speaker.cpp',
511            'integration/cpp/gold/low_volume_speaker.cpp',
512        ],
513        version_script='integration/cpp/gold/map.txt',
514        export_include_dirs=['integration/cpp/gold/include'],
515        dumper_flags=['-output-format', 'Json'],
516        linker_flags=['-input-format', 'Json', '-output-format', 'Json']
517    ),
518    LsdumpModule(
519        name='libversion_script_example',
520        arch='arm64',
521        srcs=[
522            'integration/version_script_example/example.cpp',
523        ],
524        version_script='integration/version_script_example/example.map.txt',
525        export_include_dirs=['integration/version_script_example'],
526        dumper_flags=['-output-format', 'Json'],
527        linker_flags=[
528            '-input-format', 'Json',
529            '-output-format', 'Json',
530            '-so', relative_to_abs_path(
531                'integration/version_script_example/prebuilts/' +
532                'libversion_script_example.so'
533            ),
534        ]
535    ),
536    LsdumpModule(
537        name='libversion_script_example_no_private',
538        arch='arm64',
539        srcs=[
540            'integration/version_script_example/example.cpp',
541        ],
542        version_script='integration/version_script_example/example.map.txt',
543        export_include_dirs=['integration/version_script_example'],
544        dumper_flags=['-output-format', 'Json'],
545        linker_flags=[
546            '-input-format', 'Json',
547            '-output-format', 'Json',
548            '-so', relative_to_abs_path(
549                'integration/version_script_example/prebuilts/' +
550                'libversion_script_example.so'
551            ),
552            '--exclude-symbol-version', 'LIBVERSION_SCRIPT_EXAMPLE_PRIVATE',
553        ]
554    ),
555    LsdumpModule(
556        name='libversion_script_example_no_mytag',
557        arch='arm64',
558        srcs=[
559            'integration/version_script_example/example.cpp',
560        ],
561        version_script='integration/version_script_example/example.map.txt',
562        export_include_dirs=['integration/version_script_example'],
563        dumper_flags=['-output-format', 'Json'],
564        linker_flags=[
565            '-input-format', 'Json',
566            '-output-format', 'Json',
567            '-so', relative_to_abs_path(
568                'integration/version_script_example/prebuilts/' +
569                'libversion_script_example.so'
570            ),
571            '--exclude-symbol-tag', 'mytag',
572        ]
573    ),
574
575    # Test data for test_allow_adding_removing_weak_symbols
576    LsdumpModule(
577        name='libweak_symbols_old',
578        arch='arm64',
579        srcs=[
580            'integration/weak_symbols/example.c',
581        ],
582        version_script='integration/weak_symbols/libexample_old.map.txt',
583        export_include_dirs=[],
584        dumper_flags=['-output-format', 'Json'],
585        linker_flags=[
586            '-input-format', 'Json',
587            '-output-format', 'Json',
588        ]
589    ),
590    LsdumpModule(
591        name='libweak_symbols_new',
592        arch='arm64',
593        srcs=[
594            'integration/weak_symbols/example.c',
595        ],
596        version_script='integration/weak_symbols/libexample_new.map.txt',
597        export_include_dirs=[],
598        dumper_flags=['-output-format', 'Json'],
599        linker_flags=[
600            '-input-format', 'Json',
601            '-output-format', 'Json',
602        ],
603        cflags=['-DNEW=1']
604    ),
605    LsdumpModule(
606        name='libempty',
607        arch='arm64',
608        srcs=[],
609        version_script='integration/c_and_cpp/map.txt',
610        export_include_dirs=['integration/c_and_cpp/include'],
611        linker_flags=[
612            '-output-format', 'Json',
613        ],
614    ),
615    LsdumpModule(
616        name='libgolden_anonymous_enum',
617        arch='arm64',
618        srcs=['integration/cpp/anonymous_enum/include/golden.h'],
619        version_script='',
620        export_include_dirs=['integration/cpp/anonymous_enum/include'],
621        linker_flags=['-output-format', 'Json',],
622    ),
623    LsdumpModule(
624        name='libswap_anonymous_enum',
625        arch='arm64',
626        srcs=['integration/cpp/anonymous_enum/include/swap_enum.h'],
627        version_script='',
628        export_include_dirs=['integration/cpp/anonymous_enum/include'],
629        linker_flags=['-output-format', 'Json'],
630    ),
631    LsdumpModule(
632        name='libswap_anonymous_enum_field',
633        arch='arm64',
634        srcs=['integration/cpp/anonymous_enum/include/swap_enum_field.h'],
635        version_script='',
636        export_include_dirs=['integration/cpp/anonymous_enum/include'],
637        linker_flags=['-output-format', 'Json'],
638    ),
639    LsdumpModule(
640        name='libanonymous_enum_odr',
641        arch='arm64',
642        srcs=[
643            'integration/cpp/anonymous_enum/include/golden.h',
644            'integration/cpp/anonymous_enum/include/include_golden.h',
645        ],
646        version_script='',
647        export_include_dirs=['integration/cpp/anonymous_enum/include'],
648        linker_flags=['-output-format', 'Json'],
649    ),
650    LsdumpModule(
651        name='libmerge_multi_definitions',
652        arch='arm64',
653        srcs=[
654            'integration/merge_multi_definitions/include/def1.h',
655            'integration/merge_multi_definitions/include/def2.h',
656        ],
657        version_script='integration/merge_multi_definitions/map.txt',
658        export_include_dirs=['integration/merge_multi_definitions/include'],
659        linker_flags=['-output-format', 'Json', '-sources-per-thread', '1'],
660    ),
661]
662
663TEST_MODULES = {m.name: m for m in TEST_MODULES}
664