Architectures

Architectures — CPU architectures and ABIs

Functions

Types and Values

Object Hierarchy

    GEnum
    ├── SrtArchitectureError
    ╰── SrtMachineType

Includes

#include <steam-runtime-tools/steam-runtime-tools.h>

Description

On a typical x86 PC, it might be possible to run 32-bit and/or 64-bit executables, depending on the capabilities of the CPU, OS kernel and operating system.

Functions

srt_architecture_can_run_i386 ()

gboolean
srt_architecture_can_run_i386 (void);

Check whether we can run an i386 (SRT_ABI_I386) executable.

For this check to work as intended, the contents of the libsteam-runtime-tools-0-helpers:i386 package must be available in the same directory hierarchy as the libsteam-runtime-tools-0 shared library, something like this:

1
2
3
4
5
6
7
8
any directory/
     lib/
         x86_64-linux-gnu/
             libsteam-runtime-tools-0.so.0
     libexec/
         steam-runtime-tools-0/
             i386-linux-gnu-*
             x86_64-linux-gnu-*

Returns

TRUE if we can run an i386 executable.


srt_architecture_can_run_x86_64 ()

gboolean
srt_architecture_can_run_x86_64 (void);

Check whether we can run an x86_64 (SRT_ABI_X86_64) executable.

For this check to work as intended, the contents of the libsteam-runtime-tools-0-helpers:amd64 package must be available in the same directory hierarchy as the libsteam-runtime-tools-0 shared library. See srt_architecture_can_run_i386() for details.

Returns

TRUE if we can run an x86_64 executable.


srt_architecture_error_quark ()

GQuark
srt_architecture_error_quark (void);

srt_architecture_get_expected_runtime_linker ()

const char *
srt_architecture_get_expected_runtime_linker
                               (const char *multiarch_tuple);

Return the interoperable path to the runtime linker ld.so(8), if known. For example, for x86_64, this returns /lib64/ld-linux-x86-64.so.2.

Parameters

multiarch_tuple

A multiarch tuple defining an ABI, as printed by gcc -print-multiarch in the Steam Runtime

 

Returns

An absolute path, or NULL if not known.

[type filename][transfer none]

Types and Values

enum SrtMachineType

A type of machine.

Values of this enum are numerically equal to ELF machine types, although only a small subset of ELF machine types are represented here.

Members

SRT_MACHINE_TYPE_UNKNOWN

An unknown or unspecified CPU (EM_NONE)

 

SRT_MACHINE_TYPE_386

i386 (IA-32, 32-bit x86; EM_386)

 

SRT_MACHINE_TYPE_X86_64

x86_64 (amd64, x64, Intel 64, 64-bit x86; EM_X86_64)

 

SRT_MACHINE_TYPE_AARCH64

AArch64 (64-bit ARM; EM_AARCH64)

 

SRT_ABI_I386

#define SRT_ABI_I386 "i386-linux-gnu"

The multiarch tuple for the i386 (IA-32) ABI normally used on 32-bit x86 Linux.


SRT_ABI_X86_64

#define SRT_ABI_X86_64 "x86_64-linux-gnu"

The multiarch tuple for the x86_64 ABI normally used on 64-bit x86 Linux.


SRT_ABI_AARCH64

#define SRT_ABI_AARCH64 "aarch64-linux-gnu"

The multiarch tuple for the aarch64 ABI normally used on 64-bit ARM Linux, used here as a proof-of-concept for non-x86 support.


enum SrtArchitectureError

Errors raised when checking facts about an architecture.

Errors in the GIOErrorEnum domain can also be raised: for example, if srt_system_info_check_runtime_linker() raises G_IO_ERROR_NOT_FOUND, it means the interoperable path for ld.so does not exist.

Members

SRT_ARCHITECTURE_ERROR_FAILED

Generic error

 

SRT_ARCHITECTURE_ERROR_INTERNAL_ERROR

An internal error occurred

 

SRT_ARCHITECTURE_ERROR_NO_INFORMATION

It is unknown whether the given architecture, ld.so, etc. is available or not, for example because the interoperable ld.so path for the architecture is unknown, or because SrtSystemInfo is reading a JSON report that does not contain this information

 

SRT_ARCHITECTURE_ERROR

#define SRT_ARCHITECTURE_ERROR (srt_architecture_error_quark ())