From 4a428ba252785c40c887a16acde87acb5f426fb6 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Sat, 8 Jan 2022 20:33:36 +0100 Subject: [PATCH] Meta: Do not allow undefined symbols in executables and shared objects The `--allow-shlib-undefined` option is a bit of a misnomer. It actually controls whether we should be allowed to have undefined references after symbols from all dependencies have been resolved, so it applies both to shared libraries and executables. LLD defaults to allowing undefined references in shared libraries, but not in executables. Previously, we had to disable this check for executables too, as it caused a build failure due to the LibC-LibPthread-libc++ and the LibCore-LibCrypto circular dependencies. Now that those have been resolved, we can enable this warning, in the hopes that it will prevent us from introducing circular libraries and missing dependencies that might cause unexpected breakage. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0247ea366..728b1d69ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,10 +204,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") # Clang doesn't add compiler_rt to the search path when compiling with -nostdlib. link_directories(${TOOLCHAIN_ROOT}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/) - add_link_options(LINKER:--allow-shlib-undefined) endif() add_link_options(LINKER:-z,text) +add_link_options(LINKER:--no-allow-shlib-undefined) add_compile_definitions(SANITIZE_PTRS) set(CMAKE_CXX_FLAGS_STATIC "${CMAKE_CXX_FLAGS} -static")