OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
check_c_linkage Namespace Reference

Functions

 objects (build_dir)
 load_allowlist (path)
 mangled_symbols (nm, path)
 main ()

Variables

 ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 MANGLED = re.compile(r'^_{1,2}Z')
 CMAKE_PROBE = re.compile(r'CMakeFiles/\d')

Detailed Description

Lists the C++-mangled symbols defined by the object files of a build.

    python3 scripts/check_c_linkage.py <build_dir> [--nm NM] [--allowlist FILE]

The data blobs, the .S files and the --defsym aliases refer to the engine's
symbols by their C names, so a function or a global compiled as C++ without C
linkage (a _Z... name) breaks them. Exits with 0 when no object defines a
mangled global symbol other than those in the allowlist (one name per line,
or re:<regex>; # comments; default test/c_linkage_allowlist.txt). The objects
of the targets in check_duplicates.PLUS_TARGETS (CoD2rev-Plus's C++ code,
libcod and its bridges) are skipped: their C++ names are meant to be C++.

Function Documentation

◆ load_allowlist()

check_c_linkage.load_allowlist ( path)
(names, regexes) from an allowlist file.

◆ main()

check_c_linkage.main ( )

◆ mangled_symbols()

check_c_linkage.mangled_symbols ( nm,
path )

◆ objects()

check_c_linkage.objects ( build_dir)

Variable Documentation

◆ CMAKE_PROBE

check_c_linkage.CMAKE_PROBE = re.compile(r'CMakeFiles/\d')

◆ MANGLED

check_c_linkage.MANGLED = re.compile(r'^_{1,2}Z')

◆ ROOT

check_c_linkage.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))