diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-12-15 18:42:51 -0500 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-21 13:09:49 -0800 |
commit | 3fd53baa25f1d6b8522bcb2025bf7728cd3c1ad6 (patch) | |
tree | 2e6d55cb890a010d8035734d224a066f09488f0d /Userland/Libraries/LibUnicode/CMakeLists.txt | |
parent | 749d5ebd682bdc3756f82fa101969680983fa8bf (diff) | |
download | serenity-3fd53baa25f1d6b8522bcb2025bf7728cd3c1ad6.zip |
LibUnicode: Dynamically load the generated UnicodeData symbols
The generated data for libunicodedata.so is quite large, and loading it
is a price paid by nearly every application by way of depending on
LibRegex. In order to defer this cost until an application actually uses
one of the surrounding APIs, dynamically load the generated symbols.
To be able to load the symbols dynamically, the generated methods must
have demangled names. Typically, this is accomplished with `extern "C"`
blocks. The clang toolchain complains about this here because the types
returned from the generators are strictly C++ types. So to demangle the
names, we use the asm() compiler directive to manually define a symbol
name; the caveat is that we *must* be sure the symbols are unique. As an
extra precaution, we prefix each symbol name with "unicode_". For more
details, see: https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html
This symbol loader used in this implementation provides the additional
benefit of removing many [[maybe_unused]] attributes from the LibUnicode
methods. Internally, if ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF, the
loader is able to stub out the function pointers it returns.
Note that as of this commit, LibUnicode is still directly linked against
LibUnicodeData. This commit is just a first step towards removing that.
Diffstat (limited to 'Userland/Libraries/LibUnicode/CMakeLists.txt')
-rw-r--r-- | Userland/Libraries/LibUnicode/CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibUnicode/CMakeLists.txt b/Userland/Libraries/LibUnicode/CMakeLists.txt index 6634f4b504..9249cdc373 100644 --- a/Userland/Libraries/LibUnicode/CMakeLists.txt +++ b/Userland/Libraries/LibUnicode/CMakeLists.txt @@ -13,6 +13,7 @@ set(SOURCES DateTimeFormat.cpp Locale.cpp NumberFormat.cpp + UnicodeSymbols.cpp ) serenity_lib(LibUnicode unicode) |