code: def main():
      args, groups = get_args()
  
      # Inputs
      auto_input = groups["input"]
  
      # Outputs
      lib_output = args.lib
      obj_output = args.obj
  
      # Dependencies
      global_srcs = groups["global_srcs"]
      global_srcs = strip_suppression_files(global_srcs)
      global_srcs = ProcessWholeArchiveOption(args.arch).construct_cmd(
          global_srcs
      )
      global_srcs = strip_forceload_prefix(global_srcs)
      peers = groups["peers"]
  
      # Tools
      linker = groups["linker"]
      archiver = groups["archiver"]
  
      if "YA_XCODE" in str(sys.argv):
          no_pie = "-Wl,-no_pie"
      else:
          no_pie = "-Wl,-no-pie"
  
      do_link = (
          linker
          + [
              "-o",
              obj_output,
              "-Wl,-r",
              "-nodefaultlibs",
              "-nostartfiles",
              no_pie,
          ]
          + global_srcs
          + auto_input
      )
      do_archive = archiver + [lib_output] + peers
      do_globals = None
      if args.globals_lib:
          do_globals = (
              archiver + [args.globals_lib] + auto_input + global_srcs
          )
      if args.with_own_obj:
          do_archive += auto_input
      if args.with_global_srcs:
          do_archive += global_srcs
  
      def call(c):
          proc = subprocess.Popen(
              c,
              shell=False,
              stderr=sys.stderr,
              stdout=sys.stdout,
              cwd=args.build_root,
          )
          proc.communicate()
          return proc.returncode
  
      if obj_output:
          link_res = call(do_link)
          if link_res:
              sys.exit(link_res)
  
      if do_globals:
          glob_res = call(do_globals)
          if glob_res:
              sys.exit(glob_res)
  
      sys.exit(call(do_archive))
  
file_path: catboost/build/scripts/link_fat_obj.py
imports: import argparse
  import subprocess
  import sys
  import process_command_files
  from process_whole_archive_option import ProcessWholeArchiveOption
label_desc: Use image node_id 5 for calling a global function with example usage: main() and returns: proc