Release of the LLVM 15.0 compiler suite

After six months of development, the release of the LLVM 15.0 project is presented - a GCC-compatible toolkit (compilers, optimizers and code generators) that compiles programs into an intermediate bitcode of RISC-like virtual instructions (a low-level virtual machine with a multi-level optimization system). The generated pseudo-code can be converted by the JIT compiler into machine instructions right at the time of program execution.

Major improvements in Clang 15.0:

  • For systems based on the x86 architecture, the "-fzero-call-used-regs" flag has been added, which provides zeroing of all CPU registers used in the function before returning control from the function. This option allows you to protect against information leakage from functions and reduce the number of blocks suitable for building ROP gadgets (Return-Oriented Programming) in exploits by about 20%.
  • Randomization of the placement of structures in memory for C code has been implemented, which complicates the extraction of data from structures in case of exploitation of vulnerabilities. Randomization is turned on and off with the randomize_layout and no_randomize_layout attributes, and requires seeding with the "-frandomize-layout-seed" or "-frandomize-layout-seed-file" flag.
  • Added "-fstrict-flex-arrays=" flag ”, with which you can control the boundaries for a flexible array element in structures (Flexible Array Members, an array of indefinite size at the end of the structure). When set to 0 (default), the last element of a structure with an array is always treated as a flexible array, 1 - only the sizes [], [0] and [1] are processed as a flexible array, 2 - only the sizes [] and [0] are processed as a flexible array.
  • Added experimental support for the C-like language HLSL (High-Level Shader Language), used in DirectX to write shaders.
  • Added "-Warray-parameter" option to warn about overriding functions with mismatched argument declarations associated with fixed and variable length arrays.
  • Improved compatibility with MSVC. Added support for "#pragma function" (tells the compiler to generate a function call instead of expanding it inline) and "#pragma alloc_text" (specifies the name of the function code section) provided in MSVC. Added support for MSVC compatible /JMC and /JMC flags.
  • Work continues to support future C2X and C++23 standards. Implemented for the C language: the noreturn attribute, the false and true keywords, the _BitInt(N) type for integers of a given bit depth, the *_WIDTH macros, the u8 prefix for UTF-8 characters.

    Implemented for C++: module merging, ABI isolation of function members, ordered dynamic initialization of non-local variables in modules, multidimensional index operators, auto(x), non-literal variables, goto and labels in functions declared as constexpr, delimiter escape sequences, named escape characters.

  • Expanded capabilities related to support for OpenCL and OpenMP. Added support for OpenCL extension cl_khr_subgroup_rotate.
  • For the x86 architecture, added protection against vulnerabilities in processors caused by speculative execution of instructions after unconditional forward jump operations. The problem arises from the preemptive processing of instructions immediately following the branch instruction in memory (SLS, Straight Line Speculation). To enable protection, the option "-mharden-sls=[none|all|return|indirect-jmp]" is proposed.
  • For platforms that support the SSE2 extension, the _Float16 type has been added, which is emulated using the float type if AVX512-FP16 instructions are not supported.
  • Added "-m[no-]rdpru" flag to control the use of the RDPRU instruction, supported since AMD Zen2 processors.
  • Added the "-mfunction-return=thunk-extern" flag to protect against the RETBLEED vulnerability, which works by adding a sequence of instructions that excludes the involvement of the speculative execution mechanism for indirect jumps.

Key innovations in LLVM 15.0:

  • Added support for Cortex-M85 CPUs, Armv9-A, Armv9.1-A and Armv9.2-A architectures, Armv8.1-M PACBTI-M extensions.
  • An experimental DirectX backend has been added that supports the DXIL (DirectX Intermediate Language) format used for DirectX shaders. The backend is enabled via the "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=DirectX" build option.
  • Libc++ continues to implement new features of the C++20 and C++2b standards, including the completion of the implementation of the "format" library and the proposed experimental version of the "ranges" library.
  • Improved backends for x86, PowerPC and RISC-V architectures.
  • Enhanced capabilities of LLD linker and LLDB debugger.

Source: opennet.ru

Add a comment