summaryrefslogtreecommitdiff
path: root/Meta/Lagom/CMakeLists.txt
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-12-15 18:42:51 -0500
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-21 13:09:49 -0800
commit3fd53baa25f1d6b8522bcb2025bf7728cd3c1ad6 (patch)
tree2e6d55cb890a010d8035734d224a066f09488f0d /Meta/Lagom/CMakeLists.txt
parent749d5ebd682bdc3756f82fa101969680983fa8bf (diff)
downloadserenity-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 'Meta/Lagom/CMakeLists.txt')
-rw-r--r--Meta/Lagom/CMakeLists.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt
index 174110e07d..6fe3516a01 100644
--- a/Meta/Lagom/CMakeLists.txt
+++ b/Meta/Lagom/CMakeLists.txt
@@ -427,6 +427,7 @@ if (BUILD_LAGOM)
SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES}
)
target_compile_definitions(LagomUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)
+ target_link_libraries(LagomUnicode -ldl)
# WASM
file(GLOB LIBWASM_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibWasm/*/*.cpp")