def extract_build_info(exe_path, elf_section=ELF_SECTION):
build_info = {}<EOL>with mkdtemp() as tempd, pushd(tempd):<EOL><INDENT>proc = subprocess.Popen(<EOL>[<EOL>OBJCOPY,<EOL>DUMP_SECTION,<EOL>"<STR_LIT>".format(secn=elf_section, ofile=BUILDINFO_FILE),<EOL>exe_path,<EOL>],<EOL>stderr=subprocess.PIPE,<EOL>)<EOL>proc.wait()<EOL>errno = proc.returncode<EOL>stderr = proc.stderr.read()<EOL>if errno or len(stderr):  <EOL><INDENT>LOGGER.warning('<STR_LIT>', errno)<EOL>if len(stderr):<EOL><INDENT>LOGGER.warning('<STR_LIT>', stderr)<EOL><DEDENT>return build_info<EOL><DEDENT>with open(BUILDINFO_FILE) as build_info_f:<EOL><INDENT>try:<EOL><INDENT>build_info = json.load(build_info_f, object_hook=byteify)<EOL><DEDENT>except JSONDcdError as jsde:<EOL><INDENT>LOGGER.warning('<STR_LIT>')<EOL>LOGGER.warning(jsde.msg)<EOL>LOGGER.warning('<STR_LIT>')<EOL>LOGGER.warning(jsde.doc)<EOL><DEDENT><DEDENT><DEDENT>return build_info<EOL>
Extracts the build information from a given executable.

    The build information is expected to be in json format, which is parsed
    and returned as a dictionary.
    If no build information is found an empty dictionary is returned.

    This assumes binutils 2.25 to work.

    Args:
        exe_path (str): The full path to the executable to be examined

    Returns:
        dict: A dictionary of the extracted information.