| Component | Responsibility | Typical Implementation | |-----------|----------------|------------------------| | | Program startup, atoi , printf , heap base (malloc/free) | libc.so / msvcrt.dll | | C++ ABI Runtime | Constructor/destructor calling conventions, RTTI structures, exception personality routines | libstdc++ (GCC), libc++abi (LLVM), msvcrt + VCRuntime (MSVC) | | C++ Standard Library Runtime | std::vector , std::string , std::cout , std::thread | libstdc++.so , libc++.so , MSVC STL | | Language Support Library | new / delete operators, __cxa_* exception APIs, __gxx_personality_v0 | Part of ABI runtime | | Compiler‑Generated Helpers | Thunk functions for virtual calls, dynamic cast helpers, guard variables for static locals | Injected by compiler (e.g., __cxa_guard_acquire ) |
vtable for B: [0] offset_to_top = 0 [1] typeinfo pointer -> typeinfo for B [2] A::foo() thunk (if overriding) vtable for A: [0] offset_to_top = 0 [1] typeinfo pointer -> typeinfo for A
Report ID: CPP-RT-2024-01 Date: April 14, 2026 Author: Systems Software Research Division Subject: Structure, Execution Flow, and Overhead of the C++ Runtime Environment 1. Executive Summary The C++ runtime is the set of software components that support the execution of a compiled C++ program beyond the raw machine code generated by the compiler. Unlike C, which has a relatively minimal runtime, C++ requires substantial behind‑the‑scenes machinery to implement core language features: dynamic initialization of globals, exception handling, run‑time type information (RTTI), new / delete operators, and stack unwinding. This report dissects the C++ runtime into its constituent parts, traces the execution flow from _start to main and beyond, analyzes the cost of each runtime feature, and examines implementation variations across major compilers (GCC/Clang, MSVC) and operating systems. 2. Components of the C++ Runtime The C++ runtime is not monolithic. It consists of several logical layers:
(simplified for a class hierarchy A <- B ):
// Constructor function for global std::string _GLOBAL__sub_I_example.cpp: stp x29, x30, [sp, -32]! mov x0, :got:globalString bl _ZNSt7__cxx1112basic_string...C1E... // std::string::string(char const*) ldr x0, :got:__dso_handle adrp x1, :got:_ZNSt7__cxx1112basic_string...D1E... add x1, x1, :lo12:_ZNSt7__cxx1112...D1E... bl __cxa_atexit // register destructor for atexit ldp x29, x30, [sp], 32 ret // .init_array entry points to this function
main → foo() → bar() → throw MyException(); → __cxa_throw (sets unwind info, calls _Unwind_RaiseException) → _Unwind_RaiseException → _Unwind_RaiseException_Phase1 (walks .eh_frame) → _Unwind_RaiseException_Phase2 (calls personality, destructors) → __gxx_personality_v0 (calls destructors of locals in bar, foo) → land on catch in main On Linux: readelf -S a.out (look for .init_array , .eh_frame , .gcc_except_table ) On Windows: dumpbin /HEADERS myapp.exe (look for .pdata for x64 exception tables) This report is based on the Itanium C++ ABI (version 1.2), Microsoft C++ ABI (x64), and publicly available documentation for GCC 13, Clang 17, and MSVC 2022.
done: return instance_memory;
static char instance_memory[sizeof(Logger)]; static uint8_t guard = 0; // 0 = uninitialized, 1 = initializing, 2 = done if (guard == 2) goto done; if (__cxa_guard_acquire(&guard)) new (instance_memory) Logger(); __cxa_guard_release(&guard); __cxa_atexit(destroyer, instance_memory, __dso_handle);
5 réponses sur « L’amour du Coran (partie 1) »
C++ Runtime -
| Component | Responsibility | Typical Implementation | |-----------|----------------|------------------------| | | Program startup, atoi , printf , heap base (malloc/free) | libc.so / msvcrt.dll | | C++ ABI Runtime | Constructor/destructor calling conventions, RTTI structures, exception personality routines | libstdc++ (GCC), libc++abi (LLVM), msvcrt + VCRuntime (MSVC) | | C++ Standard Library Runtime | std::vector , std::string , std::cout , std::thread | libstdc++.so , libc++.so , MSVC STL | | Language Support Library | new / delete operators, __cxa_* exception APIs, __gxx_personality_v0 | Part of ABI runtime | | Compiler‑Generated Helpers | Thunk functions for virtual calls, dynamic cast helpers, guard variables for static locals | Injected by compiler (e.g., __cxa_guard_acquire ) |
vtable for B: [0] offset_to_top = 0 [1] typeinfo pointer -> typeinfo for B [2] A::foo() thunk (if overriding) vtable for A: [0] offset_to_top = 0 [1] typeinfo pointer -> typeinfo for A
Report ID: CPP-RT-2024-01 Date: April 14, 2026 Author: Systems Software Research Division Subject: Structure, Execution Flow, and Overhead of the C++ Runtime Environment 1. Executive Summary The C++ runtime is the set of software components that support the execution of a compiled C++ program beyond the raw machine code generated by the compiler. Unlike C, which has a relatively minimal runtime, C++ requires substantial behind‑the‑scenes machinery to implement core language features: dynamic initialization of globals, exception handling, run‑time type information (RTTI), new / delete operators, and stack unwinding. This report dissects the C++ runtime into its constituent parts, traces the execution flow from _start to main and beyond, analyzes the cost of each runtime feature, and examines implementation variations across major compilers (GCC/Clang, MSVC) and operating systems. 2. Components of the C++ Runtime The C++ runtime is not monolithic. It consists of several logical layers: c++ runtime
(simplified for a class hierarchy A <- B ):
// Constructor function for global std::string _GLOBAL__sub_I_example.cpp: stp x29, x30, [sp, -32]! mov x0, :got:globalString bl _ZNSt7__cxx1112basic_string...C1E... // std::string::string(char const*) ldr x0, :got:__dso_handle adrp x1, :got:_ZNSt7__cxx1112basic_string...D1E... add x1, x1, :lo12:_ZNSt7__cxx1112...D1E... bl __cxa_atexit // register destructor for atexit ldp x29, x30, [sp], 32 ret // .init_array entry points to this function | Component | Responsibility | Typical Implementation |
main → foo() → bar() → throw MyException(); → __cxa_throw (sets unwind info, calls _Unwind_RaiseException) → _Unwind_RaiseException → _Unwind_RaiseException_Phase1 (walks .eh_frame) → _Unwind_RaiseException_Phase2 (calls personality, destructors) → __gxx_personality_v0 (calls destructors of locals in bar, foo) → land on catch in main On Linux: readelf -S a.out (look for .init_array , .eh_frame , .gcc_except_table ) On Windows: dumpbin /HEADERS myapp.exe (look for .pdata for x64 exception tables) This report is based on the Itanium C++ ABI (version 1.2), Microsoft C++ ABI (x64), and publicly available documentation for GCC 13, Clang 17, and MSVC 2022.
done: return instance_memory;
static char instance_memory[sizeof(Logger)]; static uint8_t guard = 0; // 0 = uninitialized, 1 = initializing, 2 = done if (guard == 2) goto done; if (__cxa_guard_acquire(&guard)) new (instance_memory) Logger(); __cxa_guard_release(&guard); __cxa_atexit(destroyer, instance_memory, __dso_handle);
Tous nos rêves sont réalisables avec l’aide d’Allah.
J’espère dans le prochain article (en cours) vous donnez quelques solutions pour faire de vous une addicte du Coran inshaAllah.
Toute addiction part à la base d’une habitude, il suffit simplement de prendre de bonnes habitudes avec le coran pour en devenir addicte.
wallahu a’lam
Selem alaikoum. Barrakallah ou fikoum quAllah vous accorde le paradis je pensais mon cœur mort mais Hmdl par le frère Mourad et sa méthode pour apprendre le Coran et vous ,mon cœur bat à nouveau qu Allah me facilite et éloigne de nous satan le lapidé qui nous fait perdre notre temps à ne rien faire ou à faire d autre chose futiles .
As salamou alaykoum,
JazakaAllahou kheiran pour ce magnifique article et amin à vos invocations.
As salam alaycoum wa rahmatullah
Jazak Allahou kheyr pour ce bel article. Nous aimerions tous avoir cette amour indescriptible pour le Coran, en tout cas pour ma part cest mon rêve. …mais j’en suis malheureusement loin. Que faire concrètement pour en arriver à cette état d’amour pour le Livre d’Allah?