ladybird/Meta/CMake
Daniel Bertalan c0cf6e3744 CMake: Set -fvisibility-inlines-hidden on ELF platforms
The C++ semantics of `inline` dictate that such functions might be
defined in multiple translation units. As with all other functions, they
must have the same address in all TUs. Because of this, the compiler
emits `inline` functions as weak symbols, which the dynamic linker can
then resolve to the same address everywhere.

This rule is responsible for a significant overhead at startup, as such
lookups happen by name. Namely, 86'000 of the 114'000 by-name symbol
lookups when loading LibWeb can be attributed to this. Most of these
are only ever defined in a single object, making this even more
pointless.

As nothing in our code relies on either ELF symbol interposition rules
or function address equality, we can use the -fvisibility-inlines-hidden
escape hatch, which causes this rule to be disregarded. As the symbols
are now hidden, no load-time symbol lookup is needed. This flag is used
without issues in other large C++ codebases like Chromium and LLVM.

Some relevant light reading, suggested by Nico:
- https://ridiculousfish.com/blog/posts/i-didnt-order-that-so-why-is-it-on-my-bill-episode-1.html
- https://www.cs.dartmouth.edu/~sergey/cs258/ABI/UlrichDrepper-How-To-Write-Shared-Libraries.pdf
- https://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html
- https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fvisibility-inlines-hidden
2023-08-12 05:14:20 +02:00
..
Superbuild Meta: Promote SERENITY_CACHE_DIR to a real option 2023-08-10 20:10:05 -06:00
all_the_debug_macros.cmake Kernel: Put loopback adapter debug spam behind a flag 2023-06-18 08:50:33 +01:00
ca_certificates_data.cmake Meta: Update cacert.pem 2023-05-30 13:05:19 +02:00
check_for_dependencies.cmake Meta: Do not log CMake version on each CMake invocation 2022-09-11 21:40:15 +01:00
cmake-version.cmake Toolchain+Meta: Add script to build CMake from source 2022-12-13 11:36:14 +01:00
code_generators.cmake Meta+Userland: Allow generating C++ initializer code from GML 2023-08-11 21:33:48 +02:00
common_compile_options.cmake CMake: Set -fvisibility-inlines-hidden on ELF platforms 2023-08-12 05:14:20 +02:00
common_options.cmake CMake: Add option to disable network downloads altogether 2023-08-10 20:10:05 -06:00
commonmark_spec.cmake CMake: Download Commonmark and Wasm spec tests using download_file() 2023-08-10 20:10:05 -06:00
flac_spec_tests.cmake Meta: Refactor FLAC spec test extraction with extract_tar_path 2023-03-19 14:15:35 +00:00
jakt.cmake Meta: Update jakt build support for fully bootstrapped compiler 2022-09-09 11:23:42 +02:00
lagom-install-config.cmake Meta: Update jakt build support for fully bootstrapped compiler 2022-09-09 11:23:42 +02:00
lagom_compile_options.cmake CMake: Set -fvisibility-inlines-hidden on ELF platforms 2023-08-12 05:14:20 +02:00
lagom_options.cmake Lagom: Allow opting into linking with mold 2023-06-10 17:31:41 -07:00
libgl_generators.cmake CMake: Don't require to install glapi.h to system 2023-02-04 15:53:07 -07:00
libweb_generators.cmake CMake: Make sure to install generated sources and header files 2023-08-10 20:10:05 -06:00
locale_data.cmake Meta: Assume files already extracted for ENABLE_NETWORK_DOWNLOADS=OFF 2023-08-10 20:10:05 -06:00
pnp_ids.cmake Meta: Remove unused "prefix" variable from invoke_generator() helper 2022-10-16 21:16:48 +02:00
processor-count.cmake Meta: Print error if cmake does not exist 2022-10-16 17:49:18 +02:00
serenity_compile_options.cmake CMake: Set -fvisibility-inlines-hidden on ELF platforms 2023-08-12 05:14:20 +02:00
serenity_components.cmake Meta: Properly ignore targets which don't have a component name 2022-10-15 13:12:42 +02:00
serenity_options.cmake CMake: Pass NO_POLICY_SCOPE to options cmake helpers 2022-12-14 12:43:12 +01:00
setup_ccache.cmake Meta: Detect ccache being passed as the compiler 2022-12-12 21:34:09 -07:00
time_zone_data.cmake Meta: Assume files already extracted for ENABLE_NETWORK_DOWNLOADS=OFF 2023-08-10 20:10:05 -06:00
unicode_data.cmake Meta: Assume files already extracted for ENABLE_NETWORK_DOWNLOADS=OFF 2023-08-10 20:10:05 -06:00
utils.cmake CMake: Add option to disable network downloads altogether 2023-08-10 20:10:05 -06:00
wasm_spec_tests.cmake CMake: Download Commonmark and Wasm spec tests using download_file() 2023-08-10 20:10:05 -06:00