def main():
    parse_args()
    if (args.include_subsystem_list is not None):
        for list_file in args.include_subsystem_list:
            parse_subsystems_list_file(list_file)
    if args.gperf_output:
        assert args.kernel, '--kernel ELF required for --gperf-output'
        elf = ELFFile(open(args.kernel, 'rb'))
        syms = get_symbols(elf)
        max_threads = (syms['CONFIG_MAX_THREAD_BYTES'] * 8)
        objs = find_kobjects(elf, syms)
        if (not objs):
            sys.stderr.write(('WARNING: zero kobject found in %s\n' % args.kernel))
        if (thread_counter > max_threads):
            sys.exit('Too many thread objects ({})\nIncrease CONFIG_MAX_THREAD_BYTES to {}'.format(thread_counter, (- ((- thread_counter) // 8))))
        with open(args.gperf_output, 'w') as fp:
            write_gperf_table(fp, syms, objs, elf.little_endian, syms['_static_kernel_objects_begin'], syms['_static_kernel_objects_end'])
    if args.validation_output:
        with open(args.validation_output, 'w') as fp:
            write_validation_output(fp)
    if args.kobj_types_output:
        with open(args.kobj_types_output, 'w') as fp:
            write_kobj_types_output(fp)
    if args.kobj_otype_output:
        with open(args.kobj_otype_output, 'w') as fp:
            write_kobj_otype_output(fp)
    if args.kobj_size_output:
        with open(args.kobj_size_output, 'w') as fp:
            write_kobj_size_output(fp)
def main():
    parse_args()
    if (args.include_subsystem_list is not None):
        for list_file in args.include_subsystem_list:
            parse_subsystems_list_file(list_file)
    if args.gperf_output:
        assert args.kernel, '--kernel ELF required for --gperf-output'
        elf = ELFFile(open(args.kernel, 'rb'))
        syms = get_symbols(elf)
        max_threads = (syms['CONFIG_MAX_THREAD_BYTES'] * 8)
        objs = find_kobjects(elf, syms)
        if (not objs):
            sys.stderr.write(('WARNING: zero kobject found in %s\n' % args.kernel))
        if (thread_counter > max_threads):
            sys.exit('Too many thread objects ({})\nIncrease CONFIG_MAX_THREAD_BYTES to {}'.format(thread_counter, (- ((- thread_counter) // 8))))
        with open(args.gperf_output, 'w') as fp:
            write_gperf_table(fp, syms, objs, elf.little_endian, syms['_static_kernel_objects_begin'], syms['_static_kernel_objects_end'])
    if args.validation_output:
        with open(args.validation_output, 'w') as fp:
            write_validation_output(fp)
    if args.kobj_types_output:
        with open(args.kobj_types_output, 'w') as fp:
            write_kobj_types_output(fp)
    if args.kobj_otype_output:
        with open(args.kobj_otype_output, 'w') as fp:
            write_kobj_otype_output(fp)
    if args.kobj_size_output:
        with open(args.kobj_size_output, 'w') as fp:
            write_kobj_size_output(fp)