ladybird/Libraries
Andrew Kaster cdbbe14062 LibC: Implement Itanium C++ ABI for static variable guards
This is __cxa_guard_acquire, __cxa_guard_release, and __cxa_guard_abort.

We put these symbols in a 'fake' libstdc++ to trick gcc into thinking it
has libstdc++. These symbols are necessary for C++ programs and not C
programs, so, seems file. There's no way to tell gcc that, for example,
the standard lib it should use is libc++ or libc. So, this is what we
have for now.

When threaded code enters a block that is trying to call the constructor
for a block-scope static, the compiler will emit calls to these methods
to handle the "call_once" nature of block-scope statics.

The compiler creates a 64-bit guard variable, which it checks the first
byte of to determine if the variable should be intialized or not.

If the compiler-generated code reads that byte as a 0, it will call
__cxa_guard_acquire to try and be the thread to call the constructor for
the static variable. If the first byte is 1, it will assume that the
variable's constructor was called, and go on to access it.

__cxa_guard_acquire uses one of the 7 implementation defined bytes of
the guard variable as an atomic 8 bit variable. To control a state
machine that lets each entering thread know if they gained
'initialization rights', someone is working on the varaible, someone is
working on the varaible and there's at least one thread waiting for it
to be intialized, or if the variable was initialized and it's time to
access it. We only store a 1 to the byte the compiler looks at in
__cxa_guard_release, and use a futex to handle waiting.
2020-05-20 08:37:50 +02:00
..
LibAudio Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibC LibC: Implement Itanium C++ ABI for static variable guards 2020-05-20 08:37:50 +02:00
LibCore LibCore+LibTLS: Don't keep a "ready to write" notifier on all Sockets 2020-05-18 20:16:52 +02:00
LibCrypto Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibCxx LibC: Implement Itanium C++ ABI for static variable guards 2020-05-20 08:37:50 +02:00
LibDebug Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibDesktop LaunchServer: Discover handlers from *.af files, allow launching based on a known handler 2020-05-18 11:27:27 +02:00
LibELF Kernel: Absorb LibBareMetal back into the kernel 2020-05-16 12:00:04 +02:00
LibGemini LibGemini: Implement rendering text/gemini documents to HTML 2020-05-17 16:35:42 +02:00
LibGfx LibGfx: Add UTF-32 version of the text painting code paths 2020-05-17 22:35:25 +02:00
LibGUI LibGUI: Use dbg() instead of dbgprintf() in GUI::Dialog 2020-05-19 17:46:28 +02:00
LibHTTP LibGemini+LibHTTP: Defer did_progress call to match other callbacks 2020-05-17 12:41:38 +02:00
LibIPC Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibJS LibJS: Handle hex and unicode escape sequences in string literals 2020-05-18 17:58:17 +02:00
LibLine LibLine: Default to resolving Spans as byte offsets 2020-05-19 20:02:28 +02:00
LibM LibM: Fix floor() and floorf() for negative numbers 2020-05-15 22:05:59 +02:00
LibMarkdown Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibPCIDB Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibProtocol LibProtocol: Make Protocol::Client constructor private 2020-05-19 17:46:28 +02:00
LibPthread Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibTextCodec Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibThread Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibTLS LibTLS: Flush some packets as soon as more packets are written 2020-05-20 08:30:51 +02:00
LibUnwind LibUnwind: Create UnwindBase.h to capture the EH ABI in code 2020-05-14 08:50:10 +02:00
LibVT LibVT: Pass the handler name to Launcher::open_url to control what gets launched 2020-05-18 11:27:27 +02:00
LibWeb LibWeb: Make window.location.reload() enumerable only 2020-05-20 08:30:22 +02:00
LibX86 Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
CMakeLists.txt LibC: Implement Itanium C++ ABI for static variable guards 2020-05-20 08:37:50 +02:00