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.0/8.1.0/8.2.0/8.3.0/9.1.0/9.2.0/9.3.0 |
SUSE SLES15.1 |
GCC 7.4.0/8.1.0/8.2.0/8.3.0/9.1.0/9.2.0/9.3.0 |
Ubuntu 18.04.x |
GCC 7.3.0/7.4.0/8.1.0/8.2.0/8.3.0/9.1.0/9.2.0/9.3.0 |
Ubuntu 20.04.x |
GCC 9.3.0 |
UOS 20 SP1 |
GCC 8.3.0/9.1.0/9.2.0/9.3.0 |
uosEuler 20 |
GCC 7.3.0/7.4.0/8.1.0/8.2.0/8.3.0/9.1.0/9.2.0/9.3.0 |
UOS 20-1020e |
GCC 7.3.0/7.4.0/8.1.0/8.2.0/8.3.0/9.1.0/9.2.0/9.3.0 |
- The GCC versions listed are the default GCC versions supported by the OSs. If the GCC version of the server has been upgraded, incompatibility issues may occur.
- The supported GCC versions are official GCC branches. Do not use the GCC for openEuler versions.
Environment Configuration
Before using this function, configure the environment as follows:
- Download required software packages.
- GCC source code: https://gcc.gnu.org/ (Download the source code of the corresponding version from the official GCC website.)
- GCC repair tool patch: https://github.com/kunpengcompute/devkitdriver/tree/main/gccchecker (for Debian and RHEL OSs)
- Memory consistency repair component: Obtain /devkitplugins/affinity/tools/weakconsistency/gccchecker/gcctool.tar.gz in the DevKit installation directory.
- Install the memory consistency repair component.
- Decompress the installation package.
1tar xf gcctool.tar.gz
After the decompression, check that the following files exist in the gcctool/bin directory:
gcctool, gcctool-bin, libstdc++.so.6
- Decompress the installation package.
- Apply the GCC patch.
If "'patch' command not found" is displayed, run the following command to install the patch:
Debian OSs:
1apt install patch
RHEL OSs:
1yum install patch
1 2
cd /gcc/source/root/dir patch -p1 < /path/to/gcc/patch/file
- Compile the GCC.
Tool Usage
After the environment is set up, perform the following steps to use the tool:
- Set the optimization mode of the memory consistency repair component.
1export HW_DEBUG=[ 0 | 1 | 2 ]
You can set the repair optimization mode through the environment variable. The default mode is 0.
- 0: No optimization policy is used. This setting results in the largest performance loss.
- 1: Use the most secure repair policy. This setting compromises the performance a lot.
- 2: Use component optimization rules. This setting helps minimize the performance loss.
If this environment variable is not set, memory consistency repair is disabled and no repair operations will be performed.
If you want to enable this function, select a desired optimization mode.
- (Optional) Define the range of source code that can be automatically fixed.
- You can customize the source code repair range by file or function. After the allowlist is configured, the repair component repairs only the content in the list. The allowlist must meet the following requirements:
- The file list starts with files:. Each file occupies one line.
- The file path must be an absolute path.
- Only C, C++, and Fortran files are supported. Pure assembly files are not supported.
- The function list starts with functions:. Each function occupies one line.
- C/C++ common functions are supported. Templates or functions with the abi_tag attribute are not supported.
Allowlist example:
1 2 3 4 5 6 7 8 9 10 11 12 13
files: /path/to/file/a /path/to/./file/b /path/to/../file/c /path/to/file/d functions: func_a func_b() func_c(int xxx) int func_d() classA::func_e ns::classB::func_f() std::string nsA::nsB::classC::func_g(int xxx)
- The repair component obtains the path of the allowlist.
You can set an environment variable to specify the path of the allowlist. The path is not specified by default.
export AUTOFIXLIST=/path/to/allowlist
- You can customize the source code repair range by file or function. After the allowlist is configured, the repair component repairs only the content in the list. The allowlist must meet the following requirements:
- Compile the software.
The compilation process remains unchanged.
Remove the -pipe compilation option if it is used in the previous compilation. This does not affect the result of the previous compilation.