ronin.gcc

class ronin.gcc.GccBuild(command=None, ccache=True, platform=None)

Bases: ronin.gcc._GccWithMakefile

gcc executor combining compilation and linking.

The phase inputs are “.c” source files. The phase output is an executable (the default), an “.so” or “.dll” shared library (call GccExecutor.create_shared_library()), or a static library (“.a”).

Parameters:
  • command (str or FunctionType) – gcc (or g++, etc.) command; defaults to the context’s gcc.gcc_command
  • ccache (bool) – whether to use ccache; defaults to True
  • platform (str or FunctionType or Project) – target platform or project
class ronin.gcc.GccCompile(command=None, ccache=True, platform=None)

Bases: ronin.gcc._GccWithMakefile

gcc compile executor.

The phase inputs are “.c” source files. The phase outputs are “.o” object files.

Parameters:
  • command (str or FunctionType) – gcc (or g++, etc.) command; defaults to the context’s gcc.gcc_command
  • ccache (bool) – whether to use ccache; defaults to True
  • platform (str or FunctionType or Project) – target platform or project
class ronin.gcc.GccExecutor(command=None, ccache=True, platform=None)

Bases: ronin.executors.ExecutorWithArguments

Base class for gcc executors.

For a summary of all options accepted see the documentation.

Parameters:
  • command (str or FunctionType) – gcc (or g++, etc.) command; defaults to the context’s gcc.gcc_command
  • ccache (bool) – whether to use ccache; defaults to True
  • platform (str or FunctionType or Project) – target platform or project
add_include_path(*value)
add_input(value)
add_library(value)
add_library_path(*value)
add_linker_argument(name, value=None, xlinker=True)

Add a command line argument to the linker.

For options accepted by ld see the documentation

compile_only()
create_makefile()
create_makefile_ignore_system()
create_makefile_only()
create_shared_library()
define(name, value=None)
disable_warning(value)
enable_debug()
enable_openmp()
enable_threads()
enable_warning(value=u'all')
linker_disable_new_dtags()
linker_exclude_symbols(*values)
linker_export_all_symbols_dynamically()
linker_no_symbol_table()
linker_no_undefined_symbols()
linker_no_undefined_symbols_in_libraries()
linker_rpath(value)

Add a directory to the runtime library search path.

linker_rpath_origin()
linker_undefine_symbols(*values)
optimize(value)
pic(compact=False)
set_machine(value)
set_machine_floating_point(value)
set_machine_tune(value)
set_makefile_path(value)
standard(value)
use_linker(value)

Bases: ronin.gcc.GccExecutor

gcc link executor.

The phase inputs are “.o” object files. The phase output is an executable (the default), an “.so” or “.dll” shared library (call create_shared_library), or a static library (“.a”).

Parameters:
  • command (str or FunctionType) – gcc (or g++, etc.) command; defaults to the context’s gcc.gcc_command
  • ccache (bool) – whether to use ccache; defaults to True
  • platform (str or FunctionType or Project) – target platform or project
ronin.gcc.configure_gcc(gcc_command=None, ccache=None, ccache_path=None)

Configures the current context’s gcc support.

Parameters:
  • gcc_command (str or FunctionType) – gcc (or g++, etc.) command; defaults to “gcc”
  • ccache (bool) – whether to use ccache; defaults to True
  • ccache_path (str or FunctionType) – ccache path; defaults to “/usr/lib/ccache”
ronin.gcc.gcc_platform_command(command, platform)

Finds the gcc command name for a specific target platform.

Behind the scenes uses ronin.utils.platform.platform_command().

Parameters:
Returns:

command

Return type:

str

ronin.gcc.gcc_platform_machine_bits(platform)

Bits for target platform.

Parameters:platform (str or FunctionType or Project) – target platform or project
Returns:‘64’ or ‘32’
Return type:str
ronin.gcc.which_gcc(command, ccache, platform, exception=True)

A specialized version of ronin.utils.platform.which() for gcc that supports cross-compiling and ccache.

Behind the scenes uses gcc_platform_command().

Parameters:
  • command (str or FunctionType) – gcc (or g++, etc.) command
  • ccache (bool) – set to True to attempt to use ccache; if a ccache version is not found, will silently try to use the standard gcc command
  • platform (str or FunctionType or Project) – target platform or project
  • exception (bool) – set to False in order to return None upon failure, instead of raising an exception
Returns:

absolute path to command

Return type:

str

Raises:

WhichException – if exception is True and could not find command