mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
CMake: Link with -Bsymbolic-non-weak-functions
if supported
This flag makes the linker bind default-visibility functions locally, so that calls to them do not have to go through the PLT. This makes it impossible to override them by preloading a DSO. This was already the case partially due to `-fno-semantic-interposition`, however that flag is only able to optimize call sites that are in the same Translation Unit as the function definitions. This removes 80% of the PLT relocations in `libjs.so.serenity`. Obsoletes #20877
This commit is contained in:
parent
1f747b9132
commit
6fd8f9ea51
Notes:
sideshowbarker
2024-07-17 03:10:07 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/6fd8f9ea51 Pull-request: https://github.com/SerenityOS/serenity/pull/21018 Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 6 additions and 0 deletions
|
@ -20,3 +20,7 @@ function(add_linker_flag_if_supported flag)
|
|||
endfunction()
|
||||
|
||||
add_linker_flag_if_supported(LINKER:--gdb-index)
|
||||
|
||||
if (NOT ENABLE_FUZZERS)
|
||||
add_linker_flag_if_supported(LINKER:-Bsymbolic-non-weak-functions)
|
||||
endif()
|
||||
|
|
|
@ -29,6 +29,8 @@ add_compile_options(-g1)
|
|||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
add_link_options(LINKER:-Bsymbolic-non-weak-functions)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Wno-maybe-uninitialized)
|
||||
add_compile_options(-Wcast-align)
|
||||
|
|
Loading…
Add table
Reference in a new issue