Skip to content

Commit

Permalink
build: include -fno-semantic-interposition in CXXFLAGS
Browse files Browse the repository at this point in the history
when building the shared libraries, `-fnosematntic-interposition`
option can be used to improve the performance of the shared libraries,
if interposition of exported symbol is not allowed.

by default, GCC respects the symbol interposition semantics defined by
the ELF specification. but if we want to have a better performance for
the shared libraries, and we don't want to override the exported
symbols with, for instance, `LD_PRELOAD`, we can safely disable this
behavior for better performance. as the interposition semantics
prevents compiler from doing further optimizations like inlining.
GCC only disables this when building with `-Ofast`, see
gcc-mirror/gcc@458d2c6.

Clang just disables this behavior by default. see
llvm/llvm-project@d1fd723.

so, in order to have better performance when building shared libraries,
let's just disable the interposition semantics.

this change should have no impact on the Seastar static libraries,
but it can improve the performance of the shared libraries.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Oct 1, 2024
1 parent f322e76 commit b9bd60a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ target_include_directories (seastar
${CMAKE_CURRENT_SOURCE_DIR}/src)

set (Seastar_PRIVATE_CXX_FLAGS
-fno-semantic-interposition
-UNDEBUG
-Wall
-Werror
Expand Down

0 comments on commit b9bd60a

Please sign in to comment.