fab.tools.linker module#

This file contains the base class for any Linker.

class fab.tools.linker.Linker(name=None, exec_name=None, suite=None, compiler=None, output_flag='-o')#

Bases: CompilerSuiteTool

This is the base class for any Linker. If a compiler is specified, its name, executable, and compile suite will be used for the linker (if not explicitly set in the constructor).

Parameters:
  • name (Optional[str]) – the name of the linker. (default: None)

  • exec_name (Optional[str]) – the name of the executable. (default: None)

  • suite (Optional[str]) – optional, the name of the suite. (default: None)

  • compiler (Optional[Compiler]) – optional, a compiler instance (default: None)

  • output_flag (str) – flag to use to specify the output name. (default: '-o')

check_available()#
Return type:

bool

Returns:

whether the linker is available or not. We do this by requesting the linker version.

Executes the linker with the specified input files, creating output_file.

Parameters:
  • input_files (List[Path]) – list of input files to link.

  • output_file (Path) – output file.

  • add_libs (Optional[List[str]]) – additional linker flags. (default: None)

Return type:

str

Returns:

the stdout of the link command